From green at whamcloud.com Fri Jan 4 04:45:26 2019 From: green at whamcloud.com (Oleg Drokin) Date: Fri, 4 Jan 2019 04:45:26 +0000 Subject: [lustre-devel] New tag 2.12.50 Message-ID: Hello! I just added the 2.12.50 tag into the community master branch as a sign that hte 2.13. development cycle is starting. There are no changes from 2.12.0 release at this time. From jsimmons at infradead.org Sun Jan 6 21:36:33 2019 From: jsimmons at infradead.org (James Simmons) Date: Sun, 6 Jan 2019 16:36:33 -0500 Subject: [lustre-devel] [PATCH 00/14] lustre: fixes for many test failures Message-ID: <1546810607-6348-1-git-send-email-jsimmons@infradead.org> This patch series contains mostly fixes to resolve the majority of the testing failures seen. Besides that are UAPI headers fixes to prepare for when lustre will leave the staging tree. Include Neil's dump_page_cache patch as well since it was landed in the OpenSFS branch and the migration of lu_objects to rhashtables depended on it. James Simmons (9): lustre: uapi: replace cfs_size_* macros with __ALIGN_KERNEL lustre: uapi: final fixes for UAPI support. lustre: llite: op_data->op_valid is incorrect in ll_dir_getstripe lustre: llite: return correct amount of bytes for short operations lustre: llite: user xattr_prefix() to create xattr full name lustre: llite: conditionally set it_flags in ll_file_open lustre: llite: fix file migration lustre: sysfs: temporary work around for sysfs naming lustre: libcfs: hide struct cfs_cpt_table internals John L. Hammond (1): lustre: llite: add LL_IOC_FUTIMES_3 Lai Siyao (1): lustre: llite: improve getdirstripe interface Minh Diep (1): lustre: uapi: fix lustre_user.h to C++ compatible NeilBrown (1): lustre: llite: change how "dump_page_cache" walks a hash table Patrick Farrell (1): lustre: llite: Add S_NOSEC support .../lustre/include/linux/libcfs/libcfs_cpu.h | 39 +---- .../staging/lustre/include/linux/lnet/lib-types.h | 1 + .../lustre/include/uapi/linux/lnet/lnet-types.h | 1 - .../lustre/include/uapi/linux/lustre/lustre_idl.h | 14 +- .../lustre/include/uapi/linux/lustre/lustre_user.h | 57 ++++--- drivers/staging/lustre/lnet/libcfs/libcfs_cpu.c | 34 ++++ .../staging/lustre/lustre/include/obd_support.h | 2 + drivers/staging/lustre/lustre/llite/dir.c | 3 +- drivers/staging/lustre/lustre/llite/file.c | 53 ++++++- drivers/staging/lustre/lustre/llite/llite_lib.c | 25 ++- drivers/staging/lustre/lustre/llite/namei.c | 1 + drivers/staging/lustre/lustre/llite/vvp_dev.c | 173 ++++++++++----------- drivers/staging/lustre/lustre/llite/vvp_io.c | 10 +- drivers/staging/lustre/lustre/llite/xattr.c | 4 +- drivers/staging/lustre/lustre/mdc/mdc_lib.c | 1 - drivers/staging/lustre/lustre/mgc/mgc_request.c | 2 +- .../staging/lustre/lustre/obdclass/obd_config.c | 2 +- 17 files changed, 249 insertions(+), 173 deletions(-) -- 1.8.3.1 From jsimmons at infradead.org Sun Jan 6 21:36:41 2019 From: jsimmons at infradead.org (James Simmons) Date: Sun, 6 Jan 2019 16:36:41 -0500 Subject: [lustre-devel] [PATCH 08/14] lustre: llite: op_data->op_valid is incorrect in ll_dir_getstripe In-Reply-To: <1546810607-6348-1-git-send-email-jsimmons@infradead.org> References: <1546810607-6348-1-git-send-email-jsimmons@infradead.org> Message-ID: <1546810607-6348-9-git-send-email-jsimmons@infradead.org> The function ll_dir_getstripe() passes in valid but it was never used to properly setup op_data->op_valid which prevented user land applications from getting real directory striping information. Apply the passed in valid parameter to the op_data->op_valid field. Fixes: 6e23ea986bf ("staging: lustre: llite: fix "getdirstripe" to show stripe info") Signed-off-by: James Simmons --- drivers/staging/lustre/lustre/llite/dir.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/lustre/lustre/llite/dir.c b/drivers/staging/lustre/lustre/llite/dir.c index 86b5c7a..0a7330d 100644 --- a/drivers/staging/lustre/lustre/llite/dir.c +++ b/drivers/staging/lustre/lustre/llite/dir.c @@ -631,7 +631,7 @@ int ll_dir_getstripe(struct inode *inode, void **plmm, int *plmm_size, if (IS_ERR(op_data)) return PTR_ERR(op_data); - op_data->op_valid = OBD_MD_FLEASIZE | OBD_MD_FLDIREA; + op_data->op_valid = valid | OBD_MD_FLEASIZE | OBD_MD_FLDIREA; rc = md_getattr(sbi->ll_md_exp, op_data, &req); ll_finish_md_op_data(op_data); if (rc < 0) { -- 1.8.3.1 From jsimmons at infradead.org Sun Jan 6 21:36:36 2019 From: jsimmons at infradead.org (James Simmons) Date: Sun, 6 Jan 2019 16:36:36 -0500 Subject: [lustre-devel] [PATCH 03/14] lustre: llite: add LL_IOC_FUTIMES_3 In-Reply-To: <1546810607-6348-1-git-send-email-jsimmons@infradead.org> References: <1546810607-6348-1-git-send-email-jsimmons@infradead.org> Message-ID: <1546810607-6348-4-git-send-email-jsimmons@infradead.org> From: "John L. Hammond" Add a new regular file ioctl LL_IOC_FUTIMES_3 similar to futimes() but which allows setting of all three inode timestamps. Use this ioctl during HSM restore to ensure that the volatile file has the same timestamps as the file to be restored. Strengthen sanity-hsm test_24a to check that archive, release, and restore do not change a file's ctime. Add sanity-hsm test_24e to check that tar will succeed when it encounters a HSM released file. This is a hold over until a generic solution is worked out. Signed-off-by: John L. Hammond WC-bug-id: https://jira.hpdd.intel.com/browse/LU-6213 Reviewed-on: http://review.whamcloud.com/13665 Reviewed-by: Andreas Dilger Reviewed-by: Jinshan Xiong Reviewed-by: frank zago Reviewed-by: Oleg Drokin Signed-off-by: James Simmons --- .../lustre/include/uapi/linux/lustre/lustre_user.h | 10 +++++ drivers/staging/lustre/lustre/llite/file.c | 46 ++++++++++++++++++++++ 2 files changed, 56 insertions(+) diff --git a/drivers/staging/lustre/include/uapi/linux/lustre/lustre_user.h b/drivers/staging/lustre/include/uapi/linux/lustre/lustre_user.h index 9d553ce6..6904d6d 100644 --- a/drivers/staging/lustre/include/uapi/linux/lustre/lustre_user.h +++ b/drivers/staging/lustre/include/uapi/linux/lustre/lustre_user.h @@ -215,6 +215,15 @@ struct ost_id { #define DOSTID "%#llx:%llu" #define POSTID(oi) ostid_seq(oi), ostid_id(oi) +struct ll_futimes_3 { + __u64 lfu_atime_sec; + __u64 lfu_atime_nsec; + __u64 lfu_mtime_sec; + __u64 lfu_mtime_nsec; + __u64 lfu_ctime_sec; + __u64 lfu_ctime_nsec; +}; + /* * The ioctl naming rules: * LL_* - works on the currently opened filehandle instead of parent dir @@ -251,6 +260,7 @@ struct ost_id { #define LL_IOC_PATH2FID _IOR('f', 173, long) #define LL_IOC_GET_CONNECT_FLAGS _IOWR('f', 174, __u64 *) #define LL_IOC_GET_MDTIDX _IOR('f', 175, int) +#define LL_IOC_FUTIMES_3 _IOWR('f', 176, struct ll_futimes_3) /* lustre_ioctl.h 177-210 */ #define LL_IOC_HSM_STATE_GET _IOR('f', 211, struct hsm_user_state) diff --git a/drivers/staging/lustre/lustre/llite/file.c b/drivers/staging/lustre/lustre/llite/file.c index a6f149c..5c6ebfa 100644 --- a/drivers/staging/lustre/lustre/llite/file.c +++ b/drivers/staging/lustre/lustre/llite/file.c @@ -2098,6 +2098,42 @@ static inline long ll_lease_type_from_fmode(fmode_t fmode) ((fmode & FMODE_WRITE) ? LL_LEASE_WRLCK : 0); } +static int ll_file_futimes_3(struct file *file, const struct ll_futimes_3 *lfu) +{ + struct inode *inode = file_inode(file); + struct iattr ia = { + .ia_valid = ATTR_ATIME | ATTR_ATIME_SET | + ATTR_MTIME | ATTR_MTIME_SET | + ATTR_CTIME, + .ia_atime = { + .tv_sec = lfu->lfu_atime_sec, + .tv_nsec = lfu->lfu_atime_nsec, + }, + .ia_mtime = { + .tv_sec = lfu->lfu_mtime_sec, + .tv_nsec = lfu->lfu_mtime_nsec, + }, + .ia_ctime = { + .tv_sec = lfu->lfu_ctime_sec, + .tv_nsec = lfu->lfu_ctime_nsec, + }, + }; + int rc; + + if (!capable(CAP_SYS_ADMIN)) + return -EPERM; + + if (!S_ISREG(inode->i_mode)) + return -EINVAL; + + inode_lock(inode); + rc = ll_setattr_raw(file_dentry(file), &ia, OP_XVALID_CTIME_SET, + false); + inode_unlock(inode); + + return rc; +} + /* * Give file access advices * @@ -2552,6 +2588,16 @@ int ll_ioctl_fssetxattr(struct inode *inode, unsigned int cmd, kfree(hui); return rc; } + case LL_IOC_FUTIMES_3: { + const struct ll_futimes_3 __user *lfu_user; + struct ll_futimes_3 lfu; + + lfu_user = (const struct ll_futimes_3 __user *)arg; + if (copy_from_user(&lfu, lfu_user, sizeof(lfu))) + return -EFAULT; + + return ll_file_futimes_3(file, &lfu); + } case LL_IOC_LADVISE: { struct llapi_ladvise_hdr *ladvise_hdr; int alloc_size = sizeof(*ladvise_hdr); -- 1.8.3.1 From jsimmons at infradead.org Sun Jan 6 21:36:39 2019 From: jsimmons at infradead.org (James Simmons) Date: Sun, 6 Jan 2019 16:36:39 -0500 Subject: [lustre-devel] [PATCH 06/14] lustre: uapi: replace cfs_size_* macros with __ALIGN_KERNEL In-Reply-To: <1546810607-6348-1-git-send-email-jsimmons@infradead.org> References: <1546810607-6348-1-git-send-email-jsimmons@infradead.org> Message-ID: <1546810607-6348-7-git-send-email-jsimmons@infradead.org> The lustre specific cfs_size_* macros can be easily replaced with the __ALIGN_KERNEL macro provided by the linux kernel for our user land code. This brings us closer to building against the upstream client. Signed-off-by: James Simmons WC-bug-id: https://jira.hpdd.intel.com/browse/LU-6142 Reviewed-on: https://review.whamcloud.com/30379 Reviewed-by: Dmitry Eremin Reviewed-by: Ben Evans Reviewed-by: Oleg Drokin Signed-off-by: James Simmons --- .../lustre/include/uapi/linux/lustre/lustre_user.h | 32 +++++++++------------- 1 file changed, 13 insertions(+), 19 deletions(-) diff --git a/drivers/staging/lustre/include/uapi/linux/lustre/lustre_user.h b/drivers/staging/lustre/include/uapi/linux/lustre/lustre_user.h index fef53b1..aac91a1 100644 --- a/drivers/staging/lustre/include/uapi/linux/lustre/lustre_user.h +++ b/drivers/staging/lustre/include/uapi/linux/lustre/lustre_user.h @@ -42,6 +42,9 @@ * @{ */ +#include +#include + #ifdef __KERNEL__ # include # include @@ -835,8 +838,8 @@ enum changelog_send_flag { CHANGELOG_FLAG_JOBID = 0x04, }; -#define CR_MAXSIZE cfs_size_round(2 * NAME_MAX + 2 + \ - changelog_rec_offset(CLF_SUPPORTED)) +#define CR_MAXSIZE __ALIGN_KERNEL(2 * NAME_MAX + 2 + \ + changelog_rec_offset(CLF_SUPPORTED), 8) /* 31 usable bytes string + null terminator. */ #define LUSTRE_JOBID_SIZE 32 @@ -1270,29 +1273,20 @@ struct hsm_action_list { */ } __packed; -#ifndef HAVE_CFS_SIZE_ROUND -static inline int cfs_size_round(int val) -{ - return (val + 7) & (~0x7); -} - -#define HAVE_CFS_SIZE_ROUND -#endif - /* Return pointer to first hai in action list */ static inline struct hsm_action_item *hai_first(struct hsm_action_list *hal) { - return (struct hsm_action_item *)(hal->hal_fsname + - cfs_size_round(strlen(hal-> \ - hal_fsname) - + 1)); + size_t offset = __ALIGN_KERNEL(strlen(hal->hal_fsname) + 1, 8); + + return (struct hsm_action_item *)(hal->hal_fsname + offset); } /* Return pointer to next hai */ static inline struct hsm_action_item *hai_next(struct hsm_action_item *hai) { - return (struct hsm_action_item *)((char *)hai + - cfs_size_round(hai->hai_len)); + size_t offset = __ALIGN_KERNEL(hai->hai_len, 8); + + return (struct hsm_action_item *)((char *)hai + offset); } /* Return size of an hsm_action_list */ @@ -1302,10 +1296,10 @@ static inline size_t hal_size(struct hsm_action_list *hal) size_t sz; struct hsm_action_item *hai; - sz = sizeof(*hal) + cfs_size_round(strlen(hal->hal_fsname) + 1); + sz = sizeof(*hal) + __ALIGN_KERNEL(strlen(hal->hal_fsname) + 1, 8); hai = hai_first(hal); for (i = 0; i < hal->hal_count; i++, hai = hai_next(hai)) - sz += cfs_size_round(hai->hai_len); + sz += __ALIGN_KERNEL(hai->hai_len, 8); return sz; } -- 1.8.3.1 From jsimmons at infradead.org Sun Jan 6 21:36:34 2019 From: jsimmons at infradead.org (James Simmons) Date: Sun, 6 Jan 2019 16:36:34 -0500 Subject: [lustre-devel] [PATCH 01/14] lustre: llite: Add S_NOSEC support In-Reply-To: <1546810607-6348-1-git-send-email-jsimmons@infradead.org> References: <1546810607-6348-1-git-send-email-jsimmons@infradead.org> Message-ID: <1546810607-6348-2-git-send-email-jsimmons@infradead.org> From: Patrick Farrell We must use the i_mutex to protect permission changes, which means we need to take it when we write to a file with the setuid or setgid bit set (as this removes those bits). LU-8025 attempted to use IS_NOSEC to check for this case, but did not actually add support for the S_NOSEC flag to Lustre. S_NOSEC was added in upstream kernel commit: 69b4573296469fd3f70cf7044693074980517067 But a key change requiring parallel filesystems to opt in with a superblock flag was added in: 9e1f1de02c2275d7172e18dc4e7c2065777611bf This patch adds the required support. Specifically, Lustre should set S_NOSEC correctly when an inode is created (ll_iget), but only for new inodes. Setting it for existing inodes requires taking the i_mutex, creating an unacceptable metadata performance impact in the lookup code. Existing inodes get S_NOSEC set either by a setattr call (see below), or by the first writer to write to the node, in file_remove_privs/file_remove_suid. So it's OK not to set S_NOSEC on all inodes in ll_iget. Also, Lustre must clear S_NOSEC when it gets a metadata update because another node could have changed permissions. i_flags is already cleared in ll_update_inode, but we would prefer to have S_NOSEC set whenever possible, so we want to re-do the check after the update. This requires holding the i_mutex to avoid a check/set race with permissions changes. We cannot easily take the i_mutex in ll_update_inode (it is called from too many places, some of which already hold the i_mutex). It is acceptable to sometimes not have S_NOSEC set (since occasionally taking the i_mutex when not needed is OK), so we look at getting it set most of the time. It looks like the primary concern is ll_md_setattr. The caller (ll_setattr_raw) takes the i_mutex before returning, so we do the relevant call there. This opens a window during which S_NOSEC is not set, but again, this merely creates a situation where we take the i_mutex unnecessarily, and should be rare in practice. Testing with multiple writers shows that we only very rarely attempt to take the i_mutex, so the performance impact is minimal. Signed-off-by: Patrick Farrell WC-bug-id: https://jira.whamcloud.com/browse/LU-8656 Reviewed-on: https://review.whamcloud.com/22853 Reviewed-by: James Simmons Reviewed-by: Andreas Dilger Signed-off-by: James Simmons --- drivers/staging/lustre/lustre/include/obd_support.h | 2 ++ drivers/staging/lustre/lustre/llite/llite_lib.c | 19 +++++++++++++++++-- drivers/staging/lustre/lustre/llite/namei.c | 1 + drivers/staging/lustre/lustre/llite/vvp_io.c | 10 +++++++++- 4 files changed, 29 insertions(+), 3 deletions(-) diff --git a/drivers/staging/lustre/lustre/include/obd_support.h b/drivers/staging/lustre/lustre/include/obd_support.h index 1832193..79875fa 100644 --- a/drivers/staging/lustre/lustre/include/obd_support.h +++ b/drivers/staging/lustre/lustre/include/obd_support.h @@ -442,6 +442,8 @@ #define OBD_FAIL_LLITE_LOST_LAYOUT 0x1407 #define OBD_FAIL_GETATTR_DELAY 0x1409 #define OBD_FAIL_LLITE_CREATE_NODE_PAUSE 0x140c +#define OBD_FAIL_LLITE_IMUTEX_SEC 0x140e +#define OBD_FAIL_LLITE_IMUTEX_NOSEC 0x140f #define OBD_FAIL_FID_INDIR 0x1501 #define OBD_FAIL_FID_INLMA 0x1502 diff --git a/drivers/staging/lustre/lustre/llite/llite_lib.c b/drivers/staging/lustre/lustre/llite/llite_lib.c index cd169c1..203a1f7 100644 --- a/drivers/staging/lustre/lustre/llite/llite_lib.c +++ b/drivers/staging/lustre/lustre/llite/llite_lib.c @@ -227,6 +227,11 @@ static int client_common_fill_super(struct super_block *sb, char *md, char *dt) if (sbi->ll_flags & LL_SBI_USER_XATTR) data->ocd_connect_flags |= OBD_CONNECT_XATTR; + /* Setting this indicates we correctly support S_NOSEC (See kernel + * commit 9e1f1de02c2275d7172e18dc4e7c2065777611bf) + */ + sb->s_flags |= MS_NOSEC; + if (sbi->ll_flags & LL_SBI_FLOCK) sbi->ll_fop = &ll_file_operations_flock; else if (sbi->ll_flags & LL_SBI_LOCALFLOCK) @@ -1638,6 +1643,13 @@ int ll_setattr_raw(struct dentry *dentry, struct iattr *attr, inode_lock(inode); if ((attr->ia_valid & ATTR_SIZE) && !hsm_import) inode_dio_wait(inode); + /* Once we've got the i_mutex, it's safe to set the S_NOSEC + * flag. ll_update_inode (called from ll_md_setattr), clears + * inode flags, so there is a gap where S_NOSEC is not set. + * This can cause a writer to take the i_mutex unnecessarily, + * but this is safe to do and should be rare. + */ + inode_has_no_xattr(inode); } ll_stats_ops_tally(ll_i2sbi(inode), (attr->ia_valid & ATTR_SIZE) ? @@ -1847,6 +1859,11 @@ int ll_update_inode(struct inode *inode, struct lustre_md *md) inode->i_ctime.tv_sec = body->mbo_ctime; lli->lli_ctime = body->mbo_ctime; } + + /* Clear i_flags to remove S_NOSEC before permissions are updated */ + if (body->mbo_valid & OBD_MD_FLFLAGS) + ll_update_inode_flags(inode, body->mbo_flags); + if (body->mbo_valid & OBD_MD_FLMODE) inode->i_mode = (inode->i_mode & S_IFMT) | (body->mbo_mode & ~S_IFMT); @@ -1865,8 +1882,6 @@ int ll_update_inode(struct inode *inode, struct lustre_md *md) inode->i_gid = make_kgid(&init_user_ns, body->mbo_gid); if (body->mbo_valid & OBD_MD_FLPROJID) lli->lli_projid = body->mbo_projid; - if (body->mbo_valid & OBD_MD_FLFLAGS) - ll_update_inode_flags(inode, body->mbo_flags); if (body->mbo_valid & OBD_MD_FLNLINK) set_nlink(inode, body->mbo_nlink); if (body->mbo_valid & OBD_MD_FLRDEV) diff --git a/drivers/staging/lustre/lustre/llite/namei.c b/drivers/staging/lustre/lustre/llite/namei.c index f2bd57e..b5b46f7 100644 --- a/drivers/staging/lustre/lustre/llite/namei.c +++ b/drivers/staging/lustre/lustre/llite/namei.c @@ -130,6 +130,7 @@ struct inode *ll_iget(struct super_block *sb, ino_t hash, iput(inode); inode = ERR_PTR(rc); } else { + inode_has_no_xattr(inode); unlock_new_inode(inode); } } else if (!(inode->i_state & (I_FREEING | I_CLEAR))) { diff --git a/drivers/staging/lustre/lustre/llite/vvp_io.c b/drivers/staging/lustre/lustre/llite/vvp_io.c index d6b27ba..b772e25 100644 --- a/drivers/staging/lustre/lustre/llite/vvp_io.c +++ b/drivers/staging/lustre/lustre/llite/vvp_io.c @@ -925,9 +925,10 @@ static int vvp_io_write_start(const struct lu_env *env, struct cl_object *obj = io->ci_obj; struct inode *inode = vvp_object_inode(obj); struct ll_inode_info *lli = ll_i2info(inode); - ssize_t result = 0; + bool lock_inode = !inode_is_locked(inode) && !IS_NOSEC(inode); loff_t pos = io->u.ci_wr.wr.crw_pos; size_t cnt = io->u.ci_wr.wr.crw_count; + ssize_t result = 0; down_read(&lli->lli_trunc_sem); @@ -963,6 +964,13 @@ static int vvp_io_write_start(const struct lu_env *env, return -EFBIG; } + /* Tests to verify we take the i_mutex correctly */ + if (OBD_FAIL_CHECK(OBD_FAIL_LLITE_IMUTEX_SEC) && !lock_inode) + return -EINVAL; + + if (OBD_FAIL_CHECK(OBD_FAIL_LLITE_IMUTEX_NOSEC) && lock_inode) + return -EINVAL; + if (!vio->vui_iter) { /* from a temp io in ll_cl_init(). */ result = 0; -- 1.8.3.1 From jsimmons at infradead.org Sun Jan 6 21:36:37 2019 From: jsimmons at infradead.org (James Simmons) Date: Sun, 6 Jan 2019 16:36:37 -0500 Subject: [lustre-devel] [PATCH 04/14] lustre: llite: improve getdirstripe interface In-Reply-To: <1546810607-6348-1-git-send-email-jsimmons@infradead.org> References: <1546810607-6348-1-git-send-email-jsimmons@infradead.org> Message-ID: <1546810607-6348-5-git-send-email-jsimmons@infradead.org> From: Lai Siyao The user land lustre tools added the ability to choose the DNE2 hashing algorithm. Handle the hash values coming from user land. Signed-off-by: Lai Siyao WC-bug-id: https://jira.hpdd.intel.com/browse/LU-8314 Reviewed-on: https://review.whamcloud.com/24319 Reviewed-by: Andreas Dilger Reviewed-by: Niu Yawei Reviewed-by: Oleg Drokin Signed-off-by: James Simmons --- .../staging/lustre/include/uapi/linux/lustre/lustre_idl.h | 12 ++++++++++++ .../staging/lustre/include/uapi/linux/lustre/lustre_user.h | 2 ++ drivers/staging/lustre/lustre/llite/dir.c | 1 + 3 files changed, 15 insertions(+) diff --git a/drivers/staging/lustre/include/uapi/linux/lustre/lustre_idl.h b/drivers/staging/lustre/include/uapi/linux/lustre/lustre_idl.h index 26646f9..a42ce9d 100644 --- a/drivers/staging/lustre/include/uapi/linux/lustre/lustre_idl.h +++ b/drivers/staging/lustre/include/uapi/linux/lustre/lustre_idl.h @@ -1968,6 +1968,18 @@ static inline int lmv_mds_md_stripe_count_get(const union lmv_mds_md *lmm) } } +static inline int lmv_mds_md_hash_type_get(const union lmv_mds_md *lmm) +{ + switch (__le32_to_cpu(lmm->lmv_magic)) { + case LMV_MAGIC_V1: + return __le32_to_cpu(lmm->lmv_md_v1.lmv_hash_type); + case LMV_USER_MAGIC: + return __le32_to_cpu(lmm->lmv_user_md.lum_hash_type); + default: + return -EINVAL; + } +} + enum fld_rpc_opc { FLD_QUERY = 900, FLD_READ = 901, diff --git a/drivers/staging/lustre/include/uapi/linux/lustre/lustre_user.h b/drivers/staging/lustre/include/uapi/linux/lustre/lustre_user.h index 6904d6d..4412dc8 100644 --- a/drivers/staging/lustre/include/uapi/linux/lustre/lustre_user.h +++ b/drivers/staging/lustre/include/uapi/linux/lustre/lustre_user.h @@ -443,6 +443,8 @@ enum lmv_hash_type { LMV_HASH_TYPE_FNV_1A_64 = 2, }; +#define LMV_HASH_TYPE_MAX LMV_HASH_TYPE_FNV_1A_64 + 1 + #define LMV_HASH_NAME_ALL_CHARS "all_char" #define LMV_HASH_NAME_FNV_1A_64 "fnv_1a_64" diff --git a/drivers/staging/lustre/lustre/llite/dir.c b/drivers/staging/lustre/lustre/llite/dir.c index f1c1c9c..86b5c7a 100644 --- a/drivers/staging/lustre/lustre/llite/dir.c +++ b/drivers/staging/lustre/lustre/llite/dir.c @@ -1315,6 +1315,7 @@ static long ll_dir_ioctl(struct file *file, unsigned int cmd, unsigned long arg) tmp->lum_magic = LMV_MAGIC_V1; tmp->lum_stripe_count = 0; tmp->lum_stripe_offset = mdt_index; + tmp->lum_hash_type = lmv_mds_md_hash_type_get(lmm); for (i = 0; i < stripe_count; i++) { struct lu_fid fid; -- 1.8.3.1 From jsimmons at infradead.org Sun Jan 6 21:36:38 2019 From: jsimmons at infradead.org (James Simmons) Date: Sun, 6 Jan 2019 16:36:38 -0500 Subject: [lustre-devel] [PATCH 05/14] lustre: uapi: fix lustre_user.h to C++ compatible In-Reply-To: <1546810607-6348-1-git-send-email-jsimmons@infradead.org> References: <1546810607-6348-1-git-send-email-jsimmons@infradead.org> Message-ID: <1546810607-6348-6-git-send-email-jsimmons@infradead.org> From: Minh Diep Add missing user land headers. constifiy some inline functions. Signed-off-by: Minh Diep WC-bug-id: https://jira.hpdd.intel.com/browse/LU-4107 Reviewed-on: http://review.whamcloud.com/8033 Reviewed-by: John L. Hammond Reviewed-by: Andreas Dilger Reviewed-by: Dmitry Eremin Reviewed-by: Oleg Drokin Signed-off-by: James Simmons --- .../staging/lustre/include/uapi/linux/lustre/lustre_user.h | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/drivers/staging/lustre/include/uapi/linux/lustre/lustre_user.h b/drivers/staging/lustre/include/uapi/linux/lustre/lustre_user.h index 4412dc8..fef53b1 100644 --- a/drivers/staging/lustre/include/uapi/linux/lustre/lustre_user.h +++ b/drivers/staging/lustre/include/uapi/linux/lustre/lustre_user.h @@ -50,6 +50,8 @@ # include #else /* !__KERNEL__ */ # define NEED_QUOTA_DEFS +# include +# include # include /* snprintf() */ # include # include @@ -1052,7 +1054,7 @@ enum hsm_progress_states { #define HPS_NONE 0 -static inline char *hsm_progress_state2name(enum hsm_progress_states s) +static inline const char *hsm_progress_state2name(enum hsm_progress_states s) { switch (s) { case HPS_WAITING: return "waiting"; @@ -1114,7 +1116,7 @@ enum hsm_user_action { HUA_CANCEL = 14 /* cancel a request */ }; -static inline char *hsm_user_action2name(enum hsm_user_action a) +static inline const char *hsm_user_action2name(enum hsm_user_action a) { switch (a) { case HUA_NONE: return "NOOP"; @@ -1201,7 +1203,7 @@ enum hsm_copytool_action { HSMA_CANCEL = 23 }; -static inline char *hsm_copytool_action2name(enum hsm_copytool_action a) +static inline const char *hsm_copytool_action2name(enum hsm_copytool_action a) { switch (a) { case HSMA_NONE: return "NOOP"; @@ -1294,9 +1296,10 @@ static inline struct hsm_action_item *hai_next(struct hsm_action_item *hai) } /* Return size of an hsm_action_list */ -static inline int hal_size(struct hsm_action_list *hal) +static inline size_t hal_size(struct hsm_action_list *hal) { - int i, sz; + __u32 i; + size_t sz; struct hsm_action_item *hai; sz = sizeof(*hal) + cfs_size_round(strlen(hal->hal_fsname) + 1); -- 1.8.3.1 From jsimmons at infradead.org Sun Jan 6 21:36:43 2019 From: jsimmons at infradead.org (James Simmons) Date: Sun, 6 Jan 2019 16:36:43 -0500 Subject: [lustre-devel] [PATCH 10/14] lustre: llite: user xattr_prefix() to create xattr full name In-Reply-To: <1546810607-6348-1-git-send-email-jsimmons@infradead.org> References: <1546810607-6348-1-git-send-email-jsimmons@infradead.org> Message-ID: <1546810607-6348-11-git-send-email-jsimmons@infradead.org> Some xattrs use the prefix field and some like ACLs use the name field. The function xattr_prefix() was created to handle these cases. A patch was landed to properly handle this but a part of the patch was missed in the merger. For the creation of fulname use xattr_prefix() instead of the handler prefix field. Fixes: ab42bc01284 ("staging: lustre: llite: use xattr_handler name for ACLs") Signed-off-by: James Simmons --- drivers/staging/lustre/lustre/llite/xattr.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/lustre/lustre/llite/xattr.c b/drivers/staging/lustre/lustre/llite/xattr.c index 5e27c85..aeaa04a 100644 --- a/drivers/staging/lustre/lustre/llite/xattr.c +++ b/drivers/staging/lustre/lustre/llite/xattr.c @@ -140,7 +140,7 @@ static int ll_xattr_set_common(const struct xattr_handler *handler, return -EPERM; } - fullname = kasprintf(GFP_KERNEL, "%s%s", handler->prefix, name); + fullname = kasprintf(GFP_KERNEL, "%s%s", xattr_prefix(handler), name); if (!fullname) return -ENOMEM; @@ -443,7 +443,7 @@ static int ll_xattr_get_common(const struct xattr_handler *handler, if (handler->flags == XATTR_ACL_DEFAULT_T && !S_ISDIR(inode->i_mode)) return -ENODATA; #endif - fullname = kasprintf(GFP_KERNEL, "%s%s", handler->prefix, name); + fullname = kasprintf(GFP_KERNEL, "%s%s", xattr_prefix(handler), name); if (!fullname) return -ENOMEM; -- 1.8.3.1 From jsimmons at infradead.org Sun Jan 6 21:36:44 2019 From: jsimmons at infradead.org (James Simmons) Date: Sun, 6 Jan 2019 16:36:44 -0500 Subject: [lustre-devel] [PATCH 11/14] lustre: llite: conditionally set it_flags in ll_file_open In-Reply-To: <1546810607-6348-1-git-send-email-jsimmons@infradead.org> References: <1546810607-6348-1-git-send-email-jsimmons@infradead.org> Message-ID: <1546810607-6348-12-git-send-email-jsimmons@infradead.org> For ll_file_open the it->it_flags is always setting the MDS_OPEN_LOCK bit but it should only be set when lld_nfs_dentry is set. Signed-off-by: James Simmons --- drivers/staging/lustre/lustre/llite/file.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/lustre/lustre/llite/file.c b/drivers/staging/lustre/lustre/llite/file.c index b390971..3647618 100644 --- a/drivers/staging/lustre/lustre/llite/file.c +++ b/drivers/staging/lustre/lustre/llite/file.c @@ -620,7 +620,7 @@ int ll_file_open(struct inode *inode, struct file *file) * Always specify MDS_OPEN_BY_FID because we don't want * to get file with different fid. */ - it->it_flags |= MDS_OPEN_LOCK | MDS_OPEN_BY_FID; + it->it_flags |= MDS_OPEN_BY_FID; rc = ll_intent_file_open(file->f_path.dentry, NULL, 0, it); if (rc) -- 1.8.3.1 From jsimmons at infradead.org Sun Jan 6 21:36:35 2019 From: jsimmons at infradead.org (James Simmons) Date: Sun, 6 Jan 2019 16:36:35 -0500 Subject: [lustre-devel] [PATCH 02/14] lustre: llite: change how "dump_page_cache" walks a hash table In-Reply-To: <1546810607-6348-1-git-send-email-jsimmons@infradead.org> References: <1546810607-6348-1-git-send-email-jsimmons@infradead.org> Message-ID: <1546810607-6348-3-git-send-email-jsimmons@infradead.org> From: NeilBrown The "dump_page_cache" seq_file currently tries to encode a location in the hash table into a 64bit file index so that the seq_file can seek to any location. This is not necessary with the current implementation of seq_file. seq_file performs any seeks needed itself by rewinding and calling ->next and ->show until the required index is reached. The required behaviour of ->next is that it always returns the next object after the last one returned by either ->start or ->next. It can ignore the ppos, but should increment it. The required behaviour of ->start is one of: 1/ if *ppos is 0, then return the first object 2/ if *ppos is the same value that was passed to the most recent call to either ->start or ->next, then return the same object again 3/ if *ppos is anything else, return the next object after the most recently returned one. To implement this we store a vvp_pgcache_id (index into hash table) in the seq_private data structure, and also store 'prev_pos' as the last value passed to either ->start or ->next. We remove all converstion of an id to a pos, and any limits on the size of the vpi_depth. vvp_pgcache_obj_get() is changed to ignore dying objects so that vvp_pgcache_obj only returns NULL when it reaches the end of a hash chain, and so vpi_bucket needs to be incremented. A reference to the current ->clob pointer is now kept as long as we are iterating over the pages in a given object, so we don't have to try to find it again (and possibly fail) for each page. And the ->start and ->next functions are changed as described above. Signed-off-by: NeilBrown Signed-off-by: James Simmons WC-bug-id: https://jira.whamcloud.com/browse/LU-8066 Reviewed-on: https://review.whamcloud.com/33011 Reviewed-by: Andreas Dilger Reviewed-by: Bobi Jam Reviewed-by: Oleg Drokin Signed-off-by: James Simmons --- drivers/staging/lustre/lustre/llite/vvp_dev.c | 173 ++++++++++++-------------- 1 file changed, 78 insertions(+), 95 deletions(-) diff --git a/drivers/staging/lustre/lustre/llite/vvp_dev.c b/drivers/staging/lustre/lustre/llite/vvp_dev.c index 8cc981b..4e55599 100644 --- a/drivers/staging/lustre/lustre/llite/vvp_dev.c +++ b/drivers/staging/lustre/lustre/llite/vvp_dev.c @@ -366,22 +366,6 @@ int cl_sb_fini(struct super_block *sb) * ****************************************************************************/ -/* - * To represent contents of a page cache as a byte stream, following - * information if encoded in 64bit offset: - * - * - file hash bucket in lu_site::ls_hash[] 28bits - * - * - how far file is from bucket head 4bits - * - * - page index 32bits - * - * First two data identify a file in the cache uniquely. - */ - -#define PGC_OBJ_SHIFT (32 + 4) -#define PGC_DEPTH_SHIFT (32) - struct vvp_pgcache_id { unsigned int vpi_bucket; unsigned int vpi_depth; @@ -396,37 +380,26 @@ struct vvp_seq_private { struct lu_env *vsp_env; u16 vsp_refcheck; struct cl_object *vsp_clob; + struct vvp_pgcache_id vsp_id; + /* + * prev_pos is the 'pos' of the last object returned + * by ->start of ->next. + */ + loff_t vsp_prev_pos; }; -static void vvp_pgcache_id_unpack(loff_t pos, struct vvp_pgcache_id *id) -{ - BUILD_BUG_ON(sizeof(pos) != sizeof(__u64)); - - id->vpi_index = pos & 0xffffffff; - id->vpi_depth = (pos >> PGC_DEPTH_SHIFT) & 0xf; - id->vpi_bucket = (unsigned long long)pos >> PGC_OBJ_SHIFT; -} - -static loff_t vvp_pgcache_id_pack(struct vvp_pgcache_id *id) -{ - return - ((__u64)id->vpi_index) | - ((__u64)id->vpi_depth << PGC_DEPTH_SHIFT) | - ((__u64)id->vpi_bucket << PGC_OBJ_SHIFT); -} - static int vvp_pgcache_obj_get(struct cfs_hash *hs, struct cfs_hash_bd *bd, struct hlist_node *hnode, void *data) { struct vvp_pgcache_id *id = data; struct lu_object_header *hdr = cfs_hash_object(hs, hnode); - if (id->vpi_curdep-- > 0) - return 0; /* continue */ - if (lu_object_is_dying(hdr)) return 1; + if (id->vpi_curdep-- > 0) + return 0; /* continue */ + cfs_hash_get(hs, hnode); id->vpi_obj = hdr; return 1; @@ -438,7 +411,6 @@ static struct cl_object *vvp_pgcache_obj(const struct lu_env *env, { LASSERT(lu_device_is_cl(dev)); - id->vpi_depth &= 0xf; id->vpi_obj = NULL; id->vpi_curdep = id->vpi_depth; @@ -453,55 +425,42 @@ static struct cl_object *vvp_pgcache_obj(const struct lu_env *env, return lu2cl(lu_obj); } lu_object_put(env, lu_object_top(id->vpi_obj)); - - } else if (id->vpi_curdep > 0) { - id->vpi_depth = 0xf; } return NULL; } -static struct page *vvp_pgcache_find(const struct lu_env *env, - struct lu_device *dev, - struct cl_object **clobp, loff_t *pos) +static struct page *vvp_pgcache_current(struct vvp_seq_private *priv) { - struct cl_object *clob; - struct lu_site *site; - struct vvp_pgcache_id id; - - site = dev->ld_site; - vvp_pgcache_id_unpack(*pos, &id); + struct lu_device *dev = &priv->vsp_sbi->ll_cl->cd_lu_dev; while (1) { - if (id.vpi_bucket >= CFS_HASH_NHLIST(site->ls_obj_hash)) - return NULL; - clob = vvp_pgcache_obj(env, dev, &id); - if (clob) { - struct inode *inode = vvp_object_inode(clob); - struct page *vmpage; - int nr; - - nr = find_get_pages_contig(inode->i_mapping, - id.vpi_index, 1, &vmpage); - if (nr > 0) { - id.vpi_index = vmpage->index; - /* Cant support over 16T file */ - if (vmpage->index <= 0xffffffff) { - *clobp = clob; - *pos = vvp_pgcache_id_pack(&id); - return vmpage; - } - put_page(vmpage); - } - - lu_object_ref_del(&clob->co_lu, "dump", current); - cl_object_put(env, clob); + struct inode *inode; + struct page *vmpage; + int nr; + + if (!priv->vsp_clob) { + struct cl_object *clob; + + while ((clob = vvp_pgcache_obj(priv->vsp_env, dev, &priv->vsp_id)) == NULL && + ++(priv->vsp_id.vpi_bucket) < CFS_HASH_NHLIST(dev->ld_site->ls_obj_hash)) + priv->vsp_id.vpi_depth = 0; + if (!clob) + return NULL; + priv->vsp_clob = clob; + priv->vsp_id.vpi_index = 0; + } + + inode = vvp_object_inode(priv->vsp_clob); + nr = find_get_pages_contig(inode->i_mapping, priv->vsp_id.vpi_index, 1, &vmpage); + if (nr > 0) { + priv->vsp_id.vpi_index = vmpage->index; + return vmpage; } - /* to the next object. */ - ++id.vpi_depth; - id.vpi_depth &= 0xf; - if (id.vpi_depth == 0 && ++id.vpi_bucket == 0) - return NULL; - id.vpi_index = 0; + lu_object_ref_del(&priv->vsp_clob->co_lu, "dump", current); + cl_object_put(priv->vsp_env, priv->vsp_clob); + priv->vsp_clob = NULL; + priv->vsp_id.vpi_index = 0; + priv->vsp_id.vpi_depth++; } } @@ -559,38 +518,55 @@ static int vvp_pgcache_show(struct seq_file *f, void *v) } else { seq_puts(f, "missing\n"); } - lu_object_ref_del(&priv->vsp_clob->co_lu, "dump", current); - cl_object_put(priv->vsp_env, priv->vsp_clob); return 0; } +static void vvp_pgcache_rewind(struct vvp_seq_private *priv) +{ + if (priv->vsp_prev_pos) { + memset(&priv->vsp_id, 0, sizeof(priv->vsp_id)); + priv->vsp_prev_pos = 0; + if (priv->vsp_clob) { + lu_object_ref_del(&priv->vsp_clob->co_lu, "dump", + current); + cl_object_put(priv->vsp_env, priv->vsp_clob); + } + priv->vsp_clob = NULL; + } +} + +static struct page *vvp_pgcache_next_page(struct vvp_seq_private *priv) +{ + priv->vsp_id.vpi_index += 1; + return vvp_pgcache_current(priv); +} + static void *vvp_pgcache_start(struct seq_file *f, loff_t *pos) { struct vvp_seq_private *priv = f->private; - struct page *ret; - if (priv->vsp_sbi->ll_site->ls_obj_hash->hs_cur_bits > - 64 - PGC_OBJ_SHIFT) - ret = ERR_PTR(-EFBIG); - else - ret = vvp_pgcache_find(priv->vsp_env, - &priv->vsp_sbi->ll_cl->cd_lu_dev, - &priv->vsp_clob, pos); + if (*pos == 0) { + vvp_pgcache_rewind(priv); + } else if (*pos == priv->vsp_prev_pos) { + /* Return the current item */; + } else { + WARN_ON(*pos != priv->vsp_prev_pos + 1); + priv->vsp_id.vpi_index += 1; + } - return ret; + priv->vsp_prev_pos = *pos; + return vvp_pgcache_current(priv); } static void *vvp_pgcache_next(struct seq_file *f, void *v, loff_t *pos) { struct vvp_seq_private *priv = f->private; - struct page *ret; - *pos += 1; - ret = vvp_pgcache_find(priv->vsp_env, - &priv->vsp_sbi->ll_cl->cd_lu_dev, - &priv->vsp_clob, pos); - return ret; + WARN_ON(*pos != priv->vsp_prev_pos); + + priv->vsp_prev_pos = *pos; + return vvp_pgcache_next_page(priv); } static void vvp_pgcache_stop(struct seq_file *f, void *v) @@ -615,6 +591,8 @@ static int vvp_dump_pgcache_seq_open(struct inode *inode, struct file *filp) priv->vsp_sbi = inode->i_private; priv->vsp_env = cl_env_get(&priv->vsp_refcheck); + priv->vsp_clob = NULL; + memset(&priv->vsp_id, 0, sizeof(priv->vsp_id)); if (IS_ERR(priv->vsp_env)) { int err = PTR_ERR(priv->vsp_env); @@ -629,6 +607,11 @@ static int vvp_dump_pgcache_seq_release(struct inode *inode, struct file *file) struct seq_file *seq = file->private_data; struct vvp_seq_private *priv = seq->private; + if (priv->vsp_clob) { + lu_object_ref_del(&priv->vsp_clob->co_lu, "dump", current); + cl_object_put(priv->vsp_env, priv->vsp_clob); + } + cl_env_put(priv->vsp_env, &priv->vsp_refcheck); return seq_release_private(inode, file); } -- 1.8.3.1 From jsimmons at infradead.org Sun Jan 6 21:36:42 2019 From: jsimmons at infradead.org (James Simmons) Date: Sun, 6 Jan 2019 16:36:42 -0500 Subject: [lustre-devel] [PATCH 09/14] lustre: llite: return correct amount of bytes for short operations In-Reply-To: <1546810607-6348-1-git-send-email-jsimmons@infradead.org> References: <1546810607-6348-1-git-send-email-jsimmons@infradead.org> Message-ID: <1546810607-6348-10-git-send-email-jsimmons@infradead.org> The incorrect number of bytes processed by ll_file_io_generic() is returned. We need to add io->ci_nob to result. Fixes: 623f55c4510 ("staging: lustre: llite: restart short read/write for normal IO") Signed-off-by: James Simmons --- drivers/staging/lustre/lustre/llite/file.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/lustre/lustre/llite/file.c b/drivers/staging/lustre/lustre/llite/file.c index 5c6ebfa..b390971 100644 --- a/drivers/staging/lustre/lustre/llite/file.c +++ b/drivers/staging/lustre/lustre/llite/file.c @@ -1195,7 +1195,7 @@ static void ll_io_init(struct cl_io *io, const struct file *file, int write) } if (io->ci_nob > 0) { - result = io->ci_nob; + result += io->ci_nob; count -= io->ci_nob; *ppos = io->u.ci_wr.wr.crw_pos; -- 1.8.3.1 From jsimmons at infradead.org Sun Jan 6 21:36:40 2019 From: jsimmons at infradead.org (James Simmons) Date: Sun, 6 Jan 2019 16:36:40 -0500 Subject: [lustre-devel] [PATCH 07/14] lustre: uapi: final fixes for UAPI support. In-Reply-To: <1546810607-6348-1-git-send-email-jsimmons@infradead.org> References: <1546810607-6348-1-git-send-email-jsimmons@infradead.org> Message-ID: <1546810607-6348-8-git-send-email-jsimmons@infradead.org> Two problems exist that can prevent lustre UAPI headers from installing properly into /usr/include/linux/lustre. The first problem is bvec.h is only for kernel space. So make lib-types.h include bvec.h instead of the UAPI header lnet-types.h. Last problem was having __uXX inside a comment for lustre_idl.h confused make install. Signed-off-by: James Simmons --- drivers/staging/lustre/include/linux/lnet/lib-types.h | 1 + drivers/staging/lustre/include/uapi/linux/lnet/lnet-types.h | 1 - drivers/staging/lustre/include/uapi/linux/lustre/lustre_idl.h | 2 +- 3 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/lustre/include/linux/lnet/lib-types.h b/drivers/staging/lustre/include/linux/lnet/lib-types.h index 8951a53..3a54e06 100644 --- a/drivers/staging/lustre/include/linux/lnet/lib-types.h +++ b/drivers/staging/lustre/include/linux/lnet/lib-types.h @@ -36,6 +36,7 @@ #ifndef __LNET_LIB_TYPES_H__ #define __LNET_LIB_TYPES_H__ +#include #include #include #include diff --git a/drivers/staging/lustre/include/uapi/linux/lnet/lnet-types.h b/drivers/staging/lustre/include/uapi/linux/lnet/lnet-types.h index e440100..4fcc533 100644 --- a/drivers/staging/lustre/include/uapi/linux/lnet/lnet-types.h +++ b/drivers/staging/lustre/include/uapi/linux/lnet/lnet-types.h @@ -34,7 +34,6 @@ #define __LNET_TYPES_H__ #include -#include /** \addtogroup lnet * @{ diff --git a/drivers/staging/lustre/include/uapi/linux/lustre/lustre_idl.h b/drivers/staging/lustre/include/uapi/linux/lustre/lustre_idl.h index a42ce9d..1d6faf5 100644 --- a/drivers/staging/lustre/include/uapi/linux/lustre/lustre_idl.h +++ b/drivers/staging/lustre/include/uapi/linux/lustre/lustre_idl.h @@ -40,7 +40,7 @@ * that are used in interfaces with userspace should go in lustre_user.h. * * All structs being declared here should be built from simple fixed-size - * types (__u8, __u16, __u32, __u64) or be built from other types or + * types defined in linux/types.h or be built from other types or * structs also declared in this file. Similarly, all flags and magic * values in those structs should also be declared here. This ensures * that the Lustre wire protocol is not influenced by external dependencies. -- 1.8.3.1 From jsimmons at infradead.org Sun Jan 6 21:36:47 2019 From: jsimmons at infradead.org (James Simmons) Date: Sun, 6 Jan 2019 16:36:47 -0500 Subject: [lustre-devel] [PATCH 14/14] lustre: libcfs: hide struct cfs_cpt_table internals In-Reply-To: <1546810607-6348-1-git-send-email-jsimmons@infradead.org> References: <1546810607-6348-1-git-send-email-jsimmons@infradead.org> Message-ID: <1546810607-6348-15-git-send-email-jsimmons@infradead.org> Exposing the internals of struct cfs_cpt_table in the libcfs header used by lustre makes it too tempting to use but those fields are not available for UP systems. Make cfs_cpt_table abstract so the lustre and LNet code will never use the internals and instead use the functions provided in libcfs_cpu.h. Signed-off-by: James Simmons --- .../lustre/include/linux/libcfs/libcfs_cpu.h | 39 ++-------------------- drivers/staging/lustre/lnet/libcfs/libcfs_cpu.c | 34 +++++++++++++++++++ 2 files changed, 37 insertions(+), 36 deletions(-) diff --git a/drivers/staging/lustre/include/linux/libcfs/libcfs_cpu.h b/drivers/staging/lustre/include/linux/libcfs/libcfs_cpu.h index 50eb484..3e51752 100644 --- a/drivers/staging/lustre/include/linux/libcfs/libcfs_cpu.h +++ b/drivers/staging/lustre/include/linux/libcfs/libcfs_cpu.h @@ -79,42 +79,9 @@ /* any CPU partition */ #define CFS_CPT_ANY (-1) -#ifdef CONFIG_SMP -/** virtual processing unit */ -struct cfs_cpu_partition { - /* CPUs mask for this partition */ - cpumask_var_t cpt_cpumask; - /* nodes mask for this partition */ - nodemask_t *cpt_nodemask; - /* NUMA distance between CPTs */ - unsigned int *cpt_distance; - /* spread rotor for NUMA allocator */ - unsigned int cpt_spread_rotor; - /* NUMA node if cpt_nodemask is empty */ - int cpt_node; -}; - - -/** descriptor for CPU partitions */ -struct cfs_cpt_table { - /* spread rotor for NUMA allocator */ - unsigned int ctb_spread_rotor; - /* maximum NUMA distance between all nodes in table */ - unsigned int ctb_distance; - /* # of CPU partitions */ - unsigned int ctb_nparts; - /* partitions tables */ - struct cfs_cpu_partition *ctb_parts; - /* shadow HW CPU to CPU partition ID */ - int *ctb_cpu2cpt; - /* all cpus in this partition table */ - cpumask_var_t ctb_cpumask; - /* shadow HW node to CPU partition ID */ - int *ctb_node2cpt; - /* all nodes in this partition table */ - nodemask_t *ctb_nodemask; -}; +struct cfs_cpt_table; +#ifdef CONFIG_SMP extern struct cfs_cpt_table *cfs_cpt_tab; /** @@ -215,7 +182,7 @@ void cfs_cpt_unset_nodemask(struct cfs_cpt_table *cptab, void cfs_cpu_fini(void); #else /* !CONFIG_SMP */ -struct cfs_cpt_table; + #define cfs_cpt_tab ((struct cfs_cpt_table *)NULL) static inline int cfs_cpt_table_print(struct cfs_cpt_table *cptab, diff --git a/drivers/staging/lustre/lnet/libcfs/libcfs_cpu.c b/drivers/staging/lustre/lnet/libcfs/libcfs_cpu.c index a9b59cc..a384a73 100644 --- a/drivers/staging/lustre/lnet/libcfs/libcfs_cpu.c +++ b/drivers/staging/lustre/lnet/libcfs/libcfs_cpu.c @@ -41,6 +41,40 @@ #include #include +/** virtual processing unit */ +struct cfs_cpu_partition { + /* CPUs mask for this partition */ + cpumask_var_t cpt_cpumask; + /* nodes mask for this partition */ + nodemask_t *cpt_nodemask; + /* NUMA distance between CPTs */ + unsigned int *cpt_distance; + /* spread rotor for NUMA allocator */ + unsigned int cpt_spread_rotor; + /* NUMA node if cpt_nodemask is empty */ + int cpt_node; +}; + +/** descriptor for CPU partitions */ +struct cfs_cpt_table { + /* spread rotor for NUMA allocator */ + unsigned int ctb_spread_rotor; + /* maximum NUMA distance between all nodes in table */ + unsigned int ctb_distance; + /* # of CPU partitions */ + unsigned int ctb_nparts; + /* partitions tables */ + struct cfs_cpu_partition *ctb_parts; + /* shadow HW CPU to CPU partition ID */ + int *ctb_cpu2cpt; + /* all cpus in this partition table */ + cpumask_var_t ctb_cpumask; + /* shadow HW node to CPU partition ID */ + int *ctb_node2cpt; + /* all nodes in this partition table */ + nodemask_t *ctb_nodemask; +}; + /** Global CPU partition table */ struct cfs_cpt_table *cfs_cpt_tab __read_mostly; EXPORT_SYMBOL(cfs_cpt_tab); -- 1.8.3.1 From jsimmons at infradead.org Sun Jan 6 21:36:45 2019 From: jsimmons at infradead.org (James Simmons) Date: Sun, 6 Jan 2019 16:36:45 -0500 Subject: [lustre-devel] [PATCH 12/14] lustre: llite: fix file migration In-Reply-To: <1546810607-6348-1-git-send-email-jsimmons@infradead.org> References: <1546810607-6348-1-git-send-email-jsimmons@infradead.org> Message-ID: <1546810607-6348-13-git-send-email-jsimmons@infradead.org> Several small bugs have appeared over the years that broke file migration. The first bug is that the hash was created using the parent inode instead of using file_dentry(file). The second problem occured with op_fid3 being set when the child dentry was found. The last problem was rn_opcode was always being set to REINT_RENAME in mdc_rename_pack(). Remove that extra nr_opcode setting. Signed-off-by: James Simmons --- drivers/staging/lustre/lustre/llite/file.c | 3 +-- drivers/staging/lustre/lustre/mdc/mdc_lib.c | 1 - 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/staging/lustre/lustre/llite/file.c b/drivers/staging/lustre/lustre/llite/file.c index 3647618..c018c5f 100644 --- a/drivers/staging/lustre/lustre/llite/file.c +++ b/drivers/staging/lustre/lustre/llite/file.c @@ -3003,12 +3003,11 @@ int ll_migrate(struct inode *parent, struct file *file, int mdtidx, return PTR_ERR(op_data); /* Get child FID first */ - qstr.hash = full_name_hash(parent, name, namelen); + qstr.hash = full_name_hash(file_dentry(file), name, namelen); qstr.name = name; qstr.len = namelen; dchild = d_lookup(file_dentry(file), &qstr); if (dchild) { - op_data->op_fid3 = *ll_inode2fid(dchild->d_inode); if (dchild->d_inode) child_inode = igrab(dchild->d_inode); dput(dchild); diff --git a/drivers/staging/lustre/lustre/mdc/mdc_lib.c b/drivers/staging/lustre/lustre/mdc/mdc_lib.c index 415127f..a1b1e75 100644 --- a/drivers/staging/lustre/lustre/mdc/mdc_lib.c +++ b/drivers/staging/lustre/lustre/mdc/mdc_lib.c @@ -457,7 +457,6 @@ void mdc_rename_pack(struct ptlrpc_request *req, struct md_op_data *op_data, /* XXX do something about time, uid, gid */ rec->rn_opcode = op_data->op_cli_flags & CLI_MIGRATE ? REINT_MIGRATE : REINT_RENAME; - rec->rn_opcode = REINT_RENAME; rec->rn_fsuid = op_data->op_fsuid; rec->rn_fsgid = op_data->op_fsgid; rec->rn_cap = op_data->op_cap.cap[0]; -- 1.8.3.1 From jsimmons at infradead.org Sun Jan 6 21:36:46 2019 From: jsimmons at infradead.org (James Simmons) Date: Sun, 6 Jan 2019 16:36:46 -0500 Subject: [lustre-devel] [PATCH 13/14] lustre: sysfs: temporary work around for sysfs naming In-Reply-To: <1546810607-6348-1-git-send-email-jsimmons@infradead.org> References: <1546810607-6348-1-git-send-email-jsimmons@infradead.org> Message-ID: <1546810607-6348-14-git-send-email-jsimmons@infradead.org> Lustre uses the internal addressing of data structures to name the sysfs objects. With newer kernels hashing is done on the data structure addresses to make it harder to bypass address space randomization. This breaks auto tuning with lustre. The temporary work around is to use "%px" for the naming just to make things work again. The long term solution is to move to proper uuids for the name which is being worked on. Signed-off-by: James Simmons --- drivers/staging/lustre/lustre/llite/llite_lib.c | 6 +++--- drivers/staging/lustre/lustre/mgc/mgc_request.c | 2 +- drivers/staging/lustre/lustre/obdclass/obd_config.c | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/staging/lustre/lustre/llite/llite_lib.c b/drivers/staging/lustre/lustre/llite/llite_lib.c index 203a1f7..b258c80 100644 --- a/drivers/staging/lustre/lustre/llite/llite_lib.c +++ b/drivers/staging/lustre/lustre/llite/llite_lib.c @@ -959,7 +959,7 @@ int ll_fill_super(struct super_block *sb) len -= 7; /* Mount info */ - snprintf(name, MAX_STRING_SIZE, "%.*s-%p", len, + snprintf(name, MAX_STRING_SIZE, "%.*s-%px", len, lsi->lsi_lmd->lmd_profile, sb); /* Call ll_debugsfs_register_super() before lustre_process_log() @@ -997,13 +997,13 @@ int ll_fill_super(struct super_block *sb) CDEBUG(D_CONFIG, "Found profile %s: mdc=%s osc=%s\n", profilenm, lprof->lp_md, lprof->lp_dt); - dt = kasprintf(GFP_NOFS, "%s-%p", lprof->lp_dt, cfg->cfg_instance); + dt = kasprintf(GFP_NOFS, "%s-%px", lprof->lp_dt, cfg->cfg_instance); if (!dt) { err = -ENOMEM; goto out_debugfs; } - md = kasprintf(GFP_NOFS, "%s-%p", lprof->lp_md, cfg->cfg_instance); + md = kasprintf(GFP_NOFS, "%s-%px", lprof->lp_md, cfg->cfg_instance); if (!md) { err = -ENOMEM; goto out_debugfs; diff --git a/drivers/staging/lustre/lustre/mgc/mgc_request.c b/drivers/staging/lustre/lustre/mgc/mgc_request.c index a6be2ca..ca74c75 100644 --- a/drivers/staging/lustre/lustre/mgc/mgc_request.c +++ b/drivers/staging/lustre/lustre/mgc/mgc_request.c @@ -1142,7 +1142,7 @@ static int mgc_apply_recover_logs(struct obd_device *mgc, if (!inst) return -ENOMEM; - pos = snprintf(inst, PAGE_SIZE, "%p", cfg->cfg_instance); + pos = snprintf(inst, PAGE_SIZE, "%px", cfg->cfg_instance); if (pos >= PAGE_SIZE) { kfree(inst); return -E2BIG; diff --git a/drivers/staging/lustre/lustre/obdclass/obd_config.c b/drivers/staging/lustre/lustre/obdclass/obd_config.c index 8be8751..7d00ca4 100644 --- a/drivers/staging/lustre/lustre/obdclass/obd_config.c +++ b/drivers/staging/lustre/lustre/obdclass/obd_config.c @@ -1323,7 +1323,7 @@ int class_config_llog_handler(const struct lu_env *env, LUSTRE_CFG_BUFLEN(lcfg, 0) > 0) { inst_len = LUSTRE_CFG_BUFLEN(lcfg, 0) + sizeof(clli->cfg_instance) * 2 + 4; - inst_name = kasprintf(GFP_NOFS, "%s-%p", + inst_name = kasprintf(GFP_NOFS, "%s-%px", lustre_cfg_string(lcfg, 0), clli->cfg_instance); if (!inst_name) { -- 1.8.3.1 From jsimmons at infradead.org Sun Jan 6 22:13:56 2019 From: jsimmons at infradead.org (James Simmons) Date: Sun, 6 Jan 2019 17:13:56 -0500 Subject: [lustre-devel] [PATCH v2 01/33] lustre: clio: fix incorrect invariant in cl_io_iter_fini() In-Reply-To: <1546812868-11794-1-git-send-email-jsimmons@infradead.org> References: <1546812868-11794-1-git-send-email-jsimmons@infradead.org> Message-ID: <1546812868-11794-2-git-send-email-jsimmons@infradead.org> It was discovered during PFL testing that if you enable invarients that cl_io_iter_fini() will crash with the following back trace: kernel: cl_io_iter_fini+0x10c/0x110 [obdclass] kernel: cl_io_loop+0x46/0x220 [obdclass] kernel: cl_setattr_ost+0x1ed/0x2a0 [lustre] kernel: ll_setattr_raw+0x7b0/0x9a0 [lustre] kernel: notify_change+0x1dc/0x430 kernel: do_truncate+0x72/0xc0 kernel: do_sys_ftruncate+0xf5/0x160 This is due to assumption that the ci_state will always be CIS_UNLOCKED but by looking at the behavior of cl_io_loop() it can be seen that is not the case. We do want to make sure the state is in the range of CIS_IT_STARTED to CIS_IO_FINISHED when cl_io_iter_fini() is called. Signed-off-by: James Simmons Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-11828 Reviewed-on: https://review.whamcloud.com/33915 Signed-off-by: James Simmons --- drivers/staging/lustre/lustre/obdclass/cl_io.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/lustre/lustre/obdclass/cl_io.c b/drivers/staging/lustre/lustre/obdclass/cl_io.c index 879383ae..0da731c 100644 --- a/drivers/staging/lustre/lustre/obdclass/cl_io.c +++ b/drivers/staging/lustre/lustre/obdclass/cl_io.c @@ -436,7 +436,7 @@ void cl_io_iter_fini(const struct lu_env *env, struct cl_io *io) const struct cl_io_slice *scan; LINVRNT(cl_io_is_loopable(io)); - LINVRNT(io->ci_state == CIS_UNLOCKED); + LINVRNT(io->ci_state < CIS_LOCKED || io->ci_state > CIS_IO_FINISHED); LINVRNT(cl_io_invariant(io)); list_for_each_entry_reverse(scan, &io->ci_layers, cis_linkage) { -- 1.8.3.1 From jsimmons at infradead.org Sun Jan 6 22:13:57 2019 From: jsimmons at infradead.org (James Simmons) Date: Sun, 6 Jan 2019 17:13:57 -0500 Subject: [lustre-devel] [PATCH v2 02/33] lustre: pfl: Basic data structures for composite layout In-Reply-To: <1546812868-11794-1-git-send-email-jsimmons@infradead.org> References: <1546812868-11794-1-git-send-email-jsimmons@infradead.org> Message-ID: <1546812868-11794-3-git-send-email-jsimmons@infradead.org> From: Niu Yawei Added basic structures and magic numbers for composite layout. Details about PFL can be reviewed at http://wiki.lustre.org/PFL_Prototype_High_Level_Design Signed-off-by: Niu Yawei WC-bug-id: https://jira.whamcloud.com/browse/LU-8998 Reviewed-on: https://review.whamcloud.com/24822 Reviewed-by: Jinshan Xiong Reviewed-by: Andreas Dilger Signed-off-by: James Simmons --- .../lustre/include/uapi/linux/lustre/lustre_idl.h | 1 + .../lustre/include/uapi/linux/lustre/lustre_user.h | 50 +++++++++++++++ .../staging/lustre/lustre/include/lustre_swab.h | 1 + .../staging/lustre/lustre/ptlrpc/pack_generic.c | 71 ++++++++++++++++++++++ drivers/staging/lustre/lustre/ptlrpc/wiretest.c | 67 ++++++++++++++++++++ 5 files changed, 190 insertions(+) diff --git a/drivers/staging/lustre/include/uapi/linux/lustre/lustre_idl.h b/drivers/staging/lustre/include/uapi/linux/lustre/lustre_idl.h index a42ce9d..333b791 100644 --- a/drivers/staging/lustre/include/uapi/linux/lustre/lustre_idl.h +++ b/drivers/staging/lustre/include/uapi/linux/lustre/lustre_idl.h @@ -960,6 +960,7 @@ enum obdo_flags { /* reserved for specifying OSTs */ #define LOV_MAGIC_SPECIFIC (0x0BD50000 | LOV_MAGIC_MAGIC) #define LOV_MAGIC LOV_MAGIC_V1 +#define LOV_MAGIC_COMP_V1 (0x0BD60000 | LOV_MAGIC_MAGIC) /* * magic for fully defined striping diff --git a/drivers/staging/lustre/include/uapi/linux/lustre/lustre_user.h b/drivers/staging/lustre/include/uapi/linux/lustre/lustre_user.h index 4412dc8..bb87a6f 100644 --- a/drivers/staging/lustre/include/uapi/linux/lustre/lustre_user.h +++ b/drivers/staging/lustre/include/uapi/linux/lustre/lustre_user.h @@ -327,6 +327,7 @@ enum ll_lease_type { #define LOV_USER_MAGIC_V3 0x0BD30BD0 /* 0x0BD40BD0 is occupied by LOV_MAGIC_MIGRATE */ #define LOV_USER_MAGIC_SPECIFIC 0x0BD50BD0 /* for specific OSTs */ +#define LOV_USER_MAGIC_COMP_V1 0x0BD60BD0 #define LMV_USER_MAGIC 0x0CD30CD0 /*default lmv magic*/ @@ -405,6 +406,55 @@ struct lov_user_md_v3 { /* LOV EA user data (host-endian) */ struct lov_user_ost_data_v1 lmm_objects[0]; /* per-stripe data */ } __packed; +struct lu_extent { + __u64 e_start; + __u64 e_end; +}; + +enum lov_comp_md_entry_flags { + LCME_FL_PRIMARY = 0x00000001, /* Not used */ + LCME_FL_STALE = 0x00000002, /* Not used */ + LCME_FL_OFFLINE = 0x00000004, /* Not used */ + LCME_FL_PREFERRED = 0x00000008, /* Not used */ + LCME_FL_INIT = 0x00000010, /* instantiated */ +}; + +#define LCME_KNOWN_FLAGS LCME_FL_INIT + +/* lcme_id can be specified as certain flags, and the first + * bit of lcme_id is used to indicate that the ID is representing + * certain LCME_FL_* but not a real ID. Which implies we can have + * at most 31 flags (see LCME_FL_XXX). + */ +enum lcme_id { + LCME_ID_INVAL = 0x0, + LCME_ID_MAX = 0x7FFFFFFF, + LCME_ID_ALL = 0xFFFFFFFF, + LCME_ID_NONE = 0x80000000 +}; + +struct lov_comp_md_entry_v1 { + __u32 lcme_id; /* unique id of component */ + __u32 lcme_flags; /* LCME_FL_XXX */ + struct lu_extent lcme_extent; /* file extent for component */ + __u32 lcme_offset; /* offset of component blob, + * start from lov_comp_md_v1 + */ + __u32 lcme_size; /* size of component blob */ + __u64 lcme_padding[2]; +} __packed; + +struct lov_comp_md_v1 { + __u32 lcm_magic; /* LOV_USER_MAGIC_COMP_V1 */ + __u32 lcm_size; /* overall size including this struct */ + __u32 lcm_layout_gen; + __u16 lcm_flags; + __u16 lcm_entry_count; + __u64 lcm_padding1; + __u64 lcm_padding2; + struct lov_comp_md_entry_v1 lcm_entries[0]; +} __packed; + static inline __u32 lov_user_md_size(__u16 stripes, __u32 lmm_magic) { if (lmm_magic == LOV_USER_MAGIC_V1) diff --git a/drivers/staging/lustre/lustre/include/lustre_swab.h b/drivers/staging/lustre/lustre/include/lustre_swab.h index e09a3dc..6939ac1 100644 --- a/drivers/staging/lustre/lustre/include/lustre_swab.h +++ b/drivers/staging/lustre/lustre/include/lustre_swab.h @@ -83,6 +83,7 @@ void lustre_swab_fiemap(struct fiemap *fiemap); void lustre_swab_lov_user_md_v1(struct lov_user_md_v1 *lum); void lustre_swab_lov_user_md_v3(struct lov_user_md_v3 *lum); +void lustre_swab_lov_comp_md_v1(struct lov_comp_md_v1 *lum); void lustre_swab_lov_user_md_objects(struct lov_user_ost_data *lod, int stripe_count); void lustre_swab_lov_mds_md(struct lov_mds_md *lmm); diff --git a/drivers/staging/lustre/lustre/ptlrpc/pack_generic.c b/drivers/staging/lustre/lustre/ptlrpc/pack_generic.c index 951bb92..9c5be30 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/pack_generic.c +++ b/drivers/staging/lustre/lustre/ptlrpc/pack_generic.c @@ -1990,6 +1990,77 @@ void lustre_swab_lov_user_md_v3(struct lov_user_md_v3 *lum) } EXPORT_SYMBOL(lustre_swab_lov_user_md_v3); +void lustre_swab_lov_comp_md_v1(struct lov_comp_md_v1 *lum) +{ + struct lov_comp_md_entry_v1 *ent; + bool cpu_endian; + u16 ent_count; + int i; + + cpu_endian = lum->lcm_magic == LOV_USER_MAGIC_COMP_V1; + ent_count = lum->lcm_entry_count; + if (!cpu_endian) + __swab16s(&ent_count); + + CDEBUG(D_IOCTL, "swabbing lov_user_comp_md v1\n"); + __swab32s(&lum->lcm_magic); + __swab32s(&lum->lcm_size); + __swab32s(&lum->lcm_layout_gen); + __swab16s(&lum->lcm_flags); + __swab16s(&lum->lcm_entry_count); + BUILD_BUG_ON(offsetof(typeof(*lum), lcm_padding1) == 0); + BUILD_BUG_ON(offsetof(typeof(*lum), lcm_padding2) == 0); + + for (i = 0; i < ent_count; i++) { + struct lov_user_md_v1 *v1; + u16 stripe_count; + u32 off, size; + + ent = &lum->lcm_entries[i]; + off = ent->lcme_offset; + size = ent->lcme_size; + + if (!cpu_endian) { + __swab32s(&off); + __swab32s(&size); + } + __swab32s(&ent->lcme_id); + __swab32s(&ent->lcme_flags); + __swab64s(&ent->lcme_extent.e_start); + __swab64s(&ent->lcme_extent.e_end); + __swab32s(&ent->lcme_offset); + __swab32s(&ent->lcme_size); + BUILD_BUG_ON(offsetof(typeof(*ent), lcme_padding) == 0); + + v1 = (struct lov_user_md_v1 *)((char *)lum + off); + stripe_count = v1->lmm_stripe_count; + if (!cpu_endian) + __swab16s(&stripe_count); + + if (v1->lmm_magic == __swab32(LOV_USER_MAGIC_V1) || + v1->lmm_magic == LOV_USER_MAGIC_V1) { + lustre_swab_lov_user_md_v1(v1); + if (size > sizeof(*v1)) + lustre_swab_lov_user_md_objects(v1->lmm_objects, + stripe_count); + } else if (v1->lmm_magic == __swab32(LOV_USER_MAGIC_V3) || + v1->lmm_magic == LOV_USER_MAGIC_V3 || + v1->lmm_magic == __swab32(LOV_USER_MAGIC_SPECIFIC) || + v1->lmm_magic == LOV_USER_MAGIC_SPECIFIC) { + struct lov_user_md_v3 *v3; + + v3 = (struct lov_user_md_v3 *)v1; + lustre_swab_lov_user_md_v3(v3); + if (size > sizeof(*v3)) + lustre_swab_lov_user_md_objects(v3->lmm_objects, + stripe_count); + } else { + CERROR("Invalid magic %#x\n", v1->lmm_magic); + } + } +} +EXPORT_SYMBOL(lustre_swab_lov_comp_md_v1); + void lustre_swab_lov_mds_md(struct lov_mds_md *lmm) { CDEBUG(D_IOCTL, "swabbing lov_mds_md\n"); diff --git a/drivers/staging/lustre/lustre/ptlrpc/wiretest.c b/drivers/staging/lustre/lustre/ptlrpc/wiretest.c index 3aaaebb..90e6b8c 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/wiretest.c +++ b/drivers/staging/lustre/lustre/ptlrpc/wiretest.c @@ -1450,6 +1450,73 @@ void lustre_assert_wire_constants(void) LASSERTF(LOV_PATTERN_CMOBD == 0x00000200UL, "found 0x%.8xUL\n", (unsigned int)LOV_PATTERN_CMOBD); + /* Checks for struct lov_comp_md_entry_v1 */ + LASSERTF((int)sizeof(struct lov_comp_md_entry_v1) == 48, "found %lld\n", + (long long)(int)sizeof(struct lov_comp_md_entry_v1)); + LASSERTF((int)offsetof(struct lov_comp_md_entry_v1, lcme_id) == 0, "found %lld\n", + (long long)(int)offsetof(struct lov_comp_md_entry_v1, lcme_id)); + LASSERTF((int)sizeof(((struct lov_comp_md_entry_v1 *)0)->lcme_id) == 4, "found %lld\n", + (long long)(int)sizeof(((struct lov_comp_md_entry_v1 *)0)->lcme_id)); + LASSERTF((int)offsetof(struct lov_comp_md_entry_v1, lcme_flags) == 4, "found %lld\n", + (long long)(int)offsetof(struct lov_comp_md_entry_v1, lcme_flags)); + LASSERTF((int)sizeof(((struct lov_comp_md_entry_v1 *)0)->lcme_flags) == 4, "found %lld\n", + (long long)(int)sizeof(((struct lov_comp_md_entry_v1 *)0)->lcme_flags)); + LASSERTF((int)offsetof(struct lov_comp_md_entry_v1, lcme_extent) == 8, "found %lld\n", + (long long)(int)offsetof(struct lov_comp_md_entry_v1, lcme_extent)); + LASSERTF((int)sizeof(((struct lov_comp_md_entry_v1 *)0)->lcme_extent) == 16, "found %lld\n", + (long long)(int)sizeof(((struct lov_comp_md_entry_v1 *)0)->lcme_extent)); + LASSERTF((int)offsetof(struct lov_comp_md_entry_v1, lcme_offset) == 24, "found %lld\n", + (long long)(int)offsetof(struct lov_comp_md_entry_v1, lcme_offset)); + LASSERTF((int)sizeof(((struct lov_comp_md_entry_v1 *)0)->lcme_offset) == 4, "found %lld\n", + (long long)(int)sizeof(((struct lov_comp_md_entry_v1 *)0)->lcme_offset)); + LASSERTF((int)offsetof(struct lov_comp_md_entry_v1, lcme_size) == 28, "found %lld\n", + (long long)(int)offsetof(struct lov_comp_md_entry_v1, lcme_size)); + LASSERTF((int)sizeof(((struct lov_comp_md_entry_v1 *)0)->lcme_size) == 4, "found %lld\n", + (long long)(int)sizeof(((struct lov_comp_md_entry_v1 *)0)->lcme_size)); + LASSERTF((int)offsetof(struct lov_comp_md_entry_v1, lcme_padding) == 32, "found %lld\n", + (long long)(int)offsetof(struct lov_comp_md_entry_v1, lcme_padding)); + LASSERTF((int)sizeof(((struct lov_comp_md_entry_v1 *)0)->lcme_padding) == 16, "found %lld\n", + (long long)(int)sizeof(((struct lov_comp_md_entry_v1 *)0)->lcme_padding)); + LASSERTF(LCME_FL_INIT == 0x00000010UL, "found 0x%.8xUL\n", + (unsigned int)LCME_FL_INIT); + + /* Checks for struct lov_comp_md_v1 */ + LASSERTF((int)sizeof(struct lov_comp_md_v1) == 32, "found %lld\n", + (long long)(int)sizeof(struct lov_comp_md_v1)); + LASSERTF((int)offsetof(struct lov_comp_md_v1, lcm_magic) == 0, "found %lld\n", + (long long)(int)offsetof(struct lov_comp_md_v1, lcm_magic)); + LASSERTF((int)sizeof(((struct lov_comp_md_v1 *)0)->lcm_magic) == 4, "found %lld\n", + (long long)(int)sizeof(((struct lov_comp_md_v1 *)0)->lcm_magic)); + LASSERTF((int)offsetof(struct lov_comp_md_v1, lcm_size) == 4, "found %lld\n", + (long long)(int)offsetof(struct lov_comp_md_v1, lcm_size)); + LASSERTF((int)sizeof(((struct lov_comp_md_v1 *)0)->lcm_size) == 4, "found %lld\n", + (long long)(int)sizeof(((struct lov_comp_md_v1 *)0)->lcm_size)); + LASSERTF((int)offsetof(struct lov_comp_md_v1, lcm_layout_gen) == 8, "found %lld\n", + (long long)(int)offsetof(struct lov_comp_md_v1, lcm_layout_gen)); + LASSERTF((int)sizeof(((struct lov_comp_md_v1 *)0)->lcm_layout_gen) == 4, "found %lld\n", + (long long)(int)sizeof(((struct lov_comp_md_v1 *)0)->lcm_layout_gen)); + LASSERTF((int)offsetof(struct lov_comp_md_v1, lcm_flags) == 12, "found %lld\n", + (long long)(int)offsetof(struct lov_comp_md_v1, lcm_flags)); + LASSERTF((int)sizeof(((struct lov_comp_md_v1 *)0)->lcm_flags) == 2, "found %lld\n", + (long long)(int)sizeof(((struct lov_comp_md_v1 *)0)->lcm_flags)); + LASSERTF((int)offsetof(struct lov_comp_md_v1, lcm_entry_count) == 14, "found %lld\n", + (long long)(int)offsetof(struct lov_comp_md_v1, lcm_entry_count)); + LASSERTF((int)sizeof(((struct lov_comp_md_v1 *)0)->lcm_entry_count) == 2, "found %lld\n", + (long long)(int)sizeof(((struct lov_comp_md_v1 *)0)->lcm_entry_count)); + LASSERTF((int)offsetof(struct lov_comp_md_v1, lcm_padding1) == 16, "found %lld\n", + (long long)(int)offsetof(struct lov_comp_md_v1, lcm_padding1)); + LASSERTF((int)sizeof(((struct lov_comp_md_v1 *)0)->lcm_padding1) == 8, "found %lld\n", + (long long)(int)sizeof(((struct lov_comp_md_v1 *)0)->lcm_padding1)); + LASSERTF((int)offsetof(struct lov_comp_md_v1, lcm_padding2) == 24, "found %lld\n", + (long long)(int)offsetof(struct lov_comp_md_v1, lcm_padding2)); + LASSERTF((int)sizeof(((struct lov_comp_md_v1 *)0)->lcm_padding2) == 8, "found %lld\n", + (long long)(int)sizeof(((struct lov_comp_md_v1 *)0)->lcm_padding2)); + LASSERTF((int)offsetof(struct lov_comp_md_v1, lcm_entries[0]) == 32, "found %lld\n", + (long long)(int)offsetof(struct lov_comp_md_v1, lcm_entries[0])); + LASSERTF((int)sizeof(((struct lov_comp_md_v1 *)0)->lcm_entries[0]) == 48, "found %lld\n", + (long long)(int)sizeof(((struct lov_comp_md_v1 *)0)->lcm_entries[0])); + BUILD_BUG_ON(LOV_MAGIC_COMP_V1 != (0x0BD60000 | 0x0BD0)); + /* Checks for struct lmv_mds_md_v1 */ LASSERTF((int)sizeof(struct lmv_mds_md_v1) == 56, "found %lld\n", (long long)(int)sizeof(struct lmv_mds_md_v1)); -- 1.8.3.1 From jsimmons at infradead.org Sun Jan 6 22:13:59 2019 From: jsimmons at infradead.org (James Simmons) Date: Sun, 6 Jan 2019 17:13:59 -0500 Subject: [lustre-devel] [PATCH v2 04/33] lustre: lov: merge lov_mds_md_v3 and lov_mds_md_v1 handling In-Reply-To: <1546812868-11794-1-git-send-email-jsimmons@infradead.org> References: <1546812868-11794-1-git-send-email-jsimmons@infradead.org> Message-ID: <1546812868-11794-5-git-send-email-jsimmons@infradead.org> From: Bobi Jam Several of the struct lsm_operations functions for both v1 and v3 are nearly identical. Let's merge them together. Signed-off-by: John L. Hammond Signed-off-by: Bobi Jam Signed-off-by: Niu Yawei WC-bug-id: https://jira.whamcloud.com/browse/LU-8998 Reviewed-on: https://review.whamcloud.com/24849 WC-bug-id: https://jira.whamcloud.com/browse/LU-9315 Reviewed-on: https://review.whamcloud.com/26503 Reviewed-by: Dmitry Eremin Reviewed-by: Jinshan Xiong Reviewed-by: Andreas Dilger Signed-off-by: James Simmons --- drivers/staging/lustre/lustre/lov/lov_ea.c | 58 ++++++++++++------------ drivers/staging/lustre/lustre/lov/lov_internal.h | 3 +- drivers/staging/lustre/lustre/lov/lov_pack.c | 30 ++++-------- 3 files changed, 38 insertions(+), 53 deletions(-) diff --git a/drivers/staging/lustre/lustre/lov/lov_ea.c b/drivers/staging/lustre/lustre/lov/lov_ea.c index 3dfb204..2b3552a 100644 --- a/drivers/staging/lustre/lustre/lov/lov_ea.c +++ b/drivers/staging/lustre/lustre/lov/lov_ea.c @@ -71,8 +71,8 @@ static loff_t lov_tgt_maxbytes(struct lov_tgt_desc *tgt) return maxbytes; } -static int lsm_lmm_verify_common(struct lov_mds_md *lmm, int lmm_bytes, - __u16 stripe_count) +static int lsm_lmm_verify_v1v3(struct lov_mds_md *lmm, size_t lmm_size, + u16 stripe_count) { if (stripe_count > LOV_V1_INSANE_STRIPE_COUNT) { CERROR("bad stripe count %d\n", stripe_count); @@ -103,7 +103,7 @@ static int lsm_lmm_verify_common(struct lov_mds_md *lmm, int lmm_bytes, return 0; } -void lsm_free_plain(struct lov_stripe_md *lsm) +void lsm_free(struct lov_stripe_md *lsm) { __u16 stripe_count = lsm->lsm_stripe_count; int i; @@ -145,10 +145,11 @@ struct lov_stripe_md *lsm_alloc_plain(u16 stripe_count) return NULL; } -static int lsm_unpackmd_common(struct lov_obd *lov, - struct lov_stripe_md *lsm, - struct lov_mds_md *lmm, - struct lov_ost_data_v1 *objects) +static int lsm_unpackmd_v1v3(struct lov_obd *lov, + struct lov_stripe_md *lsm, + struct lov_mds_md *lmm, + const char *pool_name, + struct lov_ost_data_v1 *objects) { loff_t min_stripe_maxbytes = 0; unsigned int stripe_count; @@ -168,6 +169,15 @@ static int lsm_unpackmd_common(struct lov_obd *lov, stripe_count = lsm_is_released(lsm) ? 0 : lsm->lsm_stripe_count; + if (pool_name) { + size_t pool_name_len; + + pool_name_len = strlcpy(lsm->lsm_pool_name, pool_name, + sizeof(lsm->lsm_pool_name)); + if (pool_name_len >= sizeof(lsm->lsm_pool_name)) + return -E2BIG; + } + for (i = 0; i < stripe_count; i++) { loi = lsm->lsm_oinfo[i]; ostid_le_to_cpu(&objects[i].l_ost_oi, &loi->loi_oi); @@ -248,17 +258,16 @@ static int lsm_lmm_verify_v1(struct lov_mds_md_v1 *lmm, int lmm_bytes, return -EINVAL; } - return lsm_lmm_verify_common(lmm, lmm_bytes, *stripe_count); + return lsm_lmm_verify_v1v3(lmm, lmm_bytes, *stripe_count); } static int lsm_unpackmd_v1(struct lov_obd *lov, struct lov_stripe_md *lsm, struct lov_mds_md_v1 *lmm) { - return lsm_unpackmd_common(lov, lsm, lmm, lmm->lmm_objects); + return lsm_unpackmd_v1v3(lov, lsm, lmm, NULL, lmm->lmm_objects); } -const struct lsm_operations lsm_v1_ops = { - .lsm_free = lsm_free_plain, +const static struct lsm_operations lsm_v1_ops = { .lsm_stripe_by_index = lsm_stripe_by_index_plain, .lsm_stripe_by_offset = lsm_stripe_by_offset_plain, .lsm_lmm_verify = lsm_lmm_verify_v1, @@ -289,7 +298,7 @@ static int lsm_lmm_verify_v3(struct lov_mds_md *lmmv1, int lmm_bytes, return -EINVAL; } - return lsm_lmm_verify_common((struct lov_mds_md_v1 *)lmm, lmm_bytes, + return lsm_lmm_verify_v1v3((struct lov_mds_md_v1 *)lmm, lmm_bytes, *stripe_count); } @@ -297,27 +306,16 @@ static int lsm_unpackmd_v3(struct lov_obd *lov, struct lov_stripe_md *lsm, struct lov_mds_md *lmm) { struct lov_mds_md_v3 *lmm_v3 = (struct lov_mds_md_v3 *)lmm; - size_t cplen = 0; - int rc; - - rc = lsm_unpackmd_common(lov, lsm, lmm, lmm_v3->lmm_objects); - if (rc) - return rc; - cplen = strlcpy(lsm->lsm_pool_name, lmm_v3->lmm_pool_name, - sizeof(lsm->lsm_pool_name)); - if (cplen >= sizeof(lsm->lsm_pool_name)) - return -E2BIG; - - return 0; + return lsm_unpackmd_v1v3(lov, lsm, lmm, lmm_v3->lmm_pool_name, + lmm_v3->lmm_objects); } -const struct lsm_operations lsm_v3_ops = { - .lsm_free = lsm_free_plain, - .lsm_stripe_by_index = lsm_stripe_by_index_plain, - .lsm_stripe_by_offset = lsm_stripe_by_offset_plain, - .lsm_lmm_verify = lsm_lmm_verify_v3, - .lsm_unpackmd = lsm_unpackmd_v3, +const static struct lsm_operations lsm_v3_ops = { + .lsm_stripe_by_index = lsm_stripe_by_index_plain, + .lsm_stripe_by_offset = lsm_stripe_by_offset_plain, + .lsm_lmm_verify = lsm_lmm_verify_v3, + .lsm_unpackmd = lsm_unpackmd_v3, }; const struct lsm_operations *lsm_op_find(int magic) diff --git a/drivers/staging/lustre/lustre/lov/lov_internal.h b/drivers/staging/lustre/lustre/lov/lov_internal.h index 51f416e..2c416b4 100644 --- a/drivers/staging/lustre/lustre/lov/lov_internal.h +++ b/drivers/staging/lustre/lustre/lov/lov_internal.h @@ -81,7 +81,6 @@ static inline bool lsm_has_objects(struct lov_stripe_md *lsm) } struct lsm_operations { - void (*lsm_free)(struct lov_stripe_md *); void (*lsm_stripe_by_index)(struct lov_stripe_md *, int *, loff_t *, loff_t *); void (*lsm_stripe_by_offset)(struct lov_stripe_md *, int *, loff_t *, @@ -93,6 +92,7 @@ struct lsm_operations { }; const struct lsm_operations *lsm_op_find(int magic); +void lsm_free(struct lov_stripe_md *lsm); /* lov_do_div64(a, b) returns a % b, and a = a / b. * The 32-bit code is LOV-specific due to knowing about stripe limits in @@ -224,7 +224,6 @@ struct lov_stripe_md *lov_unpackmd(struct lov_obd *lov, struct lov_mds_md *lmm, /* lov_ea.c */ struct lov_stripe_md *lsm_alloc_plain(u16 stripe_count); -void lsm_free_plain(struct lov_stripe_md *lsm); void dump_lsm(unsigned int level, const struct lov_stripe_md *lsm); /* lproc_lov.c */ diff --git a/drivers/staging/lustre/lustre/lov/lov_pack.c b/drivers/staging/lustre/lustre/lov/lov_pack.c index 98b114b..02936bf 100644 --- a/drivers/staging/lustre/lustre/lov/lov_pack.c +++ b/drivers/staging/lustre/lustre/lov/lov_pack.c @@ -181,22 +181,6 @@ __u16 lov_get_stripecnt(struct lov_obd *lov, __u32 magic, __u16 stripe_count) return stripe_count; } -static int lov_verify_lmm(void *lmm, int lmm_bytes, __u16 *stripe_count) -{ - int rc; - - if (!lsm_op_find(le32_to_cpu(*(__u32 *)lmm))) { - CERROR("bad disk LOV MAGIC: 0x%08X; dumping LMM (size=%d):\n", - le32_to_cpu(*(__u32 *)lmm), lmm_bytes); - CERROR("%*phN\n", lmm_bytes, lmm); - return -EINVAL; - } - rc = lsm_op_find(le32_to_cpu(*(__u32 *)lmm))->lsm_lmm_verify(lmm, - lmm_bytes, - stripe_count); - return rc; -} - static struct lov_stripe_md *lov_lsm_alloc(u16 stripe_count, u32 pattern, u32 magic) { @@ -237,7 +221,7 @@ int lov_free_memmd(struct lov_stripe_md **lsmp) LASSERT(atomic_read(&lsm->lsm_refc) > 0); refc = atomic_dec_return(&lsm->lsm_refc); if (refc == 0) - lsm_op_find(lsm->lsm_magic)->lsm_free(lsm); + lsm_free(lsm); return refc; } @@ -248,25 +232,29 @@ int lov_free_memmd(struct lov_stripe_md **lsmp) struct lov_stripe_md *lov_unpackmd(struct lov_obd *lov, struct lov_mds_md *lmm, size_t lmm_size) { + const struct lsm_operations *op; struct lov_stripe_md *lsm; u16 stripe_count; u32 pattern; u32 magic; int rc; - rc = lov_verify_lmm(lmm, lmm_size, &stripe_count); + magic = le32_to_cpu(lmm->lmm_magic); + op = lsm_op_find(magic); + if (!op) + return ERR_PTR(-EINVAL); + + rc = op->lsm_lmm_verify(lmm, lmm_size, &stripe_count); if (rc) return ERR_PTR(rc); - magic = le32_to_cpu(lmm->lmm_magic); pattern = le32_to_cpu(lmm->lmm_pattern); lsm = lov_lsm_alloc(stripe_count, pattern, magic); if (IS_ERR(lsm)) return lsm; - LASSERT(lsm_op_find(magic)); - rc = lsm_op_find(magic)->lsm_unpackmd(lov, lsm, lmm); + rc = op->lsm_unpackmd(lov, lsm, lmm); if (rc) { lov_free_memmd(&lsm); return ERR_PTR(rc); -- 1.8.3.1 From jsimmons at infradead.org Sun Jan 6 22:14:01 2019 From: jsimmons at infradead.org (James Simmons) Date: Sun, 6 Jan 2019 17:14:01 -0500 Subject: [lustre-devel] [PATCH v2 06/33] lustre: lov: create struct lov_stripe_md_entry In-Reply-To: <1546812868-11794-1-git-send-email-jsimmons@infradead.org> References: <1546812868-11794-1-git-send-email-jsimmons@infradead.org> Message-ID: <1546812868-11794-7-git-send-email-jsimmons@infradead.org> From: Bobi Jam Create a new struct lov_stripe_md_entry that will be shared with older striping methods and the new PFL handling. Rearrange the code to handle this new data structure. Signed-off-by: John L. Hammond Signed-off-by: Bobi Jam Signed-off-by: Niu Yawei WC-bug-id: https://jira.whamcloud.com/browse/LU-8998 Reviewed-on: https://review.whamcloud.com/24849 Reviewed-by: Jinshan Xiong Reviewed-by: Andreas Dilger Signed-off-by: James Simmons --- drivers/staging/lustre/lustre/include/obd.h | 4 - drivers/staging/lustre/lustre/lov/lov_ea.c | 338 ++++++++++------------- drivers/staging/lustre/lustre/lov/lov_internal.h | 35 ++- drivers/staging/lustre/lustre/lov/lov_io.c | 17 +- drivers/staging/lustre/lustre/lov/lov_merge.c | 4 +- drivers/staging/lustre/lustre/lov/lov_object.c | 80 +++--- drivers/staging/lustre/lustre/lov/lov_offset.c | 8 +- drivers/staging/lustre/lustre/lov/lov_pack.c | 32 +-- 8 files changed, 245 insertions(+), 273 deletions(-) diff --git a/drivers/staging/lustre/lustre/include/obd.h b/drivers/staging/lustre/lustre/include/obd.h index d6a968c..15d9573 100644 --- a/drivers/staging/lustre/lustre/include/obd.h +++ b/drivers/staging/lustre/lustre/include/obd.h @@ -75,10 +75,6 @@ static inline void loi_kms_set(struct lov_oinfo *oinfo, __u64 kms) oinfo->loi_kms_valid = 1; } -static inline void loi_init(struct lov_oinfo *loi) -{ -} - struct lov_stripe_md; struct obd_info; diff --git a/drivers/staging/lustre/lustre/lov/lov_ea.c b/drivers/staging/lustre/lustre/lov/lov_ea.c index 5a01fbb..f794df9 100644 --- a/drivers/staging/lustre/lustre/lov/lov_ea.c +++ b/drivers/staging/lustre/lustre/lov/lov_ea.c @@ -103,114 +103,106 @@ static int lsm_lmm_verify_v1v3(struct lov_mds_md *lmm, size_t lmm_size, return 0; } -void lsm_free(struct lov_stripe_md *lsm) +static void lsme_free(struct lov_stripe_md_entry *lsme) { - __u16 stripe_count = lsm->lsm_stripe_count; - int i; + unsigned int stripe_count = lsme->lsme_stripe_count; + unsigned int i; for (i = 0; i < stripe_count; i++) - kmem_cache_free(lov_oinfo_slab, lsm->lsm_oinfo[i]); - kvfree(lsm); -} - -struct lov_stripe_md *lsm_alloc_plain(u16 stripe_count) -{ - size_t oinfo_ptrs_size, lsm_size; - struct lov_stripe_md *lsm; - struct lov_oinfo *loi; - int i; - - LASSERT(stripe_count <= LOV_MAX_STRIPE_COUNT); - - oinfo_ptrs_size = sizeof(struct lov_oinfo *) * stripe_count; - lsm_size = sizeof(*lsm) + oinfo_ptrs_size; + kmem_cache_free(lov_oinfo_slab, lsme->lsme_oinfo[i]); - lsm = kvzalloc(lsm_size, GFP_NOFS); - if (!lsm) - return NULL; - - for (i = 0; i < stripe_count; i++) { - loi = kmem_cache_zalloc(lov_oinfo_slab, GFP_NOFS); - if (!loi) - goto err; - lsm->lsm_oinfo[i] = loi; - } - lsm->lsm_stripe_count = stripe_count; - return lsm; - -err: - while (--i >= 0) - kmem_cache_free(lov_oinfo_slab, lsm->lsm_oinfo[i]); - kvfree(lsm); - return NULL; + kvfree(lsme); } -static struct lov_stripe_md *lov_lsm_alloc(u16 stripe_count, u32 pattern, - u32 magic) +void lsm_free(struct lov_stripe_md *lsm) { - struct lov_stripe_md *lsm; + unsigned int entry_count = lsm->lsm_entry_count; unsigned int i; - CDEBUG(D_INFO, "alloc lsm, stripe_count %u\n", stripe_count); - - lsm = lsm_alloc_plain(stripe_count); - if (!lsm) { - CERROR("cannot allocate LSM stripe_count %u\n", stripe_count); - return ERR_PTR(-ENOMEM); - } - - atomic_set(&lsm->lsm_refc, 1); - spin_lock_init(&lsm->lsm_lock); - lsm->lsm_magic = magic; - lsm->lsm_stripe_count = stripe_count; - lsm->lsm_maxbytes = LUSTRE_EXT3_STRIPE_MAXBYTES * stripe_count; - lsm->lsm_pattern = pattern; - lsm->lsm_pool_name[0] = '\0'; - lsm->lsm_layout_gen = 0; - if (stripe_count > 0) - lsm->lsm_oinfo[0]->loi_ost_idx = ~0; + for (i = 0; i < entry_count; i++) + lsme_free(lsm->lsm_entries[i]); - for (i = 0; i < stripe_count; i++) - loi_init(lsm->lsm_oinfo[i]); - - return lsm; + kfree(lsm); } -static int lsm_unpackmd_v1v3(struct lov_obd *lov, - struct lov_stripe_md *lsm, - struct lov_mds_md *lmm, - const char *pool_name, - struct lov_ost_data_v1 *objects) +/** + * Unpack a struct lov_mds_md into a struct lov_stripe_md_entry. + * + * The caller should set id and extent. + */ +static struct lov_stripe_md_entry * +lsme_unpack(struct lov_obd *lov, struct lov_mds_md *lmm, size_t buf_size, + const char *pool_name, struct lov_ost_data_v1 *objects, + loff_t *maxbytes) { + struct lov_stripe_md_entry *lsme; loff_t min_stripe_maxbytes = 0; unsigned int stripe_count; - struct lov_oinfo *loi; loff_t lov_bytes; + size_t lsme_size; unsigned int i; + u32 pattern; + u32 magic; + int rc; - /* - * This supposes lov_mds_md_v1/v3 first fields are - * are the same - */ - lmm_oi_le_to_cpu(&lsm->lsm_oi, &lmm->lmm_oi); - lsm->lsm_stripe_size = le32_to_cpu(lmm->lmm_stripe_size); - lsm->lsm_pattern = le32_to_cpu(lmm->lmm_pattern); - lsm->lsm_layout_gen = le16_to_cpu(lmm->lmm_layout_gen); - lsm->lsm_pool_name[0] = '\0'; + magic = le32_to_cpu(lmm->lmm_magic); + if (magic != LOV_MAGIC_V1 && magic != LOV_MAGIC_V3) + return ERR_PTR(-EINVAL); + + pattern = le32_to_cpu(lmm->lmm_pattern); + if (pattern & LOV_PATTERN_F_RELEASED) + stripe_count = 0; + else + stripe_count = le16_to_cpu(lmm->lmm_stripe_count); + + if (buf_size < (magic == LOV_MAGIC_V1 ? sizeof(struct lov_mds_md_v1) : + sizeof(struct lov_mds_md_v3))) { + CERROR("LOV EA %s too small: %zu, need %u\n", + magic == LOV_MAGIC_V1 ? "V1" : "V3", buf_size, + lov_mds_md_size(stripe_count, magic == LOV_MAGIC_V1 ? + LOV_MAGIC_V1 : LOV_MAGIC_V3)); + lov_dump_lmm_common(D_WARNING, lmm); + return ERR_PTR(-EINVAL); + } - stripe_count = lsm_is_released(lsm) ? 0 : lsm->lsm_stripe_count; + rc = lsm_lmm_verify_v1v3(lmm, buf_size, stripe_count); + if (rc < 0) + return ERR_PTR(rc); + + lsme_size = offsetof(typeof(*lsme), lsme_oinfo[stripe_count]); + lsme = kvzalloc(lsme_size, GFP_KERNEL); + if (!lsme) + return ERR_PTR(-ENOMEM); + + lsme->lsme_magic = magic; + lsme->lsme_pattern = pattern; + lsme->lsme_stripe_size = le32_to_cpu(lmm->lmm_stripe_size); + lsme->lsme_stripe_count = stripe_count; + lsme->lsme_layout_gen = le16_to_cpu(lmm->lmm_layout_gen); if (pool_name) { size_t pool_name_len; - pool_name_len = strlcpy(lsm->lsm_pool_name, pool_name, - sizeof(lsm->lsm_pool_name)); - if (pool_name_len >= sizeof(lsm->lsm_pool_name)) - return -E2BIG; + pool_name_len = strlcpy(lsme->lsme_pool_name, pool_name, + sizeof(lsme->lsme_pool_name)); + if (pool_name_len >= sizeof(lsme->lsme_pool_name)) { + rc = -E2BIG; + goto out_lsme; + } } for (i = 0; i < stripe_count; i++) { - loi = lsm->lsm_oinfo[i]; + struct lov_tgt_desc *ltd; + struct lov_oinfo *loi; + + loi = kmem_cache_zalloc(lov_oinfo_slab, GFP_KERNEL); + if (!loi) { + rc = -ENOMEM; + goto out_lsme; + } + + lsme->lsme_oinfo[i] = loi; + ostid_le_to_cpu(&objects[i].l_ost_oi, &loi->loi_oi); loi->loi_ost_idx = le32_to_cpu(objects[i].l_ost_idx); loi->loi_ost_gen = le32_to_cpu(objects[i].l_ost_gen); @@ -223,10 +215,12 @@ static int lsm_unpackmd_v1v3(struct lov_obd *lov, (char *)lov->desc.ld_uuid.uuid, loi->loi_ost_idx, lov->desc.ld_tgt_count); lov_dump_lmm_v1(D_WARNING, lmm); - return -EINVAL; + rc = -EINVAL; + goto out_lsme; } - if (!lov->lov_tgts[loi->loi_ost_idx]) { + ltd = lov->lov_tgts[loi->loi_ost_idx]; + if (!ltd) { CERROR("%s: OST index %d missing\n", (char *)lov->desc.ld_uuid.uuid, loi->loi_ost_idx); @@ -234,7 +228,7 @@ static int lsm_unpackmd_v1v3(struct lov_obd *lov, continue; } - lov_bytes = lov_tgt_maxbytes(lov->lov_tgts[loi->loi_ost_idx]); + lov_bytes = lov_tgt_maxbytes(ltd); if (min_stripe_maxbytes == 0 || lov_bytes < min_stripe_maxbytes) min_stripe_maxbytes = lov_bytes; } @@ -242,15 +236,68 @@ static int lsm_unpackmd_v1v3(struct lov_obd *lov, if (min_stripe_maxbytes == 0) min_stripe_maxbytes = LUSTRE_EXT3_STRIPE_MAXBYTES; - stripe_count = lsm->lsm_stripe_count ?: lov->desc.ld_tgt_count; lov_bytes = min_stripe_maxbytes * stripe_count; - if (lov_bytes < min_stripe_maxbytes) /* handle overflow */ - lsm->lsm_maxbytes = MAX_LFS_FILESIZE; - else - lsm->lsm_maxbytes = lov_bytes; + if (maxbytes) { + if (lov_bytes < min_stripe_maxbytes) /* handle overflow */ + *maxbytes = MAX_LFS_FILESIZE; + else + *maxbytes = lov_bytes; + } - return 0; + return lsme; + +out_lsme: + for (i = 0; i < stripe_count; i++) { + struct lov_oinfo *loi = lsme->lsme_oinfo[i]; + + if (loi) + kmem_cache_free(lov_oinfo_slab, lsme->lsme_oinfo[i]); + } + kvfree(lsme); + + return ERR_PTR(rc); +} + +static inline struct lov_stripe_md * +lsm_unpackmd_v1v3(struct lov_obd *lov, + struct lov_mds_md *lmm, size_t buf_size, + const char *pool_name, + struct lov_ost_data_v1 *objects) +{ + struct lov_stripe_md_entry *lsme; + struct lov_stripe_md *lsm; + size_t lsm_size; + loff_t maxbytes; + u32 pattern; + + pattern = le32_to_cpu(lmm->lmm_pattern); + + lsme = lsme_unpack(lov, lmm, buf_size, pool_name, objects, &maxbytes); + if (IS_ERR(lsme)) + return ERR_CAST(lsme); + + lsme->lsme_extent.e_start = 0; + lsme->lsme_extent.e_end = LUSTRE_EOF; + + lsm_size = offsetof(typeof(*lsm), lsm_entries[1]); + lsm = kzalloc(lsm_size, GFP_KERNEL); + if (!lsm) { + lsme_free(lsme); + return ERR_PTR(-ENOMEM); + } + + atomic_set(&lsm->lsm_refc, 1); + spin_lock_init(&lsm->lsm_lock); + lsm->lsm_maxbytes = maxbytes; + lmm_oi_le_to_cpu(&lsm->lsm_oi, &lmm->lmm_oi); + lsm->lsm_magic = le32_to_cpu(lmm->lmm_magic); + lsm->lsm_layout_gen = le16_to_cpu(lmm->lmm_layout_gen); + lsm->lsm_entry_count = 1; + lsm->lsm_is_released = pattern & LOV_PATTERN_F_RELEASED; + lsm->lsm_entries[0] = lsme; + + return lsm; } static void @@ -258,7 +305,8 @@ static int lsm_unpackmd_v1v3(struct lov_obd *lov, loff_t *lov_off, loff_t *swidth) { if (swidth) - *swidth = (u64)lsm->lsm_stripe_size * lsm->lsm_stripe_count; + *swidth = (loff_t)lsm->lsm_entries[0]->lsme_stripe_size * + lsm->lsm_entries[0]->lsme_stripe_count; } static void @@ -266,59 +314,16 @@ static int lsm_unpackmd_v1v3(struct lov_obd *lov, loff_t *lov_off, loff_t *swidth) { if (swidth) - *swidth = (u64)lsm->lsm_stripe_size * lsm->lsm_stripe_count; -} - -static int lsm_lmm_verify_v1(struct lov_mds_md_v1 *lmm, size_t lmm_bytes, - __u16 *stripe_count) -{ - if (lmm_bytes < sizeof(*lmm)) { - CERROR("lov_mds_md_v1 too small: %zu, need at least %zu\n", - lmm_bytes, sizeof(*lmm)); - return -EINVAL; - } - - *stripe_count = le16_to_cpu(lmm->lmm_stripe_count); - if (le32_to_cpu(lmm->lmm_pattern) & LOV_PATTERN_F_RELEASED) - *stripe_count = 0; - - if (lmm_bytes < lov_mds_md_size(*stripe_count, LOV_MAGIC_V1)) { - CERROR("LOV EA V1 too small: %zu, need %d\n", - lmm_bytes, lov_mds_md_size(*stripe_count, LOV_MAGIC_V1)); - lov_dump_lmm_common(D_WARNING, lmm); - return -EINVAL; - } - - return lsm_lmm_verify_v1v3(lmm, lmm_bytes, *stripe_count); + *swidth = (loff_t)lsm->lsm_entries[0]->lsme_stripe_size * + lsm->lsm_entries[0]->lsme_stripe_count; } static struct lov_stripe_md * lsm_unpackmd_v1(struct lov_obd *lov, void *buf, size_t buf_size) { struct lov_mds_md_v1 *lmm = buf; - u32 magic = le32_to_cpu(lmm->lmm_magic); - struct lov_stripe_md *lsm; - u16 stripe_count; - u32 pattern; - int rc; - rc = lsm_lmm_verify_v1(lmm, buf_size, &stripe_count); - if (rc) - return ERR_PTR(rc); - - pattern = le32_to_cpu(lmm->lmm_pattern); - - lsm = lov_lsm_alloc(stripe_count, pattern, magic); - if (IS_ERR(lsm)) - return lsm; - - rc = lsm_unpackmd_v1v3(lov, lsm, lmm, NULL, lmm->lmm_objects); - if (rc) { - lov_free_memmd(&lsm); - lsm = ERR_PTR(rc); - } - - return lsm; + return lsm_unpackmd_v1v3(lov, buf, buf_size, NULL, lmm->lmm_objects); } const static struct lsm_operations lsm_v1_ops = { @@ -327,58 +332,13 @@ static int lsm_lmm_verify_v1(struct lov_mds_md_v1 *lmm, size_t lmm_bytes, .lsm_unpackmd = lsm_unpackmd_v1, }; -static int lsm_lmm_verify_v3(struct lov_mds_md_v3 *lmm, size_t lmm_bytes, - __u16 *stripe_count) -{ - if (lmm_bytes < sizeof(*lmm)) { - CERROR("lov_mds_md_v3 too small: %zu, need at least %zu\n", - lmm_bytes, sizeof(*lmm)); - return -EINVAL; - } - - *stripe_count = le16_to_cpu(lmm->lmm_stripe_count); - if (le32_to_cpu(lmm->lmm_pattern) & LOV_PATTERN_F_RELEASED) - *stripe_count = 0; - - if (lmm_bytes < lov_mds_md_size(*stripe_count, LOV_MAGIC_V3)) { - CERROR("LOV EA V3 too small: %zu, need %d\n", - lmm_bytes, lov_mds_md_size(*stripe_count, LOV_MAGIC_V3)); - lov_dump_lmm_common(D_WARNING, lmm); - return -EINVAL; - } - - return lsm_lmm_verify_v1v3((struct lov_mds_md_v1 *)lmm, lmm_bytes, - *stripe_count); -} - static struct lov_stripe_md * lsm_unpackmd_v3(struct lov_obd *lov, void *buf, size_t buf_size) { struct lov_mds_md_v3 *lmm = buf; - u32 magic = le32_to_cpu(lmm->lmm_magic); - struct lov_stripe_md *lsm; - u16 stripe_count; - u32 pattern; - int rc; - - rc = lsm_lmm_verify_v3(lmm, buf_size, &stripe_count); - if (rc) - return ERR_PTR(rc); - - pattern = le32_to_cpu(lmm->lmm_pattern); - - lsm = lov_lsm_alloc(stripe_count, pattern, magic); - if (IS_ERR(lsm)) - return lsm; - rc = lsm_unpackmd_v1v3(lov, lsm, (struct lov_mds_md_v1 *)lmm, - lmm->lmm_pool_name, lmm->lmm_objects); - if (rc) { - lov_free_memmd(&lsm); - lsm = ERR_PTR(rc); - } - - return lsm; + return lsm_unpackmd_v1v3(lov, buf, buf_size, lmm->lmm_pool_name, + lmm->lmm_objects); } const static struct lsm_operations lsm_v3_ops = { @@ -403,9 +363,9 @@ const struct lsm_operations *lsm_op_find(int magic) void dump_lsm(unsigned int level, const struct lov_stripe_md *lsm) { CDEBUG(level, "lsm %p, objid " DOSTID ", maxbytes %#llx, magic 0x%08X, stripe_size %u, stripe_count %u, refc: %d, layout_gen %u, pool [" LOV_POOLNAMEF "]\n", - lsm, - POSTID(&lsm->lsm_oi), lsm->lsm_maxbytes, lsm->lsm_magic, - lsm->lsm_stripe_size, lsm->lsm_stripe_count, + lsm, POSTID(&lsm->lsm_oi), lsm->lsm_maxbytes, lsm->lsm_magic, + lsm->lsm_entries[0]->lsme_stripe_size, + lsm->lsm_entries[0]->lsme_stripe_count, atomic_read(&lsm->lsm_refc), lsm->lsm_layout_gen, - lsm->lsm_pool_name); + lsm->lsm_entries[0]->lsme_pool_name); } diff --git a/drivers/staging/lustre/lustre/lov/lov_internal.h b/drivers/staging/lustre/lustre/lov/lov_internal.h index ae122f6..f2747c9 100644 --- a/drivers/staging/lustre/lustre/lov/lov_internal.h +++ b/drivers/staging/lustre/lustre/lov/lov_internal.h @@ -44,6 +44,18 @@ */ #define LUSTRE_EXT3_STRIPE_MAXBYTES 0x1fffffff000ULL +struct lov_stripe_md_entry { + struct lu_extent lsme_extent; + u32 lsme_id; + u32 lsme_magic; + u32 lsme_pattern; + u32 lsme_stripe_size; + u16 lsme_stripe_count; + u16 lsme_layout_gen; + char lsme_pool_name[LOV_MAXPOOLNAME + 1]; + struct lov_oinfo *lsme_oinfo[]; +}; + struct lov_stripe_md { atomic_t lsm_refc; spinlock_t lsm_lock; @@ -56,28 +68,15 @@ struct lov_stripe_md { loff_t lsm_maxbytes; struct ost_id lsm_oi; u32 lsm_magic; - u32 lsm_stripe_size; - u32 lsm_pattern; /* RAID0, RAID1, released, ... */ - u16 lsm_stripe_count; - u16 lsm_layout_gen; - char lsm_pool_name[LOV_MAXPOOLNAME + 1]; - struct lov_oinfo *lsm_oinfo[0]; + u32 lsm_layout_gen; + u32 lsm_entry_count; + bool lsm_is_released; + struct lov_stripe_md_entry *lsm_entries[]; }; -static inline bool lsm_is_released(struct lov_stripe_md *lsm) -{ - return !!(lsm->lsm_pattern & LOV_PATTERN_F_RELEASED); -} - static inline bool lsm_has_objects(struct lov_stripe_md *lsm) { - if (!lsm) - return false; - - if (lsm_is_released(lsm)) - return false; - - return true; + return lsm && !lsm->lsm_is_released; } struct lsm_operations { diff --git a/drivers/staging/lustre/lustre/lov/lov_io.c b/drivers/staging/lustre/lustre/lov/lov_io.c index 6537ba3..2d62566 100644 --- a/drivers/staging/lustre/lustre/lov/lov_io.c +++ b/drivers/staging/lustre/lustre/lov/lov_io.c @@ -251,10 +251,9 @@ static int lov_io_subio_init(const struct lu_env *env, struct lov_io *lio, * Need to be optimized, we can't afford to allocate a piece of memory * when writing a page. -jay */ - lio->lis_subs = - kvzalloc(lsm->lsm_stripe_count * + lio->lis_subs = kcalloc(lsm->lsm_entries[0]->lsme_stripe_count, sizeof(lio->lis_subs[0]), - GFP_NOFS); + GFP_KERNEL); if (lio->lis_subs) { lio->lis_nr_subios = lio->lis_stripe_count; lio->lis_single_subio_index = -1; @@ -272,7 +271,7 @@ static int lov_io_slice_init(struct lov_io *lio, struct lov_object *obj, io->ci_result = 0; lio->lis_object = obj; - lio->lis_stripe_count = obj->lo_lsm->lsm_stripe_count; + lio->lis_stripe_count = obj->lo_lsm->lsm_entries[0]->lsme_stripe_count; switch (io->ci_type) { case CIT_READ: @@ -287,7 +286,7 @@ static int lov_io_slice_init(struct lov_io *lio, struct lov_object *obj, * If there is LOV EA hole, then we may cannot locate * the current file-tail exactly. */ - if (unlikely(obj->lo_lsm->lsm_pattern & + if (unlikely(obj->lo_lsm->lsm_entries[0]->lsme_pattern & LOV_PATTERN_F_HOLE)) return -EIO; @@ -419,9 +418,9 @@ static int lov_io_rw_iter_init(const struct lu_env *env, struct lov_io *lio = cl2lov_io(env, ios); struct cl_io *io = ios->cis_io; struct lov_stripe_md *lsm = lio->lis_object->lo_lsm; - __u64 start = io->u.ci_rw.crw_pos; + unsigned long ssize = lsm->lsm_entries[0]->lsme_stripe_size; + u64 start = io->u.ci_rw.crw_pos; loff_t next; - unsigned long ssize = lsm->lsm_stripe_size; LASSERT(io->ci_type == CIT_READ || io->ci_type == CIT_WRITE); @@ -596,11 +595,11 @@ static int lov_io_read_ahead(const struct lu_env *env, if (ra_end != CL_PAGE_EOF) ra_end = lov_stripe_pgoff(loo->lo_lsm, ra_end, stripe); - pps = loo->lo_lsm->lsm_stripe_size >> PAGE_SHIFT; + pps = loo->lo_lsm->lsm_entries[0]->lsme_stripe_size >> PAGE_SHIFT; CDEBUG(D_READA, DFID " max_index = %lu, pps = %u, stripe_size = %u, stripe no = %u, start index = %lu\n", PFID(lu_object_fid(lov2lu(loo))), ra_end, pps, - loo->lo_lsm->lsm_stripe_size, stripe, start); + loo->lo_lsm->lsm_entries[0]->lsme_stripe_size, stripe, start); /* never exceed the end of the stripe */ ra->cra_end = min_t(pgoff_t, ra_end, start + pps - start % pps - 1); diff --git a/drivers/staging/lustre/lustre/lov/lov_merge.c b/drivers/staging/lustre/lustre/lov/lov_merge.c index 006717c..10b8448 100644 --- a/drivers/staging/lustre/lustre/lov/lov_merge.c +++ b/drivers/staging/lustre/lustre/lov/lov_merge.c @@ -59,8 +59,8 @@ int lov_merge_lvb_kms(struct lov_stripe_md *lsm, CDEBUG(D_INODE, "MDT ID " DOSTID " initial value: s=%llu m=%llu a=%llu c=%llu b=%llu\n", POSTID(&lsm->lsm_oi), lvb->lvb_size, lvb->lvb_mtime, lvb->lvb_atime, lvb->lvb_ctime, lvb->lvb_blocks); - for (i = 0; i < lsm->lsm_stripe_count; i++) { - struct lov_oinfo *loi = lsm->lsm_oinfo[i]; + for (i = 0; i < lsm->lsm_entries[0]->lsme_stripe_count; i++) { + struct lov_oinfo *loi = lsm->lsm_entries[0]->lsme_oinfo[i]; u64 lov_size, tmpsize; if (OST_LVB_IS_ERR(loi->loi_lvb.lvb_blocks)) { diff --git a/drivers/staging/lustre/lustre/lov/lov_object.c b/drivers/staging/lustre/lustre/lov/lov_object.c index adc90f3..ad2901a 100644 --- a/drivers/staging/lustre/lustre/lov/lov_object.c +++ b/drivers/staging/lustre/lustre/lov/lov_object.c @@ -153,7 +153,7 @@ static int lov_init_sub(const struct lu_env *env, struct lov_object *lov, hdr = cl_object_header(lov2cl(lov)); subhdr = cl_object_header(stripe); - oinfo = lov->lo_lsm->lsm_oinfo[idx]; + oinfo = lov->lo_lsm->lsm_entries[0]->lsme_oinfo[idx]; CDEBUG(D_INODE, DFID "@%p[%d] -> " DFID "@%p: ostid: " DOSTID " idx: %d gen: %d\n", PFID(&subhdr->coh_lu.loh_fid), subhdr, idx, PFID(&hdr->coh_lu.loh_fid), hdr, POSTID(&oinfo->loi_oi), @@ -239,7 +239,7 @@ static int lov_init_raid0(const struct lu_env *env, struct lov_device *dev, LASSERT(!lov->lo_lsm); lov->lo_lsm = lsm_addref(lsm); lov->lo_layout_invalid = true; - r0->lo_nr = lsm->lsm_stripe_count; + r0->lo_nr = lsm->lsm_entries[0]->lsme_stripe_count; LASSERT(r0->lo_nr <= lov_targets_nr(dev)); r0->lo_sub = kvzalloc(r0->lo_nr * sizeof(r0->lo_sub[0]), @@ -255,9 +255,10 @@ static int lov_init_raid0(const struct lu_env *env, struct lov_device *dev, */ for (i = 0; i < r0->lo_nr && result == 0; ++i) { struct cl_device *subdev; - struct lov_oinfo *oinfo = lsm->lsm_oinfo[i]; - int ost_idx = oinfo->loi_ost_idx; + struct lov_oinfo *oinfo; + int ost_idx; + oinfo = lsm->lsm_entries[0]->lsme_oinfo[i]; if (lov_oinfo_is_dummy(oinfo)) continue; @@ -266,6 +267,7 @@ static int lov_init_raid0(const struct lu_env *env, struct lov_device *dev, if (result != 0) goto out; + ost_idx = oinfo->loi_ost_idx; if (!dev->ld_target[ost_idx]) { CERROR("%s: OST %04x is not initialized\n", lov2obd(dev->ld_lov)->obd_name, ost_idx); @@ -314,7 +316,7 @@ static int lov_init_released(const struct lu_env *env, struct lov_device *dev, union lov_layout_state *state) { LASSERT(lsm); - LASSERT(lsm_is_released(lsm)); + LASSERT(lsm->lsm_is_released); LASSERT(!lov->lo_lsm); lov->lo_lsm = lsm_addref(lsm); @@ -327,7 +329,7 @@ static struct cl_object *lov_find_subobj(const struct lu_env *env, int stripe_idx) { struct lov_device *dev = lu2lov_dev(lov2lu(lov)->lo_dev); - struct lov_oinfo *oinfo = lsm->lsm_oinfo[stripe_idx]; + struct lov_oinfo *oinfo = lsm->lsm_entries[0]->lsme_oinfo[stripe_idx]; struct lov_thread_info *lti = lov_env_info(env); struct lu_fid *ofid = <i->lti_fid; struct cl_device *subdev; @@ -485,7 +487,7 @@ static int lov_print_raid0(const struct lu_env *env, void *cookie, (*p)(env, cookie, "stripes: %d, %s, lsm{%p 0x%08X %d %u %u}:\n", r0->lo_nr, lov->lo_layout_invalid ? "invalid" : "valid", lsm, lsm->lsm_magic, atomic_read(&lsm->lsm_refc), - lsm->lsm_stripe_count, lsm->lsm_layout_gen); + lsm->lsm_entries[0]->lsme_stripe_count, lsm->lsm_layout_gen); for (i = 0; i < r0->lo_nr; ++i) { struct lu_object *sub; @@ -509,7 +511,7 @@ static int lov_print_released(const struct lu_env *env, void *cookie, "released: %s, lsm{%p 0x%08X %d %u %u}:\n", lov->lo_layout_invalid ? "invalid" : "valid", lsm, lsm->lsm_magic, atomic_read(&lsm->lsm_refc), - lsm->lsm_stripe_count, lsm->lsm_layout_gen); + lsm->lsm_entries[0]->lsme_stripe_count, lsm->lsm_layout_gen); return 0; } @@ -650,8 +652,13 @@ static enum lov_layout_type lov_type(struct lov_stripe_md *lsm) { if (!lsm) return LLT_EMPTY; - if (lsm_is_released(lsm)) + + if (lsm->lsm_magic == LOV_MAGIC_COMP_V1) + return LLT_EMPTY; + + if (lsm->lsm_is_released) return LLT_RELEASED; + return LLT_RAID0; } @@ -882,7 +889,8 @@ static int lov_conf_set(const struct lu_env *env, struct cl_object *obj, if ((!lsm && !lov->lo_lsm) || ((lsm && lov->lo_lsm) && (lov->lo_lsm->lsm_layout_gen == lsm->lsm_layout_gen) && - (lov->lo_lsm->lsm_pattern == lsm->lsm_pattern))) { + (lov->lo_lsm->lsm_entries[0]->lsme_pattern == + lsm->lsm_entries[0]->lsme_pattern))) { /* same version of layout */ lov->lo_layout_invalid = false; result = 0; @@ -1010,19 +1018,24 @@ static int fiemap_calc_last_stripe(struct lov_stripe_md *lsm, u64 obd_end; int i, j; - if (fm_end - fm_start > lsm->lsm_stripe_size * lsm->lsm_stripe_count) { - last_stripe = (start_stripe < 1 ? lsm->lsm_stripe_count - 1 : + if (fm_end - fm_start > lsm->lsm_entries[0]->lsme_stripe_size * + lsm->lsm_entries[0]->lsme_stripe_count) { + last_stripe = (start_stripe < 1 ? + lsm->lsm_entries[0]->lsme_stripe_count - 1 : start_stripe - 1); - *stripe_count = lsm->lsm_stripe_count; + *stripe_count = lsm->lsm_entries[0]->lsme_stripe_count; } else { - for (j = 0, i = start_stripe; j < lsm->lsm_stripe_count; - i = (i + 1) % lsm->lsm_stripe_count, j++) { - if (!(lov_stripe_intersects(lsm, i, fm_start, fm_end, - &obd_start, &obd_end))) + for (j = 0, i = start_stripe; + j < lsm->lsm_entries[0]->lsme_stripe_count; + i = (i + 1) % lsm->lsm_entries[0]->lsme_stripe_count, + j++) { + if (lov_stripe_intersects(lsm, i, fm_start, fm_end, + &obd_start, &obd_end) == 0) break; } *stripe_count = j; - last_stripe = (start_stripe + j - 1) % lsm->lsm_stripe_count; + last_stripe = (start_stripe + j - 1) % + lsm->lsm_entries[0]->lsme_stripe_count; } return last_stripe; @@ -1090,8 +1103,8 @@ static u64 fiemap_calc_fm_end_offset(struct fiemap *fiemap, return 0; /* Find out stripe_no from ost_index saved in the fe_device */ - for (i = 0; i < lsm->lsm_stripe_count; i++) { - struct lov_oinfo *oinfo = lsm->lsm_oinfo[i]; + for (i = 0; i < lsm->lsm_entries[0]->lsme_stripe_count; i++) { + struct lov_oinfo *oinfo = lsm->lsm_entries[0]->lsme_oinfo[i]; if (lov_oinfo_is_dummy(oinfo)) continue; @@ -1110,7 +1123,7 @@ static u64 fiemap_calc_fm_end_offset(struct fiemap *fiemap, * offset to start of next device */ if (lov_stripe_intersects(lsm, stripe_no, fm_start, fm_end, - &lun_start, &lun_end) && + &lun_start, &lun_end) != 0 && local_end < lun_end) { fm_end_offset = local_end; *start_stripe = stripe_no; @@ -1119,7 +1132,8 @@ static u64 fiemap_calc_fm_end_offset(struct fiemap *fiemap, * calculate offset in next stripe. */ fm_end_offset = 0; - *start_stripe = (stripe_no + 1) % lsm->lsm_stripe_count; + *start_stripe = (stripe_no + 1) % + lsm->lsm_entries[0]->lsme_stripe_count; } return fm_end_offset; @@ -1168,7 +1182,7 @@ static int fiemap_for_stripe(const struct lu_env *env, struct cl_object *obj, &lun_start, &obd_object_end)) == 0) return 0; - if (lov_oinfo_is_dummy(lsm->lsm_oinfo[stripeno])) + if (lov_oinfo_is_dummy(lsm->lsm_entries[0]->lsme_oinfo[stripeno])) return -EIO; /* If this is a continuation FIEMAP call and we are on @@ -1218,7 +1232,7 @@ static int fiemap_for_stripe(const struct lu_env *env, struct cl_object *obj, fs->fs_fm->fm_mapped_extents = 0; fs->fs_fm->fm_flags = fiemap->fm_flags; - ost_index = lsm->lsm_oinfo[stripeno]->loi_ost_idx; + ost_index = lsm->lsm_entries[0]->lsme_oinfo[stripeno]->loi_ost_idx; if (ost_index < 0 || ost_index >= lov->desc.ld_tgt_count) { rc = -EINVAL; @@ -1347,13 +1361,13 @@ static int lov_object_fiemap(const struct lu_env *env, struct cl_object *obj, * If the stripe_count > 1 and the application does not understand * DEVICE_ORDER flag, it cannot interpret the extents correctly. */ - if (lsm->lsm_stripe_count > 1 && + if (lsm->lsm_entries[0]->lsme_stripe_count > 1 && !(fiemap->fm_flags & FIEMAP_FLAG_DEVICE_ORDER)) { rc = -ENOTSUPP; goto out; } - if (lsm_is_released(lsm)) { + if (lsm->lsm_is_released) { if (fiemap->fm_start < fmkey->lfik_oa.o_size) { /** * released file, return a minimal FIEMAP if @@ -1431,7 +1445,8 @@ static int lov_object_fiemap(const struct lu_env *env, struct cl_object *obj, /* Check each stripe */ for (cur_stripe = fs.fs_start_stripe; stripe_count > 0; --stripe_count, - cur_stripe = (cur_stripe + 1) % lsm->lsm_stripe_count) { + cur_stripe = (cur_stripe + 1) % + lsm->lsm_entries[0]->lsme_stripe_count) { rc = fiemap_for_stripe(env, obj, lsm, fiemap, buflen, fmkey, cur_stripe, &fs); if (rc < 0) @@ -1443,7 +1458,7 @@ static int lov_object_fiemap(const struct lu_env *env, struct cl_object *obj, * Indicate that we are returning device offsets unless file just has * single stripe */ - if (lsm->lsm_stripe_count > 1) + if (lsm->lsm_entries[0]->lsme_stripe_count > 1) fiemap->fm_flags |= FIEMAP_FLAG_DEVICE_ORDER; if (!fiemap->fm_extent_count) @@ -1495,7 +1510,8 @@ static int lov_object_layout_get(const struct lu_env *env, return 0; } - cl->cl_size = lov_mds_md_size(lsm->lsm_stripe_count, lsm->lsm_magic); + cl->cl_size = lov_mds_md_size(lsm->lsm_entries[0]->lsme_stripe_count, + lsm->lsm_magic); cl->cl_layout_gen = lsm->lsm_layout_gen; rc = lov_lsm_pack(lsm, buf->lb_buf, buf->lb_len); @@ -1599,9 +1615,11 @@ int lov_read_and_clear_async_rc(struct cl_object *clob) int i; lsm = lov->lo_lsm; - for (i = 0; i < lsm->lsm_stripe_count; i++) { - struct lov_oinfo *loi = lsm->lsm_oinfo[i]; + for (i = 0; i < lsm->lsm_entries[0]->lsme_stripe_count; + i++) { + struct lov_oinfo *loi; + loi = lsm->lsm_entries[0]->lsme_oinfo[i]; if (lov_oinfo_is_dummy(loi)) continue; diff --git a/drivers/staging/lustre/lustre/lov/lov_offset.c b/drivers/staging/lustre/lustre/lov/lov_offset.c index a5f00f6..19a44d3 100644 --- a/drivers/staging/lustre/lustre/lov/lov_offset.c +++ b/drivers/staging/lustre/lustre/lov/lov_offset.c @@ -40,7 +40,7 @@ /* compute object size given "stripeno" and the ost size */ u64 lov_stripe_size(struct lov_stripe_md *lsm, u64 ost_size, int stripeno) { - unsigned long ssize = lsm->lsm_stripe_size; + unsigned long ssize = lsm->lsm_entries[0]->lsme_stripe_size; unsigned long stripe_size; u64 swidth; u64 lov_size; @@ -125,7 +125,7 @@ pgoff_t lov_stripe_pgoff(struct lov_stripe_md *lsm, pgoff_t stripe_index, int lov_stripe_offset(struct lov_stripe_md *lsm, u64 lov_off, int stripeno, u64 *obdoff) { - unsigned long ssize = lsm->lsm_stripe_size; + unsigned long ssize = lsm->lsm_entries[0]->lsme_stripe_size; u64 stripe_off, this_stripe, swidth; int magic = lsm->lsm_magic; int ret = 0; @@ -180,7 +180,7 @@ int lov_stripe_offset(struct lov_stripe_md *lsm, u64 lov_off, u64 lov_size_to_stripe(struct lov_stripe_md *lsm, u64 file_size, int stripeno) { - unsigned long ssize = lsm->lsm_stripe_size; + unsigned long ssize = lsm->lsm_entries[0]->lsme_stripe_size; u64 stripe_off, this_stripe, swidth; int magic = lsm->lsm_magic; @@ -254,7 +254,7 @@ int lov_stripe_intersects(struct lov_stripe_md *lsm, int stripeno, /* compute which stripe number "lov_off" will be written into */ int lov_stripe_number(struct lov_stripe_md *lsm, u64 lov_off) { - unsigned long ssize = lsm->lsm_stripe_size; + unsigned long ssize = lsm->lsm_entries[0]->lsme_stripe_size; u64 stripe_off, swidth; int magic = lsm->lsm_magic; diff --git a/drivers/staging/lustre/lustre/lov/lov_pack.c b/drivers/staging/lustre/lustre/lov/lov_pack.c index 90f9f2d..3700937 100644 --- a/drivers/staging/lustre/lustre/lov/lov_pack.c +++ b/drivers/staging/lustre/lustre/lov/lov_pack.c @@ -116,7 +116,8 @@ ssize_t lov_lsm_pack(const struct lov_stripe_md *lsm, void *buf, size_t lmm_size; unsigned int i; - lmm_size = lov_mds_md_size(lsm->lsm_stripe_count, lsm->lsm_magic); + lmm_size = lov_mds_md_size(lsm->lsm_entries[0]->lsme_stripe_count, + lsm->lsm_magic); if (!buf_size) return lmm_size; @@ -129,23 +130,24 @@ ssize_t lov_lsm_pack(const struct lov_stripe_md *lsm, void *buf, */ lmmv1->lmm_magic = cpu_to_le32(lsm->lsm_magic); lmm_oi_cpu_to_le(&lmmv1->lmm_oi, &lsm->lsm_oi); - lmmv1->lmm_stripe_size = cpu_to_le32(lsm->lsm_stripe_size); - lmmv1->lmm_stripe_count = cpu_to_le16(lsm->lsm_stripe_count); - lmmv1->lmm_pattern = cpu_to_le32(lsm->lsm_pattern); + lmmv1->lmm_stripe_size = cpu_to_le32(lsm->lsm_entries[0]->lsme_stripe_size); + lmmv1->lmm_stripe_count = cpu_to_le16(lsm->lsm_entries[0]->lsme_stripe_count); + lmmv1->lmm_pattern = cpu_to_le32(lsm->lsm_entries[0]->lsme_pattern); lmmv1->lmm_layout_gen = cpu_to_le16(lsm->lsm_layout_gen); if (lsm->lsm_magic == LOV_MAGIC_V3) { - BUILD_BUG_ON(sizeof(lsm->lsm_pool_name) != - sizeof(lmmv3->lmm_pool_name)); - strlcpy(lmmv3->lmm_pool_name, lsm->lsm_pool_name, + BUILD_BUG_ON(sizeof(lsm->lsm_entries[0]->lsme_pool_name) != + sizeof(lmmv3->lmm_pool_name)); + strlcpy(lmmv3->lmm_pool_name, + lsm->lsm_entries[0]->lsme_pool_name, sizeof(lmmv3->lmm_pool_name)); lmm_objects = lmmv3->lmm_objects; } else { lmm_objects = lmmv1->lmm_objects; } - for (i = 0; i < lsm->lsm_stripe_count; i++) { - struct lov_oinfo *loi = lsm->lsm_oinfo[i]; + for (i = 0; i < lsm->lsm_entries[0]->lsme_stripe_count; i++) { + struct lov_oinfo *loi = lsm->lsm_entries[0]->lsme_oinfo[i]; ostid_cpu_to_le(&loi->loi_oi, &lmm_objects[i].l_ost_oi); lmm_objects[i].l_ost_gen = cpu_to_le32(loi->loi_ost_gen); @@ -240,8 +242,8 @@ int lov_getstripe(struct lov_object *obj, struct lov_stripe_md *lsm, goto out; } - if (!lsm_is_released(lsm)) - stripe_count = lsm->lsm_stripe_count; + if (!lsm->lsm_is_released) + stripe_count = lsm->lsm_entries[0]->lsme_stripe_count; else stripe_count = 0; @@ -260,18 +262,16 @@ int lov_getstripe(struct lov_object *obj, struct lov_stripe_md *lsm, goto out; } - if (lum.lmm_stripe_count && - (lum.lmm_stripe_count < lsm->lsm_stripe_count)) { + if (lum.lmm_stripe_count && lum.lmm_stripe_count < stripe_count) { /* Return right size of stripe to user */ lum.lmm_stripe_count = stripe_count; rc = copy_to_user(lump, &lum, lum_size); rc = -EOVERFLOW; goto out; } - lmmk_size = lov_mds_md_size(stripe_count, lsm->lsm_magic); - - lmmk = kvzalloc(lmmk_size, GFP_NOFS); + lmmk_size = lov_mds_md_size(stripe_count, lsm->lsm_magic); + lmmk = kvzalloc(lmmk_size, GFP_KERNEL); if (!lmmk) { rc = -ENOMEM; goto out; -- 1.8.3.1 From jsimmons at infradead.org Sun Jan 6 22:14:06 2019 From: jsimmons at infradead.org (James Simmons) Date: Sun, 6 Jan 2019 17:14:06 -0500 Subject: [lustre-devel] [PATCH v2 11/33] lustre: lov: change lo_entries to array. In-Reply-To: <1546812868-11794-1-git-send-email-jsimmons@infradead.org> References: <1546812868-11794-1-git-send-email-jsimmons@infradead.org> Message-ID: <1546812868-11794-12-git-send-email-jsimmons@infradead.org> From: Bobi Jam Old style striping is equal to a single component. To support PFL we need to change lo_entries to an array. Signed-off-by: Jinshan Xiong Signed-off-by: Bobi Jam Signed-off-by: Niu Yawei WC-bug-id: https://jira.whamcloud.com/browse/LU-8998 Reviewed-on: https://review.whamcloud.com/24850 Reviewed-by: Lai Siyao Signed-off-by: James Simmons --- .../staging/lustre/lustre/lov/lov_cl_internal.h | 14 +- drivers/staging/lustre/lustre/lov/lov_internal.h | 20 +-- drivers/staging/lustre/lustre/lov/lov_io.c | 27 ++-- drivers/staging/lustre/lustre/lov/lov_lock.c | 13 +- drivers/staging/lustre/lustre/lov/lov_merge.c | 6 +- drivers/staging/lustre/lustre/lov/lov_object.c | 149 ++++++++++++--------- drivers/staging/lustre/lustre/lov/lov_offset.c | 30 +++-- drivers/staging/lustre/lustre/lov/lov_page.c | 11 +- drivers/staging/lustre/lustre/lov/lovsub_object.c | 5 +- 9 files changed, 158 insertions(+), 117 deletions(-) diff --git a/drivers/staging/lustre/lustre/lov/lov_cl_internal.h b/drivers/staging/lustre/lustre/lov/lov_cl_internal.h index c44c937..99bd1c1 100644 --- a/drivers/staging/lustre/lustre/lov/lov_cl_internal.h +++ b/drivers/staging/lustre/lustre/lov/lov_cl_internal.h @@ -219,9 +219,13 @@ struct lov_object { struct lov_layout_state_released { } released; struct lov_layout_composite { + /** + * Current valid entry count of lo_entries. + */ + unsigned int lo_entry_count; struct lov_layout_entry { struct lov_layout_raid0 lle_raid0; - } lo_entries; + } *lo_entries; } composite; } u; /** @@ -628,13 +632,13 @@ static inline struct lov_thread_info *lov_env_info(const struct lu_env *env) return info; } -static inline struct lov_layout_raid0 *lov_r0(struct lov_object *lov) +static inline struct lov_layout_raid0 *lov_r0(struct lov_object *lov, int i) { LASSERT(lov->lo_type == LLT_COMP); - LASSERT(lov->lo_lsm->lsm_magic == LOV_MAGIC || - lov->lo_lsm->lsm_magic == LOV_MAGIC_V3); + LASSERTF(i < lov->u.composite.lo_entry_count, + "entry %d entry_count %d", i, lov->u.composite.lo_entry_count); - return &lov->u.composite.lo_entries.lle_raid0; + return &lov->u.composite.lo_entries[i].lle_raid0; } /* lov_pack.c */ diff --git a/drivers/staging/lustre/lustre/lov/lov_internal.h b/drivers/staging/lustre/lustre/lov/lov_internal.h index f2747c9..4c9e324 100644 --- a/drivers/staging/lustre/lustre/lov/lov_internal.h +++ b/drivers/staging/lustre/lustre/lov/lov_internal.h @@ -169,20 +169,22 @@ struct lov_request_set { (char *)((lv)->lov_tgts[index]->ltd_uuid.uuid) /* lov_merge.c */ -int lov_merge_lvb_kms(struct lov_stripe_md *lsm, +int lov_merge_lvb_kms(struct lov_stripe_md *lsm, int index, struct ost_lvb *lvb, __u64 *kms_place); /* lov_offset.c */ -u64 lov_stripe_size(struct lov_stripe_md *lsm, u64 ost_size, int stripeno); -int lov_stripe_offset(struct lov_stripe_md *lsm, u64 lov_off, - int stripeno, u64 *u64); -u64 lov_size_to_stripe(struct lov_stripe_md *lsm, u64 file_size, int stripeno); -int lov_stripe_intersects(struct lov_stripe_md *lsm, int stripeno, +u64 lov_stripe_size(struct lov_stripe_md *lsm, int index, u64 ost_size, + int stripeno); +int lov_stripe_offset(struct lov_stripe_md *lsm, int index, u64 lov_off, + int stripeno, u64 *obd_off); +u64 lov_size_to_stripe(struct lov_stripe_md *lsm, int index, u64 file_size, + int stripeno); +int lov_stripe_intersects(struct lov_stripe_md *lsm, int index, int stripeno, u64 start, u64 end, u64 *obd_start, u64 *obd_end); -int lov_stripe_number(struct lov_stripe_md *lsm, u64 lov_off); -pgoff_t lov_stripe_pgoff(struct lov_stripe_md *lsm, pgoff_t stripe_index, - int stripe); +int lov_stripe_number(struct lov_stripe_md *lsm, int index, u64 lov_off); +pgoff_t lov_stripe_pgoff(struct lov_stripe_md *lsm, int index, + pgoff_t stripe_index, int stripe); /* lov_request.c */ int lov_prep_statfs_set(struct obd_device *obd, struct obd_info *oinfo, diff --git a/drivers/staging/lustre/lustre/lov/lov_io.c b/drivers/staging/lustre/lustre/lov/lov_io.c index 6dd5639..26d0043 100644 --- a/drivers/staging/lustre/lustre/lov/lov_io.c +++ b/drivers/staging/lustre/lustre/lov/lov_io.c @@ -85,7 +85,7 @@ static void lov_io_sub_inherit(struct cl_io *io, struct lov_io *lio, if (cl_io_is_trunc(io)) { loff_t new_size = parent->u.ci_setattr.sa_attr.lvb_size; - new_size = lov_size_to_stripe(lsm, new_size, stripe); + new_size = lov_size_to_stripe(lsm, 0, new_size, stripe); io->u.ci_setattr.sa_attr.lvb_size = new_size; } break; @@ -101,7 +101,7 @@ static void lov_io_sub_inherit(struct cl_io *io, struct lov_io *lio, loff_t off = cl_offset(obj, parent->u.ci_fault.ft_index); io->u.ci_fault = parent->u.ci_fault; - off = lov_size_to_stripe(lsm, off, stripe); + off = lov_size_to_stripe(lsm, 0, off, stripe); io->u.ci_fault.ft_index = cl_index(obj, off); break; } @@ -144,13 +144,14 @@ static int lov_io_sub_init(const struct lu_env *env, struct lov_io *lio, struct cl_object *sub_obj; struct cl_io *io = lio->lis_cl.cis_io; int stripe = sub->sub_subio_index; + int index = 0; int rc; LASSERT(!sub->sub_io); LASSERT(!sub->sub_env); LASSERT(sub->sub_subio_index < lio->lis_stripe_count); - if (unlikely(!lov_r0(lov)->lo_sub[stripe])) + if (unlikely(!lov_r0(lov, index)->lo_sub[stripe])) return -EIO; sub->sub_io_initialized = 0; @@ -179,7 +180,7 @@ static int lov_io_sub_init(const struct lu_env *env, struct lov_io *lio, } } - sub_obj = lovsub2cl(lov_r0(lov)->lo_sub[stripe]); + sub_obj = lovsub2cl(lov_r0(lov, index)->lo_sub[stripe]); sub_io = sub->sub_io; sub_io->ci_obj = sub_obj; @@ -375,14 +376,15 @@ static int lov_io_iter_init(const struct lu_env *env, u64 end; int stripe; int rc = 0; + int index = 0; endpos = lov_offset_mod(lio->lis_endpos, -1); for (stripe = 0; stripe < lio->lis_stripe_count; stripe++) { - if (!lov_stripe_intersects(lsm, stripe, lio->lis_pos, + if (!lov_stripe_intersects(lsm, index, stripe, lio->lis_pos, endpos, &start, &end)) continue; - if (unlikely(!lov_r0(lio->lis_object)->lo_sub[stripe])) { + if (unlikely(!lov_r0(lio->lis_object, index)->lo_sub[stripe])) { if (ios->cis_io->ci_type == CIT_READ || ios->cis_io->ci_type == CIT_WRITE || ios->cis_io->ci_type == CIT_FAULT) @@ -555,15 +557,18 @@ static int lov_io_read_ahead(const struct lu_env *env, struct lov_io *lio = cl2lov_io(env, ios); struct lov_object *loo = lio->lis_object; struct cl_object *obj = lov2cl(loo); - struct lov_layout_raid0 *r0 = lov_r0(loo); + struct lov_layout_raid0 *r0; unsigned int pps; /* pages per stripe */ struct lov_io_sub *sub; pgoff_t ra_end; - loff_t suboff; + u64 suboff; int stripe; + int index = 0; int rc; - stripe = lov_stripe_number(loo->lo_lsm, cl_offset(obj, start)); + stripe = lov_stripe_number(loo->lo_lsm, index, cl_offset(obj, start)); + + r0 = lov_r0(loo, index); if (unlikely(!r0->lo_sub[stripe])) return -EIO; @@ -571,7 +576,7 @@ static int lov_io_read_ahead(const struct lu_env *env, if (IS_ERR(sub)) return PTR_ERR(sub); - lov_stripe_offset(loo->lo_lsm, cl_offset(obj, start), stripe, &suboff); + lov_stripe_offset(loo->lo_lsm, index, cl_offset(obj, start), stripe, &suboff); rc = cl_io_read_ahead(sub->sub_env, sub->sub_io, cl_index(lovsub2cl(r0->lo_sub[stripe]), suboff), ra); @@ -593,7 +598,7 @@ static int lov_io_read_ahead(const struct lu_env *env, /* cra_end is stripe level, convert it into file level */ ra_end = ra->cra_end; if (ra_end != CL_PAGE_EOF) - ra_end = lov_stripe_pgoff(loo->lo_lsm, ra_end, stripe); + ra_end = lov_stripe_pgoff(loo->lo_lsm, index, ra_end, stripe); pps = loo->lo_lsm->lsm_entries[0]->lsme_stripe_size >> PAGE_SHIFT; diff --git a/drivers/staging/lustre/lustre/lov/lov_lock.c b/drivers/staging/lustre/lustre/lov/lov_lock.c index 4340063..36c9eb7 100644 --- a/drivers/staging/lustre/lustre/lov/lov_lock.c +++ b/drivers/staging/lustre/lustre/lov/lov_lock.c @@ -114,7 +114,11 @@ static struct lov_lock *lov_lock_sub_init(const struct lu_env *env, const struct cl_object *obj, struct cl_lock *lock) { + struct lov_object *loo = cl2lov(obj); + struct lov_layout_raid0 *r0; + struct lov_lock *lovlck; int result = 0; + int index = 0; int i; int nr; u64 start; @@ -122,10 +126,6 @@ static struct lov_lock *lov_lock_sub_init(const struct lu_env *env, u64 file_start; u64 file_end; - struct lov_object *loo = cl2lov(obj); - struct lov_layout_raid0 *r0 = lov_r0(loo); - struct lov_lock *lovlck; - CDEBUG(D_INODE, "%p: lock/io FID " DFID "/" DFID ", lock/io clobj %p/%p\n", loo, PFID(lu_object_fid(lov2lu(loo))), PFID(lu_object_fid(&obj->co_lu)), @@ -134,13 +134,14 @@ static struct lov_lock *lov_lock_sub_init(const struct lu_env *env, file_start = cl_offset(lov2cl(loo), lock->cll_descr.cld_start); file_end = cl_offset(lov2cl(loo), lock->cll_descr.cld_end + 1) - 1; + r0 = lov_r0(loo, index); for (i = 0, nr = 0; i < r0->lo_nr; i++) { /* * XXX for wide striping smarter algorithm is desirable, * breaking out of the loop, early. */ if (likely(r0->lo_sub[i]) && /* spare layout */ - lov_stripe_intersects(loo->lo_lsm, i, + lov_stripe_intersects(loo->lo_lsm, index, i, file_start, file_end, &start, &end)) nr++; } @@ -153,7 +154,7 @@ static struct lov_lock *lov_lock_sub_init(const struct lu_env *env, lovlck->lls_nr = nr; for (i = 0, nr = 0; i < r0->lo_nr; ++i) { if (likely(r0->lo_sub[i]) && - lov_stripe_intersects(loo->lo_lsm, i, + lov_stripe_intersects(loo->lo_lsm, index, i, file_start, file_end, &start, &end)) { struct lov_lock_sub *lls = &lovlck->lls_sub[nr]; struct cl_lock_descr *descr; diff --git a/drivers/staging/lustre/lustre/lov/lov_merge.c b/drivers/staging/lustre/lustre/lov/lov_merge.c index 10b8448..020795f 100644 --- a/drivers/staging/lustre/lustre/lov/lov_merge.c +++ b/drivers/staging/lustre/lustre/lov/lov_merge.c @@ -41,7 +41,7 @@ * initializes the current atime, mtime, ctime to avoid regressing a more * uptodate time on the local client. */ -int lov_merge_lvb_kms(struct lov_stripe_md *lsm, +int lov_merge_lvb_kms(struct lov_stripe_md *lsm, int index, struct ost_lvb *lvb, __u64 *kms_place) { __u64 size = 0; @@ -69,14 +69,14 @@ int lov_merge_lvb_kms(struct lov_stripe_md *lsm, } tmpsize = loi->loi_kms; - lov_size = lov_stripe_size(lsm, tmpsize, i); + lov_size = lov_stripe_size(lsm, index, tmpsize, i); if (lov_size > kms) kms = lov_size; if (loi->loi_lvb.lvb_size > tmpsize) tmpsize = loi->loi_lvb.lvb_size; - lov_size = lov_stripe_size(lsm, tmpsize, i); + lov_size = lov_stripe_size(lsm, index, tmpsize, i); if (lov_size > size) size = lov_size; /* merge blocks, mtime, atime */ diff --git a/drivers/staging/lustre/lustre/lov/lov_object.c b/drivers/staging/lustre/lustre/lov/lov_object.c index 1ebaa23..de5e2a2 100644 --- a/drivers/staging/lustre/lustre/lov/lov_object.c +++ b/drivers/staging/lustre/lustre/lov/lov_object.c @@ -221,24 +221,13 @@ static int lov_init_raid0(const struct lu_env *env, struct lov_device *dev, const struct cl_object_conf *conf, struct lov_layout_raid0 *r0) { + struct cl_object *stripe; + struct lov_thread_info *lti = lov_env_info(env); + struct cl_object_conf *subconf = <i->lti_stripe_conf; + struct lu_fid *ofid = <i->lti_fid; int result; - int i; - - struct cl_object *stripe; - struct lov_thread_info *lti = lov_env_info(env); - struct cl_object_conf *subconf = <i->lti_stripe_conf; - struct lu_fid *ofid = <i->lti_fid; int psz; - - if (lsm->lsm_magic != LOV_MAGIC_V1 && lsm->lsm_magic != LOV_MAGIC_V3) { - dump_lsm(D_ERROR, lsm); - LASSERTF(0, "magic mismatch, expected %d/%d, actual %d.\n", - LOV_MAGIC_V1, LOV_MAGIC_V3, lsm->lsm_magic); - } - - LASSERT(!lov->lo_lsm); - lov->lo_lsm = lsm_addref(lsm); - lov->lo_layout_invalid = true; + int i; spin_lock_init(&r0->lo_sub_lock); r0->lo_nr = lsm->lsm_entries[0]->lsme_stripe_count; @@ -305,10 +294,7 @@ static int lov_init_raid0(const struct lu_env *env, struct lov_device *dev, } } if (result == 0) - cl_object_header(&lov->lo_cl)->coh_page_bufsize += psz; - else - result = -ENOMEM; - + result = psz; out: return result; } @@ -319,9 +305,37 @@ static int lov_init_composite(const struct lu_env *env, struct lov_device *dev, union lov_layout_state *state) { struct lov_layout_composite *comp = &state->composite; - struct lov_layout_entry *le = &comp->lo_entries; + unsigned int entry_count = 1; + unsigned int psz = 0; + int result = 0; + int i; - return lov_init_raid0(env, dev, lov, lsm, conf, &le->lle_raid0); + LASSERT(!lov->lo_lsm); + lov->lo_lsm = lsm_addref(lsm); + lov->lo_layout_invalid = true; + + comp->lo_entry_count = entry_count; + + comp->lo_entries = kcalloc(entry_count, sizeof(*comp->lo_entries), + GFP_KERNEL); + if (!comp->lo_entries) + return -ENOMEM; + + for (i = 0; i < entry_count; i++) { + struct lov_layout_entry *le = &comp->lo_entries[i]; + + result = lov_init_raid0(env, dev, lov, lsm, conf, + &le->lle_raid0); + if (result < 0) + break; + + LASSERT(ergo(psz > 0, psz == result)); + psz = result; + } + if (psz > 0) + cl_object_header(&lov->lo_cl)->coh_page_bufsize += psz; + + return result > 0 ? 0 : result; } static int lov_init_released(const struct lu_env *env, struct lov_device *dev, @@ -454,7 +468,7 @@ static int lov_delete_composite(const struct lu_env *env, union lov_layout_state *state) { struct lov_layout_composite *comp = &state->composite; - struct lov_layout_entry *entry = &comp->lo_entries; + struct lov_layout_entry *entry = &comp->lo_entries[0]; dump_lsm(D_INODE, lov->lo_lsm); @@ -484,9 +498,15 @@ static void lov_fini_composite(const struct lu_env *env, union lov_layout_state *state) { struct lov_layout_composite *comp = &state->composite; - struct lov_layout_entry *entry = &comp->lo_entries; - lov_fini_raid0(env, &entry->lle_raid0); + if (comp->lo_entries) { + struct lov_layout_entry *entry = &comp->lo_entries[0]; + + lov_fini_raid0(env, &entry->lle_raid0); + + kvfree(comp->lo_entries); + comp->lo_entries = NULL; + } dump_lsm(D_INODE, lov->lo_lsm); lov_free_memmd(&lov->lo_lsm); @@ -528,7 +548,7 @@ static int lov_print_composite(const struct lu_env *env, void *cookie, lu_printer_t p, const struct lu_object *o) { struct lov_object *lov = lu2lov(o); - struct lov_layout_raid0 *r0 = lov_r0(lov); + struct lov_layout_raid0 *r0 = lov_r0(lov, 0); struct lov_stripe_md *lsm = lov->lo_lsm; (*p)(env, cookie, "stripes: %d, %s, lsm{%p 0x%08X %d %u %u}:\n", @@ -600,7 +620,7 @@ static int lov_attr_get_raid0(const struct lu_env *env, struct lov_object *lov, * sub-object attributes. */ lov_stripe_lock(lsm); - result = lov_merge_lvb_kms(lsm, lvb, &kms); + result = lov_merge_lvb_kms(lsm, 0, lvb, &kms); lov_stripe_unlock(lsm); if (result) return result; @@ -617,7 +637,7 @@ static int lov_attr_get_composite(const struct lu_env *env, struct cl_attr *attr) { struct lov_object *lov = cl2lov(obj); - struct lov_layout_raid0 *r0 = lov_r0(lov); + struct lov_layout_raid0 *r0 = lov_r0(lov, 0); struct cl_attr *lov_attr = &r0->lo_attr; int result; @@ -1051,33 +1071,31 @@ int lov_lock_init(const struct lu_env *env, struct cl_object *obj, * * \retval last_stripe return the last stripe of the mapping */ -static int fiemap_calc_last_stripe(struct lov_stripe_md *lsm, +static int fiemap_calc_last_stripe(struct lov_stripe_md *lsm, int index, u64 fm_start, u64 fm_end, int start_stripe, int *stripe_count) { + struct lov_stripe_md_entry *lsme = lsm->lsm_entries[index]; int last_stripe; u64 obd_start; u64 obd_end; int i, j; - if (fm_end - fm_start > lsm->lsm_entries[0]->lsme_stripe_size * - lsm->lsm_entries[0]->lsme_stripe_count) { - last_stripe = (start_stripe < 1 ? - lsm->lsm_entries[0]->lsme_stripe_count - 1 : - start_stripe - 1); - *stripe_count = lsm->lsm_entries[0]->lsme_stripe_count; + if (fm_end - fm_start > + lsme->lsme_stripe_size * lsme->lsme_stripe_count) { + last_stripe = (start_stripe < 1 ? lsme->lsme_stripe_count - 1 : + start_stripe - 1); + *stripe_count = lsme->lsme_stripe_count; } else { - for (j = 0, i = start_stripe; - j < lsm->lsm_entries[0]->lsme_stripe_count; - i = (i + 1) % lsm->lsm_entries[0]->lsme_stripe_count, + for (j = 0, i = start_stripe; j < lsme->lsme_stripe_count; + i = (i + 1) % lsme->lsme_stripe_count, j++) { - if (lov_stripe_intersects(lsm, i, fm_start, fm_end, + if (lov_stripe_intersects(lsm, index, i, fm_start, fm_end, &obd_start, &obd_end) == 0) break; } *stripe_count = j; - last_stripe = (start_stripe + j - 1) % - lsm->lsm_entries[0]->lsme_stripe_count; + last_stripe = (start_stripe + j - 1) % lsme->lsme_stripe_count; } return last_stripe; @@ -1132,9 +1150,10 @@ static void fiemap_prepare_and_copy_exts(struct fiemap *fiemap, */ static u64 fiemap_calc_fm_end_offset(struct fiemap *fiemap, struct lov_stripe_md *lsm, - u64 fm_start, u64 fm_end, + int index, u64 fm_start, u64 fm_end, int *start_stripe) { + struct lov_stripe_md_entry *lsme = lsm->lsm_entries[index]; u64 local_end = fiemap->fm_extents[0].fe_logical; u64 lun_start, lun_end; u64 fm_end_offset; @@ -1145,8 +1164,8 @@ static u64 fiemap_calc_fm_end_offset(struct fiemap *fiemap, return 0; /* Find out stripe_no from ost_index saved in the fe_device */ - for (i = 0; i < lsm->lsm_entries[0]->lsme_stripe_count; i++) { - struct lov_oinfo *oinfo = lsm->lsm_entries[0]->lsme_oinfo[i]; + for (i = 0; i < lsme->lsme_stripe_count; i++) { + struct lov_oinfo *oinfo = lsme->lsme_oinfo[i]; if (lov_oinfo_is_dummy(oinfo)) continue; @@ -1164,7 +1183,7 @@ static u64 fiemap_calc_fm_end_offset(struct fiemap *fiemap, * If we have finished mapping on previous device, shift logical * offset to start of next device */ - if (lov_stripe_intersects(lsm, stripe_no, fm_start, fm_end, + if (lov_stripe_intersects(lsm, index, stripe_no, fm_start, fm_end, &lun_start, &lun_end) != 0 && local_end < lun_end) { fm_end_offset = local_end; @@ -1174,8 +1193,7 @@ static u64 fiemap_calc_fm_end_offset(struct fiemap *fiemap, * calculate offset in next stripe. */ fm_end_offset = 0; - *start_stripe = (stripe_no + 1) % - lsm->lsm_entries[0]->lsme_stripe_count; + *start_stripe = (stripe_no + 1) % lsme->lsme_stripe_count; } return fm_end_offset; @@ -1197,11 +1215,11 @@ struct fiemap_state { }; static int fiemap_for_stripe(const struct lu_env *env, struct cl_object *obj, - struct lov_stripe_md *lsm, - struct fiemap *fiemap, size_t *buflen, - struct ll_fiemap_info_key *fmkey, int stripeno, - struct fiemap_state *fs) + struct lov_stripe_md *lsm, struct fiemap *fiemap, + size_t *buflen, struct ll_fiemap_info_key *fmkey, + int index, int stripeno, struct fiemap_state *fs) { + struct lov_stripe_md_entry *lsme = lsm->lsm_entries[index]; struct cl_object *subobj; struct lov_obd *lov = lu2lov_dev(obj->co_lu.lo_dev)->ld_lov; struct fiemap_extent *fm_ext = &fs->fs_fm->fm_extents[0]; @@ -1220,11 +1238,12 @@ static int fiemap_for_stripe(const struct lu_env *env, struct cl_object *obj, fs->fs_device_done = false; /* Find out range of mapping on this stripe */ - if ((lov_stripe_intersects(lsm, stripeno, fs->fs_start, fs->fs_end, + if ((lov_stripe_intersects(lsm, index, stripeno, + fs->fs_start, fs->fs_end, &lun_start, &obd_object_end)) == 0) return 0; - if (lov_oinfo_is_dummy(lsm->lsm_entries[0]->lsme_oinfo[stripeno])) + if (lov_oinfo_is_dummy(lsme->lsme_oinfo[stripeno])) return -EIO; /* If this is a continuation FIEMAP call and we are on @@ -1239,7 +1258,8 @@ static int fiemap_for_stripe(const struct lu_env *env, struct cl_object *obj, /* Handle fs->fs_start + fs->fs_length overflow */ if (fs->fs_start + fs->fs_length < fs->fs_start) fs->fs_length = ~0ULL - fs->fs_start; - lun_end = lov_size_to_stripe(lsm, fs->fs_start + fs->fs_length, + lun_end = lov_size_to_stripe(lsm, index, + fs->fs_start + fs->fs_length, stripeno); } @@ -1274,7 +1294,7 @@ static int fiemap_for_stripe(const struct lu_env *env, struct cl_object *obj, fs->fs_fm->fm_mapped_extents = 0; fs->fs_fm->fm_flags = fiemap->fm_flags; - ost_index = lsm->lsm_entries[0]->lsme_oinfo[stripeno]->loi_ost_idx; + ost_index = lsme->lsme_oinfo[stripeno]->loi_ost_idx; if (ost_index < 0 || ost_index >= lov->desc.ld_tgt_count) { rc = -EINVAL; @@ -1345,8 +1365,9 @@ static int fiemap_for_stripe(const struct lu_env *env, struct cl_object *obj, */ if (fm_ext[ext_count - 1].fe_flags & FIEMAP_EXTENT_LAST) fm_ext[ext_count - 1].fe_flags &= ~FIEMAP_EXTENT_LAST; - if (lov_stripe_size(lsm, fm_ext[ext_count - 1].fe_logical + - fm_ext[ext_count - 1].fe_length, + if (lov_stripe_size(lsm, index, + fm_ext[ext_count - 1].fe_logical + + fm_ext[ext_count - 1].fe_length, stripeno) >= fmkey->lfik_oa.o_size) { ost_eof = true; fs->fs_device_done = true; @@ -1391,6 +1412,7 @@ static int lov_object_fiemap(const struct lu_env *env, struct cl_object *obj, struct fiemap *fm_local = NULL; struct lov_stripe_md *lsm; int rc = 0; + int entry = 0; int cur_stripe; int stripe_count; struct fiemap_state fs = { NULL }; @@ -1450,7 +1472,7 @@ static int lov_object_fiemap(const struct lu_env *env, struct cl_object *obj, goto out; } /* Calculate start stripe, last stripe and length of mapping */ - fs.fs_start_stripe = lov_stripe_number(lsm, fs.fs_start); + fs.fs_start_stripe = lov_stripe_number(lsm, 0, fs.fs_start); fs.fs_end = (fs.fs_length == ~0ULL) ? fmkey->lfik_oa.o_size : fs.fs_start + fs.fs_length - 1; /* If fs_length != ~0ULL but fs_start+fs_length-1 exceeds file size */ @@ -1459,11 +1481,12 @@ static int lov_object_fiemap(const struct lu_env *env, struct cl_object *obj, fs.fs_length = fs.fs_end - fs.fs_start; } - fs.fs_last_stripe = fiemap_calc_last_stripe(lsm, fs.fs_start, fs.fs_end, + fs.fs_last_stripe = fiemap_calc_last_stripe(lsm, entry, + fs.fs_start, fs.fs_end, fs.fs_start_stripe, &stripe_count); - fs.fs_end_offset = fiemap_calc_fm_end_offset(fiemap, lsm, fs.fs_start, - fs.fs_end, + fs.fs_end_offset = fiemap_calc_fm_end_offset(fiemap, lsm, entry, + fs.fs_start, fs.fs_end, &fs.fs_start_stripe); if (fs.fs_end_offset == -EINVAL) { rc = -EINVAL; @@ -1489,8 +1512,8 @@ static int lov_object_fiemap(const struct lu_env *env, struct cl_object *obj, --stripe_count, cur_stripe = (cur_stripe + 1) % lsm->lsm_entries[0]->lsme_stripe_count) { - rc = fiemap_for_stripe(env, obj, lsm, fiemap, buflen, fmkey, - cur_stripe, &fs); + rc = fiemap_for_stripe(env, obj, lsm, fiemap, buflen, + fmkey, 0, cur_stripe, &fs); if (rc < 0) goto out; if (fs.fs_finish) diff --git a/drivers/staging/lustre/lustre/lov/lov_offset.c b/drivers/staging/lustre/lustre/lov/lov_offset.c index 19a44d3..d817aa5 100644 --- a/drivers/staging/lustre/lustre/lov/lov_offset.c +++ b/drivers/staging/lustre/lustre/lov/lov_offset.c @@ -38,9 +38,10 @@ #include "lov_internal.h" /* compute object size given "stripeno" and the ost size */ -u64 lov_stripe_size(struct lov_stripe_md *lsm, u64 ost_size, int stripeno) +u64 lov_stripe_size(struct lov_stripe_md *lsm, int index, u64 ost_size, + int stripeno) { - unsigned long ssize = lsm->lsm_entries[0]->lsme_stripe_size; + unsigned long ssize = lsm->lsm_entries[index]->lsme_stripe_size; unsigned long stripe_size; u64 swidth; u64 lov_size; @@ -64,12 +65,13 @@ u64 lov_stripe_size(struct lov_stripe_md *lsm, u64 ost_size, int stripeno) /** * Compute file level page index by stripe level page offset */ -pgoff_t lov_stripe_pgoff(struct lov_stripe_md *lsm, pgoff_t stripe_index, - int stripe) +pgoff_t lov_stripe_pgoff(struct lov_stripe_md *lsm, int index, + pgoff_t stripe_index, int stripe) { loff_t offset; - offset = lov_stripe_size(lsm, (stripe_index << PAGE_SHIFT) + 1, stripe); + offset = lov_stripe_size(lsm, index, (stripe_index << PAGE_SHIFT) + 1, + stripe); return offset >> PAGE_SHIFT; } @@ -122,10 +124,10 @@ pgoff_t lov_stripe_pgoff(struct lov_stripe_md *lsm, pgoff_t stripe_index, * falls in the stripe and no shifting was done; > 0 when the offset * was outside the stripe and was pulled back to its final byte. */ -int lov_stripe_offset(struct lov_stripe_md *lsm, u64 lov_off, +int lov_stripe_offset(struct lov_stripe_md *lsm, int index, u64 lov_off, int stripeno, u64 *obdoff) { - unsigned long ssize = lsm->lsm_entries[0]->lsme_stripe_size; + unsigned long ssize = lsm->lsm_entries[index]->lsme_stripe_size; u64 stripe_off, this_stripe, swidth; int magic = lsm->lsm_magic; int ret = 0; @@ -177,10 +179,10 @@ int lov_stripe_offset(struct lov_stripe_md *lsm, u64 lov_off, * | 0 | 1 | 2 | 0 | 1 | 2 | * --------------------------------------------------------------------- */ -u64 lov_size_to_stripe(struct lov_stripe_md *lsm, u64 file_size, +u64 lov_size_to_stripe(struct lov_stripe_md *lsm, int index, u64 file_size, int stripeno) { - unsigned long ssize = lsm->lsm_entries[0]->lsme_stripe_size; + unsigned long ssize = lsm->lsm_entries[index]->lsme_stripe_size; u64 stripe_off, this_stripe, swidth; int magic = lsm->lsm_magic; @@ -218,13 +220,13 @@ u64 lov_size_to_stripe(struct lov_stripe_md *lsm, u64 file_size, * that is contained within the lov extent. this returns true if the given * stripe does intersect with the lov extent. */ -int lov_stripe_intersects(struct lov_stripe_md *lsm, int stripeno, +int lov_stripe_intersects(struct lov_stripe_md *lsm, int index, int stripeno, u64 start, u64 end, u64 *obd_start, u64 *obd_end) { int start_side, end_side; - start_side = lov_stripe_offset(lsm, start, stripeno, obd_start); - end_side = lov_stripe_offset(lsm, end, stripeno, obd_end); + start_side = lov_stripe_offset(lsm, index, start, stripeno, obd_start); + end_side = lov_stripe_offset(lsm, index, end, stripeno, obd_end); CDEBUG(D_INODE, "[%llu->%llu] -> [(%d) %llu->%llu (%d)]\n", start, end, start_side, *obd_start, *obd_end, end_side); @@ -252,9 +254,9 @@ int lov_stripe_intersects(struct lov_stripe_md *lsm, int stripeno, } /* compute which stripe number "lov_off" will be written into */ -int lov_stripe_number(struct lov_stripe_md *lsm, u64 lov_off) +int lov_stripe_number(struct lov_stripe_md *lsm, int index, u64 lov_off) { - unsigned long ssize = lsm->lsm_entries[0]->lsme_stripe_size; + unsigned long ssize = lsm->lsm_entries[index]->lsme_stripe_size; u64 stripe_off, swidth; int magic = lsm->lsm_magic; diff --git a/drivers/staging/lustre/lustre/lov/lov_page.c b/drivers/staging/lustre/lustre/lov/lov_page.c index d94d003..ad34fc3 100644 --- a/drivers/staging/lustre/lustre/lov/lov_page.c +++ b/drivers/staging/lustre/lustre/lov/lov_page.c @@ -67,21 +67,24 @@ int lov_page_init_composite(const struct lu_env *env, struct cl_object *obj, struct cl_page *page, pgoff_t index) { struct lov_object *loo = cl2lov(obj); - struct lov_layout_raid0 *r0 = lov_r0(loo); struct lov_io *lio = lov_env_io(env); + struct lov_layout_raid0 *r0; struct cl_object *subobj; struct cl_object *o; struct lov_io_sub *sub; struct lov_page *lpg = cl_object_page_slice(obj, page); - loff_t offset; + u64 offset; u64 suboff; int stripe; + int entry = 0; int rc; offset = cl_offset(obj, index); - stripe = lov_stripe_number(loo->lo_lsm, offset); + + r0 = lov_r0(loo, entry); + stripe = lov_stripe_number(loo->lo_lsm, entry, offset); LASSERT(stripe < r0->lo_nr); - rc = lov_stripe_offset(loo->lo_lsm, offset, stripe, &suboff); + rc = lov_stripe_offset(loo->lo_lsm, entry, offset, stripe, &suboff); LASSERT(rc == 0); lpg->lps_index = stripe; diff --git a/drivers/staging/lustre/lustre/lov/lovsub_object.c b/drivers/staging/lustre/lustre/lov/lovsub_object.c index d3e9537..cd7806b 100644 --- a/drivers/staging/lustre/lustre/lov/lovsub_object.c +++ b/drivers/staging/lustre/lustre/lov/lovsub_object.c @@ -79,8 +79,9 @@ static void lovsub_object_free(const struct lu_env *env, struct lu_object *obj) * object handling in lu_object_find. */ if (lov) { + int index = 0; int stripe = los->lso_index; - struct lov_layout_raid0 *r0 = lov_r0(lov); + struct lov_layout_raid0 *r0 = lov_r0(lov, index); LASSERT(lov->lo_type == LLT_COMP); LASSERT(r0->lo_sub[stripe] == los); @@ -107,7 +108,7 @@ static int lovsub_attr_update(const struct lu_env *env, struct cl_object *obj, { struct lov_object *lov = cl2lovsub(obj)->lso_super; - lov_r0(lov)->lo_attr_valid = 0; + lov_r0(lov, 0)->lo_attr_valid = 0; return 0; } -- 1.8.3.1 From jsimmons at infradead.org Sun Jan 6 22:14:12 2019 From: jsimmons at infradead.org (James Simmons) Date: Sun, 6 Jan 2019 17:14:12 -0500 Subject: [lustre-devel] [PATCH v2 17/33] lustre: clio: getstripe support comp layout In-Reply-To: <1546812868-11794-1-git-send-email-jsimmons@infradead.org> References: <1546812868-11794-1-git-send-email-jsimmons@infradead.org> Message-ID: <1546812868-11794-18-git-send-email-jsimmons@infradead.org> From: Niu Yawei {get/set}stripe support composite layout Signed-off-by: Bobi Jam Signed-off-by: Niu Yawei WC-bug-id: https://jira.whamcloud.com/browse/LU-8998 Reviewed-on: https://review.whamcloud.com/24851 Reviewed-by: Andreas Dilger Reviewed-by: Lai Siyao Reviewed-by: Jinshan Xiong Signed-off-by: James Simmons --- drivers/staging/lustre/lustre/llite/dir.c | 33 +++- drivers/staging/lustre/lustre/llite/file.c | 25 ++- .../staging/lustre/lustre/llite/llite_internal.h | 2 + drivers/staging/lustre/lustre/llite/xattr.c | 70 +++++---- drivers/staging/lustre/lustre/lov/lov_internal.h | 24 +++ drivers/staging/lustre/lustre/lov/lov_object.c | 3 +- drivers/staging/lustre/lustre/lov/lov_pack.c | 172 ++++++++++++--------- 7 files changed, 203 insertions(+), 126 deletions(-) diff --git a/drivers/staging/lustre/lustre/llite/dir.c b/drivers/staging/lustre/lustre/llite/dir.c index 0a7330d..57acb7b 100644 --- a/drivers/staging/lustre/lustre/llite/dir.c +++ b/drivers/staging/lustre/lustre/llite/dir.c @@ -522,6 +522,15 @@ int ll_dir_setstripe(struct inode *inode, struct lov_user_md *lump, lum_size = sizeof(struct lov_user_md_v3); break; } + case LOV_USER_MAGIC_COMP_V1: { + if (lump->lmm_magic != + cpu_to_le32(LOV_USER_MAGIC_COMP_V1)) + lustre_swab_lov_comp_md_v1( + (struct lov_comp_md_v1 *)lump); + lum_size = le32_to_cpu( + ((struct lov_comp_md_v1 *)lump)->lcm_size); + break; + } case LMV_USER_MAGIC: { if (lump->lmm_magic != cpu_to_le32(LMV_USER_MAGIC)) lustre_swab_lmv_user_md( @@ -562,7 +571,9 @@ int ll_dir_setstripe(struct inode *inode, struct lov_user_md *lump, * LOV_USER_MAGIC_V3 have the same initial fields so we do not * need to make the distinction between the 2 versions */ - if (set_default && mgc->u.cli.cl_mgc_mgsexp) { + if (set_default && mgc->u.cli.cl_mgc_mgsexp && + (!lump || le32_to_cpu(lump->lmm_magic) == LOV_USER_MAGIC_V1 || + le32_to_cpu(lump->lmm_magic) == LOV_USER_MAGIC_V3)) { char *param = NULL; char *buf; @@ -577,23 +588,23 @@ int ll_dir_setstripe(struct inode *inode, struct lov_user_md *lump, buf += strlen(buf); /* Set root stripesize */ - sprintf(buf, ".stripesize=%u", - lump ? le32_to_cpu(lump->lmm_stripe_size) : 0); + snprintf(buf, MGS_PARAM_MAXLEN, ".stripesize=%u", + lump ? le32_to_cpu(lump->lmm_stripe_size) : 0); rc = ll_send_mgc_param(mgc->u.cli.cl_mgc_mgsexp, param); if (rc) goto end; /* Set root stripecount */ - sprintf(buf, ".stripecount=%hd", - lump ? le16_to_cpu(lump->lmm_stripe_count) : 0); + snprintf(buf, MGS_PARAM_MAXLEN, ".stripecount=%hd", + lump ? le16_to_cpu(lump->lmm_stripe_count) : 0); rc = ll_send_mgc_param(mgc->u.cli.cl_mgc_mgsexp, param); if (rc) goto end; /* Set root stripeoffset */ - sprintf(buf, ".stripeoffset=%hd", - lump ? le16_to_cpu(lump->lmm_stripe_offset) : - (typeof(lump->lmm_stripe_offset))(-1)); + snprintf(buf, MGS_PARAM_MAXLEN, ".stripeoffset=%hd", + lump ? le16_to_cpu(lump->lmm_stripe_offset) : + (typeof(lump->lmm_stripe_offset))(-1)); rc = ll_send_mgc_param(mgc->u.cli.cl_mgc_mgsexp, param); end: @@ -669,6 +680,10 @@ int ll_dir_getstripe(struct inode *inode, void **plmm, int *plmm_size, if (cpu_to_le32(LOV_MAGIC) != LOV_MAGIC) lustre_swab_lov_user_md_v3((struct lov_user_md_v3 *)lmm); break; + case LOV_MAGIC_COMP_V1: + if (cpu_to_le32(LOV_MAGIC) != LOV_MAGIC) + lustre_swab_lov_comp_md_v1((struct lov_comp_md_v1 *)lmm); + break; case LMV_MAGIC_V1: if (cpu_to_le32(LMV_MAGIC) != LMV_MAGIC) lustre_swab_lmv_mds_md((union lmv_mds_md *)lmm); @@ -1217,6 +1232,8 @@ static long ll_dir_ioctl(struct file *file, unsigned int cmd, unsigned long arg) int set_default = 0; + BUILD_BUG_ON(sizeof(struct lov_user_md_v3) <= + sizeof(struct lov_comp_md_v1)); LASSERT(sizeof(lumv3) == sizeof(*lumv3p)); LASSERT(sizeof(lumv3.lmm_objects[0]) == sizeof(lumv3p->lmm_objects[0])); diff --git a/drivers/staging/lustre/lustre/llite/file.c b/drivers/staging/lustre/lustre/llite/file.c index fae0111..24a0948 100644 --- a/drivers/staging/lustre/lustre/llite/file.c +++ b/drivers/staging/lustre/lustre/llite/file.c @@ -1430,8 +1430,9 @@ int ll_lov_getstripe_ea_info(struct inode *inode, const char *filename, lmm = req_capsule_server_sized_get(&req->rq_pill, &RMF_MDT_MD, lmmsize); - if ((lmm->lmm_magic != cpu_to_le32(LOV_MAGIC_V1)) && - (lmm->lmm_magic != cpu_to_le32(LOV_MAGIC_V3))) { + if (lmm->lmm_magic != cpu_to_le32(LOV_MAGIC_V1) && + lmm->lmm_magic != cpu_to_le32(LOV_MAGIC_V3) && + lmm->lmm_magic != cpu_to_le32(LOV_MAGIC_COMP_V1)) { rc = -EPROTO; goto out; } @@ -1444,9 +1445,13 @@ int ll_lov_getstripe_ea_info(struct inode *inode, const char *filename, if (cpu_to_le32(LOV_MAGIC) != LOV_MAGIC) { int stripe_count; - stripe_count = le16_to_cpu(lmm->lmm_stripe_count); - if (le32_to_cpu(lmm->lmm_pattern) & LOV_PATTERN_F_RELEASED) - stripe_count = 0; + if (lmm->lmm_magic == cpu_to_le32(LOV_MAGIC_V1) || + lmm->lmm_magic == cpu_to_le32(LOV_MAGIC_V3)) { + stripe_count = le16_to_cpu(lmm->lmm_stripe_count); + if (le32_to_cpu(lmm->lmm_pattern) & + LOV_PATTERN_F_RELEASED) + stripe_count = 0; + } /* if function called for directory - we should * avoid swab not existent lsm objects @@ -1463,6 +1468,8 @@ int ll_lov_getstripe_ea_info(struct inode *inode, const char *filename, lustre_swab_lov_user_md_objects( ((struct lov_user_md_v3 *)lmm)->lmm_objects, stripe_count); + } else if (lmm->lmm_magic == cpu_to_le32(LOV_MAGIC_COMP_V1)) { + lustre_swab_lov_comp_md_v1((struct lov_comp_md_v1 *)lmm); } } @@ -1534,14 +1541,6 @@ static int ll_lov_setstripe(struct inode *inode, struct file *file, rc = ll_lov_setstripe_ea_info(inode, file->f_path.dentry, flags, klum, lum_size); cl_lov_delay_create_clear(&file->f_flags); - if (rc == 0) { - __u32 gen; - - put_user(0, &lum->lmm_stripe_count); - - ll_layout_refresh(inode, &gen); - rc = ll_file_getstripe(inode, (struct lov_user_md __user *)arg); - } kfree(klum); return rc; diff --git a/drivers/staging/lustre/lustre/llite/llite_internal.h b/drivers/staging/lustre/lustre/llite/llite_internal.h index 48424a4..e3f5450 100644 --- a/drivers/staging/lustre/lustre/llite/llite_internal.h +++ b/drivers/staging/lustre/lustre/llite/llite_internal.h @@ -927,6 +927,8 @@ static inline ssize_t ll_lov_user_md_size(const struct lov_user_md *lum) return lov_user_md_size(lum->lmm_stripe_count, LOV_USER_MAGIC_SPECIFIC); + case LOV_USER_MAGIC_COMP_V1: + return ((struct lov_comp_md_v1 *)lum)->lcm_size; } return -EINVAL; } diff --git a/drivers/staging/lustre/lustre/llite/xattr.c b/drivers/staging/lustre/lustre/llite/xattr.c index aeaa04a..0670ed3 100644 --- a/drivers/staging/lustre/lustre/llite/xattr.c +++ b/drivers/staging/lustre/lustre/llite/xattr.c @@ -194,40 +194,53 @@ static int get_hsm_state(struct inode *inode, u32 *hus_states) static int ll_adjust_lum(struct inode *inode, struct lov_user_md *lump) { + struct lov_comp_md_v1 *comp_v1 = (struct lov_comp_md_v1 *)lump; + struct lov_user_md *v1 = lump; + bool need_clear_release = false; + bool release_checked = false; + bool is_composite = false; + u16 entry_count = 1; int rc = 0; + int i; if (!lump) return 0; - /* Attributes that are saved via getxattr will always have - * the stripe_offset as 0. Instead, the MDS should be - * allowed to pick the starting OST index. b=17846 - */ - if (lump->lmm_stripe_offset == 0) - lump->lmm_stripe_offset = -1; + if (lump->lmm_magic == LOV_USER_MAGIC_COMP_V1) { + entry_count = comp_v1->lcm_entry_count; + is_composite = true; + } + + for (i = 0; i < entry_count; i++) { + if (lump->lmm_magic == LOV_USER_MAGIC_COMP_V1) { + void *ptr = comp_v1; - /* Avoid anyone directly setting the RELEASED flag. */ - if (lump->lmm_pattern & LOV_PATTERN_F_RELEASED) { - /* Only if we have a released flag check if the file - * was indeed archived. + ptr += comp_v1->lcm_entries[i].lcme_offset; + v1 = (struct lov_user_md *)ptr; + } + + /* Attributes that are saved via getxattr will always have + * the stripe_offset as 0. Instead, the MDS should be + * allowed to pick the starting OST index. b=17846 */ - u32 state = HS_NONE; - - rc = get_hsm_state(inode, &state); - if (rc) - return rc; - - if (!(state & HS_ARCHIVED)) { - CDEBUG(D_VFSTRACE, - "hus_states state = %x, pattern = %x\n", - state, lump->lmm_pattern); - /* - * Here the state is: real file is not - * archived but user is requesting to set - * the RELEASED flag so we mask off the - * released flag from the request - */ - lump->lmm_pattern ^= LOV_PATTERN_F_RELEASED; + if (!is_composite && v1->lmm_stripe_offset == 0) + v1->lmm_stripe_offset = -1; + + /* Avoid anyone directly setting the RELEASED flag. */ + if (v1->lmm_pattern & LOV_PATTERN_F_RELEASED) { + if (!release_checked) { + u32 state = HS_NONE; + + rc = get_hsm_state(inode, &state); + if (rc) + return rc; + + if (!(state & HS_ARCHIVED)) + need_clear_release = true; + release_checked = true; + } + if (need_clear_release) + v1->lmm_pattern ^= LOV_PATTERN_F_RELEASED; } } @@ -495,6 +508,9 @@ static ssize_t ll_getxattr_lov(struct inode *inode, void *buf, size_t buf_size) * recognizing layout gen as stripe offset when the * file is restored. See LU-2809. */ + if (((struct lov_mds_md *)buf)->lmm_magic == LOV_MAGIC_COMP_V1) + goto out_env; + ((struct lov_mds_md *)buf)->lmm_layout_gen = 0; out_env: cl_env_put(env, &refcheck); diff --git a/drivers/staging/lustre/lustre/lov/lov_internal.h b/drivers/staging/lustre/lustre/lov/lov_internal.h index 29325ff..9c0a4f7 100644 --- a/drivers/staging/lustre/lustre/lov/lov_internal.h +++ b/drivers/staging/lustre/lustre/lov/lov_internal.h @@ -74,6 +74,30 @@ struct lov_stripe_md { struct lov_stripe_md_entry *lsm_entries[]; }; +static inline size_t lov_comp_md_size(const struct lov_stripe_md *lsm) +{ + struct lov_stripe_md_entry *lsme; + size_t size; + int entry; + + if (lsm->lsm_magic == LOV_MAGIC_V1 || lsm->lsm_magic == LOV_MAGIC_V3) + return lov_mds_md_size(lsm->lsm_entries[0]->lsme_stripe_count, + lsm->lsm_entries[0]->lsme_magic); + + LASSERT(lsm->lsm_magic == LOV_MAGIC_COMP_V1); + + size = sizeof(struct lov_comp_md_v1); + for (entry = 0; entry < lsm->lsm_entry_count; entry++) { + lsme = lsm->lsm_entries[entry]; + + size += sizeof(*lsme); + size += lov_mds_md_size(lsme->lsme_stripe_count, + lsme->lsme_magic); + } + + return size; +} + static inline bool lsm_has_objects(struct lov_stripe_md *lsm) { return lsm && !lsm->lsm_is_released; diff --git a/drivers/staging/lustre/lustre/lov/lov_object.c b/drivers/staging/lustre/lustre/lov/lov_object.c index a7d3068..8596c2f 100644 --- a/drivers/staging/lustre/lustre/lov/lov_object.c +++ b/drivers/staging/lustre/lustre/lov/lov_object.c @@ -1641,8 +1641,7 @@ static int lov_object_layout_get(const struct lu_env *env, return 0; } - cl->cl_size = lov_mds_md_size(lsm->lsm_entries[0]->lsme_stripe_count, - lsm->lsm_magic); + cl->cl_size = lov_comp_md_size(lsm); cl->cl_layout_gen = lsm->lsm_layout_gen; rc = lov_lsm_pack(lsm, buf->lb_buf, buf->lb_len); diff --git a/drivers/staging/lustre/lustre/lov/lov_pack.c b/drivers/staging/lustre/lustre/lov/lov_pack.c index ba7c488..79d8a32 100644 --- a/drivers/staging/lustre/lustre/lov/lov_pack.c +++ b/drivers/staging/lustre/lustre/lov/lov_pack.c @@ -107,8 +107,8 @@ void lov_dump_lmm_v3(int level, struct lov_mds_md_v3 *lmm) * then return the size needed. If \a buf_size is too small then * return -ERANGE. Otherwise return the size of the result. */ -ssize_t lov_lsm_pack(const struct lov_stripe_md *lsm, void *buf, - size_t buf_size) +ssize_t lov_lsm_pack_v1v3(const struct lov_stripe_md *lsm, void *buf, + size_t buf_size) { struct lov_ost_data_v1 *lmm_objects; struct lov_mds_md_v1 *lmmv1 = buf; @@ -157,6 +157,88 @@ ssize_t lov_lsm_pack(const struct lov_stripe_md *lsm, void *buf, return lmm_size; } +ssize_t lov_lsm_pack(const struct lov_stripe_md *lsm, void *buf, + size_t buf_size) +{ + struct lov_comp_md_v1 *lcmv1 = buf; + struct lov_comp_md_entry_v1 *lcme; + struct lov_ost_data_v1 *lmm_objects; + unsigned int offset; + unsigned int entry; + unsigned int size; + unsigned int i; + size_t lmm_size; + + if (lsm->lsm_magic == LOV_MAGIC_V1 || lsm->lsm_magic == LOV_MAGIC_V3) + return lov_lsm_pack_v1v3(lsm, buf, buf_size); + + lmm_size = lov_comp_md_size(lsm); + if (buf_size == 0) + return lmm_size; + + if (buf_size < lmm_size) + return -ERANGE; + + lcmv1->lcm_magic = cpu_to_le32(lsm->lsm_magic); + lcmv1->lcm_size = cpu_to_le32(lmm_size); + lcmv1->lcm_layout_gen = cpu_to_le32(lsm->lsm_layout_gen); + lcmv1->lcm_entry_count = cpu_to_le16(lsm->lsm_entry_count); + + offset = sizeof(*lcmv1) + sizeof(*lcme) * lsm->lsm_entry_count; + + for (entry = 0; entry < lsm->lsm_entry_count; entry++) { + struct lov_stripe_md_entry *lsme; + struct lov_mds_md *lmm; + + lsme = lsm->lsm_entries[entry]; + lcme = &lcmv1->lcm_entries[entry]; + + lcme->lcme_id = cpu_to_le32(lsme->lsme_id); + lcme->lcme_extent.e_start = + cpu_to_le64(lsme->lsme_extent.e_start); + lcme->lcme_extent.e_end = + cpu_to_le64(lsme->lsme_extent.e_end); + lcme->lcme_offset = cpu_to_le32(offset); + + lmm = (struct lov_mds_md *)((char *)lcmv1 + offset); + lmm->lmm_magic = cpu_to_le32(lsme->lsme_magic); + /* lmm->lmm_oi not set */ + lmm->lmm_pattern = cpu_to_le32(lsme->lsme_pattern); + lmm->lmm_stripe_size = cpu_to_le32(lsme->lsme_stripe_size); + lmm->lmm_stripe_count = cpu_to_le16(lsme->lsme_stripe_count); + lmm->lmm_layout_gen = cpu_to_le16(lsme->lsme_layout_gen); + + if (lsme->lsme_magic == LOV_MAGIC_V3) { + struct lov_mds_md_v3 *lmmv3; + + lmmv3 = (struct lov_mds_md_v3 *)lmm; + + strlcpy(lmmv3->lmm_pool_name, lsme->lsme_pool_name, + sizeof(lmmv3->lmm_pool_name)); + lmm_objects = lmmv3->lmm_objects; + } else { + lmm_objects = ((struct lov_mds_md_v1 *)lmm)->lmm_objects; + } + + for (i = 0; i < lsme->lsme_stripe_count; i++) { + struct lov_oinfo *loi = lsme->lsme_oinfo[i]; + + ostid_cpu_to_le(&loi->loi_oi, &lmm_objects[i].l_ost_oi); + lmm_objects[i].l_ost_gen = + cpu_to_le32(loi->loi_ost_gen); + lmm_objects[i].l_ost_idx = + cpu_to_le32(loi->loi_ost_idx); + } + + size = lov_mds_md_size(lsme->lsme_stripe_count, + lsme->lsme_magic); + lcme->lcme_size = cpu_to_le32(size); + offset += size; + } /* for each layout component */ + + return lmm_size; +} + /* Find the max stripecount we should use */ __u16 lov_get_stripecnt(struct lov_obd *lov, __u32 magic, __u16 stripe_count) { @@ -227,53 +309,23 @@ int lov_getstripe(struct lov_object *obj, struct lov_stripe_md *lsm, struct lov_user_md __user *lump) { /* we use lov_user_md_v3 because it is larger than lov_user_md_v1 */ - struct lov_user_md_v3 lum; struct lov_mds_md *lmmk; - u32 stripe_count; ssize_t lmm_size; size_t lmmk_size; - size_t lum_size; - int rc; + int rc = 0; if (!lsm) return -ENODATA; - if (lsm->lsm_magic != LOV_MAGIC_V1 && lsm->lsm_magic != LOV_MAGIC_V3) { + if (lsm->lsm_magic != LOV_MAGIC_V1 && lsm->lsm_magic != LOV_MAGIC_V3 && + lsm->lsm_magic != LOV_MAGIC_COMP_V1) { CERROR("bad LSM MAGIC: 0x%08X != 0x%08X nor 0x%08X\n", lsm->lsm_magic, LOV_MAGIC_V1, LOV_MAGIC_V3); rc = -EIO; goto out; } - if (!lsm->lsm_is_released) - stripe_count = lsm->lsm_entries[0]->lsme_stripe_count; - else - stripe_count = 0; - - /* we only need the header part from user space to get lmm_magic and - * lmm_stripe_count, (the header part is common to v1 and v3) - */ - lum_size = sizeof(struct lov_user_md_v1); - if (copy_from_user(&lum, lump, lum_size)) { - rc = -EFAULT; - goto out; - } - if (lum.lmm_magic != LOV_USER_MAGIC_V1 && - lum.lmm_magic != LOV_USER_MAGIC_V3 && - lum.lmm_magic != LOV_USER_MAGIC_SPECIFIC) { - rc = -EINVAL; - goto out; - } - - if (lum.lmm_stripe_count && lum.lmm_stripe_count < stripe_count) { - /* Return right size of stripe to user */ - lum.lmm_stripe_count = stripe_count; - rc = copy_to_user(lump, &lum, lum_size); - rc = -EOVERFLOW; - goto out; - } - - lmmk_size = lov_mds_md_size(stripe_count, lsm->lsm_magic); + lmmk_size = lov_comp_md_size(lsm); lmmk = kvzalloc(lmmk_size, GFP_KERNEL); if (!lmmk) { rc = -ENOMEM; @@ -286,54 +338,22 @@ int lov_getstripe(struct lov_object *obj, struct lov_stripe_md *lsm, goto out_free; } - /* FIXME: Bug 1185 - copy fields properly when structs change */ - /* struct lov_user_md_v3 and struct lov_mds_md_v3 must be the same */ - BUILD_BUG_ON(sizeof(lum) != sizeof(struct lov_mds_md_v3)); - BUILD_BUG_ON(sizeof(lum.lmm_objects[0]) != sizeof(lmmk->lmm_objects[0])); - - if (cpu_to_le32(LOV_MAGIC) != LOV_MAGIC && - (lmmk->lmm_magic == cpu_to_le32(LOV_MAGIC_V1) || - lmmk->lmm_magic == cpu_to_le32(LOV_MAGIC_V3))) { - lustre_swab_lov_mds_md(lmmk); - lustre_swab_lov_user_md_objects( + if (cpu_to_le32(LOV_MAGIC) != LOV_MAGIC) { + if (lmmk->lmm_magic == cpu_to_le32(LOV_MAGIC_V1) || + lmmk->lmm_magic == cpu_to_le32(LOV_MAGIC_V3)) { + lustre_swab_lov_mds_md(lmmk); + lustre_swab_lov_user_md_objects( (struct lov_user_ost_data *)lmmk->lmm_objects, lmmk->lmm_stripe_count); - } - - if (lum.lmm_magic == LOV_USER_MAGIC) { - /* User request for v1, we need skip lmm_pool_name */ - if (lmmk->lmm_magic == LOV_MAGIC_V3) { - memmove(((struct lov_mds_md_v1 *)lmmk)->lmm_objects, - ((struct lov_mds_md_v3 *)lmmk)->lmm_objects, - lmmk->lmm_stripe_count * - sizeof(struct lov_ost_data_v1)); - lmm_size -= LOV_MAXPOOLNAME; + } else if (lmmk->lmm_magic == cpu_to_le32(LOV_MAGIC_COMP_V1)) { + lustre_swab_lov_comp_md_v1((struct lov_comp_md_v1 *)lmmk); } - } else { - /* if v3 we just have to update the lum_size */ - lum_size = sizeof(struct lov_user_md_v3); } - /* User wasn't expecting this many OST entries */ - if (lum.lmm_stripe_count == 0) { - lmm_size = lum_size; - } else if (lum.lmm_stripe_count < lmmk->lmm_stripe_count) { - rc = -EOVERFLOW; - goto out_free; - } - /* - * Have a difference between lov_mds_md & lov_user_md. - * So we have to re-order the data before copy to user. - */ - lum.lmm_stripe_count = lmmk->lmm_stripe_count; - lum.lmm_layout_gen = lmmk->lmm_layout_gen; - ((struct lov_user_md *)lmmk)->lmm_layout_gen = lum.lmm_layout_gen; - ((struct lov_user_md *)lmmk)->lmm_stripe_count = lum.lmm_stripe_count; - if (copy_to_user(lump, lmmk, lmm_size)) + if (copy_to_user(lump, lmmk, lmmk_size)) rc = -EFAULT; else rc = 0; - out_free: kvfree(lmmk); out: -- 1.8.3.1 From jsimmons at infradead.org Sun Jan 6 22:14:03 2019 From: jsimmons at infradead.org (James Simmons) Date: Sun, 6 Jan 2019 17:14:03 -0500 Subject: [lustre-devel] [PATCH v2 08/33] lustre: lov: embedded raid0 in struct lov_layout_composite In-Reply-To: <1546812868-11794-1-git-send-email-jsimmons@infradead.org> References: <1546812868-11794-1-git-send-email-jsimmons@infradead.org> Message-ID: <1546812868-11794-9-git-send-email-jsimmons@infradead.org> From: Bobi Jam Create bare bones struct lov_layout_composite that Make client layer support composite layout. Plain layout will be stored in LOV layer as a composite layout containing a single component. Signed-off-by: Jinshan Xiong Signed-off-by: Bobi Jam Signed-off-by: Niu Yawei WC-bug-id: https://jira.whamcloud.com/browse/LU-8998 Reviewed-on: https://review.whamcloud.com/24850 Reviewed-by: Lai Siyao Signed-off-by: James Simmons --- .../staging/lustre/lustre/lov/lov_cl_internal.h | 78 ++++++++++++---------- drivers/staging/lustre/lustre/lov/lov_object.c | 8 +-- drivers/staging/lustre/lustre/lov/lovsub_object.c | 8 +-- 3 files changed, 50 insertions(+), 44 deletions(-) diff --git a/drivers/staging/lustre/lustre/lov/lov_cl_internal.h b/drivers/staging/lustre/lustre/lov/lov_cl_internal.h index e4f7621..c6ace49 100644 --- a/drivers/staging/lustre/lustre/lov/lov_cl_internal.h +++ b/drivers/staging/lustre/lustre/lov/lov_cl_internal.h @@ -129,6 +129,42 @@ static inline char *llt2str(enum lov_layout_type llt) return ""; } +struct lov_layout_raid0 { + unsigned int lo_nr; + /** + * When this is true, lov_object::lo_attr contains + * valid up to date attributes for a top-level + * object. This field is reset to 0 when attributes of + * any sub-object change. + */ + int lo_attr_valid; + /** + * Array of sub-objects. Allocated when top-object is + * created (lov_init_raid0()). + * + * Top-object is a strict master of its sub-objects: + * it is created before them, and outlives its + * children (this later is necessary so that basic + * functions like cl_object_top() always + * work). Top-object keeps a reference on every + * sub-object. + * + * When top-object is destroyed (lov_delete_raid0()) + * it releases its reference to a sub-object and waits + * until the latter is finally destroyed. + */ + struct lovsub_object **lo_sub; + /** + * protect lo_sub + */ + spinlock_t lo_sub_lock; + /** + * Cached object attribute, built from sub-object + * attributes. + */ + struct cl_attr lo_attr; +}; + /** * lov-specific file state. * @@ -178,45 +214,15 @@ struct lov_object { struct lov_stripe_md *lo_lsm; union lov_layout_state { - struct lov_layout_raid0 { - unsigned int lo_nr; - /** - * When this is true, lov_object::lo_attr contains - * valid up to date attributes for a top-level - * object. This field is reset to 0 when attributes of - * any sub-object change. - */ - int lo_attr_valid; - /** - * Array of sub-objects. Allocated when top-object is - * created (lov_init_raid0()). - * - * Top-object is a strict master of its sub-objects: - * it is created before them, and outlives its - * children (this later is necessary so that basic - * functions like cl_object_top() always - * work). Top-object keeps a reference on every - * sub-object. - * - * When top-object is destroyed (lov_delete_raid0()) - * it releases its reference to a sub-object and waits - * until the latter is finally destroyed. - */ - struct lovsub_object **lo_sub; - /** - * protect lo_sub - */ - spinlock_t lo_sub_lock; - /** - * Cached object attribute, built from sub-object - * attributes. - */ - struct cl_attr lo_attr; - } raid0; struct lov_layout_state_empty { } empty; struct lov_layout_state_released { } released; + struct lov_layout_composite { + struct lov_layout_entry { + struct lov_layout_raid0 lle_raid0; + } lo_entries; + } composite; } u; /** * Thread that acquired lov_object::lo_type_guard in an exclusive @@ -627,7 +633,7 @@ static inline struct lov_layout_raid0 *lov_r0(struct lov_object *lov) LASSERT(lov->lo_type == LLT_RAID0); LASSERT(lov->lo_lsm->lsm_magic == LOV_MAGIC || lov->lo_lsm->lsm_magic == LOV_MAGIC_V3); - return &lov->u.raid0; + return &lov->u.composite.lo_entries.lle_raid0; } /* lov_pack.c */ diff --git a/drivers/staging/lustre/lustre/lov/lov_object.c b/drivers/staging/lustre/lustre/lov/lov_object.c index ad2901a..15ed378 100644 --- a/drivers/staging/lustre/lustre/lov/lov_object.c +++ b/drivers/staging/lustre/lustre/lov/lov_object.c @@ -228,7 +228,7 @@ static int lov_init_raid0(const struct lu_env *env, struct lov_device *dev, struct lov_thread_info *lti = lov_env_info(env); struct cl_object_conf *subconf = <i->lti_stripe_conf; struct lu_fid *ofid = <i->lti_fid; - struct lov_layout_raid0 *r0 = &state->raid0; + struct lov_layout_raid0 *r0 = &state->composite.lo_entries.lle_raid0; if (lsm->lsm_magic != LOV_MAGIC_V1 && lsm->lsm_magic != LOV_MAGIC_V3) { dump_lsm(D_ERROR, lsm); @@ -375,7 +375,7 @@ static void lov_subobject_kill(const struct lu_env *env, struct lov_object *lov, wait_queue_head_t *wq; wait_queue_entry_t *waiter; - r0 = &lov->u.raid0; + r0 = &lov->u.composite.lo_entries.lle_raid0; LASSERT(r0->lo_sub[idx] == los); sub = lovsub2cl(los); @@ -418,7 +418,7 @@ static void lov_subobject_kill(const struct lu_env *env, struct lov_object *lov, static int lov_delete_raid0(const struct lu_env *env, struct lov_object *lov, union lov_layout_state *state) { - struct lov_layout_raid0 *r0 = &state->raid0; + struct lov_layout_raid0 *r0 = &state->composite.lo_entries.lle_raid0; struct lov_stripe_md *lsm = lov->lo_lsm; int i; @@ -451,7 +451,7 @@ static void lov_fini_empty(const struct lu_env *env, struct lov_object *lov, static void lov_fini_raid0(const struct lu_env *env, struct lov_object *lov, union lov_layout_state *state) { - struct lov_layout_raid0 *r0 = &state->raid0; + struct lov_layout_raid0 *r0 = &state->composite.lo_entries.lle_raid0; if (r0->lo_sub) { kvfree(r0->lo_sub); diff --git a/drivers/staging/lustre/lustre/lov/lovsub_object.c b/drivers/staging/lustre/lustre/lov/lovsub_object.c index 13d4520..7360c16 100644 --- a/drivers/staging/lustre/lustre/lov/lovsub_object.c +++ b/drivers/staging/lustre/lustre/lov/lovsub_object.c @@ -80,10 +80,10 @@ static void lovsub_object_free(const struct lu_env *env, struct lu_object *obj) */ if (lov) { LASSERT(lov->lo_type == LLT_RAID0); - LASSERT(lov->u.raid0.lo_sub[los->lso_index] == los); - spin_lock(&lov->u.raid0.lo_sub_lock); - lov->u.raid0.lo_sub[los->lso_index] = NULL; - spin_unlock(&lov->u.raid0.lo_sub_lock); + LASSERT(lov->u.composite.lo_entries.lle_raid0.lo_sub[los->lso_index] == los); + spin_lock(&lov->u.composite.lo_entries.lle_raid0.lo_sub_lock); + lov->u.composite.lo_entries.lle_raid0.lo_sub[los->lso_index] = NULL; + spin_unlock(&lov->u.composite.lo_entries.lle_raid0.lo_sub_lock); } lu_object_fini(obj); -- 1.8.3.1 From jsimmons at infradead.org Sun Jan 6 22:13:55 2019 From: jsimmons at infradead.org (James Simmons) Date: Sun, 6 Jan 2019 17:13:55 -0500 Subject: [lustre-devel] [PATCH v2 00/33] lustre: add PFL support Message-ID: <1546812868-11794-1-git-send-email-jsimmons@infradead.org> Progressive file layouts are characterized by increasing the stripe count of the file in a step-wise manner as the file offset increases. This will be achieved by using multiple extent-based composite layouts as described in the Layout Enhancement High Level Design: http://wiki.lustre.org/Layout_Enhancement_High_Level_Design This was the key item still missing in the linux lustre client. We added this funcitonality with this patch set. With this last key feature added this brings the linux lustre client on about the same level as the 2.10.6 LTS. Since this is the case we can bump the lustre version. Andreas Dilger (1): lustre: lov: use stripe_count instead of stripe_nr Bobi Jam (20): lustre: lov: move code for PFL work lustre: lov: merge lov_mds_md_v3 and lov_mds_md_v1 handling lustre: lov: fold lmm_verify() handling into lmm_unpackmd() lustre: lov: create struct lov_stripe_md_entry lustre: lov: add composite layout unpacking lustre: lov: embedded raid0 in struct lov_layout_composite lustre: lov: migrate lov raid0 to future PFL component handling lustre: lov: reduce code indentation lustre: lov: change lo_entries to array. lustre: lov: move around PFL code and cleanups lustre: lov: remove lsm_stripe_by_[index|offset]_plain lustre: lov: add looping lsm_entry_count times lustre: lov: create lov_comp_* wrappers lustre: clio: client side implementation for PFL lustre: pfl: dynamic layout modification with write/truncate lustre: pfl: calculate PFL file LOVEA correctly lustre: lov: keep minimum LOVEA size lustre: pfl: fix hang with grouplocks lustre: pfl: fix ost pool op->size handling lustre: llite: restore ll_file_getstripe in ll_lov_setstripe Fan Yong (1): lustre: pfl: enhance PFID EA for PFL James Simmons (2): lustre: clio: fix incorrect invariant in cl_io_iter_fini() lustre: update version to 2.9.99 Jinshan Xiong (3): lustre: pfl: Read should not trigger layout write intent lustre: lov: readahead shouldn't exceed component boundary lustre: lov: do not split IO for single striped file Mike Pershin (1): lustre: lov: call cl_object_attr_get under cl_attr lock Niu Yawei (4): lustre: pfl: Basic data structures for composite layout lustre: clio: getstripe support comp layout lustre: uapi: support negative flags lustre: llite: return v1/v3 layout for legacy app wang di (1): lustre: ldlm: Transfer layout only if layout lock is granted .../lustre/include/uapi/linux/lustre/lustre_idl.h | 36 +- .../lustre/include/uapi/linux/lustre/lustre_user.h | 84 ++- .../lustre/include/uapi/linux/lustre/lustre_ver.h | 4 +- drivers/staging/lustre/lustre/include/cl_object.h | 12 +- drivers/staging/lustre/lustre/include/lustre_sec.h | 4 +- .../staging/lustre/lustre/include/lustre_swab.h | 1 + drivers/staging/lustre/lustre/include/obd.h | 4 - drivers/staging/lustre/lustre/ldlm/ldlm_lockd.c | 18 - drivers/staging/lustre/lustre/llite/dir.c | 38 +- drivers/staging/lustre/lustre/llite/file.c | 200 +++-- .../staging/lustre/lustre/llite/llite_internal.h | 3 + drivers/staging/lustre/lustre/llite/vvp_io.c | 44 +- drivers/staging/lustre/lustre/llite/xattr.c | 70 +- .../staging/lustre/lustre/lov/lov_cl_internal.h | 191 ++--- drivers/staging/lustre/lustre/lov/lov_ea.c | 570 ++++++++++---- drivers/staging/lustre/lustre/lov/lov_internal.h | 177 +++-- drivers/staging/lustre/lustre/lov/lov_io.c | 651 +++++++++------- drivers/staging/lustre/lustre/lov/lov_lock.c | 94 ++- drivers/staging/lustre/lustre/lov/lov_merge.c | 12 +- drivers/staging/lustre/lustre/lov/lov_object.c | 833 ++++++++++++--------- drivers/staging/lustre/lustre/lov/lov_offset.c | 65 +- drivers/staging/lustre/lustre/lov/lov_pack.c | 368 +++++---- drivers/staging/lustre/lustre/lov/lov_page.c | 42 +- drivers/staging/lustre/lustre/lov/lov_pool.c | 20 +- drivers/staging/lustre/lustre/lov/lov_request.c | 4 +- drivers/staging/lustre/lustre/lov/lovsub_object.c | 23 +- drivers/staging/lustre/lustre/mdc/mdc_locks.c | 89 ++- drivers/staging/lustre/lustre/obdclass/cl_io.c | 2 +- drivers/staging/lustre/lustre/obdclass/cl_object.c | 5 +- drivers/staging/lustre/lustre/obdclass/genops.c | 16 +- drivers/staging/lustre/lustre/osc/osc_io.c | 4 +- drivers/staging/lustre/lustre/osc/osc_lock.c | 7 +- drivers/staging/lustre/lustre/ptlrpc/layout.c | 6 +- .../staging/lustre/lustre/ptlrpc/pack_generic.c | 84 ++- .../staging/lustre/lustre/ptlrpc/ptlrpc_internal.h | 7 +- drivers/staging/lustre/lustre/ptlrpc/sec.c | 5 +- drivers/staging/lustre/lustre/ptlrpc/wiretest.c | 125 +++- 37 files changed, 2507 insertions(+), 1411 deletions(-) -- 1.8.3.1 From jsimmons at infradead.org Sun Jan 6 22:13:58 2019 From: jsimmons at infradead.org (James Simmons) Date: Sun, 6 Jan 2019 17:13:58 -0500 Subject: [lustre-devel] [PATCH v2 03/33] lustre: lov: move code for PFL work In-Reply-To: <1546812868-11794-1-git-send-email-jsimmons@infradead.org> References: <1546812868-11794-1-git-send-email-jsimmons@infradead.org> Message-ID: <1546812868-11794-4-git-send-email-jsimmons@infradead.org> From: Bobi Jam Move lov_tgt_maxbytes() and lsm_free_plain() toward the top of lov_ea.c for upcoming PFL work. Migrate inline function lsm_op_find() out of lov_internal.h to lov_ea.c since it is consider bad code style to add define external structures and have an inline function in the same header. Instead only add lsm_op_find() prototype to lov_internal.h and make all the struct lsm_operations static in lov_ea.c. Signed-off-by: John L. Hammond Signed-off-by: Bobi Jam Signed-off-by: Niu Yawei WC-bug-id: https://jira.whamcloud.com/browse/LU-8998 Reviewed-on: https://review.whamcloud.com/24849 Reviewed-by: Jinshan Xiong Reviewed-by: Andreas Dilger Signed-off-by: James Simmons --- drivers/staging/lustre/lustre/lov/lov_ea.c | 87 ++++++++++++++---------- drivers/staging/lustre/lustre/lov/lov_internal.h | 16 +---- 2 files changed, 51 insertions(+), 52 deletions(-) diff --git a/drivers/staging/lustre/lustre/lov/lov_ea.c b/drivers/staging/lustre/lustre/lov/lov_ea.c index c80320a..3dfb204 100644 --- a/drivers/staging/lustre/lustre/lov/lov_ea.c +++ b/drivers/staging/lustre/lustre/lov/lov_ea.c @@ -44,6 +44,33 @@ #include "lov_internal.h" +/* + * Find minimum stripe maxbytes value. For inactive or + * reconnecting targets use LUSTRE_EXT3_STRIPE_MAXBYTES. + */ +static loff_t lov_tgt_maxbytes(struct lov_tgt_desc *tgt) +{ + loff_t maxbytes = LUSTRE_EXT3_STRIPE_MAXBYTES; + struct obd_import *imp; + + if (!tgt->ltd_active) + return maxbytes; + + imp = tgt->ltd_obd->u.cli.cl_import; + if (!imp) + return maxbytes; + + spin_lock(&imp->imp_lock); + if (imp->imp_state == LUSTRE_IMP_FULL && + (imp->imp_connect_data.ocd_connect_flags & OBD_CONNECT_MAXBYTES) && + imp->imp_connect_data.ocd_maxbytes > 0) + maxbytes = imp->imp_connect_data.ocd_maxbytes; + + spin_unlock(&imp->imp_lock); + + return maxbytes; +} + static int lsm_lmm_verify_common(struct lov_mds_md *lmm, int lmm_bytes, __u16 stripe_count) { @@ -76,6 +103,16 @@ static int lsm_lmm_verify_common(struct lov_mds_md *lmm, int lmm_bytes, return 0; } +void lsm_free_plain(struct lov_stripe_md *lsm) +{ + __u16 stripe_count = lsm->lsm_stripe_count; + int i; + + for (i = 0; i < stripe_count; i++) + kmem_cache_free(lov_oinfo_slab, lsm->lsm_oinfo[i]); + kvfree(lsm); +} + struct lov_stripe_md *lsm_alloc_plain(u16 stripe_count) { size_t oinfo_ptrs_size, lsm_size; @@ -108,43 +145,6 @@ struct lov_stripe_md *lsm_alloc_plain(u16 stripe_count) return NULL; } -void lsm_free_plain(struct lov_stripe_md *lsm) -{ - __u16 stripe_count = lsm->lsm_stripe_count; - int i; - - for (i = 0; i < stripe_count; i++) - kmem_cache_free(lov_oinfo_slab, lsm->lsm_oinfo[i]); - kvfree(lsm); -} - -/* - * Find minimum stripe maxbytes value. For inactive or - * reconnecting targets use LUSTRE_EXT3_STRIPE_MAXBYTES. - */ -static loff_t lov_tgt_maxbytes(struct lov_tgt_desc *tgt) -{ - loff_t maxbytes = LUSTRE_EXT3_STRIPE_MAXBYTES; - struct obd_import *imp; - - if (!tgt->ltd_active) - return maxbytes; - - imp = tgt->ltd_obd->u.cli.cl_import; - if (!imp) - return maxbytes; - - spin_lock(&imp->imp_lock); - if (imp->imp_state == LUSTRE_IMP_FULL && - (imp->imp_connect_data.ocd_connect_flags & OBD_CONNECT_MAXBYTES) && - imp->imp_connect_data.ocd_maxbytes > 0) - maxbytes = imp->imp_connect_data.ocd_maxbytes; - - spin_unlock(&imp->imp_lock); - - return maxbytes; -} - static int lsm_unpackmd_common(struct lov_obd *lov, struct lov_stripe_md *lsm, struct lov_mds_md *lmm, @@ -320,6 +320,19 @@ static int lsm_unpackmd_v3(struct lov_obd *lov, struct lov_stripe_md *lsm, .lsm_unpackmd = lsm_unpackmd_v3, }; +const struct lsm_operations *lsm_op_find(int magic) +{ + switch (magic) { + case LOV_MAGIC_V1: + return &lsm_v1_ops; + case LOV_MAGIC_V3: + return &lsm_v3_ops; + default: + CERROR("unrecognized lsm_magic %08x\n", magic); + return NULL; + } +} + void dump_lsm(unsigned int level, const struct lov_stripe_md *lsm) { CDEBUG(level, "lsm %p, objid " DOSTID ", maxbytes %#llx, magic 0x%08X, stripe_size %u, stripe_count %u, refc: %d, layout_gen %u, pool [" LOV_POOLNAMEF "]\n", diff --git a/drivers/staging/lustre/lustre/lov/lov_internal.h b/drivers/staging/lustre/lustre/lov/lov_internal.h index 44a997e..51f416e 100644 --- a/drivers/staging/lustre/lustre/lov/lov_internal.h +++ b/drivers/staging/lustre/lustre/lov/lov_internal.h @@ -92,21 +92,7 @@ struct lsm_operations { struct lov_mds_md *lmm); }; -extern const struct lsm_operations lsm_v1_ops; -extern const struct lsm_operations lsm_v3_ops; - -static inline const struct lsm_operations *lsm_op_find(int magic) -{ - switch (magic) { - case LOV_MAGIC_V1: - return &lsm_v1_ops; - case LOV_MAGIC_V3: - return &lsm_v3_ops; - default: - CERROR("unrecognized lsm_magic %08x\n", magic); - return NULL; - } -} +const struct lsm_operations *lsm_op_find(int magic); /* lov_do_div64(a, b) returns a % b, and a = a / b. * The 32-bit code is LOV-specific due to knowing about stripe limits in -- 1.8.3.1 From jsimmons at infradead.org Sun Jan 6 22:14:08 2019 From: jsimmons at infradead.org (James Simmons) Date: Sun, 6 Jan 2019 17:14:08 -0500 Subject: [lustre-devel] [PATCH v2 13/33] lustre: lov: remove lsm_stripe_by_[index|offset]_plain In-Reply-To: <1546812868-11794-1-git-send-email-jsimmons@infradead.org> References: <1546812868-11794-1-git-send-email-jsimmons@infradead.org> Message-ID: <1546812868-11794-14-git-send-email-jsimmons@infradead.org> From: Bobi Jam Since both lsm_stripe_by_index() and lsm_stripe_by_offset() are the same for lsm_operations replace them with a new universal function stripe_width(). Signed-off-by: Jinshan Xiong Signed-off-by: Bobi Jam Signed-off-by: Niu Yawei WC-bug-id: https://jira.whamcloud.com/browse/LU-8998 Reviewed-on: https://review.whamcloud.com/24850 Reviewed-by: Lai Siyao Signed-off-by: James Simmons --- drivers/staging/lustre/lustre/lov/lov_ea.c | 24 ------------------------ drivers/staging/lustre/lustre/lov/lov_internal.h | 4 ---- drivers/staging/lustre/lustre/lov/lov_offset.c | 23 +++++++++++++---------- 3 files changed, 13 insertions(+), 38 deletions(-) diff --git a/drivers/staging/lustre/lustre/lov/lov_ea.c b/drivers/staging/lustre/lustre/lov/lov_ea.c index f2a5a60..1824469 100644 --- a/drivers/staging/lustre/lustre/lov/lov_ea.c +++ b/drivers/staging/lustre/lustre/lov/lov_ea.c @@ -309,24 +309,6 @@ void lsm_free(struct lov_stripe_md *lsm) return lsm; } -static void -lsm_stripe_by_index_plain(struct lov_stripe_md *lsm, int *stripeno, - loff_t *lov_off, loff_t *swidth) -{ - if (swidth) - *swidth = (loff_t)lsm->lsm_entries[0]->lsme_stripe_size * - lsm->lsm_entries[0]->lsme_stripe_count; -} - -static void -lsm_stripe_by_offset_plain(struct lov_stripe_md *lsm, int *stripeno, - loff_t *lov_off, loff_t *swidth) -{ - if (swidth) - *swidth = (loff_t)lsm->lsm_entries[0]->lsme_stripe_size * - lsm->lsm_entries[0]->lsme_stripe_count; -} - static struct lov_stripe_md * lsm_unpackmd_v1(struct lov_obd *lov, void *buf, size_t buf_size) { @@ -336,8 +318,6 @@ void lsm_free(struct lov_stripe_md *lsm) } const static struct lsm_operations lsm_v1_ops = { - .lsm_stripe_by_index = lsm_stripe_by_index_plain, - .lsm_stripe_by_offset = lsm_stripe_by_offset_plain, .lsm_unpackmd = lsm_unpackmd_v1, }; @@ -351,8 +331,6 @@ void lsm_free(struct lov_stripe_md *lsm) } const static struct lsm_operations lsm_v3_ops = { - .lsm_stripe_by_index = lsm_stripe_by_index_plain, - .lsm_stripe_by_offset = lsm_stripe_by_offset_plain, .lsm_unpackmd = lsm_unpackmd_v3, }; @@ -502,8 +480,6 @@ static int lsm_verify_comp_md_v1(struct lov_comp_md_v1 *lcm, } const static struct lsm_operations lsm_comp_md_v1_ops = { - .lsm_stripe_by_index = lsm_stripe_by_index_plain, - .lsm_stripe_by_offset = lsm_stripe_by_offset_plain, .lsm_unpackmd = lsm_unpackmd_comp_md_v1, }; diff --git a/drivers/staging/lustre/lustre/lov/lov_internal.h b/drivers/staging/lustre/lustre/lov/lov_internal.h index 4c9e324..ebe5890 100644 --- a/drivers/staging/lustre/lustre/lov/lov_internal.h +++ b/drivers/staging/lustre/lustre/lov/lov_internal.h @@ -80,10 +80,6 @@ static inline bool lsm_has_objects(struct lov_stripe_md *lsm) } struct lsm_operations { - void (*lsm_stripe_by_index)(struct lov_stripe_md *, int *, loff_t *, - loff_t *); - void (*lsm_stripe_by_offset)(struct lov_stripe_md *, int *, loff_t *, - loff_t *); struct lov_stripe_md *(*lsm_unpackmd)(struct lov_obd *obd, void *buf, size_t buf_len); }; diff --git a/drivers/staging/lustre/lustre/lov/lov_offset.c b/drivers/staging/lustre/lustre/lov/lov_offset.c index d817aa5..513f1fd 100644 --- a/drivers/staging/lustre/lustre/lov/lov_offset.c +++ b/drivers/staging/lustre/lustre/lov/lov_offset.c @@ -37,6 +37,15 @@ #include "lov_internal.h" +static u64 stripe_width(struct lov_stripe_md *lsm, unsigned int index) +{ + struct lov_stripe_md_entry *entry = lsm->lsm_entries[index]; + + LASSERT(index < lsm->lsm_entry_count); + + return entry->lsme_stripe_size * entry->lsme_stripe_count; +} + /* compute object size given "stripeno" and the ost size */ u64 lov_stripe_size(struct lov_stripe_md *lsm, int index, u64 ost_size, int stripeno) @@ -45,12 +54,11 @@ u64 lov_stripe_size(struct lov_stripe_md *lsm, int index, u64 ost_size, unsigned long stripe_size; u64 swidth; u64 lov_size; - int magic = lsm->lsm_magic; if (ost_size == 0) return 0; - lsm_op_find(magic)->lsm_stripe_by_index(lsm, &stripeno, NULL, &swidth); + swidth = stripe_width(lsm, index); /* lov_do_div64(a, b) returns a % b, and a = a / b */ stripe_size = lov_do_div64(ost_size, ssize); @@ -129,7 +137,6 @@ int lov_stripe_offset(struct lov_stripe_md *lsm, int index, u64 lov_off, { unsigned long ssize = lsm->lsm_entries[index]->lsme_stripe_size; u64 stripe_off, this_stripe, swidth; - int magic = lsm->lsm_magic; int ret = 0; if (lov_off == OBD_OBJECT_EOF) { @@ -137,8 +144,7 @@ int lov_stripe_offset(struct lov_stripe_md *lsm, int index, u64 lov_off, return 0; } - lsm_op_find(magic)->lsm_stripe_by_index(lsm, &stripeno, &lov_off, - &swidth); + swidth = stripe_width(lsm, index); /* lov_do_div64(a, b) returns a % b, and a = a / b */ stripe_off = lov_do_div64(lov_off, swidth); @@ -184,13 +190,11 @@ u64 lov_size_to_stripe(struct lov_stripe_md *lsm, int index, u64 file_size, { unsigned long ssize = lsm->lsm_entries[index]->lsme_stripe_size; u64 stripe_off, this_stripe, swidth; - int magic = lsm->lsm_magic; if (file_size == OBD_OBJECT_EOF) return OBD_OBJECT_EOF; - lsm_op_find(magic)->lsm_stripe_by_index(lsm, &stripeno, &file_size, - &swidth); + swidth = stripe_width(lsm, index); /* lov_do_div64(a, b) returns a % b, and a = a / b */ stripe_off = lov_do_div64(file_size, swidth); @@ -258,9 +262,8 @@ int lov_stripe_number(struct lov_stripe_md *lsm, int index, u64 lov_off) { unsigned long ssize = lsm->lsm_entries[index]->lsme_stripe_size; u64 stripe_off, swidth; - int magic = lsm->lsm_magic; - lsm_op_find(magic)->lsm_stripe_by_offset(lsm, NULL, &lov_off, &swidth); + swidth = stripe_width(lsm, index); stripe_off = lov_do_div64(lov_off, swidth); -- 1.8.3.1 From jsimmons at infradead.org Sun Jan 6 22:14:09 2019 From: jsimmons at infradead.org (James Simmons) Date: Sun, 6 Jan 2019 17:14:09 -0500 Subject: [lustre-devel] [PATCH v2 14/33] lustre: lov: add looping lsm_entry_count times In-Reply-To: <1546812868-11794-1-git-send-email-jsimmons@infradead.org> References: <1546812868-11794-1-git-send-email-jsimmons@infradead.org> Message-ID: <1546812868-11794-15-git-send-email-jsimmons@infradead.org> From: Bobi Jam Create lov_for_each_layout_entry() and lov_lse() to handle when lsm_entry_count will be greater than one. Modifiy various code blocks to loop lsm_entry_count times. Signed-off-by: Jinshan Xiong Signed-off-by: Bobi Jam Signed-off-by: Niu Yawei WC-bug-id: https://jira.whamcloud.com/browse/LU-8998 Reviewed-on: https://review.whamcloud.com/24850 Reviewed-by: Lai Siyao Signed-off-by: James Simmons --- .../staging/lustre/lustre/lov/lov_cl_internal.h | 13 +++ drivers/staging/lustre/lustre/lov/lov_ea.c | 20 +++- drivers/staging/lustre/lustre/lov/lov_io.c | 88 +++++++++------- drivers/staging/lustre/lustre/lov/lov_merge.c | 6 +- drivers/staging/lustre/lustre/lov/lov_object.c | 116 +++++++++++++-------- 5 files changed, 156 insertions(+), 87 deletions(-) diff --git a/drivers/staging/lustre/lustre/lov/lov_cl_internal.h b/drivers/staging/lustre/lustre/lov/lov_cl_internal.h index ce32823..952da3a 100644 --- a/drivers/staging/lustre/lustre/lov/lov_cl_internal.h +++ b/drivers/staging/lustre/lustre/lov/lov_cl_internal.h @@ -235,6 +235,11 @@ struct lov_object { struct task_struct *lo_owner; }; +#define lov_foreach_layout_entry(lov, entry) \ + for (entry = &lov->u.composite.lo_entries[0]; \ + entry < &lov->u.composite.lo_entries[lov->u.composite.lo_entry_count];\ + entry++) + /** * State lov_lock keeps for each sub-lock. */ @@ -642,6 +647,14 @@ static inline struct lov_layout_raid0 *lov_r0(struct lov_object *lov, int i) return &lov->u.composite.lo_entries[i].lle_raid0; } +static inline struct lov_stripe_md_entry *lov_lse(struct lov_object *lov, int i) +{ + LASSERT(lov->lo_lsm); + LASSERT(i < lov->lo_lsm->lsm_entry_count); + + return lov->lo_lsm->lsm_entries[i]; +} + /* lov_pack.c */ int lov_getstripe(struct lov_object *obj, struct lov_stripe_md *lsm, struct lov_user_md __user *lump); diff --git a/drivers/staging/lustre/lustre/lov/lov_ea.c b/drivers/staging/lustre/lustre/lov/lov_ea.c index 1824469..ff6b251 100644 --- a/drivers/staging/lustre/lustre/lov/lov_ea.c +++ b/drivers/staging/lustre/lustre/lov/lov_ea.c @@ -507,11 +507,21 @@ const struct lsm_operations *lsm_op_find(int magic) void dump_lsm(unsigned int level, const struct lov_stripe_md *lsm) { + int i; + CDEBUG(level, - "lsm %p, objid " DOSTID ", maxbytes %#llx, magic 0x%08X, stripe_size %u, stripe_count %u, refc: %d, layout_gen %u, pool [" LOV_POOLNAMEF "]\n", + "lsm %p, objid " DOSTID ", maxbytes %#llx, magic 0x%08X, refc: %d, entry: %u, layout_gen %u\n", lsm, POSTID(&lsm->lsm_oi), lsm->lsm_maxbytes, lsm->lsm_magic, - lsm->lsm_entries[0]->lsme_stripe_size, - lsm->lsm_entries[0]->lsme_stripe_count, - atomic_read(&lsm->lsm_refc), lsm->lsm_layout_gen, - lsm->lsm_entries[0]->lsme_pool_name); + atomic_read(&lsm->lsm_refc), lsm->lsm_entry_count, + lsm->lsm_layout_gen); + + for (i = 0; i < lsm->lsm_entry_count; i++) { + struct lov_stripe_md_entry *lse = lsm->lsm_entries[i]; + + CDEBUG(level, + ": id: %u, magic 0x%08X, stripe count %u, size %u, layout_gen %u, pool: [" LOV_POOLNAMEF "]\n", + lse->lsme_id, lse->lsme_magic, + lse->lsme_stripe_count, lse->lsme_stripe_size, + lse->lsme_layout_gen, lse->lsme_pool_name); + } } diff --git a/drivers/staging/lustre/lustre/lov/lov_io.c b/drivers/staging/lustre/lustre/lov/lov_io.c index ab97326..7fdbed9 100644 --- a/drivers/staging/lustre/lustre/lov/lov_io.c +++ b/drivers/staging/lustre/lustre/lov/lov_io.c @@ -368,46 +368,59 @@ static int lov_io_iter_init(const struct lu_env *env, { struct lov_io *lio = cl2lov_io(env, ios); struct lov_stripe_md *lsm = lio->lis_object->lo_lsm; + struct lov_layout_entry *le; struct lov_io_sub *sub; u64 endpos; - u64 start; - u64 end; - int stripe; int rc = 0; - int index = 0; + int index; endpos = lov_offset_mod(lio->lis_endpos, -1); - for (stripe = 0; stripe < lio->lis_stripe_count; stripe++) { - if (!lov_stripe_intersects(lsm, index, stripe, lio->lis_pos, - endpos, &start, &end)) - continue; - - if (unlikely(!lov_r0(lio->lis_object, index)->lo_sub[stripe])) { - if (ios->cis_io->ci_type == CIT_READ || - ios->cis_io->ci_type == CIT_WRITE || - ios->cis_io->ci_type == CIT_FAULT) - return -EIO; - continue; - } + index = 0; + lov_foreach_layout_entry(lio->lis_object, le) { + struct lov_layout_raid0 *r0 = &le->lle_raid0; + int stripe; + u64 start; + u64 end; + + index++; + + for (stripe = 0; stripe < r0->lo_nr; stripe++) { + if (!lov_stripe_intersects(lsm, index - 1, stripe, + lio->lis_pos, + endpos, &start, &end)) + continue; + + if (unlikely(!r0->lo_sub[stripe])) { + if (ios->cis_io->ci_type == CIT_READ || + ios->cis_io->ci_type == CIT_WRITE || + ios->cis_io->ci_type == CIT_FAULT) + return -EIO; + + continue; + } + + end = lov_offset_mod(end, 1); + sub = lov_sub_get(env, lio, stripe); + if (IS_ERR(sub)) { + rc = PTR_ERR(sub); + break; + } - end = lov_offset_mod(end, 1); - sub = lov_sub_get(env, lio, stripe); - if (IS_ERR(sub)) { - rc = PTR_ERR(sub); - break; - } + lov_io_sub_inherit(sub->sub_io, lio, stripe, start, end); + rc = cl_io_iter_init(sub->sub_env, sub->sub_io); + if (rc) { + cl_io_iter_fini(sub->sub_env, sub->sub_io); + break; + } - lov_io_sub_inherit(sub->sub_io, lio, stripe, start, end); - rc = cl_io_iter_init(sub->sub_env, sub->sub_io); - if (rc) { - cl_io_iter_fini(sub->sub_env, sub->sub_io); - break; - } - CDEBUG(D_VFSTRACE, "shrink: %d [%llu, %llu)\n", - stripe, start, end); + CDEBUG(D_VFSTRACE, "shrink: %d [%llu, %llu)\n", + stripe, start, end); - list_add_tail(&sub->sub_linkage, &lio->lis_active); + list_add_tail(&sub->sub_linkage, &lio->lis_active); + } + if (rc) + break; } return rc; } @@ -417,13 +430,18 @@ static int lov_io_rw_iter_init(const struct lu_env *env, { struct lov_io *lio = cl2lov_io(env, ios); struct cl_io *io = ios->cis_io; - struct lov_stripe_md *lsm = lio->lis_object->lo_lsm; - unsigned long ssize = lsm->lsm_entries[0]->lsme_stripe_size; u64 start = io->u.ci_rw.crw_pos; + struct lov_stripe_md_entry *lse; + unsigned long ssize; loff_t next; + int index = 0; LASSERT(io->ci_type == CIT_READ || io->ci_type == CIT_WRITE); + lse = lov_lse(lio->lis_object, index); + + ssize = lse->lsme_stripe_size; + /* fast path for common case. */ if (lio->lis_nr_subios != 1 && !cl_io_is_append(io)) { lov_do_div64(start, ssize); @@ -598,12 +616,12 @@ static int lov_io_read_ahead(const struct lu_env *env, if (ra_end != CL_PAGE_EOF) ra_end = lov_stripe_pgoff(loo->lo_lsm, index, ra_end, stripe); - pps = loo->lo_lsm->lsm_entries[0]->lsme_stripe_size >> PAGE_SHIFT; + pps = lov_lse(loo, index)->lsme_stripe_size >> PAGE_SHIFT; CDEBUG(D_READA, DFID " max_index = %lu, pps = %u, stripe_size = %u, stripe no = %u, start index = %lu\n", PFID(lu_object_fid(lov2lu(loo))), ra_end, pps, - loo->lo_lsm->lsm_entries[0]->lsme_stripe_size, stripe, start); + lov_lse(loo, index)->lsme_stripe_size, stripe, start); /* never exceed the end of the stripe */ ra->cra_end = min_t(pgoff_t, ra_end, start + pps - start % pps - 1); diff --git a/drivers/staging/lustre/lustre/lov/lov_merge.c b/drivers/staging/lustre/lustre/lov/lov_merge.c index 020795f..79edc26 100644 --- a/drivers/staging/lustre/lustre/lov/lov_merge.c +++ b/drivers/staging/lustre/lustre/lov/lov_merge.c @@ -44,6 +44,7 @@ int lov_merge_lvb_kms(struct lov_stripe_md *lsm, int index, struct ost_lvb *lvb, __u64 *kms_place) { + struct lov_stripe_md_entry *lse = lsm->lsm_entries[index]; __u64 size = 0; __u64 kms = 0; __u64 blocks = 0; @@ -59,8 +60,9 @@ int lov_merge_lvb_kms(struct lov_stripe_md *lsm, int index, CDEBUG(D_INODE, "MDT ID " DOSTID " initial value: s=%llu m=%llu a=%llu c=%llu b=%llu\n", POSTID(&lsm->lsm_oi), lvb->lvb_size, lvb->lvb_mtime, lvb->lvb_atime, lvb->lvb_ctime, lvb->lvb_blocks); - for (i = 0; i < lsm->lsm_entries[0]->lsme_stripe_count; i++) { - struct lov_oinfo *loi = lsm->lsm_entries[0]->lsme_oinfo[i]; + + for (i = 0; i < lse->lsme_stripe_count; i++) { + struct lov_oinfo *loi = lse->lsme_oinfo[i]; u64 lov_size, tmpsize; if (OST_LVB_IS_ERR(loi->loi_lvb.lvb_blocks)) { diff --git a/drivers/staging/lustre/lustre/lov/lov_object.c b/drivers/staging/lustre/lustre/lov/lov_object.c index 3677fac..74e95b1 100644 --- a/drivers/staging/lustre/lustre/lov/lov_object.c +++ b/drivers/staging/lustre/lustre/lov/lov_object.c @@ -217,10 +217,11 @@ static int lov_page_slice_fixup(struct lov_object *lov, } static int lov_init_raid0(const struct lu_env *env, struct lov_device *dev, - struct lov_object *lov, struct lov_stripe_md *lsm, + struct lov_object *lov, int index, const struct cl_object_conf *conf, struct lov_layout_raid0 *r0) { + struct lov_stripe_md_entry *lse = lov_lse(lov, index); struct cl_object *stripe; struct lov_thread_info *lti = lov_env_info(env); struct cl_object_conf *subconf = <i->lti_stripe_conf; @@ -230,7 +231,7 @@ static int lov_init_raid0(const struct lu_env *env, struct lov_device *dev, int i; spin_lock_init(&r0->lo_sub_lock); - r0->lo_nr = lsm->lsm_entries[0]->lsme_stripe_count; + r0->lo_nr = lse->lsme_stripe_count; LASSERT(r0->lo_nr <= lov_targets_nr(dev)); r0->lo_sub = kvzalloc(r0->lo_nr * sizeof(r0->lo_sub[0]), @@ -245,11 +246,10 @@ static int lov_init_raid0(const struct lu_env *env, struct lov_device *dev, * Create stripe cl_objects. */ for (i = 0; i < r0->lo_nr; ++i) { + struct lov_oinfo *oinfo = lse->lsme_oinfo[i]; struct cl_device *subdev; - struct lov_oinfo *oinfo; int ost_idx; - oinfo = lsm->lsm_entries[0]->lsme_oinfo[i]; if (lov_oinfo_is_dummy(oinfo)) continue; @@ -324,7 +324,7 @@ static int lov_init_composite(const struct lu_env *env, struct lov_device *dev, for (i = 0; i < entry_count; i++) { struct lov_layout_entry *le = &comp->lo_entries[i]; - result = lov_init_raid0(env, dev, lov, lsm, conf, + result = lov_init_raid0(env, dev, lov, i, conf, &le->lle_raid0); if (result < 0) break; @@ -467,13 +467,13 @@ static int lov_delete_composite(const struct lu_env *env, struct lov_object *lov, union lov_layout_state *state) { - struct lov_layout_composite *comp = &state->composite; - struct lov_layout_entry *entry = &comp->lo_entries[0]; + struct lov_layout_entry *entry; dump_lsm(D_INODE, lov->lo_lsm); lov_layout_wait(env, lov); - lov_delete_raid0(env, lov, &entry->lle_raid0); + lov_foreach_layout_entry(lov, entry) + lov_delete_raid0(env, lov, &entry->lle_raid0); return 0; } @@ -500,9 +500,10 @@ static void lov_fini_composite(const struct lu_env *env, struct lov_layout_composite *comp = &state->composite; if (comp->lo_entries) { - struct lov_layout_entry *entry = &comp->lo_entries[0]; + struct lov_layout_entry *entry; - lov_fini_raid0(env, &entry->lle_raid0); + lov_foreach_layout_entry(lov, entry) + lov_fini_raid0(env, &entry->lle_raid0); kvfree(comp->lo_entries); comp->lo_entries = NULL; @@ -548,15 +549,24 @@ static int lov_print_composite(const struct lu_env *env, void *cookie, lu_printer_t p, const struct lu_object *o) { struct lov_object *lov = lu2lov(o); - struct lov_layout_raid0 *r0 = lov_r0(lov, 0); struct lov_stripe_md *lsm = lov->lo_lsm; + int i; - (*p)(env, cookie, "stripes: %d, %s, lsm{%p 0x%08X %d %u %u}:\n", - r0->lo_nr, lov->lo_layout_invalid ? "invalid" : "valid", lsm, + (*p)(env, cookie, "entries: %d, %s, lsm{%p 0x%08X %d %u}:\n", + lsm->lsm_entry_count, + lov->lo_layout_invalid ? "invalid" : "valid", lsm, lsm->lsm_magic, atomic_read(&lsm->lsm_refc), - lsm->lsm_entries[0]->lsme_stripe_count, lsm->lsm_layout_gen); + lsm->lsm_layout_gen); + + for (i = 0; i < lsm->lsm_entry_count; i++) { + struct lov_stripe_md_entry *lse = lsm->lsm_entries[i]; - lov_print_raid0(env, cookie, p, r0); + (*p)(env, cookie, ": { 0x%08X, %u, %u, %u, %u }\n", + lse->lsme_magic, + lse->lsme_id, lse->lsme_layout_gen, + lse->lsme_stripe_count, lse->lsme_stripe_size); + lov_print_raid0(env, cookie, p, lov_r0(lov, i)); + } return 0; } @@ -589,10 +599,11 @@ static int lov_attr_get_empty(const struct lu_env *env, struct cl_object *obj, } static int lov_attr_get_raid0(const struct lu_env *env, struct lov_object *lov, - struct cl_attr *attr, struct lov_layout_raid0 *r0) + unsigned int index, struct lov_layout_raid0 *r0) { struct lov_stripe_md *lsm = lov->lo_lsm; struct ost_lvb *lvb = &lov_env_info(env)->lti_lvb; + struct cl_attr *attr = &r0->lo_attr; int result = 0; u64 kms = 0; @@ -621,7 +632,7 @@ static int lov_attr_get_raid0(const struct lu_env *env, struct lov_object *lov, * sub-object attributes. */ lov_stripe_lock(lsm); - result = lov_merge_lvb_kms(lsm, 0, lvb, &kms); + result = lov_merge_lvb_kms(lsm, index, lvb, &kms); lov_stripe_unlock(lsm); if (result) return result; @@ -638,24 +649,33 @@ static int lov_attr_get_composite(const struct lu_env *env, struct cl_attr *attr) { struct lov_object *lov = cl2lov(obj); - struct lov_layout_raid0 *r0 = lov_r0(lov, 0); - struct cl_attr *lov_attr = &r0->lo_attr; - int result; + struct lov_layout_entry *entry; + int result = 0; + int index = 0; - result = lov_attr_get_raid0(env, lov, attr, r0); - if (result) - return result; + attr->cat_blocks = 0; + attr->cat_size = 0; + lov_foreach_layout_entry(lov, entry) { + struct lov_layout_raid0 *r0 = &entry->lle_raid0; + struct cl_attr *lov_attr = &r0->lo_attr; - attr->cat_blocks = lov_attr->cat_blocks; - attr->cat_size = lov_attr->cat_size; - attr->cat_kms = lov_attr->cat_kms; - if (attr->cat_atime < lov_attr->cat_atime) - attr->cat_atime = lov_attr->cat_atime; - if (attr->cat_ctime < lov_attr->cat_ctime) - attr->cat_ctime = lov_attr->cat_ctime; - if (attr->cat_mtime < lov_attr->cat_mtime) - attr->cat_mtime = lov_attr->cat_mtime; + result = lov_attr_get_raid0(env, lov, index, r0); + if (result) + break; + /* merge results */ + attr->cat_blocks += lov_attr->cat_blocks; + if (attr->cat_size < lov_attr->cat_size) + attr->cat_size = lov_attr->cat_size; + if (attr->cat_kms < lov_attr->cat_kms) + attr->cat_kms = lov_attr->cat_kms; + if (attr->cat_atime < lov_attr->cat_atime) + attr->cat_atime = lov_attr->cat_atime; + if (attr->cat_ctime < lov_attr->cat_ctime) + attr->cat_ctime = lov_attr->cat_ctime; + if (attr->cat_mtime < lov_attr->cat_mtime) + attr->cat_mtime = lov_attr->cat_mtime; + } return result; } @@ -1089,8 +1109,7 @@ static int fiemap_calc_last_stripe(struct lov_stripe_md *lsm, int index, *stripe_count = lsme->lsme_stripe_count; } else { for (j = 0, i = start_stripe; j < lsme->lsme_stripe_count; - i = (i + 1) % lsme->lsme_stripe_count, - j++) { + i = (i + 1) % lsme->lsme_stripe_count, j++) { if (lov_stripe_intersects(lsm, index, i, fm_start, fm_end, &obd_start, &obd_end) == 0) break; @@ -1681,18 +1700,25 @@ int lov_read_and_clear_async_rc(struct cl_object *clob) int i; lsm = lov->lo_lsm; - for (i = 0; i < lsm->lsm_entries[0]->lsme_stripe_count; - i++) { - struct lov_oinfo *loi; - - loi = lsm->lsm_entries[0]->lsme_oinfo[i]; - if (lov_oinfo_is_dummy(loi)) - continue; - - if (loi->loi_ar.ar_rc && !rc) - rc = loi->loi_ar.ar_rc; - loi->loi_ar.ar_rc = 0; + LASSERT(lsm); + for (i = 0; i < lsm->lsm_entry_count; i++) { + struct lov_stripe_md_entry *lse; + int j; + + lse = lsm->lsm_entries[i]; + for (j = 0; j < lse->lsme_stripe_count; j++) { + struct lov_oinfo *loi; + + loi = lse->lsme_oinfo[j]; + if (lov_oinfo_is_dummy(loi)) + continue; + + if (loi->loi_ar.ar_rc && !rc) + rc = loi->loi_ar.ar_rc; + loi->loi_ar.ar_rc = 0; + } } + break; } case LLT_RELEASED: case LLT_EMPTY: -- 1.8.3.1 From jsimmons at infradead.org Sun Jan 6 22:14:22 2019 From: jsimmons at infradead.org (James Simmons) Date: Sun, 6 Jan 2019 17:14:22 -0500 Subject: [lustre-devel] [PATCH v2 27/33] lustre: uapi: support negative flags In-Reply-To: <1546812868-11794-1-git-send-email-jsimmons@infradead.org> References: <1546812868-11794-1-git-send-email-jsimmons@infradead.org> Message-ID: <1546812868-11794-28-git-send-email-jsimmons@infradead.org> From: Niu Yawei 'flags' can be negative flags. Signed-off-by: Niu Yawei WC-bug-id: https://jira.whamcloud.com/browse/LU-8998 Reviewed-on: https://review.whamcloud.com/26490 Reviewed-by: Andreas Dilger Reviewed-by: Jinshan Xiong Signed-off-by: James Simmons --- drivers/staging/lustre/include/uapi/linux/lustre/lustre_user.h | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/staging/lustre/include/uapi/linux/lustre/lustre_user.h b/drivers/staging/lustre/include/uapi/linux/lustre/lustre_user.h index 0f401bb..eeea79c 100644 --- a/drivers/staging/lustre/include/uapi/linux/lustre/lustre_user.h +++ b/drivers/staging/lustre/include/uapi/linux/lustre/lustre_user.h @@ -423,9 +423,12 @@ enum lov_comp_md_entry_flags { LCME_FL_OFFLINE = 0x00000004, /* Not used */ LCME_FL_PREFERRED = 0x00000008, /* Not used */ LCME_FL_INIT = 0x00000010, /* instantiated */ + LCME_FL_NEG = 0x80000000, /* used to indicate a negative + * flag, won't be stored on disk + */ }; -#define LCME_KNOWN_FLAGS LCME_FL_INIT +#define LCME_KNOWN_FLAGS (LCME_FL_NEG | LCME_FL_INIT) /* lcme_id can be specified as certain flags, and the first * bit of lcme_id is used to indicate that the ID is representing @@ -436,7 +439,7 @@ enum lcme_id { LCME_ID_INVAL = 0x0, LCME_ID_MAX = 0x7FFFFFFF, LCME_ID_ALL = 0xFFFFFFFF, - LCME_ID_NONE = 0x80000000 + LCME_ID_NOT_ID = LCME_FL_NEG }; struct lov_comp_md_entry_v1 { -- 1.8.3.1 From jsimmons at infradead.org Sun Jan 6 22:14:02 2019 From: jsimmons at infradead.org (James Simmons) Date: Sun, 6 Jan 2019 17:14:02 -0500 Subject: [lustre-devel] [PATCH v2 07/33] lustre: lov: add composite layout unpacking In-Reply-To: <1546812868-11794-1-git-send-email-jsimmons@infradead.org> References: <1546812868-11794-1-git-send-email-jsimmons@infradead.org> Message-ID: <1546812868-11794-8-git-send-email-jsimmons@infradead.org> From: Bobi Jam Update struct lov_stripe_md to accommodate composite layouts. Add methods to unpack composite layouts. Signed-off-by: John L. Hammond Signed-off-by: Bobi Jam Signed-off-by: Niu Yawei WC-bug-id: https://jira.whamcloud.com/browse/LU-8998 Reviewed-on: https://review.whamcloud.com/24849 WC-bug-id: https://jira.whamcloud.com/browse/LU-9315 Reviewed-on: https://review.whamcloud.com/26503 Reviewed-by: Dmitry Eremin Reviewed-by: Jinshan Xiong Reviewed-by: Andreas Dilger Signed-off-by: James Simmons --- drivers/staging/lustre/lustre/lov/lov_ea.c | 175 ++++++++++++++++++++++++++- drivers/staging/lustre/lustre/lov/lov_pack.c | 3 + 2 files changed, 175 insertions(+), 3 deletions(-) diff --git a/drivers/staging/lustre/lustre/lov/lov_ea.c b/drivers/staging/lustre/lustre/lov/lov_ea.c index f794df9..7d86318 100644 --- a/drivers/staging/lustre/lustre/lov/lov_ea.c +++ b/drivers/staging/lustre/lustre/lov/lov_ea.c @@ -38,12 +38,21 @@ #define DEBUG_SUBSYSTEM S_LOV #include +#include #include #include +#include #include "lov_internal.h" +static inline void lu_extent_le_to_cpu(struct lu_extent *dst, + const struct lu_extent *src) +{ + dst->e_start = le64_to_cpu(src->e_start); + dst->e_end = le64_to_cpu(src->e_end); +} + /* * Find minimum stripe maxbytes value. For inactive or * reconnecting targets use LUSTRE_EXT3_STRIPE_MAXBYTES. @@ -347,17 +356,177 @@ void lsm_free(struct lov_stripe_md *lsm) .lsm_unpackmd = lsm_unpackmd_v3, }; +static int lsm_verify_comp_md_v1(struct lov_comp_md_v1 *lcm, + size_t lcm_buf_size) +{ + unsigned int entry_count; + size_t lcm_size; + unsigned int i; + + lcm_size = le32_to_cpu(lcm->lcm_size); + if (lcm_buf_size < lcm_size) { + CERROR("bad LCM buffer size %zu, expected %zu\n", + lcm_buf_size, lcm_size); + return -EINVAL; + } + + entry_count = le16_to_cpu(lcm->lcm_entry_count); + for (i = 0; i < entry_count; i++) { + struct lov_comp_md_entry_v1 *lcme = &lcm->lcm_entries[i]; + size_t blob_offset; + size_t blob_size; + + blob_offset = le32_to_cpu(lcme->lcme_offset); + blob_size = le32_to_cpu(lcme->lcme_size); + + if (lcm_size < blob_offset || lcm_size < blob_size || + lcm_size < blob_offset + blob_size) { + CERROR("LCM entry %u has invalid blob: LCM size = %zu, offset = %zu, size = %zu\n", + le32_to_cpu(lcme->lcme_id), lcm_size, + blob_offset, blob_size); + return -EINVAL; + } + } + + return 0; +} + +static struct lov_stripe_md_entry * +lsme_unpack_comp(struct lov_obd *lov, struct lov_mds_md *lmm, + size_t lmm_buf_size, loff_t *maxbytes) +{ + unsigned int stripe_count; + unsigned int magic; + + stripe_count = le16_to_cpu(lmm->lmm_stripe_count); + if (stripe_count == 0) + return ERR_PTR(-EINVAL); + + magic = le32_to_cpu(lmm->lmm_magic); + if (magic != LOV_MAGIC_V1 && magic != LOV_MAGIC_V3) + return ERR_PTR(-EINVAL); + + if (lmm_buf_size < lov_mds_md_size(stripe_count, magic)) + return ERR_PTR(-EINVAL); + + if (magic == LOV_MAGIC_V1) { + return lsme_unpack(lov, lmm, lmm_buf_size, NULL, + lmm->lmm_objects, maxbytes); + } else { + struct lov_mds_md_v3 *lmm3 = (struct lov_mds_md_v3 *)lmm; + + return lsme_unpack(lov, lmm, lmm_buf_size, lmm3->lmm_pool_name, + lmm3->lmm_objects, maxbytes); + } +} + +static struct lov_stripe_md * +lsm_unpackmd_comp_md_v1(struct lov_obd *lov, void *buf, size_t buf_size) +{ + struct lov_comp_md_v1 *lcm = buf; + struct lov_stripe_md *lsm; + unsigned int entry_count = 0; + loff_t maxbytes; + size_t lsm_size; + unsigned int i; + int rc; + + rc = lsm_verify_comp_md_v1(buf, buf_size); + if (rc < 0) + return ERR_PTR(rc); + + entry_count = le16_to_cpu(lcm->lcm_entry_count); + + lsm_size = offsetof(typeof(*lsm), lsm_entries[entry_count]); + lsm = kzalloc(lsm_size, GFP_KERNEL); + if (!lsm) + return ERR_PTR(-ENOMEM); + + atomic_set(&lsm->lsm_refc, 1); + spin_lock_init(&lsm->lsm_lock); + lsm->lsm_magic = le32_to_cpu(lcm->lcm_magic); + lsm->lsm_layout_gen = le32_to_cpu(lcm->lcm_layout_gen); + lsm->lsm_entry_count = entry_count; + lsm->lsm_is_released = true; + lsm->lsm_maxbytes = LLONG_MIN; + + for (i = 0; i < entry_count; i++) { + struct lov_comp_md_entry_v1 *lcme = &lcm->lcm_entries[i]; + struct lov_stripe_md_entry *lsme; + size_t blob_offset; + size_t blob_size; + void *blob; + + blob_offset = le32_to_cpu(lcme->lcme_offset); + blob_size = le32_to_cpu(lcme->lcme_size); + blob = (char *)lcm + blob_offset; + + lsme = lsme_unpack_comp(lov, blob, blob_size, + (i == entry_count - 1) ? &maxbytes : + NULL); + if (IS_ERR(lsme)) { + rc = PTR_ERR(lsme); + goto out_lsm; + } + + if (!(lsme->lsme_pattern & LOV_PATTERN_F_RELEASED)) + lsm->lsm_is_released = false; + + lsm->lsm_entries[i] = lsme; + lsme->lsme_id = le32_to_cpu(lcme->lcme_id); + lu_extent_le_to_cpu(&lsme->lsme_extent, &lcme->lcme_extent); + + if (i == entry_count - 1) { + lsm->lsm_maxbytes = (loff_t)lsme->lsme_extent.e_start + + maxbytes; + /* the last component hasn't been defined, or + * lsm_maxbytes overflowed. + */ + if (lsme->lsme_extent.e_end != LUSTRE_EOF || + lsm->lsm_maxbytes < + (loff_t)lsme->lsme_extent.e_start) + lsm->lsm_maxbytes = MAX_LFS_FILESIZE; + } + } + + return lsm; + +out_lsm: + for (i = 0; i < entry_count; i++) + if (lsm->lsm_entries[i]) + lsme_free(lsm->lsm_entries[i]); + + kfree(lsm); + + return ERR_PTR(rc); +} + +const static struct lsm_operations lsm_comp_md_v1_ops = { + .lsm_stripe_by_index = lsm_stripe_by_index_plain, + .lsm_stripe_by_offset = lsm_stripe_by_offset_plain, + .lsm_unpackmd = lsm_unpackmd_comp_md_v1, +}; + const struct lsm_operations *lsm_op_find(int magic) { + const struct lsm_operations *lsm = NULL; + switch (magic) { case LOV_MAGIC_V1: - return &lsm_v1_ops; + lsm = &lsm_v1_ops; + break; case LOV_MAGIC_V3: - return &lsm_v3_ops; + lsm = &lsm_v3_ops; + break; + case LOV_MAGIC_COMP_V1: + lsm = &lsm_comp_md_v1_ops; + break; default: CERROR("unrecognized lsm_magic %08x\n", magic); - return NULL; + break; } + + return lsm; } void dump_lsm(unsigned int level, const struct lov_stripe_md *lsm) diff --git a/drivers/staging/lustre/lustre/lov/lov_pack.c b/drivers/staging/lustre/lustre/lov/lov_pack.c index 3700937..8b7a572 100644 --- a/drivers/staging/lustre/lustre/lov/lov_pack.c +++ b/drivers/staging/lustre/lustre/lov/lov_pack.c @@ -206,6 +206,9 @@ struct lov_stripe_md *lov_unpackmd(struct lov_obd *lov, void *buf, const struct lsm_operations *op; u32 magic; + if (buf_size < sizeof(magic)) + return ERR_PTR(-EINVAL); + magic = le32_to_cpu(*(u32 *)buf); op = lsm_op_find(magic); if (!op) -- 1.8.3.1 From jsimmons at infradead.org Sun Jan 6 22:14:04 2019 From: jsimmons at infradead.org (James Simmons) Date: Sun, 6 Jan 2019 17:14:04 -0500 Subject: [lustre-devel] [PATCH v2 09/33] lustre: lov: migrate lov raid0 to future PFL component handling In-Reply-To: <1546812868-11794-1-git-send-email-jsimmons@infradead.org> References: <1546812868-11794-1-git-send-email-jsimmons@infradead.org> Message-ID: <1546812868-11794-10-git-send-email-jsimmons@infradead.org> From: Bobi Jam PFL will change striping from being static to dynamic. The idea of stripe count will change under this case. So rename the fields representing stripe index to component index. The raid0 stripe handing will be replaced with PFL component handling so make the raid0 a subsystem of PFL handling. Signed-off-by: Jinshan Xiong Signed-off-by: Bobi Jam Signed-off-by: Niu Yawei WC-bug-id: https://jira.whamcloud.com/browse/LU-8998 Reviewed-on: https://review.whamcloud.com/24850 Reviewed-by: Lai Siyao Signed-off-by: James Simmons --- .../staging/lustre/lustre/lov/lov_cl_internal.h | 29 +-- drivers/staging/lustre/lustre/lov/lov_io.c | 41 +++-- drivers/staging/lustre/lustre/lov/lov_lock.c | 8 +- drivers/staging/lustre/lustre/lov/lov_object.c | 196 +++++++++++++-------- drivers/staging/lustre/lustre/lov/lov_page.c | 19 +- drivers/staging/lustre/lustre/lov/lovsub_object.c | 13 +- 6 files changed, 178 insertions(+), 128 deletions(-) diff --git a/drivers/staging/lustre/lustre/lov/lov_cl_internal.h b/drivers/staging/lustre/lustre/lov/lov_cl_internal.h index c6ace49..c44c937 100644 --- a/drivers/staging/lustre/lustre/lov/lov_cl_internal.h +++ b/drivers/staging/lustre/lustre/lov/lov_cl_internal.h @@ -108,8 +108,8 @@ struct lov_device { */ enum lov_layout_type { LLT_EMPTY, /** empty file without body (mknod + truncate) */ - LLT_RAID0, /** striped file */ LLT_RELEASED, /** file with no objects (data in HSM) */ + LLT_COMP, /** support composite layout */ LLT_NR }; @@ -118,10 +118,10 @@ static inline char *llt2str(enum lov_layout_type llt) switch (llt) { case LLT_EMPTY: return "EMPTY"; - case LLT_RAID0: - return "RAID0"; case LLT_RELEASED: return "RELEASED"; + case LLT_COMP: + return "COMPOSITE"; case LLT_NR: LBUG(); } @@ -242,7 +242,7 @@ struct lov_lock_sub { */ unsigned int sub_is_enqueued:1, sub_initialized:1; - int sub_stripe; + int sub_index; }; /** @@ -258,7 +258,8 @@ struct lov_lock { struct lov_page { struct cl_page_slice lps_cl; - unsigned int lps_stripe; /* stripe index */ + /** layout_entry + stripe index, composed using lov_comp_index() */ + unsigned int lps_index; }; /* @@ -309,7 +310,6 @@ struct lov_thread_info { * State that lov_io maintains for every sub-io. */ struct lov_io_sub { - u16 sub_stripe; /** * environment's refcheck. * @@ -331,6 +331,7 @@ struct lov_io_sub { * sub-io's active for the current IO iteration. */ struct list_head sub_linkage; + u16 sub_subio_index; /** * sub-io for a stripe. Ideally sub-io's can be stopped and resumed * independently, with lov acting as a scheduler to maximize overall @@ -425,12 +426,12 @@ int lov_io_init(const struct lu_env *env, struct cl_object *obj, int lovsub_lock_init(const struct lu_env *env, struct cl_object *obj, struct cl_lock *lock, const struct cl_io *io); -int lov_lock_init_raid0(const struct lu_env *env, struct cl_object *obj, - struct cl_lock *lock, const struct cl_io *io); +int lov_lock_init_composite(const struct lu_env *env, struct cl_object *obj, + struct cl_lock *lock, const struct cl_io *io); int lov_lock_init_empty(const struct lu_env *env, struct cl_object *obj, struct cl_lock *lock, const struct cl_io *io); -int lov_io_init_raid0(const struct lu_env *env, struct cl_object *obj, - struct cl_io *io); +int lov_io_init_composite(const struct lu_env *env, struct cl_object *obj, + struct cl_io *io); int lov_io_init_empty(const struct lu_env *env, struct cl_object *obj, struct cl_io *io); int lov_io_init_released(const struct lu_env *env, struct cl_object *obj, @@ -445,8 +446,8 @@ int lovsub_page_init(const struct lu_env *env, struct cl_object *ob, struct cl_page *page, pgoff_t index); int lov_page_init_empty(const struct lu_env *env, struct cl_object *obj, struct cl_page *page, pgoff_t index); -int lov_page_init_raid0(const struct lu_env *env, struct cl_object *obj, - struct cl_page *page, pgoff_t index); +int lov_page_init_composite(const struct lu_env *env, struct cl_object *obj, + struct cl_page *page, pgoff_t index); struct lu_object *lov_object_alloc(const struct lu_env *env, const struct lu_object_header *hdr, struct lu_device *dev); @@ -455,7 +456,6 @@ struct lu_object *lovsub_object_alloc(const struct lu_env *env, struct lu_device *dev); struct lov_stripe_md *lov_lsm_addref(struct lov_object *lov); -int lov_page_stripe(const struct cl_page *page); #define lov_foreach_target(lov, var) \ for (var = 0; var < lov_targets_nr(lov); ++var) @@ -630,9 +630,10 @@ static inline struct lov_thread_info *lov_env_info(const struct lu_env *env) static inline struct lov_layout_raid0 *lov_r0(struct lov_object *lov) { - LASSERT(lov->lo_type == LLT_RAID0); + LASSERT(lov->lo_type == LLT_COMP); LASSERT(lov->lo_lsm->lsm_magic == LOV_MAGIC || lov->lo_lsm->lsm_magic == LOV_MAGIC_V3); + return &lov->u.composite.lo_entries.lle_raid0; } diff --git a/drivers/staging/lustre/lustre/lov/lov_io.c b/drivers/staging/lustre/lustre/lov/lov_io.c index 2d62566..023b588 100644 --- a/drivers/staging/lustre/lustre/lov/lov_io.c +++ b/drivers/staging/lustre/lustre/lov/lov_io.c @@ -53,7 +53,7 @@ static void lov_io_sub_fini(const struct lu_env *env, struct lov_io *lio, sub->sub_io_initialized = 0; lio->lis_active_subios--; } - if (sub->sub_stripe == lio->lis_single_subio_index) + if (sub->sub_subio_index == lio->lis_single_subio_index) lio->lis_single_subio_index = -1; else if (!sub->sub_borrowed) kfree(sub->sub_io); @@ -143,12 +143,12 @@ static int lov_io_sub_init(const struct lu_env *env, struct lov_io *lio, struct cl_io *sub_io; struct cl_object *sub_obj; struct cl_io *io = lio->lis_cl.cis_io; - int stripe = sub->sub_stripe; + int stripe = sub->sub_subio_index; int rc; LASSERT(!sub->sub_io); LASSERT(!sub->sub_env); - LASSERT(sub->sub_stripe < lio->lis_stripe_count); + LASSERT(sub->sub_subio_index < lio->lis_stripe_count); if (unlikely(!lov_r0(lov)->lo_sub[stripe])) return -EIO; @@ -203,15 +203,15 @@ static int lov_io_sub_init(const struct lu_env *env, struct lov_io *lio, } struct lov_io_sub *lov_sub_get(const struct lu_env *env, - struct lov_io *lio, int stripe) + struct lov_io *lio, int index) { int rc; - struct lov_io_sub *sub = &lio->lis_subs[stripe]; + struct lov_io_sub *sub = &lio->lis_subs[index]; - LASSERT(stripe < lio->lis_stripe_count); + LASSERT(index < lio->lis_stripe_count); if (!sub->sub_io_initialized) { - sub->sub_stripe = stripe; + sub->sub_subio_index = index; rc = lov_io_sub_init(env, lio, sub); } else { rc = 0; @@ -228,14 +228,14 @@ struct lov_io_sub *lov_sub_get(const struct lu_env *env, * */ -int lov_page_stripe(const struct cl_page *page) +static int lov_page_index(const struct cl_page *page) { const struct cl_page_slice *slice; slice = cl_page_at(page, &lov_device_type); LASSERT(slice->cpl_obj); - return cl2lov_page(slice)->lps_stripe; + return cl2lov_page(slice)->lps_index; } static int lov_io_subio_init(const struct lu_env *env, struct lov_io *lio, @@ -630,8 +630,7 @@ static int lov_io_submit(const struct lu_env *env, struct lov_io_sub *sub; struct cl_page_list *plist = &lov_env_info(env)->lti_plist; struct cl_page *page; - int stripe; - + int index; int rc = 0; if (lio->lis_active_subios == 1) { @@ -657,16 +656,16 @@ static int lov_io_submit(const struct lu_env *env, page = cl_page_list_first(qin); cl_page_list_move(&cl2q->c2_qin, qin, page); - stripe = lov_page_stripe(page); + index = lov_page_index(page); while (qin->pl_nr > 0) { page = cl_page_list_first(qin); - if (stripe != lov_page_stripe(page)) + if (index != lov_page_index(page)) break; cl_page_list_move(&cl2q->c2_qin, qin, page); } - sub = lov_sub_get(env, lio, stripe); + sub = lov_sub_get(env, lio, index); if (!IS_ERR(sub)) { rc = cl_io_submit_rw(sub->sub_env, sub->sub_io, crt, cl2q); @@ -716,16 +715,16 @@ static int lov_io_commit_async(const struct lu_env *env, cl_page_list_init(plist); while (queue->pl_nr > 0) { int stripe_to = to; - int stripe; + int index; LASSERT(plist->pl_nr == 0); page = cl_page_list_first(queue); cl_page_list_move(plist, queue, page); - stripe = lov_page_stripe(page); + index = lov_page_index(page); while (queue->pl_nr > 0) { page = cl_page_list_first(queue); - if (stripe != lov_page_stripe(page)) + if (index != lov_page_index(page)) break; cl_page_list_move(plist, queue, page); @@ -734,7 +733,7 @@ static int lov_io_commit_async(const struct lu_env *env, if (queue->pl_nr > 0) /* still has more pages */ stripe_to = PAGE_SIZE; - sub = lov_sub_get(env, lio, stripe); + sub = lov_sub_get(env, lio, index); if (!IS_ERR(sub)) { rc = cl_io_commit_async(sub->sub_env, sub->sub_io, plist, from, stripe_to, cb); @@ -769,7 +768,7 @@ static int lov_io_fault_start(const struct lu_env *env, fio = &ios->cis_io->u.ci_fault; lio = cl2lov_io(env, ios); - sub = lov_sub_get(env, lio, lov_page_stripe(fio->ft_page)); + sub = lov_sub_get(env, lio, lov_page_index(fio->ft_page)); if (IS_ERR(sub)) return PTR_ERR(sub); sub->sub_io->u.ci_fault.ft_nob = fio->ft_nob; @@ -941,8 +940,8 @@ static void lov_empty_impossible(const struct lu_env *env, .cio_commit_async = LOV_EMPTY_IMPOSSIBLE }; -int lov_io_init_raid0(const struct lu_env *env, struct cl_object *obj, - struct cl_io *io) +int lov_io_init_composite(const struct lu_env *env, struct cl_object *obj, + struct cl_io *io) { struct lov_io *lio = lov_env_io(env); struct lov_object *lov = cl2lov(obj); diff --git a/drivers/staging/lustre/lustre/lov/lov_lock.c b/drivers/staging/lustre/lustre/lov/lov_lock.c index b029210..4340063 100644 --- a/drivers/staging/lustre/lustre/lov/lov_lock.c +++ b/drivers/staging/lustre/lustre/lov/lov_lock.c @@ -73,7 +73,7 @@ static struct lov_sublock_env *lov_sublock_env_get(const struct lu_env *env, subenv->lse_env = env; subenv->lse_io = io; } else { - sub = lov_sub_get(env, lio, lls->sub_stripe); + sub = lov_sub_get(env, lio, lls->sub_index); if (!IS_ERR(sub)) { subenv->lse_env = sub->sub_env; subenv->lse_io = sub->sub_io; @@ -167,7 +167,7 @@ static struct lov_lock *lov_lock_sub_init(const struct lu_env *env, descr->cld_mode = lock->cll_descr.cld_mode; descr->cld_gid = lock->cll_descr.cld_gid; descr->cld_enq_flags = lock->cll_descr.cld_enq_flags; - lls->sub_stripe = i; + lls->sub_index = i; /* initialize sub lock */ result = lov_sublock_init(env, lock, lls); @@ -295,8 +295,8 @@ static int lov_lock_print(const struct lu_env *env, void *cookie, .clo_print = lov_lock_print }; -int lov_lock_init_raid0(const struct lu_env *env, struct cl_object *obj, - struct cl_lock *lock, const struct cl_io *io) +int lov_lock_init_composite(const struct lu_env *env, struct cl_object *obj, + struct cl_lock *lock, const struct cl_io *io) { struct lov_lock *lck; int result = 0; diff --git a/drivers/staging/lustre/lustre/lov/lov_object.c b/drivers/staging/lustre/lustre/lov/lov_object.c index 15ed378..f5c6da1 100644 --- a/drivers/staging/lustre/lustre/lov/lov_object.c +++ b/drivers/staging/lustre/lustre/lov/lov_object.c @@ -110,9 +110,9 @@ static int lov_init_empty(const struct lu_env *env, struct lov_device *dev, return 0; } -static void lov_install_raid0(const struct lu_env *env, - struct lov_object *lov, - union lov_layout_state *state) +static void lov_install_composite(const struct lu_env *env, + struct lov_object *lov, + union lov_layout_state *state) { } @@ -129,7 +129,7 @@ static struct cl_object *lov_sub_find(const struct lu_env *env, } static int lov_init_sub(const struct lu_env *env, struct lov_object *lov, - struct cl_object *stripe, struct lov_layout_raid0 *r0, + struct cl_object *subobj, struct lov_layout_raid0 *r0, int idx) { struct cl_object_header *hdr; @@ -145,13 +145,13 @@ static int lov_init_sub(const struct lu_env *env, struct lov_object *lov, * lov_oinfo of lsm_stripe_data which will be freed due to * this failure. */ - cl_object_kill(env, stripe); - cl_object_put(env, stripe); + cl_object_kill(env, subobj); + cl_object_put(env, subobj); return -EIO; } hdr = cl_object_header(lov2cl(lov)); - subhdr = cl_object_header(stripe); + subhdr = cl_object_header(subobj); oinfo = lov->lo_lsm->lsm_entries[0]->lsme_oinfo[idx]; CDEBUG(D_INODE, DFID "@%p[%d] -> " DFID "@%p: ostid: " DOSTID " idx: %d gen: %d\n", @@ -166,8 +166,8 @@ static int lov_init_sub(const struct lu_env *env, struct lov_object *lov, subhdr->coh_parent = hdr; spin_unlock(&subhdr->coh_attr_guard); subhdr->coh_nesting = hdr->coh_nesting + 1; - lu_object_ref_add(&stripe->co_lu, "lov-parent", lov); - r0->lo_sub[idx] = cl2lovsub(stripe); + lu_object_ref_add(&subobj->co_lu, "lov-parent", lov); + r0->lo_sub[idx] = cl2lovsub(subobj); r0->lo_sub[idx]->lso_super = lov; r0->lo_sub[idx]->lso_index = idx; result = 0; @@ -184,18 +184,18 @@ static int lov_init_sub(const struct lu_env *env, struct lov_object *lov, /* the object's layout has already changed but isn't * refreshed */ - lu_object_unhash(env, &stripe->co_lu); + lu_object_unhash(env, &subobj->co_lu); result = -EAGAIN; } else { mask = D_ERROR; result = -EIO; } - LU_OBJECT_DEBUG(mask, env, &stripe->co_lu, + LU_OBJECT_DEBUG(mask, env, &subobj->co_lu, "stripe %d is already owned.", idx); LU_OBJECT_DEBUG(mask, env, old_obj, "owned."); LU_OBJECT_HEADER(mask, env, lov2lu(lov), "try to own.\n"); - cl_object_put(env, stripe); + cl_object_put(env, subobj); } return result; } @@ -219,7 +219,7 @@ static int lov_page_slice_fixup(struct lov_object *lov, static int lov_init_raid0(const struct lu_env *env, struct lov_device *dev, struct lov_object *lov, struct lov_stripe_md *lsm, const struct cl_object_conf *conf, - union lov_layout_state *state) + struct lov_layout_raid0 *r0) { int result; int i; @@ -228,7 +228,6 @@ static int lov_init_raid0(const struct lu_env *env, struct lov_device *dev, struct lov_thread_info *lti = lov_env_info(env); struct cl_object_conf *subconf = <i->lti_stripe_conf; struct lu_fid *ofid = <i->lti_fid; - struct lov_layout_raid0 *r0 = &state->composite.lo_entries.lle_raid0; if (lsm->lsm_magic != LOV_MAGIC_V1 && lsm->lsm_magic != LOV_MAGIC_V3) { dump_lsm(D_ERROR, lsm); @@ -310,6 +309,17 @@ static int lov_init_raid0(const struct lu_env *env, struct lov_device *dev, return result; } +static int lov_init_composite(const struct lu_env *env, struct lov_device *dev, + struct lov_object *lov, struct lov_stripe_md *lsm, + const struct cl_object_conf *conf, + union lov_layout_state *state) +{ + struct lov_layout_composite *comp = &state->composite; + struct lov_layout_entry *le = &comp->lo_entries; + + return lov_init_raid0(env, dev, lov, lsm, conf, &le->lle_raid0); +} + static int lov_init_released(const struct lu_env *env, struct lov_device *dev, struct lov_object *lov, struct lov_stripe_md *lsm, const struct cl_object_conf *conf, @@ -337,7 +347,7 @@ static struct cl_object *lov_find_subobj(const struct lu_env *env, int ost_idx; int rc; - if (lov->lo_type != LLT_RAID0) { + if (lov->lo_type != LLT_COMP) { result = NULL; goto out; } @@ -367,15 +377,14 @@ static int lov_delete_empty(const struct lu_env *env, struct lov_object *lov, } static void lov_subobject_kill(const struct lu_env *env, struct lov_object *lov, + struct lov_layout_raid0 *r0, struct lovsub_object *los, int idx) { struct cl_object *sub; - struct lov_layout_raid0 *r0; struct lu_site *site; wait_queue_head_t *wq; wait_queue_entry_t *waiter; - r0 = &lov->u.composite.lo_entries.lle_raid0; LASSERT(r0->lo_sub[idx] == los); sub = lovsub2cl(los); @@ -415,17 +424,12 @@ static void lov_subobject_kill(const struct lu_env *env, struct lov_object *lov, LASSERT(!r0->lo_sub[idx]); } -static int lov_delete_raid0(const struct lu_env *env, struct lov_object *lov, - union lov_layout_state *state) +static void lov_delete_raid0(const struct lu_env *env, struct lov_object *lov, + struct lov_layout_raid0 *r0) { - struct lov_layout_raid0 *r0 = &state->composite.lo_entries.lle_raid0; - struct lov_stripe_md *lsm = lov->lo_lsm; - int i; - - dump_lsm(D_INODE, lsm); - - lov_layout_wait(env, lov); if (r0->lo_sub) { + int i; + for (i = 0; i < r0->lo_nr; ++i) { struct lovsub_object *los = r0->lo_sub[i]; @@ -435,10 +439,24 @@ static int lov_delete_raid0(const struct lu_env *env, struct lov_object *lov, * If top-level object is to be evicted from * the cache, so are its sub-objects. */ - lov_subobject_kill(env, lov, los, i); + lov_subobject_kill(env, lov, r0, los, i); } } } +} + +static int lov_delete_composite(const struct lu_env *env, + struct lov_object *lov, + union lov_layout_state *state) +{ + struct lov_layout_composite *comp = &state->composite; + struct lov_layout_entry *entry = &comp->lo_entries; + + dump_lsm(D_INODE, lov->lo_lsm); + + lov_layout_wait(env, lov); + lov_delete_raid0(env, lov, &entry->lle_raid0); + return 0; } @@ -448,15 +466,23 @@ static void lov_fini_empty(const struct lu_env *env, struct lov_object *lov, LASSERT(lov->lo_type == LLT_EMPTY || lov->lo_type == LLT_RELEASED); } -static void lov_fini_raid0(const struct lu_env *env, struct lov_object *lov, - union lov_layout_state *state) +static void lov_fini_raid0(const struct lu_env *env, + struct lov_layout_raid0 *r0) { - struct lov_layout_raid0 *r0 = &state->composite.lo_entries.lle_raid0; - if (r0->lo_sub) { kvfree(r0->lo_sub); r0->lo_sub = NULL; } +} + +static void lov_fini_composite(const struct lu_env *env, + struct lov_object *lov, + union lov_layout_state *state) +{ + struct lov_layout_composite *comp = &state->composite; + struct lov_layout_entry *entry = &comp->lo_entries; + + lov_fini_raid0(env, &entry->lle_raid0); dump_lsm(D_INODE, lov->lo_lsm); lov_free_memmd(&lov->lo_lsm); @@ -477,17 +503,10 @@ static int lov_print_empty(const struct lu_env *env, void *cookie, } static int lov_print_raid0(const struct lu_env *env, void *cookie, - lu_printer_t p, const struct lu_object *o) + lu_printer_t p, struct lov_layout_raid0 *r0) { - struct lov_object *lov = lu2lov(o); - struct lov_layout_raid0 *r0 = lov_r0(lov); - struct lov_stripe_md *lsm = lov->lo_lsm; - int i; + int i; - (*p)(env, cookie, "stripes: %d, %s, lsm{%p 0x%08X %d %u %u}:\n", - r0->lo_nr, lov->lo_layout_invalid ? "invalid" : "valid", lsm, - lsm->lsm_magic, atomic_read(&lsm->lsm_refc), - lsm->lsm_entries[0]->lsme_stripe_count, lsm->lsm_layout_gen); for (i = 0; i < r0->lo_nr; ++i) { struct lu_object *sub; @@ -501,6 +520,23 @@ static int lov_print_raid0(const struct lu_env *env, void *cookie, return 0; } +static int lov_print_composite(const struct lu_env *env, void *cookie, + lu_printer_t p, const struct lu_object *o) +{ + struct lov_object *lov = lu2lov(o); + struct lov_layout_raid0 *r0 = lov_r0(lov); + struct lov_stripe_md *lsm = lov->lo_lsm; + + (*p)(env, cookie, "stripes: %d, %s, lsm{%p 0x%08X %d %u %u}:\n", + r0->lo_nr, lov->lo_layout_invalid ? "invalid" : "valid", lsm, + lsm->lsm_magic, atomic_read(&lsm->lsm_refc), + lsm->lsm_entries[0]->lsme_stripe_count, lsm->lsm_layout_gen); + + lov_print_raid0(env, cookie, p, r0); + + return 0; +} + static int lov_print_released(const struct lu_env *env, void *cookie, lu_printer_t p, const struct lu_object *o) { @@ -525,17 +561,13 @@ static int lov_print_released(const struct lu_env *env, void *cookie, static int lov_attr_get_empty(const struct lu_env *env, struct cl_object *obj, struct cl_attr *attr) { - attr->cat_blocks = 0; return 0; } -static int lov_attr_get_raid0(const struct lu_env *env, struct cl_object *obj, - struct cl_attr *attr) +static int lov_attr_get_raid0(const struct lu_env *env, struct lov_object *lov, + struct cl_attr *attr, struct lov_layout_raid0 *r0) { - struct lov_object *lov = cl2lov(obj); - struct lov_layout_raid0 *r0 = lov_r0(lov); - struct cl_attr *lov_attr = &r0->lo_attr; - int result = 0; + int result = 0; /* this is called w/o holding type guard mutex, so it must be inside * an on going IO otherwise lsm may be replaced. @@ -577,22 +609,38 @@ static int lov_attr_get_raid0(const struct lu_env *env, struct cl_object *obj, result = lov_merge_lvb_kms(lsm, lvb, &kms); lov_stripe_unlock(lsm); if (result == 0) { - cl_lvb2attr(lov_attr, lvb); - lov_attr->cat_kms = kms; + cl_lvb2attr(attr, lvb); + attr->cat_kms = kms; r0->lo_attr_valid = 1; } } - if (result == 0) { /* merge results */ - attr->cat_blocks = lov_attr->cat_blocks; - attr->cat_size = lov_attr->cat_size; - attr->cat_kms = lov_attr->cat_kms; - if (attr->cat_atime < lov_attr->cat_atime) - attr->cat_atime = lov_attr->cat_atime; - if (attr->cat_ctime < lov_attr->cat_ctime) - attr->cat_ctime = lov_attr->cat_ctime; - if (attr->cat_mtime < lov_attr->cat_mtime) - attr->cat_mtime = lov_attr->cat_mtime; - } + + return result; +} + +static int lov_attr_get_composite(const struct lu_env *env, + struct cl_object *obj, + struct cl_attr *attr) +{ + struct lov_object *lov = cl2lov(obj); + struct lov_layout_raid0 *r0 = lov_r0(lov); + struct cl_attr *lov_attr = &r0->lo_attr; + int result; + + result = lov_attr_get_raid0(env, lov, attr, r0); + if (result) + return result; + + attr->cat_blocks = lov_attr->cat_blocks; + attr->cat_size = lov_attr->cat_size; + attr->cat_kms = lov_attr->cat_kms; + if (attr->cat_atime < lov_attr->cat_atime) + attr->cat_atime = lov_attr->cat_atime; + if (attr->cat_ctime < lov_attr->cat_ctime) + attr->cat_ctime = lov_attr->cat_ctime; + if (attr->cat_mtime < lov_attr->cat_mtime) + attr->cat_mtime = lov_attr->cat_mtime; + return result; } @@ -608,17 +656,6 @@ static int lov_attr_get_raid0(const struct lu_env *env, struct cl_object *obj, .llo_io_init = lov_io_init_empty, .llo_getattr = lov_attr_get_empty }, - [LLT_RAID0] = { - .llo_init = lov_init_raid0, - .llo_delete = lov_delete_raid0, - .llo_fini = lov_fini_raid0, - .llo_install = lov_install_raid0, - .llo_print = lov_print_raid0, - .llo_page_init = lov_page_init_raid0, - .llo_lock_init = lov_lock_init_raid0, - .llo_io_init = lov_io_init_raid0, - .llo_getattr = lov_attr_get_raid0 - }, [LLT_RELEASED] = { .llo_init = lov_init_released, .llo_delete = lov_delete_empty, @@ -629,7 +666,18 @@ static int lov_attr_get_raid0(const struct lu_env *env, struct cl_object *obj, .llo_lock_init = lov_lock_init_empty, .llo_io_init = lov_io_init_released, .llo_getattr = lov_attr_get_empty - } + }, + [LLT_COMP] = { + .llo_init = lov_init_composite, + .llo_delete = lov_delete_composite, + .llo_fini = lov_fini_composite, + .llo_install = lov_install_composite, + .llo_print = lov_print_composite, + .llo_page_init = lov_page_init_composite, + .llo_lock_init = lov_lock_init_composite, + .llo_io_init = lov_io_init_composite, + .llo_getattr = lov_attr_get_composite, + }, }; /** @@ -659,7 +707,7 @@ static enum lov_layout_type lov_type(struct lov_stripe_md *lsm) if (lsm->lsm_is_released) return LLT_RELEASED; - return LLT_RAID0; + return LLT_COMP; } static inline void lov_conf_freeze(struct lov_object *lov) @@ -1610,7 +1658,7 @@ int lov_read_and_clear_async_rc(struct cl_object *clob) lov_conf_freeze(lov); switch (lov->lo_type) { - case LLT_RAID0: { + case LLT_COMP: { struct lov_stripe_md *lsm; int i; diff --git a/drivers/staging/lustre/lustre/lov/lov_page.c b/drivers/staging/lustre/lustre/lov/lov_page.c index f1c99a2..d94d003 100644 --- a/drivers/staging/lustre/lustre/lov/lov_page.c +++ b/drivers/staging/lustre/lustre/lov/lov_page.c @@ -50,22 +50,21 @@ * Lov page operations. * */ - -static int lov_raid0_page_print(const struct lu_env *env, - const struct cl_page_slice *slice, - void *cookie, lu_printer_t printer) +static int lov_comp_page_print(const struct lu_env *env, + const struct cl_page_slice *slice, + void *cookie, lu_printer_t printer) { struct lov_page *lp = cl2lov_page(slice); return (*printer)(env, cookie, LUSTRE_LOV_NAME "-page@%p, raid0\n", lp); } -static const struct cl_page_operations lov_raid0_page_ops = { - .cpo_print = lov_raid0_page_print +static const struct cl_page_operations lov_comp_page_ops = { + .cpo_print = lov_comp_page_print }; -int lov_page_init_raid0(const struct lu_env *env, struct cl_object *obj, - struct cl_page *page, pgoff_t index) +int lov_page_init_composite(const struct lu_env *env, struct cl_object *obj, + struct cl_page *page, pgoff_t index) { struct lov_object *loo = cl2lov(obj); struct lov_layout_raid0 *r0 = lov_r0(loo); @@ -85,8 +84,8 @@ int lov_page_init_raid0(const struct lu_env *env, struct cl_object *obj, rc = lov_stripe_offset(loo->lo_lsm, offset, stripe, &suboff); LASSERT(rc == 0); - lpg->lps_stripe = stripe; - cl_page_slice_add(page, &lpg->lps_cl, obj, index, &lov_raid0_page_ops); + lpg->lps_index = stripe; + cl_page_slice_add(page, &lpg->lps_cl, obj, index, &lov_comp_page_ops); sub = lov_sub_get(env, lio, stripe); if (IS_ERR(sub)) diff --git a/drivers/staging/lustre/lustre/lov/lovsub_object.c b/drivers/staging/lustre/lustre/lov/lovsub_object.c index 7360c16..d3e9537 100644 --- a/drivers/staging/lustre/lustre/lov/lovsub_object.c +++ b/drivers/staging/lustre/lustre/lov/lovsub_object.c @@ -79,11 +79,14 @@ static void lovsub_object_free(const struct lu_env *env, struct lu_object *obj) * object handling in lu_object_find. */ if (lov) { - LASSERT(lov->lo_type == LLT_RAID0); - LASSERT(lov->u.composite.lo_entries.lle_raid0.lo_sub[los->lso_index] == los); - spin_lock(&lov->u.composite.lo_entries.lle_raid0.lo_sub_lock); - lov->u.composite.lo_entries.lle_raid0.lo_sub[los->lso_index] = NULL; - spin_unlock(&lov->u.composite.lo_entries.lle_raid0.lo_sub_lock); + int stripe = los->lso_index; + struct lov_layout_raid0 *r0 = lov_r0(lov); + + LASSERT(lov->lo_type == LLT_COMP); + LASSERT(r0->lo_sub[stripe] == los); + spin_lock(&r0->lo_sub_lock); + r0->lo_sub[stripe] = NULL; + spin_unlock(&r0->lo_sub_lock); } lu_object_fini(obj); -- 1.8.3.1 From jsimmons at infradead.org Sun Jan 6 22:14:18 2019 From: jsimmons at infradead.org (James Simmons) Date: Sun, 6 Jan 2019 17:14:18 -0500 Subject: [lustre-devel] [PATCH v2 23/33] lustre: pfl: Read should not trigger layout write intent In-Reply-To: <1546812868-11794-1-git-send-email-jsimmons@infradead.org> References: <1546812868-11794-1-git-send-email-jsimmons@infradead.org> Message-ID: <1546812868-11794-24-git-send-email-jsimmons@infradead.org> From: Jinshan Xiong In lov_io_rw_iter_init(), only write not read operation should trigger layout write intent. For append write, it has to make sure all uninited components are instantiated. Page mkwrite should also trigger write intent. Signed-off-by: Jinshan Xiong Signed-off-by: Bobi Jam WC-bug-id: https://jira.whamcloud.com/browse/LU-9008 Reviewed-on: https://review.whamcloud.com/26499 Reviewed-by: Andreas Dilger Reviewed-by: Niu Yawei Reviewed-by: Oleg Drokin Signed-off-by: James Simmons --- drivers/staging/lustre/lustre/llite/vvp_io.c | 20 ++++++++++++----- drivers/staging/lustre/lustre/lov/lov_io.c | 33 +++++++++++++++++----------- 2 files changed, 34 insertions(+), 19 deletions(-) diff --git a/drivers/staging/lustre/lustre/llite/vvp_io.c b/drivers/staging/lustre/lustre/llite/vvp_io.c index c325eba..d9f02ae 100644 --- a/drivers/staging/lustre/lustre/llite/vvp_io.c +++ b/drivers/staging/lustre/lustre/llite/vvp_io.c @@ -323,18 +323,26 @@ static void vvp_io_fini(const struct lu_env *env, const struct cl_io_slice *ios) * RPC. */ if (io->ci_need_write_intent) { + loff_t end = OBD_OBJECT_EOF; loff_t start = 0; - loff_t end = 0; - - LASSERT(io->ci_type == CIT_WRITE || cl_io_is_trunc(io)); io->ci_need_write_intent = 0; + LASSERT(io->ci_type == CIT_WRITE || + cl_io_is_trunc(io) || cl_io_is_mkwrite(io)); + if (io->ci_type == CIT_WRITE) { - start = io->u.ci_rw.crw_pos; - end = io->u.ci_rw.crw_pos + io->u.ci_rw.crw_count; - } else { + if (!cl_io_is_append(io)) { + start = io->u.ci_rw.crw_pos; + end = start + io->u.ci_rw.crw_count; + } + } else if (cl_io_is_trunc(io)) { end = io->u.ci_setattr.sa_attr.lvb_size; + } else { /* mkwrite */ + pgoff_t index = io->u.ci_fault.ft_index; + + start = cl_offset(io->ci_obj, index); + end = cl_offset(io->ci_obj, index + 1); } CDEBUG(D_VFSTRACE, DFID" type %d [%llx, %llx)\n", diff --git a/drivers/staging/lustre/lustre/lov/lov_io.c b/drivers/staging/lustre/lustre/lov/lov_io.c index 8a1bb85..0d809b1 100644 --- a/drivers/staging/lustre/lustre/lov/lov_io.c +++ b/drivers/staging/lustre/lustre/lov/lov_io.c @@ -378,6 +378,7 @@ static int lov_io_iter_init(const struct lu_env *env, { struct lov_io *lio = cl2lov_io(env, ios); struct lov_stripe_md *lsm = lio->lis_object->lo_lsm; + struct cl_io *io = ios->cis_io; struct lov_layout_entry *le; struct lov_io_sub *sub; struct lu_extent ext; @@ -394,15 +395,28 @@ static int lov_io_iter_init(const struct lu_env *env, u64 start; u64 end; - CDEBUG(D_VFSTRACE, "component[%d] flags %#x\n", - index, lsm->lsm_entries[index]->lsme_flags); - if (!lsm_entry_inited(lsm, index)) - break; - index++; if (!lu_extent_is_overlapped(&ext, &le->lle_extent)) continue; + CDEBUG(D_VFSTRACE, "component[%d] flags %#x\n", + index - 1, lsm->lsm_entries[index - 1]->lsme_flags); + if (!lsm_entry_inited(lsm, index - 1)) { + /* truncate IO will trigger write intent as well, and + * it's handled in lov_io_setattr_iter_init() + */ + if (io->ci_type == CIT_WRITE || cl_io_is_mkwrite(io)) { + io->ci_need_write_intent = 1; + rc = -ENODATA; + break; + } + + /* Read from uninitialized components should return + * zero filled pages. + */ + continue; + } + for (stripe = 0; stripe < r0->lo_nr; stripe++) { if (!lov_stripe_intersects(lsm, index - 1, stripe, &ext, &start, &end)) @@ -498,13 +512,6 @@ static int lov_io_rw_iter_init(const struct lu_env *env, start, lio->lis_pos, lio->lis_endpos, lio->lis_io_endpos); - index = lov_lsm_entry(lsm, lio->lis_endpos - 1); - if (index > 0 && !lsm_entry_inited(lsm, index)) { - io->ci_need_write_intent = 1; - io->ci_result = -ENODATA; - return io->ci_result; - } - /* * XXX The following call should be optimized: we know, that * [lio->lis_pos, lio->lis_endpos) intersects with exactly one stripe. @@ -520,7 +527,7 @@ static int lov_io_setattr_iter_init(const struct lu_env *env, struct lov_stripe_md *lsm = lio->lis_object->lo_lsm; int index; - if (cl_io_is_trunc(io) && lio->lis_pos) { + if (cl_io_is_trunc(io) && lio->lis_pos > 0) { index = lov_lsm_entry(lsm, lio->lis_pos - 1); if (index > 0 && !lsm_entry_inited(lsm, index)) { io->ci_need_write_intent = 1; -- 1.8.3.1 From jsimmons at infradead.org Sun Jan 6 22:14:00 2019 From: jsimmons at infradead.org (James Simmons) Date: Sun, 6 Jan 2019 17:14:00 -0500 Subject: [lustre-devel] [PATCH v2 05/33] lustre: lov: fold lmm_verify() handling into lmm_unpackmd() In-Reply-To: <1546812868-11794-1-git-send-email-jsimmons@infradead.org> References: <1546812868-11794-1-git-send-email-jsimmons@infradead.org> Message-ID: <1546812868-11794-6-git-send-email-jsimmons@infradead.org> From: Bobi Jam The function lov_unpackmd() calls the format specific version of lmm_verify() and uses the returned information to allocate the correct amount for the lsm information. We can fold the lmm_verify() handling into the format specific unpackmd() function. This also enables use to intergate the lsm allocation as well into the unpackmd() function. This also greatly simplifies lov_unpackmd(). Signed-off-by: John L. Hammond Signed-off-by: Bobi Jam Signed-off-by: Niu Yawei WC-bug-id: https://jira.whamcloud.com/browse/LU-8998 Reviewed-on: https://review.whamcloud.com/24849 Reviewed-by: Jinshan Xiong Reviewed-by: Andreas Dilger Signed-off-by: James Simmons --- drivers/staging/lustre/lustre/lov/lov_ea.c | 113 ++++++++++++++++++----- drivers/staging/lustre/lustre/lov/lov_internal.h | 11 +-- drivers/staging/lustre/lustre/lov/lov_pack.c | 59 +----------- 3 files changed, 99 insertions(+), 84 deletions(-) diff --git a/drivers/staging/lustre/lustre/lov/lov_ea.c b/drivers/staging/lustre/lustre/lov/lov_ea.c index 2b3552a..5a01fbb 100644 --- a/drivers/staging/lustre/lustre/lov/lov_ea.c +++ b/drivers/staging/lustre/lustre/lov/lov_ea.c @@ -145,6 +145,37 @@ struct lov_stripe_md *lsm_alloc_plain(u16 stripe_count) return NULL; } +static struct lov_stripe_md *lov_lsm_alloc(u16 stripe_count, u32 pattern, + u32 magic) +{ + struct lov_stripe_md *lsm; + unsigned int i; + + CDEBUG(D_INFO, "alloc lsm, stripe_count %u\n", stripe_count); + + lsm = lsm_alloc_plain(stripe_count); + if (!lsm) { + CERROR("cannot allocate LSM stripe_count %u\n", stripe_count); + return ERR_PTR(-ENOMEM); + } + + atomic_set(&lsm->lsm_refc, 1); + spin_lock_init(&lsm->lsm_lock); + lsm->lsm_magic = magic; + lsm->lsm_stripe_count = stripe_count; + lsm->lsm_maxbytes = LUSTRE_EXT3_STRIPE_MAXBYTES * stripe_count; + lsm->lsm_pattern = pattern; + lsm->lsm_pool_name[0] = '\0'; + lsm->lsm_layout_gen = 0; + if (stripe_count > 0) + lsm->lsm_oinfo[0]->loi_ost_idx = ~0; + + for (i = 0; i < stripe_count; i++) + loi_init(lsm->lsm_oinfo[i]); + + return lsm; +} + static int lsm_unpackmd_v1v3(struct lov_obd *lov, struct lov_stripe_md *lsm, struct lov_mds_md *lmm, @@ -238,12 +269,12 @@ static int lsm_unpackmd_v1v3(struct lov_obd *lov, *swidth = (u64)lsm->lsm_stripe_size * lsm->lsm_stripe_count; } -static int lsm_lmm_verify_v1(struct lov_mds_md_v1 *lmm, int lmm_bytes, +static int lsm_lmm_verify_v1(struct lov_mds_md_v1 *lmm, size_t lmm_bytes, __u16 *stripe_count) { if (lmm_bytes < sizeof(*lmm)) { - CERROR("lov_mds_md_v1 too small: %d, need at least %d\n", - lmm_bytes, (int)sizeof(*lmm)); + CERROR("lov_mds_md_v1 too small: %zu, need at least %zu\n", + lmm_bytes, sizeof(*lmm)); return -EINVAL; } @@ -252,7 +283,7 @@ static int lsm_lmm_verify_v1(struct lov_mds_md_v1 *lmm, int lmm_bytes, *stripe_count = 0; if (lmm_bytes < lov_mds_md_size(*stripe_count, LOV_MAGIC_V1)) { - CERROR("LOV EA V1 too small: %d, need %d\n", + CERROR("LOV EA V1 too small: %zu, need %d\n", lmm_bytes, lov_mds_md_size(*stripe_count, LOV_MAGIC_V1)); lov_dump_lmm_common(D_WARNING, lmm); return -EINVAL; @@ -261,29 +292,47 @@ static int lsm_lmm_verify_v1(struct lov_mds_md_v1 *lmm, int lmm_bytes, return lsm_lmm_verify_v1v3(lmm, lmm_bytes, *stripe_count); } -static int lsm_unpackmd_v1(struct lov_obd *lov, struct lov_stripe_md *lsm, - struct lov_mds_md_v1 *lmm) +static struct lov_stripe_md * +lsm_unpackmd_v1(struct lov_obd *lov, void *buf, size_t buf_size) { - return lsm_unpackmd_v1v3(lov, lsm, lmm, NULL, lmm->lmm_objects); + struct lov_mds_md_v1 *lmm = buf; + u32 magic = le32_to_cpu(lmm->lmm_magic); + struct lov_stripe_md *lsm; + u16 stripe_count; + u32 pattern; + int rc; + + rc = lsm_lmm_verify_v1(lmm, buf_size, &stripe_count); + if (rc) + return ERR_PTR(rc); + + pattern = le32_to_cpu(lmm->lmm_pattern); + + lsm = lov_lsm_alloc(stripe_count, pattern, magic); + if (IS_ERR(lsm)) + return lsm; + + rc = lsm_unpackmd_v1v3(lov, lsm, lmm, NULL, lmm->lmm_objects); + if (rc) { + lov_free_memmd(&lsm); + lsm = ERR_PTR(rc); + } + + return lsm; } const static struct lsm_operations lsm_v1_ops = { .lsm_stripe_by_index = lsm_stripe_by_index_plain, .lsm_stripe_by_offset = lsm_stripe_by_offset_plain, - .lsm_lmm_verify = lsm_lmm_verify_v1, .lsm_unpackmd = lsm_unpackmd_v1, }; -static int lsm_lmm_verify_v3(struct lov_mds_md *lmmv1, int lmm_bytes, +static int lsm_lmm_verify_v3(struct lov_mds_md_v3 *lmm, size_t lmm_bytes, __u16 *stripe_count) { - struct lov_mds_md_v3 *lmm; - - lmm = (struct lov_mds_md_v3 *)lmmv1; - if (lmm_bytes < sizeof(*lmm)) { - CERROR("lov_mds_md_v3 too small: %d, need at least %d\n", - lmm_bytes, (int)sizeof(*lmm)); + CERROR("lov_mds_md_v3 too small: %zu, need at least %zu\n", + lmm_bytes, sizeof(*lmm)); return -EINVAL; } @@ -292,7 +341,7 @@ static int lsm_lmm_verify_v3(struct lov_mds_md *lmmv1, int lmm_bytes, *stripe_count = 0; if (lmm_bytes < lov_mds_md_size(*stripe_count, LOV_MAGIC_V3)) { - CERROR("LOV EA V3 too small: %d, need %d\n", + CERROR("LOV EA V3 too small: %zu, need %d\n", lmm_bytes, lov_mds_md_size(*stripe_count, LOV_MAGIC_V3)); lov_dump_lmm_common(D_WARNING, lmm); return -EINVAL; @@ -302,19 +351,39 @@ static int lsm_lmm_verify_v3(struct lov_mds_md *lmmv1, int lmm_bytes, *stripe_count); } -static int lsm_unpackmd_v3(struct lov_obd *lov, struct lov_stripe_md *lsm, - struct lov_mds_md *lmm) +static struct lov_stripe_md * +lsm_unpackmd_v3(struct lov_obd *lov, void *buf, size_t buf_size) { - struct lov_mds_md_v3 *lmm_v3 = (struct lov_mds_md_v3 *)lmm; + struct lov_mds_md_v3 *lmm = buf; + u32 magic = le32_to_cpu(lmm->lmm_magic); + struct lov_stripe_md *lsm; + u16 stripe_count; + u32 pattern; + int rc; + + rc = lsm_lmm_verify_v3(lmm, buf_size, &stripe_count); + if (rc) + return ERR_PTR(rc); + + pattern = le32_to_cpu(lmm->lmm_pattern); - return lsm_unpackmd_v1v3(lov, lsm, lmm, lmm_v3->lmm_pool_name, - lmm_v3->lmm_objects); + lsm = lov_lsm_alloc(stripe_count, pattern, magic); + if (IS_ERR(lsm)) + return lsm; + + rc = lsm_unpackmd_v1v3(lov, lsm, (struct lov_mds_md_v1 *)lmm, + lmm->lmm_pool_name, lmm->lmm_objects); + if (rc) { + lov_free_memmd(&lsm); + lsm = ERR_PTR(rc); + } + + return lsm; } const static struct lsm_operations lsm_v3_ops = { .lsm_stripe_by_index = lsm_stripe_by_index_plain, .lsm_stripe_by_offset = lsm_stripe_by_offset_plain, - .lsm_lmm_verify = lsm_lmm_verify_v3, .lsm_unpackmd = lsm_unpackmd_v3, }; diff --git a/drivers/staging/lustre/lustre/lov/lov_internal.h b/drivers/staging/lustre/lustre/lov/lov_internal.h index 2c416b4..ae122f6 100644 --- a/drivers/staging/lustre/lustre/lov/lov_internal.h +++ b/drivers/staging/lustre/lustre/lov/lov_internal.h @@ -85,10 +85,8 @@ struct lsm_operations { loff_t *); void (*lsm_stripe_by_offset)(struct lov_stripe_md *, int *, loff_t *, loff_t *); - int (*lsm_lmm_verify)(struct lov_mds_md *lmm, int lmm_bytes, - u16 *stripe_count); - int (*lsm_unpackmd)(struct lov_obd *lov, struct lov_stripe_md *lsm, - struct lov_mds_md *lmm); + struct lov_stripe_md *(*lsm_unpackmd)(struct lov_obd *obd, void *buf, + size_t buf_len); }; const struct lsm_operations *lsm_op_find(int magic); @@ -214,8 +212,8 @@ int lov_del_target(struct obd_device *obd, __u32 index, /* lov_pack.c */ ssize_t lov_lsm_pack(const struct lov_stripe_md *lsm, void *buf, size_t buf_size); -struct lov_stripe_md *lov_unpackmd(struct lov_obd *lov, struct lov_mds_md *lmm, - size_t lmm_size); +struct lov_stripe_md *lov_unpackmd(struct lov_obd *lov, void *buf, + size_t buf_size); int lov_free_memmd(struct lov_stripe_md **lsmp); void lov_dump_lmm_v1(int level, struct lov_mds_md_v1 *lmm); @@ -223,7 +221,6 @@ struct lov_stripe_md *lov_unpackmd(struct lov_obd *lov, struct lov_mds_md *lmm, void lov_dump_lmm_common(int level, void *lmmp); /* lov_ea.c */ -struct lov_stripe_md *lsm_alloc_plain(u16 stripe_count); void dump_lsm(unsigned int level, const struct lov_stripe_md *lsm); /* lproc_lov.c */ diff --git a/drivers/staging/lustre/lustre/lov/lov_pack.c b/drivers/staging/lustre/lustre/lov/lov_pack.c index 02936bf..90f9f2d 100644 --- a/drivers/staging/lustre/lustre/lov/lov_pack.c +++ b/drivers/staging/lustre/lustre/lov/lov_pack.c @@ -181,37 +181,6 @@ __u16 lov_get_stripecnt(struct lov_obd *lov, __u32 magic, __u16 stripe_count) return stripe_count; } -static struct lov_stripe_md *lov_lsm_alloc(u16 stripe_count, u32 pattern, - u32 magic) -{ - struct lov_stripe_md *lsm; - unsigned int i; - - CDEBUG(D_INFO, "alloc lsm, stripe_count %u\n", stripe_count); - - lsm = lsm_alloc_plain(stripe_count); - if (!lsm) { - CERROR("cannot allocate LSM stripe_count %u\n", stripe_count); - return ERR_PTR(-ENOMEM); - } - - atomic_set(&lsm->lsm_refc, 1); - spin_lock_init(&lsm->lsm_lock); - lsm->lsm_magic = magic; - lsm->lsm_stripe_count = stripe_count; - lsm->lsm_maxbytes = LUSTRE_EXT3_STRIPE_MAXBYTES * stripe_count; - lsm->lsm_pattern = pattern; - lsm->lsm_pool_name[0] = '\0'; - lsm->lsm_layout_gen = 0; - if (stripe_count > 0) - lsm->lsm_oinfo[0]->loi_ost_idx = ~0; - - for (i = 0; i < stripe_count; i++) - loi_init(lsm->lsm_oinfo[i]); - - return lsm; -} - int lov_free_memmd(struct lov_stripe_md **lsmp) { struct lov_stripe_md *lsm = *lsmp; @@ -229,38 +198,18 @@ int lov_free_memmd(struct lov_stripe_md **lsmp) /* Unpack LOV object metadata from disk storage. It is packed in LE byte * order and is opaque to the networking layer. */ -struct lov_stripe_md *lov_unpackmd(struct lov_obd *lov, struct lov_mds_md *lmm, - size_t lmm_size) +struct lov_stripe_md *lov_unpackmd(struct lov_obd *lov, void *buf, + size_t buf_size) { const struct lsm_operations *op; - struct lov_stripe_md *lsm; - u16 stripe_count; - u32 pattern; u32 magic; - int rc; - magic = le32_to_cpu(lmm->lmm_magic); + magic = le32_to_cpu(*(u32 *)buf); op = lsm_op_find(magic); if (!op) return ERR_PTR(-EINVAL); - rc = op->lsm_lmm_verify(lmm, lmm_size, &stripe_count); - if (rc) - return ERR_PTR(rc); - - pattern = le32_to_cpu(lmm->lmm_pattern); - - lsm = lov_lsm_alloc(stripe_count, pattern, magic); - if (IS_ERR(lsm)) - return lsm; - - rc = op->lsm_unpackmd(lov, lsm, lmm); - if (rc) { - lov_free_memmd(&lsm); - return ERR_PTR(rc); - } - - return lsm; + return op->lsm_unpackmd(lov, buf, buf_size); } /* Retrieve object striping information. -- 1.8.3.1 From jsimmons at infradead.org Sun Jan 6 22:14:27 2019 From: jsimmons at infradead.org (James Simmons) Date: Sun, 6 Jan 2019 17:14:27 -0500 Subject: [lustre-devel] [PATCH v2 32/33] lustre: lov: use stripe_count instead of stripe_nr In-Reply-To: <1546812868-11794-1-git-send-email-jsimmons@infradead.org> References: <1546812868-11794-1-git-send-email-jsimmons@infradead.org> Message-ID: <1546812868-11794-33-git-send-email-jsimmons@infradead.org> From: Andreas Dilger Replace the use of stripecnt in the code with stripe_count to be consistent the rest of the code. Signed-off-by: Andreas Dilger WC-bug-id: https://jira.whamcloud.com/browse/LU-8653 Reviewed-on: https://review.whamcloud.com/26681 Reviewed-by: Lai Siyao Reviewed-by: Steve Guminski Reviewed-by: Oleg Drokin Signed-off-by: James Simmons --- drivers/staging/lustre/lustre/lov/lov_internal.h | 2 +- drivers/staging/lustre/lustre/lov/lov_pack.c | 12 ++++++------ drivers/staging/lustre/lustre/lov/lov_request.c | 4 ++-- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/drivers/staging/lustre/lustre/lov/lov_internal.h b/drivers/staging/lustre/lustre/lov/lov_internal.h index 3878cad..2b31c99 100644 --- a/drivers/staging/lustre/lustre/lov/lov_internal.h +++ b/drivers/staging/lustre/lustre/lov/lov_internal.h @@ -271,7 +271,7 @@ int lov_prep_statfs_set(struct obd_device *obd, struct obd_info *oinfo, void lov_fix_desc_stripe_count(__u32 *val); void lov_fix_desc_pattern(__u32 *val); void lov_fix_desc_qos_maxage(__u32 *val); -__u16 lov_get_stripecnt(struct lov_obd *lov, __u32 magic, __u16 stripe_count); +u16 lov_get_stripe_count(struct lov_obd *lov, u32 magic, u16 stripe_count); int lov_connect_obd(struct obd_device *obd, __u32 index, int activate, struct obd_connect_data *data); int lov_setup(struct obd_device *obd, struct lustre_cfg *lcfg); diff --git a/drivers/staging/lustre/lustre/lov/lov_pack.c b/drivers/staging/lustre/lustre/lov/lov_pack.c index 089e556..0a6bb1e 100644 --- a/drivers/staging/lustre/lustre/lov/lov_pack.c +++ b/drivers/staging/lustre/lustre/lov/lov_pack.c @@ -192,7 +192,7 @@ ssize_t lov_lsm_pack(const struct lov_stripe_md *lsm, void *buf, for (entry = 0; entry < lsm->lsm_entry_count; entry++) { struct lov_stripe_md_entry *lsme; struct lov_mds_md *lmm; - u16 stripecnt; + u16 stripe_count; lsme = lsm->lsm_entries[entry]; lcme = &lcmv1->lcm_entries[entry]; @@ -227,11 +227,11 @@ ssize_t lov_lsm_pack(const struct lov_stripe_md *lsm, void *buf, if (lsme_inited(lsme) && !(lsme->lsme_pattern & LOV_PATTERN_F_RELEASED)) - stripecnt = lsme->lsme_stripe_count; + stripe_count = lsme->lsme_stripe_count; else - stripecnt = 0; + stripe_count = 0; - for (i = 0; i < stripecnt; i++) { + for (i = 0; i < stripe_count; i++) { struct lov_oinfo *loi = lsme->lsme_oinfo[i]; ostid_cpu_to_le(&loi->loi_oi, &lmm_objects[i].l_ost_oi); @@ -241,7 +241,7 @@ ssize_t lov_lsm_pack(const struct lov_stripe_md *lsm, void *buf, cpu_to_le32(loi->loi_ost_idx); } - size = lov_mds_md_size(stripecnt, lsme->lsme_magic); + size = lov_mds_md_size(stripe_count, lsme->lsme_magic); lcme->lcme_size = cpu_to_le32(size); offset += size; } /* for each layout component */ @@ -250,7 +250,7 @@ ssize_t lov_lsm_pack(const struct lov_stripe_md *lsm, void *buf, } /* Find the max stripecount we should use */ -__u16 lov_get_stripecnt(struct lov_obd *lov, __u32 magic, __u16 stripe_count) +u16 lov_get_stripe_count(struct lov_obd *lov, u32 magic, u16 stripe_count) { __u32 max_stripes = LOV_MAX_STRIPE_COUNT_OLD; diff --git a/drivers/staging/lustre/lustre/lov/lov_request.c b/drivers/staging/lustre/lustre/lov/lov_request.c index 8ca13ed..d13e8d1 100644 --- a/drivers/staging/lustre/lustre/lov/lov_request.c +++ b/drivers/staging/lustre/lustre/lov/lov_request.c @@ -149,8 +149,8 @@ static int lov_fini_statfs(struct obd_device *obd, struct obd_statfs *osfs, int success) { if (success) { - __u32 expected_stripes = lov_get_stripecnt(&obd->u.lov, - LOV_MAGIC, 0); + u32 expected_stripes = lov_get_stripe_count(&obd->u.lov, + LOV_MAGIC, 0); if (osfs->os_files != LOV_U64_MAX) lov_do_div64(osfs->os_files, expected_stripes); if (osfs->os_ffree != LOV_U64_MAX) -- 1.8.3.1 From jsimmons at infradead.org Sun Jan 6 22:14:05 2019 From: jsimmons at infradead.org (James Simmons) Date: Sun, 6 Jan 2019 17:14:05 -0500 Subject: [lustre-devel] [PATCH v2 10/33] lustre: lov: reduce code indentation In-Reply-To: <1546812868-11794-1-git-send-email-jsimmons@infradead.org> References: <1546812868-11794-1-git-send-email-jsimmons@infradead.org> Message-ID: <1546812868-11794-11-git-send-email-jsimmons@infradead.org> From: Bobi Jam For lov_init_raid0() we check for the failure of lo_sub and return an error rigth away. This allows us to reduce the code indentation. The same can be done for lov_attr_get_raid0() with the test of r0->lo_attr_valid. Signed-off-by: Jinshan Xiong Signed-off-by: Bobi Jam Signed-off-by: Niu Yawei WC-bug-id: https://jira.whamcloud.com/browse/LU-8998 Reviewed-on: https://review.whamcloud.com/24850 Reviewed-by: Lai Siyao Signed-off-by: James Simmons --- drivers/staging/lustre/lustre/lov/lov_io.c | 11 +- drivers/staging/lustre/lustre/lov/lov_object.c | 186 ++++++++++++------------- 2 files changed, 96 insertions(+), 101 deletions(-) diff --git a/drivers/staging/lustre/lustre/lov/lov_io.c b/drivers/staging/lustre/lustre/lov/lov_io.c index 023b588..6dd5639 100644 --- a/drivers/staging/lustre/lustre/lov/lov_io.c +++ b/drivers/staging/lustre/lustre/lov/lov_io.c @@ -948,12 +948,13 @@ int lov_io_init_composite(const struct lu_env *env, struct cl_object *obj, INIT_LIST_HEAD(&lio->lis_active); io->ci_result = lov_io_slice_init(lio, lov, io); + if (io->ci_result) + return io->ci_result; + + io->ci_result = lov_io_subio_init(env, lio, io); if (io->ci_result == 0) { - io->ci_result = lov_io_subio_init(env, lio, io); - if (io->ci_result == 0) { - cl_io_slice_add(io, &lio->lis_cl, obj, &lov_io_ops); - atomic_inc(&lov->lo_active_ios); - } + cl_io_slice_add(io, &lio->lis_cl, obj, &lov_io_ops); + atomic_inc(&lov->lo_active_ios); } return io->ci_result; } diff --git a/drivers/staging/lustre/lustre/lov/lov_object.c b/drivers/staging/lustre/lustre/lov/lov_object.c index f5c6da1..1ebaa23 100644 --- a/drivers/staging/lustre/lustre/lov/lov_object.c +++ b/drivers/staging/lustre/lustre/lov/lov_object.c @@ -228,6 +228,7 @@ static int lov_init_raid0(const struct lu_env *env, struct lov_device *dev, struct lov_thread_info *lti = lov_env_info(env); struct cl_object_conf *subconf = <i->lti_stripe_conf; struct lu_fid *ofid = <i->lti_fid; + int psz; if (lsm->lsm_magic != LOV_MAGIC_V1 && lsm->lsm_magic != LOV_MAGIC_V3) { dump_lsm(D_ERROR, lsm); @@ -238,73 +239,76 @@ static int lov_init_raid0(const struct lu_env *env, struct lov_device *dev, LASSERT(!lov->lo_lsm); lov->lo_lsm = lsm_addref(lsm); lov->lo_layout_invalid = true; + + spin_lock_init(&r0->lo_sub_lock); r0->lo_nr = lsm->lsm_entries[0]->lsme_stripe_count; LASSERT(r0->lo_nr <= lov_targets_nr(dev)); r0->lo_sub = kvzalloc(r0->lo_nr * sizeof(r0->lo_sub[0]), GFP_NOFS); - if (r0->lo_sub) { - int psz = 0; + if (!r0->lo_sub) + return -ENOMEM; - result = 0; - subconf->coc_inode = conf->coc_inode; - spin_lock_init(&r0->lo_sub_lock); - /* - * Create stripe cl_objects. + psz = 0; + result = 0; + subconf->coc_inode = conf->coc_inode; + /* + * Create stripe cl_objects. + */ + for (i = 0; i < r0->lo_nr; ++i) { + struct cl_device *subdev; + struct lov_oinfo *oinfo; + int ost_idx; + + oinfo = lsm->lsm_entries[0]->lsme_oinfo[i]; + if (lov_oinfo_is_dummy(oinfo)) + continue; + + result = ostid_to_fid(ofid, &oinfo->loi_oi, + oinfo->loi_ost_idx); + if (result != 0) + goto out; + + ost_idx = oinfo->loi_ost_idx; + if (!dev->ld_target[ost_idx]) { + CERROR("%s: OST %04x is not initialized\n", + lov2obd(dev->ld_lov)->obd_name, ost_idx); + result = -EIO; + goto out; + } + + subdev = lovsub2cl_dev(dev->ld_target[ost_idx]); + subconf->u.coc_oinfo = oinfo; + LASSERTF(subdev, "not init ost %d\n", ost_idx); + /* In the function below, .hs_keycmp resolves to + * lu_obj_hop_keycmp() */ - for (i = 0; i < r0->lo_nr && result == 0; ++i) { - struct cl_device *subdev; - struct lov_oinfo *oinfo; - int ost_idx; - - oinfo = lsm->lsm_entries[0]->lsme_oinfo[i]; - if (lov_oinfo_is_dummy(oinfo)) - continue; - - result = ostid_to_fid(ofid, &oinfo->loi_oi, - oinfo->loi_ost_idx); - if (result != 0) - goto out; - - ost_idx = oinfo->loi_ost_idx; - if (!dev->ld_target[ost_idx]) { - CERROR("%s: OST %04x is not initialized\n", - lov2obd(dev->ld_lov)->obd_name, ost_idx); - result = -EIO; - goto out; - } + /* coverity[overrun-buffer-val] */ + stripe = lov_sub_find(env, subdev, ofid, subconf); + if (IS_ERR(stripe)) { + result = PTR_ERR(stripe); + goto out; + } - subdev = lovsub2cl_dev(dev->ld_target[ost_idx]); - subconf->u.coc_oinfo = oinfo; - LASSERTF(subdev, "not init ost %d\n", ost_idx); - /* In the function below, .hs_keycmp resolves to - * lu_obj_hop_keycmp() - */ - /* coverity[overrun-buffer-val] */ - stripe = lov_sub_find(env, subdev, ofid, subconf); - if (!IS_ERR(stripe)) { - result = lov_init_sub(env, lov, stripe, r0, i); - if (result == -EAGAIN) { /* try again */ - --i; - result = 0; - continue; - } - } else { - result = PTR_ERR(stripe); - } + result = lov_init_sub(env, lov, stripe, r0, i); + if (result == -EAGAIN) { /* try again */ + --i; + result = 0; + continue; + } - if (result == 0) { - int sz = lov_page_slice_fixup(lov, stripe); + if (result == 0) { + int sz = lov_page_slice_fixup(lov, stripe); - LASSERT(ergo(psz > 0, psz == sz)); - psz = sz; - } + LASSERT(ergo(psz > 0, psz == sz)); + psz = sz; } - if (result == 0) - cl_object_header(&lov->lo_cl)->coh_page_bufsize += psz; - } else { - result = -ENOMEM; } + if (result == 0) + cl_object_header(&lov->lo_cl)->coh_page_bufsize += psz; + else + result = -ENOMEM; + out: return result; } @@ -567,53 +571,43 @@ static int lov_attr_get_empty(const struct lu_env *env, struct cl_object *obj, static int lov_attr_get_raid0(const struct lu_env *env, struct lov_object *lov, struct cl_attr *attr, struct lov_layout_raid0 *r0) { + struct lov_stripe_md *lsm = lov->lo_lsm; + struct ost_lvb *lvb = &lov_env_info(env)->lti_lvb; int result = 0; + u64 kms = 0; - /* this is called w/o holding type guard mutex, so it must be inside - * an on going IO otherwise lsm may be replaced. - * LU-2117: it turns out there exists one exception. For mmaped files, - * the lock of those files may be requested in the other file's IO - * context, and this function is called in ccc_lock_state(), it will - * hit this assertion. - * Anyway, it's still okay to call attr_get w/o type guard as layout - * can't go if locks exist. - */ - /* LASSERT(atomic_read(&lsm->lsm_refc) > 1); */ + if (r0->lo_attr_valid) + return 0; - if (!r0->lo_attr_valid) { - struct lov_stripe_md *lsm = lov->lo_lsm; - struct ost_lvb *lvb = &lov_env_info(env)->lti_lvb; - __u64 kms = 0; + memset(lvb, 0, sizeof(*lvb)); + /* XXX: timestamps can be negative by sanity:test_39m, + * how can it be? + */ + lvb->lvb_atime = LLONG_MIN; + lvb->lvb_ctime = LLONG_MIN; + lvb->lvb_mtime = LLONG_MIN; - memset(lvb, 0, sizeof(*lvb)); - /* XXX: timestamps can be negative by sanity:test_39m, - * how can it be? - */ - lvb->lvb_atime = LLONG_MIN; - lvb->lvb_ctime = LLONG_MIN; - lvb->lvb_mtime = LLONG_MIN; + /* + * XXX that should be replaced with a loop over sub-objects, + * doing cl_object_attr_get() on them. But for now, let's + * reuse old lov code. + */ - /* - * XXX that should be replaced with a loop over sub-objects, - * doing cl_object_attr_get() on them. But for now, let's - * reuse old lov code. - */ + /* + * XXX take lsm spin-lock to keep lov_merge_lvb_kms() + * happy. It's not needed, because new code uses + * ->coh_attr_guard spin-lock to protect consistency of + * sub-object attributes. + */ + lov_stripe_lock(lsm); + result = lov_merge_lvb_kms(lsm, lvb, &kms); + lov_stripe_unlock(lsm); + if (result) + return result; - /* - * XXX take lsm spin-lock to keep lov_merge_lvb_kms() - * happy. It's not needed, because new code uses - * ->coh_attr_guard spin-lock to protect consistency of - * sub-object attributes. - */ - lov_stripe_lock(lsm); - result = lov_merge_lvb_kms(lsm, lvb, &kms); - lov_stripe_unlock(lsm); - if (result == 0) { - cl_lvb2attr(attr, lvb); - attr->cat_kms = kms; - r0->lo_attr_valid = 1; - } - } + cl_lvb2attr(attr, lvb); + attr->cat_kms = kms; + r0->lo_attr_valid = 1; return result; } -- 1.8.3.1 From jsimmons at infradead.org Sun Jan 6 22:14:28 2019 From: jsimmons at infradead.org (James Simmons) Date: Sun, 6 Jan 2019 17:14:28 -0500 Subject: [lustre-devel] [PATCH v2 33/33] lustre: update version to 2.9.99 In-Reply-To: <1546812868-11794-1-git-send-email-jsimmons@infradead.org> References: <1546812868-11794-1-git-send-email-jsimmons@infradead.org> Message-ID: <1546812868-11794-34-git-send-email-jsimmons@infradead.org> With the majority of missing patches and features from the lustre 2.10 release merged upstream its time to update the upstream client's version. Signed-off-by: James Simmons --- drivers/staging/lustre/include/uapi/linux/lustre/lustre_ver.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/lustre/include/uapi/linux/lustre/lustre_ver.h b/drivers/staging/lustre/include/uapi/linux/lustre/lustre_ver.h index 1428fdd..e7a2eda 100644 --- a/drivers/staging/lustre/include/uapi/linux/lustre/lustre_ver.h +++ b/drivers/staging/lustre/include/uapi/linux/lustre/lustre_ver.h @@ -2,10 +2,10 @@ #define _LUSTRE_VER_H_ #define LUSTRE_MAJOR 2 -#define LUSTRE_MINOR 8 +#define LUSTRE_MINOR 9 #define LUSTRE_PATCH 99 #define LUSTRE_FIX 0 -#define LUSTRE_VERSION_STRING "2.8.99" +#define LUSTRE_VERSION_STRING "2.9.99" #define OBD_OCD_VERSION(major, minor, patch, fix) \ (((major) << 24) + ((minor) << 16) + ((patch) << 8) + (fix)) -- 1.8.3.1 From jsimmons at infradead.org Sun Jan 6 22:14:10 2019 From: jsimmons at infradead.org (James Simmons) Date: Sun, 6 Jan 2019 17:14:10 -0500 Subject: [lustre-devel] [PATCH v2 15/33] lustre: lov: create lov_comp_* wrappers In-Reply-To: <1546812868-11794-1-git-send-email-jsimmons@infradead.org> References: <1546812868-11794-1-git-send-email-jsimmons@infradead.org> Message-ID: <1546812868-11794-16-git-send-email-jsimmons@infradead.org> From: Bobi Jam Add new lov_comp_*() wrappers to get the index, stripe, and entries for PFL components. Signed-off-by: Jinshan Xiong Signed-off-by: Bobi Jam Signed-off-by: Niu Yawei WC-bug-id: https://jira.whamcloud.com/browse/LU-8998 Reviewed-on: https://review.whamcloud.com/24850 Reviewed-by: Lai Siyao Signed-off-by: James Simmons --- drivers/staging/lustre/lustre/lov/lov_internal.h | 15 ++++++++++++++ drivers/staging/lustre/lustre/lov/lov_io.c | 20 ++++++++++-------- drivers/staging/lustre/lustre/lov/lov_lock.c | 3 ++- drivers/staging/lustre/lustre/lov/lov_object.c | 25 +++++++++++++++-------- drivers/staging/lustre/lustre/lov/lov_page.c | 4 ++-- drivers/staging/lustre/lustre/lov/lovsub_object.c | 9 ++++---- 6 files changed, 52 insertions(+), 24 deletions(-) diff --git a/drivers/staging/lustre/lustre/lov/lov_internal.h b/drivers/staging/lustre/lustre/lov/lov_internal.h index ebe5890..ef47c67 100644 --- a/drivers/staging/lustre/lustre/lov/lov_internal.h +++ b/drivers/staging/lustre/lustre/lov/lov_internal.h @@ -79,6 +79,21 @@ static inline bool lsm_has_objects(struct lov_stripe_md *lsm) return lsm && !lsm->lsm_is_released; } +static inline unsigned int lov_comp_index(int entry, int stripe) +{ + return stripe; +} + +static inline int lov_comp_stripe(int index) +{ + return index & 0xffff; +} + +static inline int lov_comp_entry(int index) +{ + return 0; +} + struct lsm_operations { struct lov_stripe_md *(*lsm_unpackmd)(struct lov_obd *obd, void *buf, size_t buf_len); diff --git a/drivers/staging/lustre/lustre/lov/lov_io.c b/drivers/staging/lustre/lustre/lov/lov_io.c index 7fdbed9..635e5a6 100644 --- a/drivers/staging/lustre/lustre/lov/lov_io.c +++ b/drivers/staging/lustre/lustre/lov/lov_io.c @@ -72,8 +72,8 @@ static int lov_io_sub_init(const struct lu_env *env, struct lov_io *lio, struct cl_io *sub_io; struct cl_object *sub_obj; struct cl_io *io = lio->lis_cl.cis_io; - int stripe = sub->sub_subio_index; - int index = 0; + int index = lov_comp_entry(sub->sub_subio_index); + int stripe = lov_comp_stripe(sub->sub_subio_index); int rc; LASSERT(!sub->sub_io); @@ -286,11 +286,13 @@ static void lov_io_fini(const struct lu_env *env, const struct cl_io_slice *ios) wake_up_all(&lov->lo_waitq); } -static void lov_io_sub_inherit(struct cl_io *io, struct lov_io *lio, +static void lov_io_sub_inherit(struct lov_io_sub *sub, struct lov_io *lio, int stripe, loff_t start, loff_t end) { + struct cl_io *io = sub->sub_io; struct lov_stripe_md *lsm = lio->lis_object->lo_lsm; struct cl_io *parent = lio->lis_cl.cis_io; + int index = lov_comp_entry(sub->sub_subio_index); switch (io->ci_type) { case CIT_SETATTR: { @@ -305,7 +307,8 @@ static void lov_io_sub_inherit(struct cl_io *io, struct lov_io *lio, if (cl_io_is_trunc(io)) { loff_t new_size = parent->u.ci_setattr.sa_attr.lvb_size; - new_size = lov_size_to_stripe(lsm, 0, new_size, stripe); + new_size = lov_size_to_stripe(lsm, index, new_size, + stripe); io->u.ci_setattr.sa_attr.lvb_size = new_size; } break; @@ -321,7 +324,7 @@ static void lov_io_sub_inherit(struct cl_io *io, struct lov_io *lio, loff_t off = cl_offset(obj, parent->u.ci_fault.ft_index); io->u.ci_fault = parent->u.ci_fault; - off = lov_size_to_stripe(lsm, 0, off, stripe); + off = lov_size_to_stripe(lsm, index, off, stripe); io->u.ci_fault.ft_index = cl_index(obj, off); break; } @@ -401,13 +404,14 @@ static int lov_io_iter_init(const struct lu_env *env, } end = lov_offset_mod(end, 1); - sub = lov_sub_get(env, lio, stripe); + sub = lov_sub_get(env, lio, + lov_comp_index(index - 1, stripe)); if (IS_ERR(sub)) { rc = PTR_ERR(sub); break; } - lov_io_sub_inherit(sub->sub_io, lio, stripe, start, end); + lov_io_sub_inherit(sub, lio, stripe, start, end); rc = cl_io_iter_init(sub->sub_env, sub->sub_io); if (rc) { cl_io_iter_fini(sub->sub_env, sub->sub_io); @@ -588,7 +592,7 @@ static int lov_io_read_ahead(const struct lu_env *env, if (unlikely(!r0->lo_sub[stripe])) return -EIO; - sub = lov_sub_get(env, lio, stripe); + sub = lov_sub_get(env, lio, lov_comp_index(index, stripe)); if (IS_ERR(sub)) return PTR_ERR(sub); diff --git a/drivers/staging/lustre/lustre/lov/lov_lock.c b/drivers/staging/lustre/lustre/lov/lov_lock.c index 36c9eb7..cc08e96 100644 --- a/drivers/staging/lustre/lustre/lov/lov_lock.c +++ b/drivers/staging/lustre/lustre/lov/lov_lock.c @@ -168,7 +168,8 @@ static struct lov_lock *lov_lock_sub_init(const struct lu_env *env, descr->cld_mode = lock->cll_descr.cld_mode; descr->cld_gid = lock->cll_descr.cld_gid; descr->cld_enq_flags = lock->cll_descr.cld_enq_flags; - lls->sub_index = i; + + lls->sub_index = lov_comp_index(index, i); /* initialize sub lock */ result = lov_sublock_init(env, lock, lls); diff --git a/drivers/staging/lustre/lustre/lov/lov_object.c b/drivers/staging/lustre/lustre/lov/lov_object.c index 74e95b1..3b34713 100644 --- a/drivers/staging/lustre/lustre/lov/lov_object.c +++ b/drivers/staging/lustre/lustre/lov/lov_object.c @@ -132,6 +132,8 @@ static int lov_init_sub(const struct lu_env *env, struct lov_object *lov, struct cl_object *subobj, struct lov_layout_raid0 *r0, int idx) { + int stripe = lov_comp_stripe(idx); + int entry = lov_comp_entry(idx); struct cl_object_header *hdr; struct cl_object_header *subhdr; struct cl_object_header *parent; @@ -154,8 +156,9 @@ static int lov_init_sub(const struct lu_env *env, struct lov_object *lov, subhdr = cl_object_header(subobj); oinfo = lov->lo_lsm->lsm_entries[0]->lsme_oinfo[idx]; - CDEBUG(D_INODE, DFID "@%p[%d] -> " DFID "@%p: ostid: " DOSTID " idx: %d gen: %d\n", - PFID(&subhdr->coh_lu.loh_fid), subhdr, idx, + CDEBUG(D_INODE, + DFID "@%p[%d:%d] -> " DFID "@%p: ostid: " DOSTID " ost idx: %d gen: %d\n", + PFID(&subhdr->coh_lu.loh_fid), subhdr, entry, stripe, PFID(&hdr->coh_lu.loh_fid), hdr, POSTID(&oinfo->loi_oi), oinfo->loi_ost_idx, oinfo->loi_ost_gen); @@ -167,9 +170,9 @@ static int lov_init_sub(const struct lu_env *env, struct lov_object *lov, spin_unlock(&subhdr->coh_attr_guard); subhdr->coh_nesting = hdr->coh_nesting + 1; lu_object_ref_add(&subobj->co_lu, "lov-parent", lov); - r0->lo_sub[idx] = cl2lovsub(subobj); - r0->lo_sub[idx]->lso_super = lov; - r0->lo_sub[idx]->lso_index = idx; + r0->lo_sub[stripe] = cl2lovsub(subobj); + r0->lo_sub[stripe]->lso_super = lov; + r0->lo_sub[stripe]->lso_index = idx; result = 0; } else { struct lu_object *old_obj; @@ -279,7 +282,8 @@ static int lov_init_raid0(const struct lu_env *env, struct lov_device *dev, goto out; } - result = lov_init_sub(env, lov, stripe, r0, i); + result = lov_init_sub(env, lov, stripe, r0, + lov_comp_index(index, i)); if (result == -EAGAIN) { /* try again */ --i; result = 0; @@ -354,14 +358,15 @@ static int lov_init_released(const struct lu_env *env, struct lov_device *dev, static struct cl_object *lov_find_subobj(const struct lu_env *env, struct lov_object *lov, struct lov_stripe_md *lsm, - int stripe_idx) + int index) { struct lov_device *dev = lu2lov_dev(lov2lu(lov)->lo_dev); - struct lov_oinfo *oinfo = lsm->lsm_entries[0]->lsme_oinfo[stripe_idx]; struct lov_thread_info *lti = lov_env_info(env); struct lu_fid *ofid = <i->lti_fid; + int stripe = lov_comp_stripe(index); struct cl_device *subdev; struct cl_object *result; + struct lov_oinfo *oinfo; int ost_idx; int rc; @@ -370,6 +375,7 @@ static struct cl_object *lov_find_subobj(const struct lu_env *env, goto out; } + oinfo = lsm->lsm_entries[0]->lsme_oinfo[stripe]; ost_idx = oinfo->loi_ost_idx; rc = ostid_to_fid(ofid, &oinfo->loi_oi, ost_idx); if (rc) { @@ -1291,7 +1297,8 @@ static int fiemap_for_stripe(const struct lu_env *env, struct cl_object *obj, len_mapped_single_call = 0; /* find lobsub object */ - subobj = lov_find_subobj(env, cl2lov(obj), lsm, stripeno); + subobj = lov_find_subobj(env, cl2lov(obj), lsm, + lov_comp_index(index, stripeno)); if (IS_ERR(subobj)) return PTR_ERR(subobj); /* If the output buffer is very large and the objects have many diff --git a/drivers/staging/lustre/lustre/lov/lov_page.c b/drivers/staging/lustre/lustre/lov/lov_page.c index ad34fc3..e227279 100644 --- a/drivers/staging/lustre/lustre/lov/lov_page.c +++ b/drivers/staging/lustre/lustre/lov/lov_page.c @@ -87,10 +87,10 @@ int lov_page_init_composite(const struct lu_env *env, struct cl_object *obj, rc = lov_stripe_offset(loo->lo_lsm, entry, offset, stripe, &suboff); LASSERT(rc == 0); - lpg->lps_index = stripe; + lpg->lps_index = lov_comp_index(entry, stripe); cl_page_slice_add(page, &lpg->lps_cl, obj, index, &lov_comp_page_ops); - sub = lov_sub_get(env, lio, stripe); + sub = lov_sub_get(env, lio, lpg->lps_index); if (IS_ERR(sub)) return PTR_ERR(sub); diff --git a/drivers/staging/lustre/lustre/lov/lovsub_object.c b/drivers/staging/lustre/lustre/lov/lovsub_object.c index cd7806b..ca7c8a0 100644 --- a/drivers/staging/lustre/lustre/lov/lovsub_object.c +++ b/drivers/staging/lustre/lustre/lov/lovsub_object.c @@ -79,8 +79,8 @@ static void lovsub_object_free(const struct lu_env *env, struct lu_object *obj) * object handling in lu_object_find. */ if (lov) { - int index = 0; - int stripe = los->lso_index; + int index = lov_comp_entry(los->lso_index); + int stripe = lov_comp_stripe(los->lso_index); struct lov_layout_raid0 *r0 = lov_r0(lov, index); LASSERT(lov->lo_type == LLT_COMP); @@ -107,8 +107,9 @@ static int lovsub_attr_update(const struct lu_env *env, struct cl_object *obj, const struct cl_attr *attr, unsigned int valid) { struct lov_object *lov = cl2lovsub(obj)->lso_super; + struct lovsub_object *los = cl2lovsub(obj); - lov_r0(lov, 0)->lo_attr_valid = 0; + lov_r0(lov, lov_comp_entry(los->lso_index))->lo_attr_valid = 0; return 0; } @@ -137,7 +138,7 @@ static void lovsub_req_attr_set(const struct lu_env *env, struct cl_object *obj, * There is no OBD_MD_* flag for obdo::o_stripe_idx, so set it * unconditionally. It never changes anyway. */ - attr->cra_oa->o_stripe_idx = subobj->lso_index; + attr->cra_oa->o_stripe_idx = lov_comp_stripe(subobj->lso_index); } static const struct cl_object_operations lovsub_ops = { -- 1.8.3.1 From jsimmons at infradead.org Sun Jan 6 22:14:21 2019 From: jsimmons at infradead.org (James Simmons) Date: Sun, 6 Jan 2019 17:14:21 -0500 Subject: [lustre-devel] [PATCH v2 26/33] lustre: lov: readahead shouldn't exceed component boundary In-Reply-To: <1546812868-11794-1-git-send-email-jsimmons@infradead.org> References: <1546812868-11794-1-git-send-email-jsimmons@infradead.org> Message-ID: <1546812868-11794-27-git-send-email-jsimmons@infradead.org> From: Jinshan Xiong Otherwise, it will extend the readahead RPC to the next component while the actual lock of that component is not checked. Signed-off-by: Jinshan Xiong WC-bug-id: https://jira.whamcloud.com/browse/LU-9340 Reviewed-on: https://review.whamcloud.com/26677 Reviewed-on: https://review.whamcloud.com/26861 Reviewed-by: Bobi Jam Reviewed-by: Andreas Dilger Reviewed-by: Niu Yawei Reviewed-by: Oleg Drokin Signed-off-by: James Simmons --- drivers/staging/lustre/lustre/lov/lov_io.c | 23 ++++++++++++++++------- drivers/staging/lustre/lustre/lov/lov_page.c | 4 +++- 2 files changed, 19 insertions(+), 8 deletions(-) diff --git a/drivers/staging/lustre/lustre/lov/lov_io.c b/drivers/staging/lustre/lustre/lov/lov_io.c index ec0d14f..9a3352f 100644 --- a/drivers/staging/lustre/lustre/lov/lov_io.c +++ b/drivers/staging/lustre/lustre/lov/lov_io.c @@ -684,28 +684,37 @@ static int lov_io_read_ahead(const struct lu_env *env, return rc; /** - * Adjust the stripe index by layout of raid0. ra->cra_end is + * Adjust the stripe index by layout of comp. ra->cra_end is * the maximum page index covered by an underlying DLM lock. * This function converts cra_end from stripe level to file - * level, and make sure it's not beyond stripe boundary. + * level, and make sure it's not beyond stripe and component + * boundary. */ - if (r0->lo_nr == 1) /* single stripe file */ - return 0; /* cra_end is stripe level, convert it into file level */ ra_end = ra->cra_end; if (ra_end != CL_PAGE_EOF) - ra_end = lov_stripe_pgoff(loo->lo_lsm, index, ra_end, stripe); + ra->cra_end = lov_stripe_pgoff(loo->lo_lsm, index, + ra_end, stripe); + + /* boundary of current component */ + ra_end = cl_index(obj, (loff_t)lov_lse(loo, index)->lsme_extent.e_end); + if (ra_end != CL_PAGE_EOF && ra->cra_end >= ra_end) + ra->cra_end = ra_end - 1; + + if (r0->lo_nr == 1) /* single stripe file */ + return 0; pps = lov_lse(loo, index)->lsme_stripe_size >> PAGE_SHIFT; CDEBUG(D_READA, DFID " max_index = %lu, pps = %u, index = %u, stripe_size = %u, stripe no = %u, start index = %lu\n", - PFID(lu_object_fid(lov2lu(loo))), ra_end, pps, index, + PFID(lu_object_fid(lov2lu(loo))), ra->cra_end, pps, index, lov_lse(loo, index)->lsme_stripe_size, stripe, start); /* never exceed the end of the stripe */ - ra->cra_end = min_t(pgoff_t, ra_end, start + pps - start % pps - 1); + ra->cra_end = min_t(pgoff_t, + ra->cra_end, start + pps - start % pps - 1); return 0; } diff --git a/drivers/staging/lustre/lustre/lov/lov_page.c b/drivers/staging/lustre/lustre/lov/lov_page.c index 8b68d3c..90e2981 100644 --- a/drivers/staging/lustre/lustre/lov/lov_page.c +++ b/drivers/staging/lustre/lustre/lov/lov_page.c @@ -56,7 +56,9 @@ static int lov_comp_page_print(const struct lu_env *env, { struct lov_page *lp = cl2lov_page(slice); - return (*printer)(env, cookie, LUSTRE_LOV_NAME "-page@%p, raid0\n", lp); + return (*printer)(env, cookie, + LUSTRE_LOV_NAME "-page@%p, comp index: %x\n", + lp, lp->lps_index); } static const struct cl_page_operations lov_comp_page_ops = { -- 1.8.3.1 From jsimmons at infradead.org Sun Jan 6 22:14:24 2019 From: jsimmons at infradead.org (James Simmons) Date: Sun, 6 Jan 2019 17:14:24 -0500 Subject: [lustre-devel] [PATCH v2 29/33] lustre: llite: restore ll_file_getstripe in ll_lov_setstripe In-Reply-To: <1546812868-11794-1-git-send-email-jsimmons@infradead.org> References: <1546812868-11794-1-git-send-email-jsimmons@infradead.org> Message-ID: <1546812868-11794-30-git-send-email-jsimmons@infradead.org> From: Bobi Jam Commit fafe6b4d4a6fa63cedff3bd44e6578009578b3d7 has get rid of the call to ll_file_getstripe in ll_lov_setstripe. Add a @size parameter for series of xxx_getstripe interfaces, indicating the max buffer size that user provides to hold the stripe information. It is mainly for the ll_lov_setstripe, which will call ll_file_getstripe to fetch basic stripe inforation. Add LL_IOC_LOV_SETSTRIPE_NEW/LL_IOC_LOV_GETSTRIPE_NEW ioctl interface which defines the interface correctly, which could be used in later Lustre versions. Signed-off-by: Bobi Jam WC-bug-id: https://jira.whamcloud.com/browse/LU-9367 Reviewed-on: https://review.whamcloud.com/26915 Reviewed-by: Andreas Dilger Reviewed-by: Jinshan Xiong Signed-off-by: James Simmons --- .../lustre/include/uapi/linux/lustre/lustre_user.h | 2 ++ drivers/staging/lustre/lustre/include/cl_object.h | 4 +-- drivers/staging/lustre/lustre/llite/dir.c | 5 ++- drivers/staging/lustre/lustre/llite/file.c | 36 +++++++++++++++------- .../staging/lustre/lustre/lov/lov_cl_internal.h | 5 +-- drivers/staging/lustre/lustre/lov/lov_object.c | 4 +-- drivers/staging/lustre/lustre/lov/lov_pack.c | 33 ++++++++++++++------ drivers/staging/lustre/lustre/obdclass/cl_object.c | 5 +-- 8 files changed, 64 insertions(+), 30 deletions(-) diff --git a/drivers/staging/lustre/include/uapi/linux/lustre/lustre_user.h b/drivers/staging/lustre/include/uapi/linux/lustre/lustre_user.h index eeea79c..835b60c 100644 --- a/drivers/staging/lustre/include/uapi/linux/lustre/lustre_user.h +++ b/drivers/staging/lustre/include/uapi/linux/lustre/lustre_user.h @@ -236,7 +236,9 @@ struct ll_futimes_3 { #define LL_IOC_SETFLAGS _IOW('f', 152, long) #define LL_IOC_CLRFLAGS _IOW('f', 153, long) #define LL_IOC_LOV_SETSTRIPE _IOW('f', 154, long) +#define LL_IOC_LOV_SETSTRIPE_NEW _IOWR('f', 154, struct lov_user_md) #define LL_IOC_LOV_GETSTRIPE _IOW('f', 155, long) +#define LL_IOC_LOV_GETSTRIPE_NEW _IOR('f', 155, struct lov_user_md) #define LL_IOC_LOV_SETEA _IOW('f', 156, long) /* LL_IOC_RECREATE_OBJ 157 obsolete */ /* LL_IOC_RECREATE_FID 158 obsolete */ diff --git a/drivers/staging/lustre/lustre/include/cl_object.h b/drivers/staging/lustre/lustre/include/cl_object.h index ee71f1c..4f0e8e2 100644 --- a/drivers/staging/lustre/lustre/include/cl_object.h +++ b/drivers/staging/lustre/lustre/include/cl_object.h @@ -390,7 +390,7 @@ struct cl_object_operations { * Object getstripe method. */ int (*coo_getstripe)(const struct lu_env *env, struct cl_object *obj, - struct lov_user_md __user *lum); + struct lov_user_md __user *lum, size_t size); /** * Get FIEMAP mapping from the object. */ @@ -2057,7 +2057,7 @@ int cl_conf_set(const struct lu_env *env, struct cl_object *obj, int cl_object_prune(const struct lu_env *env, struct cl_object *obj); void cl_object_kill(const struct lu_env *env, struct cl_object *obj); int cl_object_getstripe(const struct lu_env *env, struct cl_object *obj, - struct lov_user_md __user *lum); + struct lov_user_md __user *lum, size_t size); int cl_object_fiemap(const struct lu_env *env, struct cl_object *obj, struct ll_fiemap_info_key *fmkey, struct fiemap *fiemap, size_t *buflen); diff --git a/drivers/staging/lustre/lustre/llite/dir.c b/drivers/staging/lustre/lustre/llite/dir.c index 57acb7b..2459f5c 100644 --- a/drivers/staging/lustre/lustre/llite/dir.c +++ b/drivers/staging/lustre/lustre/llite/dir.c @@ -1224,6 +1224,7 @@ static long ll_dir_ioctl(struct file *file, unsigned int cmd, unsigned long arg) return rc; } + case LL_IOC_LOV_SETSTRIPE_NEW: case LL_IOC_LOV_SETSTRIPE: { struct lov_user_md_v3 lumv3; struct lov_user_md_v1 *lumv1 = (struct lov_user_md_v1 *)&lumv3; @@ -1363,6 +1364,7 @@ static long ll_dir_ioctl(struct file *file, unsigned int cmd, unsigned long arg) case IOC_OBD_STATFS: return ll_obd_statfs(inode, (void __user *)arg); case LL_IOC_LOV_GETSTRIPE: + case LL_IOC_LOV_GETSTRIPE_NEW: case LL_IOC_MDC_GETINFO: case IOC_MDC_GETFILEINFO: case IOC_MDC_GETFILESTRIPE: { @@ -1405,7 +1407,8 @@ static long ll_dir_ioctl(struct file *file, unsigned int cmd, unsigned long arg) } if (cmd == IOC_MDC_GETFILESTRIPE || - cmd == LL_IOC_LOV_GETSTRIPE) { + cmd == LL_IOC_LOV_GETSTRIPE || + cmd == LL_IOC_LOV_GETSTRIPE_NEW) { lump = (struct lov_user_md __user *)arg; } else { struct lov_user_mds_data __user *lmdp; diff --git a/drivers/staging/lustre/lustre/llite/file.c b/drivers/staging/lustre/lustre/llite/file.c index 08ba8f7..94574b7 100644 --- a/drivers/staging/lustre/lustre/llite/file.c +++ b/drivers/staging/lustre/lustre/llite/file.c @@ -1481,7 +1481,7 @@ int ll_lov_getstripe_ea_info(struct inode *inode, const char *filename, } static int ll_lov_setea(struct inode *inode, struct file *file, - unsigned long arg) + void __user *arg) { __u64 flags = MDS_OPEN_HAS_OBJS | FMODE_WRITE; struct lov_user_md *lump; @@ -1496,7 +1496,7 @@ static int ll_lov_setea(struct inode *inode, struct file *file, if (!lump) return -ENOMEM; - if (copy_from_user(lump, (struct lov_user_md __user *)arg, lum_size)) { + if (copy_from_user(lump, arg, lum_size)) { kvfree(lump); return -EFAULT; } @@ -1509,8 +1509,7 @@ static int ll_lov_setea(struct inode *inode, struct file *file, return rc; } -static int ll_file_getstripe(struct inode *inode, - struct lov_user_md __user *lum) +static int ll_file_getstripe(struct inode *inode, void __user *lum, size_t size) { struct lu_env *env; u16 refcheck; @@ -1520,13 +1519,13 @@ static int ll_file_getstripe(struct inode *inode, if (IS_ERR(env)) return PTR_ERR(env); - rc = cl_object_getstripe(env, ll_i2info(inode)->lli_clob, lum); + rc = cl_object_getstripe(env, ll_i2info(inode)->lli_clob, lum, size); cl_env_put(env, &refcheck); return rc; } static int ll_lov_setstripe(struct inode *inode, struct file *file, - unsigned long arg) + void __user *arg) { struct lov_user_md __user *lum = (struct lov_user_md __user *)arg; struct lov_user_md *klum; @@ -1540,8 +1539,22 @@ static int ll_lov_setstripe(struct inode *inode, struct file *file, lum_size = rc; rc = ll_lov_setstripe_ea_info(inode, file->f_path.dentry, flags, klum, lum_size); - cl_lov_delay_create_clear(&file->f_flags); + if (!rc) { + u32 gen; + + rc = put_user(0, &lum->lmm_stripe_count); + if (rc) + goto out; + rc = ll_layout_refresh(inode, &gen); + if (rc) + goto out; + + rc = ll_file_getstripe(inode, arg, lum_size); + } + + cl_lov_delay_create_clear(&file->f_flags); +out: kfree(klum); return rc; } @@ -2329,9 +2342,10 @@ int ll_ioctl_fssetxattr(struct inode *inode, unsigned int cmd, } return 0; case LL_IOC_LOV_SETSTRIPE: - return ll_lov_setstripe(inode, file, arg); + case LL_IOC_LOV_SETSTRIPE_NEW: + return ll_lov_setstripe(inode, file, (void __user *) arg); case LL_IOC_LOV_SETEA: - return ll_lov_setea(inode, file, arg); + return ll_lov_setea(inode, file, (void __user *) arg); case LL_IOC_LOV_SWAP_LAYOUTS: { struct file *file2; struct lustre_swap_layouts lsl; @@ -2384,8 +2398,8 @@ int ll_ioctl_fssetxattr(struct inode *inode, unsigned int cmd, return rc; } case LL_IOC_LOV_GETSTRIPE: - return ll_file_getstripe(inode, - (struct lov_user_md __user *)arg); + case LL_IOC_LOV_GETSTRIPE_NEW: + return ll_file_getstripe(inode, (void __user *)arg, 0); case FSFILT_IOC_GETFLAGS: case FSFILT_IOC_SETFLAGS: return ll_iocontrol(inode, file, cmd, arg); diff --git a/drivers/staging/lustre/lustre/lov/lov_cl_internal.h b/drivers/staging/lustre/lustre/lov/lov_cl_internal.h index 96e6636..5d4c83b 100644 --- a/drivers/staging/lustre/lustre/lov/lov_cl_internal.h +++ b/drivers/staging/lustre/lustre/lov/lov_cl_internal.h @@ -651,8 +651,9 @@ static inline struct lov_stripe_md_entry *lov_lse(struct lov_object *lov, int i) } /* lov_pack.c */ -int lov_getstripe(struct lov_object *obj, struct lov_stripe_md *lsm, - struct lov_user_md __user *lump); +int lov_getstripe(const struct lu_env *env, struct lov_object *obj, + struct lov_stripe_md *lsm, struct lov_user_md __user *lump, + size_t size); /** @} lov */ diff --git a/drivers/staging/lustre/lustre/lov/lov_object.c b/drivers/staging/lustre/lustre/lov/lov_object.c index aad4fee..72f42fc 100644 --- a/drivers/staging/lustre/lustre/lov/lov_object.c +++ b/drivers/staging/lustre/lustre/lov/lov_object.c @@ -1605,7 +1605,7 @@ static int lov_object_fiemap(const struct lu_env *env, struct cl_object *obj, } static int lov_object_getstripe(const struct lu_env *env, struct cl_object *obj, - struct lov_user_md __user *lum) + struct lov_user_md __user *lum, size_t size) { struct lov_object *lov = cl2lov(obj); struct lov_stripe_md *lsm; @@ -1615,7 +1615,7 @@ static int lov_object_getstripe(const struct lu_env *env, struct cl_object *obj, if (!lsm) return -ENODATA; - rc = lov_getstripe(env, cl2lov(obj), lsm, lum); + rc = lov_getstripe(env, cl2lov(obj), lsm, lum, size); lov_lsm_put(lsm); return rc; } diff --git a/drivers/staging/lustre/lustre/lov/lov_pack.c b/drivers/staging/lustre/lustre/lov/lov_pack.c index 10be119..ef3c040 100644 --- a/drivers/staging/lustre/lustre/lov/lov_pack.c +++ b/drivers/staging/lustre/lustre/lov/lov_pack.c @@ -314,12 +314,16 @@ struct lov_stripe_md *lov_unpackmd(struct lov_obd *lov, void *buf, * @lump is a pointer to an in-core struct with lmm_ost_count indicating * the maximum number of OST indices which will fit in the user buffer. * lmm_magic must be LOV_USER_MAGIC. + * + * If @size > 0, User specified limited buffer size, usually the buffer is from + * ll_lov_setstripe(), and the buffer can only hold basic layout template info. */ int lov_getstripe(const struct lu_env *env, struct lov_object *obj, - struct lov_stripe_md *lsm, struct lov_user_md __user *lump) + struct lov_stripe_md *lsm, struct lov_user_md __user *lump, + size_t size) { /* we use lov_user_md_v3 because it is larger than lov_user_md_v1 */ - struct lov_mds_md *lmmk; + struct lov_mds_md *lmmk, *lmm; struct lov_user_md_v1 lum; ssize_t lmm_size, lum_size = 0; static bool printed; @@ -410,15 +414,24 @@ int lov_getstripe(const struct lu_env *env, struct lov_object *obj, comp_md = (struct lov_mds_md *)((char *)comp_v1 + comp_v1->lcm_entries[i].lcme_offset); } - if (copy_to_user(lump, comp_md, lum_size)) { - rc = -EFAULT; - goto out_free; - } + + lmm = comp_md; + lmm_size = lum_size; } else { - if (copy_to_user(lump, lmmk, lmmk_size)) { - rc = -EFAULT; - goto out_free; - } + lmm = lmmk; + lmm_size = lmmk_size; + } + /** + * User specified limited buffer size, usually the buffer is + * from ll_lov_setstripe(), and the buffer can only hold basic + * layout template info. + */ + if (size == 0 || size > lmm_size) + size = lmm_size; + + if (copy_to_user(lump, lmm, size)) { + rc = -EFAULT; + goto out_free; } out_free: diff --git a/drivers/staging/lustre/lustre/obdclass/cl_object.c b/drivers/staging/lustre/lustre/obdclass/cl_object.c index 09fc7e7..b2bf570 100644 --- a/drivers/staging/lustre/lustre/obdclass/cl_object.c +++ b/drivers/staging/lustre/lustre/obdclass/cl_object.c @@ -323,7 +323,7 @@ int cl_object_prune(const struct lu_env *env, struct cl_object *obj) * Get stripe information of this object. */ int cl_object_getstripe(const struct lu_env *env, struct cl_object *obj, - struct lov_user_md __user *uarg) + struct lov_user_md __user *uarg, size_t size) { struct lu_object_header *top; int result = 0; @@ -331,7 +331,8 @@ int cl_object_getstripe(const struct lu_env *env, struct cl_object *obj, top = obj->co_lu.lo_header; list_for_each_entry(obj, &top->loh_layers, co_lu.lo_linkage) { if (obj->co_ops->coo_getstripe) { - result = obj->co_ops->coo_getstripe(env, obj, uarg); + result = obj->co_ops->coo_getstripe(env, obj, uarg, + size); if (result) break; } -- 1.8.3.1 From jsimmons at infradead.org Sun Jan 6 22:14:20 2019 From: jsimmons at infradead.org (James Simmons) Date: Sun, 6 Jan 2019 17:14:20 -0500 Subject: [lustre-devel] [PATCH v2 25/33] lustre: pfl: fix ost pool op->size handling In-Reply-To: <1546812868-11794-1-git-send-email-jsimmons@infradead.org> References: <1546812868-11794-1-git-send-email-jsimmons@infradead.org> Message-ID: <1546812868-11794-26-git-send-email-jsimmons@infradead.org> From: Bobi Jam This patch fixes the misunderstanding of ost_pool::op->size, it indicates the buffer size allocated instead of the array count. Signed-off-by: Bobi Jam WC-bug-id: https://jira.whamcloud.com/browse/LU-9359 Reviewed-on: https://review.whamcloud.com/26706 Reviewed-by: Niu Yawei Reviewed-by: Andreas Dilger Signed-off-by: James Simmons --- drivers/staging/lustre/lustre/lov/lov_internal.h | 1 - drivers/staging/lustre/lustre/lov/lov_io.c | 3 ++- drivers/staging/lustre/lustre/lov/lov_pool.c | 20 +++++++++++--------- 3 files changed, 13 insertions(+), 11 deletions(-) diff --git a/drivers/staging/lustre/lustre/lov/lov_internal.h b/drivers/staging/lustre/lustre/lov/lov_internal.h index dd4dd24..3878cad 100644 --- a/drivers/staging/lustre/lustre/lov/lov_internal.h +++ b/drivers/staging/lustre/lustre/lov/lov_internal.h @@ -195,7 +195,6 @@ struct lsm_operations { }) #endif -#define pool_tgt_size(p) ((p)->pool_obds.op_size) #define pool_tgt_count(p) ((p)->pool_obds.op_count) #define pool_tgt_array(p) ((p)->pool_obds.op_array) #define pool_tgt_rw_sem(p) ((p)->pool_obds.op_rw_sem) diff --git a/drivers/staging/lustre/lustre/lov/lov_io.c b/drivers/staging/lustre/lustre/lov/lov_io.c index 0d809b1..ec0d14f 100644 --- a/drivers/staging/lustre/lustre/lov/lov_io.c +++ b/drivers/staging/lustre/lustre/lov/lov_io.c @@ -100,7 +100,8 @@ static int lov_io_sub_init(const struct lu_env *env, struct lov_io *lio, LASSERT(!sub->sub_env); - if (unlikely(!lov_r0(lov, index)->lo_sub[stripe])) + if (unlikely(!lov_r0(lov, index)->lo_sub || + !lov_r0(lov, index)->lo_sub[stripe])) return -EIO; /* obtain new environment */ diff --git a/drivers/staging/lustre/lustre/lov/lov_pool.c b/drivers/staging/lustre/lustre/lov/lov_pool.c index c79c2ae..b90fb1c 100644 --- a/drivers/staging/lustre/lustre/lov/lov_pool.c +++ b/drivers/staging/lustre/lustre/lov/lov_pool.c @@ -238,8 +238,9 @@ int lov_ost_pool_init(struct ost_pool *op, unsigned int count) op->op_array = NULL; op->op_count = 0; init_rwsem(&op->op_rw_sem); - op->op_size = count; - op->op_array = kcalloc(op->op_size, sizeof(op->op_array[0]), GFP_NOFS); + op->op_size = count * sizeof(op->op_array[0]); + op->op_array = kcalloc(count, sizeof(op->op_array[0]), + GFP_KERNEL); if (!op->op_array) { op->op_size = 0; return -ENOMEM; @@ -250,24 +251,25 @@ int lov_ost_pool_init(struct ost_pool *op, unsigned int count) /* Caller must hold write op_rwlock */ int lov_ost_pool_extend(struct ost_pool *op, unsigned int min_count) { - __u32 *new; - int new_size; + int new_count; + u32 *new; LASSERT(min_count != 0); - if (op->op_count < op->op_size) + if (op->op_count * sizeof(op->op_array[0]) < op->op_size) return 0; - new_size = max(min_count, 2 * op->op_size); - new = kcalloc(new_size, sizeof(op->op_array[0]), GFP_NOFS); + new_count = max_t(u32, min_count, + 2 * op->op_size / sizeof(op->op_array[0])); + new = kcalloc(new_count, sizeof(op->op_array[0]), GFP_KERNEL); if (!new) return -ENOMEM; /* copy old array to new one */ - memcpy(new, op->op_array, op->op_size * sizeof(op->op_array[0])); + memcpy(new, op->op_array, op->op_size); kfree(op->op_array); op->op_array = new; - op->op_size = new_size; + op->op_size = new_count * sizeof(op->op_array[0]); return 0; } -- 1.8.3.1 From jsimmons at infradead.org Sun Jan 6 22:14:23 2019 From: jsimmons at infradead.org (James Simmons) Date: Sun, 6 Jan 2019 17:14:23 -0500 Subject: [lustre-devel] [PATCH v2 28/33] lustre: llite: return v1/v3 layout for legacy app In-Reply-To: <1546812868-11794-1-git-send-email-jsimmons@infradead.org> References: <1546812868-11794-1-git-send-email-jsimmons@infradead.org> Message-ID: <1546812868-11794-29-git-send-email-jsimmons@infradead.org> From: Niu Yawei Legacy app such as ADIO fetches LOVEA by ioctl LL_IOC_LOV_GETSTRIPE and treats file layout as v1/v3 blindly, we'd return a reasonable v1/v3 in this case. Signed-off-by: Niu Yawei WC-bug-id: https://jira.whamcloud.com/browse/LU-9490 Reviewed-on: https://review.whamcloud.com/27183 Reviewed-by: Bobi Jam Reviewed-by: Andreas Dilger Reviewed-by: Oleg Drokin Signed-off-by: James Simmons --- drivers/staging/lustre/lustre/lov/lov_object.c | 2 +- drivers/staging/lustre/lustre/lov/lov_pack.c | 72 +++++++++++++++++++++++--- 2 files changed, 67 insertions(+), 7 deletions(-) diff --git a/drivers/staging/lustre/lustre/lov/lov_object.c b/drivers/staging/lustre/lustre/lov/lov_object.c index 968c49d..aad4fee 100644 --- a/drivers/staging/lustre/lustre/lov/lov_object.c +++ b/drivers/staging/lustre/lustre/lov/lov_object.c @@ -1615,7 +1615,7 @@ static int lov_object_getstripe(const struct lu_env *env, struct cl_object *obj, if (!lsm) return -ENODATA; - rc = lov_getstripe(cl2lov(obj), lsm, lum); + rc = lov_getstripe(env, cl2lov(obj), lsm, lum); lov_lsm_put(lsm); return rc; } diff --git a/drivers/staging/lustre/lustre/lov/lov_pack.c b/drivers/staging/lustre/lustre/lov/lov_pack.c index 32e4b33..10be119 100644 --- a/drivers/staging/lustre/lustre/lov/lov_pack.c +++ b/drivers/staging/lustre/lustre/lov/lov_pack.c @@ -315,12 +315,14 @@ struct lov_stripe_md *lov_unpackmd(struct lov_obd *lov, void *buf, * the maximum number of OST indices which will fit in the user buffer. * lmm_magic must be LOV_USER_MAGIC. */ -int lov_getstripe(struct lov_object *obj, struct lov_stripe_md *lsm, - struct lov_user_md __user *lump) +int lov_getstripe(const struct lu_env *env, struct lov_object *obj, + struct lov_stripe_md *lsm, struct lov_user_md __user *lump) { /* we use lov_user_md_v3 because it is larger than lov_user_md_v1 */ struct lov_mds_md *lmmk; - ssize_t lmm_size; + struct lov_user_md_v1 lum; + ssize_t lmm_size, lum_size = 0; + static bool printed; size_t lmmk_size; int rc = 0; @@ -332,6 +334,13 @@ int lov_getstripe(struct lov_object *obj, struct lov_stripe_md *lsm, goto out; } + if (!printed) { + LCONSOLE_WARN("%s: using old ioctl(LL_IOC_LOV_GETSTRIPE) on " DFID ", use llapi_layout_get_by_path()\n", + current->comm, + PFID(&obj->lo_cl.co_lu.lo_header->loh_fid)); + printed = true; + } + lmmk_size = lov_comp_md_size(lsm); lmmk = kvzalloc(lmmk_size, GFP_KERNEL); if (!lmmk) { @@ -357,10 +366,61 @@ int lov_getstripe(struct lov_object *obj, struct lov_stripe_md *lsm, } } - if (copy_to_user(lump, lmmk, lmmk_size)) + /* Legacy appication passes limited buffer, we need to figure out + * the user buffer size by the passed in lmm_stripe_count. + */ + if (copy_from_user(&lum, lump, sizeof(struct lov_user_md_v1))) { rc = -EFAULT; - else - rc = 0; + goto out_free; + } + + if (lum.lmm_magic == LOV_USER_MAGIC_V1 || + lum.lmm_magic == LOV_USER_MAGIC_V3) + lum_size = lov_user_md_size(lum.lmm_stripe_count, + lum.lmm_magic); + + if (lum_size != 0) { + struct lov_mds_md *comp_md = lmmk; + + /* Legacy app (ADIO for instance) treats the layout as V1/V3 + * blindly, we'd return a reasonable V1/V3 for them. + */ + if (lmmk->lmm_magic == LOV_MAGIC_COMP_V1) { + struct lov_comp_md_v1 *comp_v1; + struct cl_object *cl_obj; + struct cl_attr attr; + int i; + + attr.cat_size = 0; + cl_obj = cl_object_top(&obj->lo_cl); + cl_object_attr_get(env, cl_obj, &attr); + + /* return the last instantiated component if file size + * is non-zero, otherwise, return the last component. + */ + comp_v1 = (struct lov_comp_md_v1 *)lmmk; + i = attr.cat_size == 0 ? comp_v1->lcm_entry_count : 0; + for (; i < comp_v1->lcm_entry_count; i++) { + if (!(comp_v1->lcm_entries[i].lcme_flags & + LCME_FL_INIT)) + break; + } + if (i > 0) + i--; + comp_md = (struct lov_mds_md *)((char *)comp_v1 + + comp_v1->lcm_entries[i].lcme_offset); + } + if (copy_to_user(lump, comp_md, lum_size)) { + rc = -EFAULT; + goto out_free; + } + } else { + if (copy_to_user(lump, lmmk, lmmk_size)) { + rc = -EFAULT; + goto out_free; + } + } + out_free: kvfree(lmmk); out: -- 1.8.3.1 From jsimmons at infradead.org Sun Jan 6 22:14:11 2019 From: jsimmons at infradead.org (James Simmons) Date: Sun, 6 Jan 2019 17:14:11 -0500 Subject: [lustre-devel] [PATCH v2 16/33] lustre: clio: client side implementation for PFL In-Reply-To: <1546812868-11794-1-git-send-email-jsimmons@infradead.org> References: <1546812868-11794-1-git-send-email-jsimmons@infradead.org> Message-ID: <1546812868-11794-17-git-send-email-jsimmons@infradead.org> From: Bobi Jam Make client layer support composite layout. Plain layout will be stored in LOV layer as a composite layout containing a single component. Signed-off-by: Jinshan Xiong Signed-off-by: Bobi Jam Signed-off-by: Niu Yawei WC-bug-id: https://jira.whamcloud.com/browse/LU-8998 Reviewed-on: https://review.whamcloud.com/24850 Reviewed-by: Lai Siyao Signed-off-by: James Simmons --- .../lustre/include/uapi/linux/lustre/lustre_user.h | 9 + .../staging/lustre/lustre/lov/lov_cl_internal.h | 25 +- drivers/staging/lustre/lustre/lov/lov_ea.c | 21 +- drivers/staging/lustre/lustre/lov/lov_internal.h | 10 +- drivers/staging/lustre/lustre/lov/lov_io.c | 301 +++++++++++---------- drivers/staging/lustre/lustre/lov/lov_lock.c | 83 +++--- drivers/staging/lustre/lustre/lov/lov_object.c | 283 ++++++++++--------- drivers/staging/lustre/lustre/lov/lov_offset.c | 12 +- drivers/staging/lustre/lustre/lov/lov_pack.c | 2 +- drivers/staging/lustre/lustre/lov/lov_page.c | 8 +- drivers/staging/lustre/lustre/osc/osc_lock.c | 7 +- 11 files changed, 438 insertions(+), 323 deletions(-) diff --git a/drivers/staging/lustre/include/uapi/linux/lustre/lustre_user.h b/drivers/staging/lustre/include/uapi/linux/lustre/lustre_user.h index bb87a6f..8ef05f5 100644 --- a/drivers/staging/lustre/include/uapi/linux/lustre/lustre_user.h +++ b/drivers/staging/lustre/include/uapi/linux/lustre/lustre_user.h @@ -411,6 +411,15 @@ struct lu_extent { __u64 e_end; }; +#define DEXT "[ %#llx , %#llx )" +#define PEXT(ext) (ext)->e_start, (ext)->e_end + +static inline bool lu_extent_is_overlapped(struct lu_extent *e1, + struct lu_extent *e2) +{ + return e1->e_start < e2->e_end && e2->e_start < e1->e_end; +} + enum lov_comp_md_entry_flags { LCME_FL_PRIMARY = 0x00000001, /* Not used */ LCME_FL_STALE = 0x00000002, /* Not used */ diff --git a/drivers/staging/lustre/lustre/lov/lov_cl_internal.h b/drivers/staging/lustre/lustre/lov/lov_cl_internal.h index 952da3a..96e6636 100644 --- a/drivers/staging/lustre/lustre/lov/lov_cl_internal.h +++ b/drivers/staging/lustre/lustre/lov/lov_cl_internal.h @@ -224,6 +224,7 @@ struct lov_object { */ unsigned int lo_entry_count; struct lov_layout_entry { + struct lu_extent lle_extent; struct lov_layout_raid0 lle_raid0; } *lo_entries; } composite; @@ -320,15 +321,9 @@ struct lov_thread_info { */ struct lov_io_sub { /** - * true, iff cl_io_init() was successfully executed against - * lov_io_sub::sub_io. + * Linkage into a list (hanging off lov_io::lis_subios) */ - u16 sub_io_initialized:1, - /** - * True, iff lov_io_sub::sub_io and lov_io_sub::sub_env weren't - * allocated, but borrowed from a per-device emergency pool. - */ - sub_borrowed:1; + struct list_head sub_list; /** * Linkage into a list (hanging off lov_io::lis_active) of all * sub-io's active for the current IO iteration. @@ -340,7 +335,7 @@ struct lov_io_sub { * independently, with lov acting as a scheduler to maximize overall * throughput. */ - struct cl_io *sub_io; + struct cl_io sub_io; /** * environment, in which sub-io executes. */ @@ -351,6 +346,7 @@ struct lov_io_sub { * \see cl_env_get() */ u16 sub_refcheck; + u16 sub_reenter; }; /** @@ -384,14 +380,13 @@ struct lov_io { * exclusive (i.e., next offset after last byte affected by io). */ u64 lis_endpos; - int lis_stripe_count; - int lis_active_subios; + int lis_nr_subios; /** * the index of ls_single_subio in ls_subios array */ int lis_single_subio_index; - struct cl_io lis_single_subio; + struct lov_io_sub lis_single_subio; /** * List of active sub-io's. Active sub-io's are under the range @@ -400,10 +395,9 @@ struct lov_io { struct list_head lis_active; /** - * size of ls_subios array, actually the highest stripe # + * All sub-io's created in this lov_io. */ - int lis_nr_subios; - struct lov_io_sub *lis_subs; + struct list_head lis_subios; }; struct lov_session { @@ -466,6 +460,7 @@ struct lu_object *lovsub_object_alloc(const struct lu_env *env, struct lu_device *dev); struct lov_stripe_md *lov_lsm_addref(struct lov_object *lov); +int lov_lsm_entry(const struct lov_stripe_md *lsm, u64 offset); #define lov_foreach_target(lov, var) \ for (var = 0; var < lov_targets_nr(lov); ++var) diff --git a/drivers/staging/lustre/lustre/lov/lov_ea.c b/drivers/staging/lustre/lustre/lov/lov_ea.c index ff6b251..6e5b59e 100644 --- a/drivers/staging/lustre/lustre/lov/lov_ea.c +++ b/drivers/staging/lustre/lustre/lov/lov_ea.c @@ -519,9 +519,26 @@ void dump_lsm(unsigned int level, const struct lov_stripe_md *lsm) struct lov_stripe_md_entry *lse = lsm->lsm_entries[i]; CDEBUG(level, - ": id: %u, magic 0x%08X, stripe count %u, size %u, layout_gen %u, pool: [" LOV_POOLNAMEF "]\n", - lse->lsme_id, lse->lsme_magic, + DEXT ": id: %u, magic 0x%08X, stripe count %u, size %u, layout_gen %u, pool: [" LOV_POOLNAMEF "]\n", + PEXT(&lse->lsme_extent), lse->lsme_id, lse->lsme_magic, lse->lsme_stripe_count, lse->lsme_stripe_size, lse->lsme_layout_gen, lse->lsme_pool_name); } } + +int lov_lsm_entry(const struct lov_stripe_md *lsm, u64 offset) +{ + int i; + + for (i = 0; i < lsm->lsm_entry_count; i++) { + struct lov_stripe_md_entry *lse = lsm->lsm_entries[i]; + + if ((offset >= lse->lsme_extent.e_start && + offset < lse->lsme_extent.e_end) || + (offset == OBD_OBJECT_EOF && + lse->lsme_extent.e_end == OBD_OBJECT_EOF)) + return i; + } + + return -1; +} diff --git a/drivers/staging/lustre/lustre/lov/lov_internal.h b/drivers/staging/lustre/lustre/lov/lov_internal.h index ef47c67..29325ff 100644 --- a/drivers/staging/lustre/lustre/lov/lov_internal.h +++ b/drivers/staging/lustre/lustre/lov/lov_internal.h @@ -81,7 +81,10 @@ static inline bool lsm_has_objects(struct lov_stripe_md *lsm) static inline unsigned int lov_comp_index(int entry, int stripe) { - return stripe; + LASSERT(entry >= 0 && entry <= SHRT_MAX); + LASSERT(stripe >= 0 && stripe < USHRT_MAX); + + return entry << 16 | stripe; } static inline int lov_comp_stripe(int index) @@ -91,7 +94,7 @@ static inline int lov_comp_stripe(int index) static inline int lov_comp_entry(int index) { - return 0; + return index >> 16; } struct lsm_operations { @@ -191,8 +194,7 @@ int lov_stripe_offset(struct lov_stripe_md *lsm, int index, u64 lov_off, u64 lov_size_to_stripe(struct lov_stripe_md *lsm, int index, u64 file_size, int stripeno); int lov_stripe_intersects(struct lov_stripe_md *lsm, int index, int stripeno, - u64 start, u64 end, - u64 *obd_start, u64 *obd_end); + struct lu_extent *ext, u64 *obd_start, u64 *obd_end); int lov_stripe_number(struct lov_stripe_md *lsm, int index, u64 lov_off); pgoff_t lov_stripe_pgoff(struct lov_stripe_md *lsm, int index, pgoff_t stripe_index, int stripe); diff --git a/drivers/staging/lustre/lustre/lov/lov_io.c b/drivers/staging/lustre/lustre/lov/lov_io.c index 635e5a6..d9b2a81 100644 --- a/drivers/staging/lustre/lustre/lov/lov_io.c +++ b/drivers/staging/lustre/lustre/lov/lov_io.c @@ -43,24 +43,46 @@ /** \addtogroup lov * @{ */ + +static inline struct lov_io_sub *lov_sub_alloc(struct lov_io *lio, int index) +{ + struct lov_io_sub *sub; + + if (lio->lis_nr_subios == 0) { + LASSERT(lio->lis_single_subio_index == -1); + sub = &lio->lis_single_subio; + lio->lis_single_subio_index = index; + memset(sub, 0, sizeof(*sub)); + } else { + sub = kzalloc(sizeof(*sub), GFP_KERNEL); + } + + if (sub) { + INIT_LIST_HEAD(&sub->sub_list); + INIT_LIST_HEAD(&sub->sub_linkage); + sub->sub_subio_index = index; + } + + return sub; +} + +static inline void lov_sub_free(struct lov_io *lio, struct lov_io_sub *sub) +{ + if (sub->sub_subio_index == lio->lis_single_subio_index) { + LASSERT(sub == &lio->lis_single_subio); + lio->lis_single_subio_index = -1; + } else { + kfree(sub); + } +} + static void lov_io_sub_fini(const struct lu_env *env, struct lov_io *lio, struct lov_io_sub *sub) { - if (sub->sub_io) { - if (sub->sub_io_initialized) { - cl_io_fini(sub->sub_env, sub->sub_io); - sub->sub_io_initialized = 0; - lio->lis_active_subios--; - } - if (sub->sub_subio_index == lio->lis_single_subio_index) - lio->lis_single_subio_index = -1; - else if (!sub->sub_borrowed) - kfree(sub->sub_io); - sub->sub_io = NULL; - } - if (!IS_ERR_OR_NULL(sub->sub_env)) { - if (!sub->sub_borrowed) - cl_env_put(sub->sub_env, &sub->sub_refcheck); + cl_io_fini(sub->sub_env, &sub->sub_io); + + if (sub->sub_env && !IS_ERR(sub->sub_env)) { + cl_env_put(sub->sub_env, &sub->sub_refcheck); sub->sub_env = NULL; } } @@ -74,46 +96,24 @@ static int lov_io_sub_init(const struct lu_env *env, struct lov_io *lio, struct cl_io *io = lio->lis_cl.cis_io; int index = lov_comp_entry(sub->sub_subio_index); int stripe = lov_comp_stripe(sub->sub_subio_index); - int rc; + int rc = 0; - LASSERT(!sub->sub_io); LASSERT(!sub->sub_env); - LASSERT(sub->sub_subio_index < lio->lis_stripe_count); if (unlikely(!lov_r0(lov, index)->lo_sub[stripe])) return -EIO; - sub->sub_io_initialized = 0; - sub->sub_borrowed = 0; - /* obtain new environment */ sub->sub_env = cl_env_get(&sub->sub_refcheck); - if (IS_ERR(sub->sub_env)) { + if (IS_ERR(sub->sub_env)) rc = PTR_ERR(sub->sub_env); - goto fini_lov_io; - } - - /* - * First sub-io. Use ->lis_single_subio to - * avoid dynamic allocation. - */ - if (lio->lis_active_subios == 0) { - sub->sub_io = &lio->lis_single_subio; - lio->lis_single_subio_index = stripe; - } else { - sub->sub_io = kzalloc(sizeof(*sub->sub_io), - GFP_NOFS); - if (!sub->sub_io) { - rc = -ENOMEM; - goto fini_lov_io; - } - } sub_obj = lovsub2cl(lov_r0(lov, index)->lo_sub[stripe]); - sub_io = sub->sub_io; + sub_io = &sub->sub_io; sub_io->ci_obj = sub_obj; sub_io->ci_result = 0; + sub_io->ci_parent = io; sub_io->ci_lockreq = io->ci_lockreq; sub_io->ci_type = io->ci_type; @@ -121,31 +121,42 @@ static int lov_io_sub_init(const struct lu_env *env, struct lov_io *lio, sub_io->ci_noatime = io->ci_noatime; rc = cl_io_sub_init(sub->sub_env, sub_io, io->ci_type, sub_obj); - if (rc >= 0) { - lio->lis_active_subios++; - sub->sub_io_initialized = 1; - rc = 0; - } -fini_lov_io: - if (rc) + if (rc < 0) lov_io_sub_fini(env, lio, sub); + return rc; } struct lov_io_sub *lov_sub_get(const struct lu_env *env, struct lov_io *lio, int index) { - int rc; - struct lov_io_sub *sub = &lio->lis_subs[index]; + struct lov_io_sub *sub; + int rc = 0; - LASSERT(index < lio->lis_stripe_count); + list_for_each_entry(sub, &lio->lis_subios, sub_list) { + if (sub->sub_subio_index == index) { + rc = 1; + break; + } + } + + if (rc == 0) { + sub = lov_sub_alloc(lio, index); + if (!sub) { + rc = -ENOMEM; + goto out; + } - if (!sub->sub_io_initialized) { - sub->sub_subio_index = index; rc = lov_io_sub_init(env, lio, sub); - } else { - rc = 0; + if (rc < 0) { + lov_sub_free(lio, sub); + goto out; + } + + list_add_tail(&sub->sub_list, &lio->lis_subios); + lio->lis_nr_subios++; } +out: if (rc < 0) sub = ERR_PTR(rc); @@ -162,6 +173,7 @@ static int lov_page_index(const struct cl_page *page) const struct cl_page_slice *slice; slice = cl_page_at(page, &lov_device_type); + LASSERT(slice); LASSERT(slice->cpl_obj); return cl2lov_page(slice)->lps_index; @@ -170,28 +182,13 @@ static int lov_page_index(const struct cl_page *page) static int lov_io_subio_init(const struct lu_env *env, struct lov_io *lio, struct cl_io *io) { - struct lov_stripe_md *lsm; - int result; - LASSERT(lio->lis_object); - lsm = lio->lis_object->lo_lsm; - /* - * Need to be optimized, we can't afford to allocate a piece of memory - * when writing a page. -jay - */ - lio->lis_subs = kcalloc(lsm->lsm_entries[0]->lsme_stripe_count, - sizeof(lio->lis_subs[0]), - GFP_KERNEL); - if (lio->lis_subs) { - lio->lis_nr_subios = lio->lis_stripe_count; - lio->lis_single_subio_index = -1; - lio->lis_active_subios = 0; - result = 0; - } else { - result = -ENOMEM; - } - return result; + INIT_LIST_HEAD(&lio->lis_subios); + lio->lis_single_subio_index = -1; + lio->lis_nr_subios = 0; + + return 0; } static int lov_io_slice_init(struct lov_io *lio, struct lov_object *obj, @@ -200,7 +197,7 @@ static int lov_io_slice_init(struct lov_io *lio, struct lov_object *obj, io->ci_result = 0; lio->lis_object = obj; - lio->lis_stripe_count = obj->lo_lsm->lsm_entries[0]->lsme_stripe_count; + LASSERT(obj->lo_lsm); switch (io->ci_type) { case CIT_READ: @@ -272,14 +269,21 @@ static void lov_io_fini(const struct lu_env *env, const struct cl_io_slice *ios) { struct lov_io *lio = cl2lov_io(env, ios); struct lov_object *lov = cl2lov(ios->cis_obj); - int i; - if (lio->lis_subs) { - for (i = 0; i < lio->lis_nr_subios; i++) - lov_io_sub_fini(env, lio, &lio->lis_subs[i]); - kvfree(lio->lis_subs); - lio->lis_nr_subios = 0; + LASSERT(list_empty(&lio->lis_active)); + + while (!list_empty(&lio->lis_subios)) { + struct lov_io_sub *sub = list_entry(lio->lis_subios.next, + struct lov_io_sub, + sub_list); + + list_del_init(&sub->sub_list); + lio->lis_nr_subios--; + + lov_io_sub_fini(env, lio, sub); + lov_sub_free(lio, sub); } + LASSERT(lio->lis_nr_subios == 0); LASSERT(atomic_read(&lov->lo_active_ios) > 0); if (atomic_dec_and_test(&lov->lo_active_ios)) @@ -287,12 +291,13 @@ static void lov_io_fini(const struct lu_env *env, const struct cl_io_slice *ios) } static void lov_io_sub_inherit(struct lov_io_sub *sub, struct lov_io *lio, - int stripe, loff_t start, loff_t end) + loff_t start, loff_t end) { - struct cl_io *io = sub->sub_io; + struct cl_io *io = &sub->sub_io; struct lov_stripe_md *lsm = lio->lis_object->lo_lsm; struct cl_io *parent = lio->lis_cl.cis_io; int index = lov_comp_entry(sub->sub_subio_index); + int stripe = lov_comp_stripe(sub->sub_subio_index); switch (io->ci_type) { case CIT_SETATTR: { @@ -321,7 +326,7 @@ static void lov_io_sub_inherit(struct lov_io_sub *sub, struct lov_io *lio, } case CIT_FAULT: { struct cl_object *obj = parent->ci_obj; - loff_t off = cl_offset(obj, parent->u.ci_fault.ft_index); + u64 off = cl_offset(obj, parent->u.ci_fault.ft_index); io->u.ci_fault = parent->u.ci_fault; off = lov_size_to_stripe(lsm, index, off, stripe); @@ -373,11 +378,12 @@ static int lov_io_iter_init(const struct lu_env *env, struct lov_stripe_md *lsm = lio->lis_object->lo_lsm; struct lov_layout_entry *le; struct lov_io_sub *sub; - u64 endpos; + struct lu_extent ext; int rc = 0; int index; - endpos = lov_offset_mod(lio->lis_endpos, -1); + ext.e_start = lio->lis_pos; + ext.e_end = lio->lis_endpos; index = 0; lov_foreach_layout_entry(lio->lis_object, le) { @@ -387,11 +393,12 @@ static int lov_io_iter_init(const struct lu_env *env, u64 end; index++; + if (!lu_extent_is_overlapped(&ext, &le->lle_extent)) + continue; for (stripe = 0; stripe < r0->lo_nr; stripe++) { if (!lov_stripe_intersects(lsm, index - 1, stripe, - lio->lis_pos, - endpos, &start, &end)) + &ext, &start, &end)) continue; if (unlikely(!r0->lo_sub[stripe])) { @@ -411,10 +418,10 @@ static int lov_io_iter_init(const struct lu_env *env, break; } - lov_io_sub_inherit(sub, lio, stripe, start, end); - rc = cl_io_iter_init(sub->sub_env, sub->sub_io); + lov_io_sub_inherit(sub, lio, start, end); + rc = cl_io_iter_init(sub->sub_env, &sub->sub_io); if (rc) { - cl_io_iter_fini(sub->sub_env, sub->sub_io); + cl_io_iter_fini(sub->sub_env, &sub->sub_io); break; } @@ -437,31 +444,50 @@ static int lov_io_rw_iter_init(const struct lu_env *env, u64 start = io->u.ci_rw.crw_pos; struct lov_stripe_md_entry *lse; unsigned long ssize; - loff_t next; - int index = 0; + int index; + u64 next; LASSERT(io->ci_type == CIT_READ || io->ci_type == CIT_WRITE); + if (cl_io_is_append(io)) + return lov_io_iter_init(env, ios); + + index = lov_lsm_entry(lio->lis_object->lo_lsm, io->u.ci_rw.crw_pos); + if (index < 0) { /* non-existing layout component */ + if (io->ci_type == CIT_READ) { + /* TODO: it needs to detect the next component and + * then set the next pos + */ + io->ci_continue = 0; + + return lov_io_iter_init(env, ios); + } + + return -ENODATA; + } + lse = lov_lse(lio->lis_object, index); ssize = lse->lsme_stripe_size; + lov_do_div64(start, ssize); + next = (start + 1) * ssize; + if (next <= start * ssize) + next = ~0ull; + + LASSERT(io->u.ci_rw.crw_pos >= lse->lsme_extent.e_start); + next = min_t(u64, next, lse->lsme_extent.e_end); + next = min_t(u64, next, lio->lis_io_endpos); + + io->ci_continue = next < lio->lis_io_endpos; + io->u.ci_rw.crw_count = next - io->u.ci_rw.crw_pos; + lio->lis_pos = io->u.ci_rw.crw_pos; + lio->lis_endpos = io->u.ci_rw.crw_pos + io->u.ci_rw.crw_count; + + CDEBUG(D_VFSTRACE, + "stripe: %llu chunk: [%llu, %llu) %llu\n", + (u64)start, lio->lis_pos, lio->lis_endpos, + (u64)lio->lis_io_endpos); - /* fast path for common case. */ - if (lio->lis_nr_subios != 1 && !cl_io_is_append(io)) { - lov_do_div64(start, ssize); - next = (start + 1) * ssize; - if (next <= start * ssize) - next = ~0ull; - - io->ci_continue = next < lio->lis_io_endpos; - io->u.ci_rw.crw_count = min_t(loff_t, lio->lis_io_endpos, - next) - io->u.ci_rw.crw_pos; - lio->lis_pos = io->u.ci_rw.crw_pos; - lio->lis_endpos = io->u.ci_rw.crw_pos + io->u.ci_rw.crw_count; - CDEBUG(D_VFSTRACE, "stripe: %llu chunk: [%llu, %llu) %llu\n", - (__u64)start, lio->lis_pos, lio->lis_endpos, - (__u64)lio->lis_io_endpos); - } /* * XXX The following call should be optimized: we know, that * [lio->lis_pos, lio->lis_endpos) intersects with exactly one stripe. @@ -477,12 +503,12 @@ static int lov_io_call(const struct lu_env *env, struct lov_io *lio, int rc = 0; list_for_each_entry(sub, &lio->lis_active, sub_linkage) { - rc = iofunc(sub->sub_env, sub->sub_io); + rc = iofunc(sub->sub_env, &sub->sub_io); if (rc) break; if (parent->ci_result == 0) - parent->ci_result = sub->sub_io->ci_result; + parent->ci_result = sub->sub_io.ci_result; } return rc; } @@ -539,13 +565,13 @@ static void lov_io_end(const struct lu_env *env, const struct cl_io_slice *ios) struct lov_io_sub *sub; list_for_each_entry(sub, &lio->lis_active, sub_linkage) { - lov_io_end_wrapper(sub->sub_env, sub->sub_io); + lov_io_end_wrapper(sub->sub_env, &sub->sub_io); parent->u.ci_data_version.dv_data_version += - sub->sub_io->u.ci_data_version.dv_data_version; + sub->sub_io.u.ci_data_version.dv_data_version; if (!parent->ci_result) - parent->ci_result = sub->sub_io->ci_result; + parent->ci_result = sub->sub_io.ci_result; } } @@ -581,12 +607,18 @@ static int lov_io_read_ahead(const struct lu_env *env, unsigned int pps; /* pages per stripe */ struct lov_io_sub *sub; pgoff_t ra_end; + u64 offset; u64 suboff; int stripe; - int index = 0; + int index; int rc; - stripe = lov_stripe_number(loo->lo_lsm, index, cl_offset(obj, start)); + offset = cl_offset(obj, start); + index = lov_lsm_entry(loo->lo_lsm, offset); + if (index < 0) + return -ENODATA; + + stripe = lov_stripe_number(loo->lo_lsm, index, offset); r0 = lov_r0(loo, index); if (unlikely(!r0->lo_sub[stripe])) @@ -596,8 +628,8 @@ static int lov_io_read_ahead(const struct lu_env *env, if (IS_ERR(sub)) return PTR_ERR(sub); - lov_stripe_offset(loo->lo_lsm, index, cl_offset(obj, start), stripe, &suboff); - rc = cl_io_read_ahead(sub->sub_env, sub->sub_io, + lov_stripe_offset(loo->lo_lsm, index, offset, stripe, &suboff); + rc = cl_io_read_ahead(sub->sub_env, &sub->sub_io, cl_index(lovsub2cl(r0->lo_sub[stripe]), suboff), ra); @@ -623,8 +655,8 @@ static int lov_io_read_ahead(const struct lu_env *env, pps = lov_lse(loo, index)->lsme_stripe_size >> PAGE_SHIFT; CDEBUG(D_READA, - DFID " max_index = %lu, pps = %u, stripe_size = %u, stripe no = %u, start index = %lu\n", - PFID(lu_object_fid(lov2lu(loo))), ra_end, pps, + DFID " max_index = %lu, pps = %u, index = %u, stripe_size = %u, stripe no = %u, start index = %lu\n", + PFID(lu_object_fid(lov2lu(loo))), ra_end, pps, index, lov_lse(loo, index)->lsme_stripe_size, stripe, start); /* never exceed the end of the stripe */ @@ -659,20 +691,17 @@ static int lov_io_submit(const struct lu_env *env, int index; int rc = 0; - if (lio->lis_active_subios == 1) { + if (lio->lis_nr_subios == 1) { int idx = lio->lis_single_subio_index; - LASSERT(idx < lio->lis_nr_subios); sub = lov_sub_get(env, lio, idx); LASSERT(!IS_ERR(sub)); - LASSERT(sub->sub_io == &lio->lis_single_subio); - rc = cl_io_submit_rw(sub->sub_env, sub->sub_io, + LASSERT(sub == &lio->lis_single_subio); + rc = cl_io_submit_rw(sub->sub_env, &sub->sub_io, crt, queue); return rc; } - LASSERT(lio->lis_subs); - cl_page_list_init(plist); while (qin->pl_nr > 0) { struct cl_2queue *cl2q = &lov_env_info(env)->lti_cl2q; @@ -693,7 +722,7 @@ static int lov_io_submit(const struct lu_env *env, sub = lov_sub_get(env, lio, index); if (!IS_ERR(sub)) { - rc = cl_io_submit_rw(sub->sub_env, sub->sub_io, + rc = cl_io_submit_rw(sub->sub_env, &sub->sub_io, crt, cl2q); } else { rc = PTR_ERR(sub); @@ -724,20 +753,17 @@ static int lov_io_commit_async(const struct lu_env *env, struct cl_page *page; int rc = 0; - if (lio->lis_active_subios == 1) { + if (lio->lis_nr_subios == 1) { int idx = lio->lis_single_subio_index; - LASSERT(idx < lio->lis_nr_subios); sub = lov_sub_get(env, lio, idx); LASSERT(!IS_ERR(sub)); - LASSERT(sub->sub_io == &lio->lis_single_subio); - rc = cl_io_commit_async(sub->sub_env, sub->sub_io, queue, + LASSERT(sub == &lio->lis_single_subio); + rc = cl_io_commit_async(sub->sub_env, &sub->sub_io, queue, from, to, cb); return rc; } - LASSERT(lio->lis_subs); - cl_page_list_init(plist); while (queue->pl_nr > 0) { int stripe_to = to; @@ -761,7 +787,7 @@ static int lov_io_commit_async(const struct lu_env *env, sub = lov_sub_get(env, lio, index); if (!IS_ERR(sub)) { - rc = cl_io_commit_async(sub->sub_env, sub->sub_io, + rc = cl_io_commit_async(sub->sub_env, &sub->sub_io, plist, from, stripe_to, cb); } else { rc = PTR_ERR(sub); @@ -797,7 +823,8 @@ static int lov_io_fault_start(const struct lu_env *env, sub = lov_sub_get(env, lio, lov_page_index(fio->ft_page)); if (IS_ERR(sub)) return PTR_ERR(sub); - sub->sub_io->u.ci_fault.ft_nob = fio->ft_nob; + sub->sub_io.u.ci_fault.ft_nob = fio->ft_nob; + return lov_io_start(env, ios); } @@ -810,7 +837,7 @@ static void lov_io_fsync_end(const struct lu_env *env, *written = 0; list_for_each_entry(sub, &lio->lis_active, sub_linkage) { - struct cl_io *subio = sub->sub_io; + struct cl_io *subio = &sub->sub_io; lov_io_end_wrapper(sub->sub_env, subio); diff --git a/drivers/staging/lustre/lustre/lov/lov_lock.c b/drivers/staging/lustre/lustre/lov/lov_lock.c index cc08e96..ba31be4 100644 --- a/drivers/staging/lustre/lustre/lov/lov_lock.c +++ b/drivers/staging/lustre/lustre/lov/lov_lock.c @@ -76,7 +76,7 @@ static struct lov_sublock_env *lov_sublock_env_get(const struct lu_env *env, sub = lov_sub_get(env, lio, lls->sub_index); if (!IS_ERR(sub)) { subenv->lse_env = sub->sub_env; - subenv->lse_io = sub->sub_io; + subenv->lse_io = &sub->sub_io; } else { subenv = (void *)sub; } @@ -114,52 +114,65 @@ static struct lov_lock *lov_lock_sub_init(const struct lu_env *env, const struct cl_object *obj, struct cl_lock *lock) { - struct lov_object *loo = cl2lov(obj); - struct lov_layout_raid0 *r0; - struct lov_lock *lovlck; + struct lov_object *lov = cl2lov(obj); + struct lov_lock *lovlck; + struct lu_extent ext; int result = 0; - int index = 0; + int index; int i; int nr; u64 start; u64 end; - u64 file_start; - u64 file_end; - - CDEBUG(D_INODE, "%p: lock/io FID " DFID "/" DFID ", lock/io clobj %p/%p\n", - loo, PFID(lu_object_fid(lov2lu(loo))), - PFID(lu_object_fid(&obj->co_lu)), - lov2cl(loo), obj); - - file_start = cl_offset(lov2cl(loo), lock->cll_descr.cld_start); - file_end = cl_offset(lov2cl(loo), lock->cll_descr.cld_end + 1) - 1; - - r0 = lov_r0(loo, index); - for (i = 0, nr = 0; i < r0->lo_nr; i++) { - /* - * XXX for wide striping smarter algorithm is desirable, - * breaking out of the loop, early. - */ - if (likely(r0->lo_sub[i]) && /* spare layout */ - lov_stripe_intersects(loo->lo_lsm, index, i, - file_start, file_end, &start, &end)) - nr++; + + ext.e_start = cl_offset(obj, lock->cll_descr.cld_start); + if (lock->cll_descr.cld_end == CL_PAGE_EOF) + ext.e_end = OBD_OBJECT_EOF; + else + ext.e_end = cl_offset(obj, lock->cll_descr.cld_end + 1); + + nr = 0; + for (index = lov_lsm_entry(lov->lo_lsm, ext.e_start); + index != -1 && index < lov->lo_lsm->lsm_entry_count; index++) { + struct lov_layout_raid0 *r0 = lov_r0(lov, index); + + /* assume lsm entries are sorted. */ + if (!lu_extent_is_overlapped(&ext, + &lov_lse(lov, index)->lsme_extent)) + break; + + for (i = 0; i < r0->lo_nr; i++) { + if (likely(r0->lo_sub[i]) && /* spare layout */ + lov_stripe_intersects(lov->lo_lsm, index, i, + &ext, &start, &end)) + nr++; + } } - LASSERT(nr > 0); + if (nr == 0) + return ERR_PTR(-EINVAL); + lovlck = kvzalloc(offsetof(struct lov_lock, lls_sub[nr]), GFP_NOFS); if (!lovlck) return ERR_PTR(-ENOMEM); lovlck->lls_nr = nr; - for (i = 0, nr = 0; i < r0->lo_nr; ++i) { - if (likely(r0->lo_sub[i]) && - lov_stripe_intersects(loo->lo_lsm, index, i, - file_start, file_end, &start, &end)) { + nr = 0; + for (index = lov_lsm_entry(lov->lo_lsm, ext.e_start); + index < lov->lo_lsm->lsm_entry_count; index++) { + struct lov_layout_raid0 *r0 = lov_r0(lov, index); + + /* assume lsm entries are sorted. */ + if (!lu_extent_is_overlapped(&ext, + &lov_lse(lov, index)->lsme_extent)) + break; + for (i = 0; i < r0->lo_nr; ++i) { struct lov_lock_sub *lls = &lovlck->lls_sub[nr]; - struct cl_lock_descr *descr; + struct cl_lock_descr *descr = &lls->sub_lock.cll_descr; - descr = &lls->sub_lock.cll_descr; + if (unlikely(!r0->lo_sub[i]) || + !lov_stripe_intersects(lov->lo_lsm, index, i, + &ext, &start, &end)) + continue; LASSERT(!descr->cld_obj); descr->cld_obj = lovsub2cl(r0->lo_sub[i]); @@ -267,8 +280,8 @@ static void lov_lock_cancel(const struct lu_env *env, cl_lock_cancel(subenv->lse_env, sublock); } else { CL_LOCK_DEBUG(D_ERROR, env, slice->cls_lock, - "%s fails with %ld.\n", - __func__, PTR_ERR(subenv)); + "lov_lock_cancel fails with %ld.\n", + PTR_ERR(subenv)); } } } diff --git a/drivers/staging/lustre/lustre/lov/lov_object.c b/drivers/staging/lustre/lustre/lov/lov_object.c index 3b34713..a7d3068 100644 --- a/drivers/staging/lustre/lustre/lov/lov_object.c +++ b/drivers/staging/lustre/lustre/lov/lov_object.c @@ -130,14 +130,13 @@ static struct cl_object *lov_sub_find(const struct lu_env *env, static int lov_init_sub(const struct lu_env *env, struct lov_object *lov, struct cl_object *subobj, struct lov_layout_raid0 *r0, - int idx) + struct lov_oinfo *oinfo, int idx) { int stripe = lov_comp_stripe(idx); int entry = lov_comp_entry(idx); struct cl_object_header *hdr; struct cl_object_header *subhdr; struct cl_object_header *parent; - struct lov_oinfo *oinfo; int result; if (OBD_FAIL_CHECK(OBD_FAIL_LOV_INIT)) { @@ -155,11 +154,10 @@ static int lov_init_sub(const struct lu_env *env, struct lov_object *lov, hdr = cl_object_header(lov2cl(lov)); subhdr = cl_object_header(subobj); - oinfo = lov->lo_lsm->lsm_entries[0]->lsme_oinfo[idx]; CDEBUG(D_INODE, DFID "@%p[%d:%d] -> " DFID "@%p: ostid: " DOSTID " ost idx: %d gen: %d\n", - PFID(&subhdr->coh_lu.loh_fid), subhdr, entry, stripe, - PFID(&hdr->coh_lu.loh_fid), hdr, POSTID(&oinfo->loi_oi), + PFID(lu_object_fid(&subobj->co_lu)), subhdr, entry, stripe, + PFID(lu_object_fid(lov2lu(lov))), hdr, POSTID(&oinfo->loi_oi), oinfo->loi_ost_idx, oinfo->loi_ost_gen); /* reuse ->coh_attr_guard to protect coh_parent change */ @@ -221,14 +219,13 @@ static int lov_page_slice_fixup(struct lov_object *lov, static int lov_init_raid0(const struct lu_env *env, struct lov_device *dev, struct lov_object *lov, int index, - const struct cl_object_conf *conf, struct lov_layout_raid0 *r0) { struct lov_stripe_md_entry *lse = lov_lse(lov, index); - struct cl_object *stripe; struct lov_thread_info *lti = lov_env_info(env); struct cl_object_conf *subconf = <i->lti_stripe_conf; struct lu_fid *ofid = <i->lti_fid; + struct cl_object *stripe; int result; int psz; int i; @@ -238,20 +235,21 @@ static int lov_init_raid0(const struct lu_env *env, struct lov_device *dev, LASSERT(r0->lo_nr <= lov_targets_nr(dev)); r0->lo_sub = kvzalloc(r0->lo_nr * sizeof(r0->lo_sub[0]), - GFP_NOFS); + GFP_KERNEL); if (!r0->lo_sub) return -ENOMEM; psz = 0; result = 0; - subconf->coc_inode = conf->coc_inode; + memset(subconf, 0, sizeof(*subconf)); + /* * Create stripe cl_objects. */ for (i = 0; i < r0->lo_nr; ++i) { struct lov_oinfo *oinfo = lse->lsme_oinfo[i]; + int ost_idx = oinfo->loi_ost_idx; struct cl_device *subdev; - int ost_idx; if (lov_oinfo_is_dummy(oinfo)) continue; @@ -261,7 +259,6 @@ static int lov_init_raid0(const struct lu_env *env, struct lov_device *dev, if (result != 0) goto out; - ost_idx = oinfo->loi_ost_idx; if (!dev->ld_target[ost_idx]) { CERROR("%s: OST %04x is not initialized\n", lov2obd(dev->ld_lov)->obd_name, ost_idx); @@ -282,7 +279,7 @@ static int lov_init_raid0(const struct lu_env *env, struct lov_device *dev, goto out; } - result = lov_init_sub(env, lov, stripe, r0, + result = lov_init_sub(env, lov, stripe, r0, oinfo, lov_comp_index(index, i)); if (result == -EAGAIN) { /* try again */ --i; @@ -309,15 +306,17 @@ static int lov_init_composite(const struct lu_env *env, struct lov_device *dev, union lov_layout_state *state) { struct lov_layout_composite *comp = &state->composite; - unsigned int entry_count = 1; + unsigned int entry_count; unsigned int psz = 0; int result = 0; int i; + LASSERT(lsm->lsm_entry_count > 0); LASSERT(!lov->lo_lsm); lov->lo_lsm = lsm_addref(lsm); lov->lo_layout_invalid = true; + entry_count = lsm->lsm_entry_count; comp->lo_entry_count = entry_count; comp->lo_entries = kcalloc(entry_count, sizeof(*comp->lo_entries), @@ -328,8 +327,8 @@ static int lov_init_composite(const struct lu_env *env, struct lov_device *dev, for (i = 0; i < entry_count; i++) { struct lov_layout_entry *le = &comp->lo_entries[i]; - result = lov_init_raid0(env, dev, lov, i, conf, - &le->lle_raid0); + le->lle_extent = lsm->lsm_entries[i]->lsme_extent; + result = lov_init_raid0(env, dev, lov, i, &le->lle_raid0); if (result < 0) break; @@ -364,31 +363,30 @@ static struct cl_object *lov_find_subobj(const struct lu_env *env, struct lov_thread_info *lti = lov_env_info(env); struct lu_fid *ofid = <i->lti_fid; int stripe = lov_comp_stripe(index); + int entry = lov_comp_entry(index); + struct cl_object *result = NULL; struct cl_device *subdev; - struct cl_object *result; struct lov_oinfo *oinfo; int ost_idx; int rc; - if (lov->lo_type != LLT_COMP) { - result = NULL; + if (lov->lo_type != LLT_COMP) + goto out; + + if (entry >= lsm->lsm_entry_count || + stripe >= lsm->lsm_entries[entry]->lsme_stripe_count) goto out; - } - oinfo = lsm->lsm_entries[0]->lsme_oinfo[stripe]; + oinfo = lsm->lsm_entries[entry]->lsme_oinfo[stripe]; ost_idx = oinfo->loi_ost_idx; rc = ostid_to_fid(ofid, &oinfo->loi_oi, ost_idx); - if (rc) { - result = NULL; + if (rc) goto out; - } subdev = lovsub2cl_dev(dev->ld_target[ost_idx]); result = lov_sub_find(env, subdev, ofid, NULL); out: - if (!result) - result = ERR_PTR(-EINVAL); - return result; + return result ? result : ERR_PTR(-EINVAL); } static int lov_delete_empty(const struct lu_env *env, struct lov_object *lov, @@ -567,8 +565,8 @@ static int lov_print_composite(const struct lu_env *env, void *cookie, for (i = 0; i < lsm->lsm_entry_count; i++) { struct lov_stripe_md_entry *lse = lsm->lsm_entries[i]; - (*p)(env, cookie, ": { 0x%08X, %u, %u, %u, %u }\n", - lse->lsme_magic, + (*p)(env, cookie, DEXT ": { 0x%08X, %u, %u, %u, %u }\n", + PEXT(&lse->lsme_extent), lse->lsme_magic, lse->lsme_id, lse->lsme_layout_gen, lse->lsme_stripe_count, lse->lsme_stripe_size); lov_print_raid0(env, cookie, p, lov_r0(lov, i)); @@ -584,10 +582,10 @@ static int lov_print_released(const struct lu_env *env, void *cookie, struct lov_stripe_md *lsm = lov->lo_lsm; (*p)(env, cookie, - "released: %s, lsm{%p 0x%08X %d %u %u}:\n", + "released: %s, lsm{%p 0x%08X %d %u}:\n", lov->lo_layout_invalid ? "invalid" : "valid", lsm, lsm->lsm_magic, atomic_read(&lsm->lsm_refc), - lsm->lsm_entries[0]->lsme_stripe_count, lsm->lsm_layout_gen); + lsm->lsm_layout_gen); return 0; } @@ -601,6 +599,7 @@ static int lov_print_released(const struct lu_env *env, void *cookie, static int lov_attr_get_empty(const struct lu_env *env, struct cl_object *obj, struct cl_attr *attr) { + attr->cat_blocks = 0; return 0; } @@ -659,16 +658,18 @@ static int lov_attr_get_composite(const struct lu_env *env, int result = 0; int index = 0; - attr->cat_blocks = 0; attr->cat_size = 0; + attr->cat_blocks = 0; lov_foreach_layout_entry(lov, entry) { struct lov_layout_raid0 *r0 = &entry->lle_raid0; struct cl_attr *lov_attr = &r0->lo_attr; result = lov_attr_get_raid0(env, lov, index, r0); - if (result) + if (result != 0) break; + index++; + /* merge results */ attr->cat_blocks += lov_attr->cat_blocks; if (attr->cat_size < lov_attr->cat_size) @@ -742,13 +743,15 @@ static enum lov_layout_type lov_type(struct lov_stripe_md *lsm) if (!lsm) return LLT_EMPTY; - if (lsm->lsm_magic == LOV_MAGIC_COMP_V1) - return LLT_EMPTY; - if (lsm->lsm_is_released) return LLT_RELEASED; - return LLT_COMP; + if (lsm->lsm_magic == LOV_MAGIC_V1 || + lsm->lsm_magic == LOV_MAGIC_V3 || + lsm->lsm_magic == LOV_MAGIC_COMP_V1) + return LLT_COMP; + + return LLT_EMPTY; } static inline void lov_conf_freeze(struct lov_object *lov) @@ -926,6 +929,8 @@ int lov_object_init(const struct lu_env *env, struct lu_object *obj, cconf->u.coc_layout.lb_len); if (IS_ERR(lsm)) return PTR_ERR(lsm); + + dump_lsm(D_INODE, lsm); } /* no locking is necessary, as object is being created */ @@ -1090,8 +1095,8 @@ int lov_lock_init(const struct lu_env *env, struct cl_object *obj, * over which the mapping is spread * * \param lsm [in] striping information for the file - * \param fm_start [in] logical start of mapping - * \param fm_end [in] logical end of mapping + * @index stripe component index + * @ext logical extent of mapping * \param start_stripe [in] starting stripe of the mapping * \param stripe_count [out] the number of stripes across which to map is * returned @@ -1099,7 +1104,7 @@ int lov_lock_init(const struct lu_env *env, struct cl_object *obj, * \retval last_stripe return the last stripe of the mapping */ static int fiemap_calc_last_stripe(struct lov_stripe_md *lsm, int index, - u64 fm_start, u64 fm_end, + struct lu_extent *ext, int start_stripe, int *stripe_count) { struct lov_stripe_md_entry *lsme = lsm->lsm_entries[index]; @@ -1108,7 +1113,7 @@ static int fiemap_calc_last_stripe(struct lov_stripe_md *lsm, int index, u64 obd_end; int i, j; - if (fm_end - fm_start > + if (ext->e_end - ext->e_start > lsme->lsme_stripe_size * lsme->lsme_stripe_count) { last_stripe = (start_stripe < 1 ? lsme->lsme_stripe_count - 1 : start_stripe - 1); @@ -1116,7 +1121,7 @@ static int fiemap_calc_last_stripe(struct lov_stripe_md *lsm, int index, } else { for (j = 0, i = start_stripe; j < lsme->lsme_stripe_count; i = (i + 1) % lsme->lsme_stripe_count, j++) { - if (lov_stripe_intersects(lsm, index, i, fm_start, fm_end, + if (lov_stripe_intersects(lsm, index, i, ext, &obd_start, &obd_end) == 0) break; } @@ -1170,13 +1175,13 @@ static void fiemap_prepare_and_copy_exts(struct fiemap *fiemap, * * \param fiemap [in] fiemap request header * \param lsm [in] striping information for the file - * \param fm_start [in] logical start of mapping - * \param fm_end [in] logical end of mapping + * @index stripe component index + * @ext logical extent of mapping * \param start_stripe [out] starting stripe will be returned in this */ static u64 fiemap_calc_fm_end_offset(struct fiemap *fiemap, struct lov_stripe_md *lsm, - int index, u64 fm_start, u64 fm_end, + int index, struct lu_extent *ext, int *start_stripe) { struct lov_stripe_md_entry *lsme = lsm->lsm_entries[index]; @@ -1209,7 +1214,7 @@ static u64 fiemap_calc_fm_end_offset(struct fiemap *fiemap, * If we have finished mapping on previous device, shift logical * offset to start of next device */ - if (lov_stripe_intersects(lsm, index, stripe_no, fm_start, fm_end, + if (lov_stripe_intersects(lsm, index, stripe_no, ext, &lun_start, &lun_end) != 0 && local_end < lun_end) { fm_end_offset = local_end; @@ -1227,16 +1232,15 @@ static u64 fiemap_calc_fm_end_offset(struct fiemap *fiemap, struct fiemap_state { struct fiemap *fs_fm; - u64 fs_start; + struct lu_extent fs_ext; u64 fs_length; - u64 fs_end; u64 fs_end_offset; int fs_cur_extent; int fs_cnt_need; int fs_start_stripe; int fs_last_stripe; bool fs_device_done; - bool fs_finish; + bool fs_finish_stripe; bool fs_enough; }; @@ -1264,8 +1268,7 @@ static int fiemap_for_stripe(const struct lu_env *env, struct cl_object *obj, fs->fs_device_done = false; /* Find out range of mapping on this stripe */ - if ((lov_stripe_intersects(lsm, index, stripeno, - fs->fs_start, fs->fs_end, + if ((lov_stripe_intersects(lsm, index, stripeno, &fs->fs_ext, &lun_start, &obd_object_end)) == 0) return 0; @@ -1279,16 +1282,7 @@ static int fiemap_for_stripe(const struct lu_env *env, struct cl_object *obj, if (fs->fs_end_offset != 0 && stripeno == fs->fs_start_stripe) lun_start = fs->fs_end_offset; - lun_end = fs->fs_length; - if (lun_end != ~0ULL) { - /* Handle fs->fs_start + fs->fs_length overflow */ - if (fs->fs_start + fs->fs_length < fs->fs_start) - fs->fs_length = ~0ULL - fs->fs_start; - lun_end = lov_size_to_stripe(lsm, index, - fs->fs_start + fs->fs_length, - stripeno); - } - + lun_end = lov_size_to_stripe(lsm, index, fs->fs_ext.e_end, stripeno); if (lun_start == lun_end) return 0; @@ -1316,6 +1310,11 @@ static int fiemap_for_stripe(const struct lu_env *env, struct cl_object *obj, lun_start += len_mapped_single_call; fs->fs_fm->fm_length = req_fm_len - len_mapped_single_call; req_fm_len = fs->fs_fm->fm_length; + /** + * If we've collected enough extent map, we'd request 1 more, + * to see whether we coincidentally finished all available + * extent map, so that FIEMAP_EXTENT_LAST would be set. + */ fs->fs_fm->fm_extent_count = fs->fs_enough ? 1 : fs->fs_cnt_need; fs->fs_fm->fm_mapped_extents = 0; @@ -1357,7 +1356,7 @@ static int fiemap_for_stripe(const struct lu_env *env, struct cl_object *obj, */ if (stripeno == fs->fs_last_stripe) { fiemap->fm_mapped_extents = 0; - fs->fs_finish = true; + fs->fs_finish_stripe = true; goto obj_put; } break; @@ -1366,7 +1365,6 @@ static int fiemap_for_stripe(const struct lu_env *env, struct cl_object *obj, * We've collected enough extents and there are * more extents after it. */ - fs->fs_finish = true; goto obj_put; } @@ -1410,7 +1408,7 @@ static int fiemap_for_stripe(const struct lu_env *env, struct cl_object *obj, } while (!ost_done && !ost_eof); if (stripeno == fs->fs_last_stripe) - fs->fs_finish = true; + fs->fs_finish_stripe = true; obj_put: cl_object_put(env, subobj); @@ -1436,26 +1434,35 @@ static int lov_object_fiemap(const struct lu_env *env, struct cl_object *obj, struct fiemap *fiemap, size_t *buflen) { unsigned int buffer_size = FIEMAP_BUFFER_SIZE; + struct lov_stripe_md_entry *lsme; struct fiemap *fm_local = NULL; struct lov_stripe_md *lsm; - int rc = 0; - int entry = 0; - int cur_stripe; + loff_t whole_start; + loff_t whole_end; + int entry; + int start_entry; + int end_entry; + int cur_stripe = 0; int stripe_count; + int rc = 0; struct fiemap_state fs = { NULL }; lsm = lov_lsm_addref(cl2lov(obj)); if (!lsm) return -ENODATA; - /** - * If the stripe_count > 1 and the application does not understand - * DEVICE_ORDER flag, it cannot interpret the extents correctly. - */ - if (lsm->lsm_entries[0]->lsme_stripe_count > 1 && - !(fiemap->fm_flags & FIEMAP_FLAG_DEVICE_ORDER)) { - rc = -ENOTSUPP; - goto out; + if (!(fiemap->fm_flags & FIEMAP_FLAG_DEVICE_ORDER)) { + /** + * If the entry count > 1 or stripe_count > 1 and the + * application does not understand DEVICE_ORDER flag, + * it cannot interpret the extents correctly. + */ + if (lsm->lsm_entry_count > 1 || + (lsm->lsm_entry_count == 1 && + lsm->lsm_entries[0]->lsme_stripe_count > 1)) { + rc = -ENOTSUPP; + goto out_lsm; + } } if (lsm->lsm_is_released) { @@ -1478,49 +1485,19 @@ static int lov_object_fiemap(const struct lu_env *env, struct cl_object *obj, FIEMAP_EXTENT_UNKNOWN | FIEMAP_EXTENT_LAST; } rc = 0; - goto out; + goto out_lsm; } + /* buffer_size is small to hold fm_extent_count of extents. */ if (fiemap_count_to_size(fiemap->fm_extent_count) < buffer_size) buffer_size = fiemap_count_to_size(fiemap->fm_extent_count); fm_local = kvzalloc(buffer_size, GFP_NOFS); if (!fm_local) { rc = -ENOMEM; - goto out; - } - fs.fs_fm = fm_local; - fs.fs_cnt_need = fiemap_size_to_count(buffer_size); - - fs.fs_start = fiemap->fm_start; - /* fs_start is beyond the end of the file */ - if (fs.fs_start > fmkey->lfik_oa.o_size) { - rc = -EINVAL; - goto out; - } - /* Calculate start stripe, last stripe and length of mapping */ - fs.fs_start_stripe = lov_stripe_number(lsm, 0, fs.fs_start); - fs.fs_end = (fs.fs_length == ~0ULL) ? fmkey->lfik_oa.o_size : - fs.fs_start + fs.fs_length - 1; - /* If fs_length != ~0ULL but fs_start+fs_length-1 exceeds file size */ - if (fs.fs_end > fmkey->lfik_oa.o_size) { - fs.fs_end = fmkey->lfik_oa.o_size; - fs.fs_length = fs.fs_end - fs.fs_start; + goto out_lsm; } - fs.fs_last_stripe = fiemap_calc_last_stripe(lsm, entry, - fs.fs_start, fs.fs_end, - fs.fs_start_stripe, - &stripe_count); - fs.fs_end_offset = fiemap_calc_fm_end_offset(fiemap, lsm, entry, - fs.fs_start, fs.fs_end, - &fs.fs_start_stripe); - if (fs.fs_end_offset == -EINVAL) { - rc = -EINVAL; - goto out; - } - - /** * Requested extent count exceeds the fiemap buffer size, shrink our * ambition. @@ -1530,27 +1507,88 @@ static int lov_object_fiemap(const struct lu_env *env, struct cl_object *obj, if (!fiemap->fm_extent_count) fs.fs_cnt_need = 0; - fs.fs_finish = false; fs.fs_enough = false; fs.fs_cur_extent = 0; + fs.fs_fm = fm_local; + fs.fs_cnt_need = fiemap_size_to_count(buffer_size); + + whole_start = fiemap->fm_start; + /* whole_start is beyond the end of the file */ + if (whole_start > fmkey->lfik_oa.o_size) { + rc = -EINVAL; + goto out_fm_local; + } + whole_end = (fiemap->fm_length == OBD_OBJECT_EOF) ? + fmkey->lfik_oa.o_size : + whole_start + fiemap->fm_length - 1; + /** + * If fiemap->fm_length != OBD_OBJECT_EOF but whole_end exceeds file + * size + */ + if (whole_end > fmkey->lfik_oa.o_size) + whole_end = fmkey->lfik_oa.o_size; + + start_entry = lov_lsm_entry(lsm, whole_start); + end_entry = lov_lsm_entry(lsm, whole_end); + if (end_entry == -1) + end_entry = lsm->lsm_entry_count - 1; + + if (start_entry == -1 || end_entry == -1) { + rc = -EINVAL; + goto out_fm_local; + } + + for (entry = start_entry; entry <= end_entry; entry++) { + lsme = lsm->lsm_entries[entry]; + + if (entry == start_entry) + fs.fs_ext.e_start = whole_start; + else + fs.fs_ext.e_start = lsme->lsme_extent.e_start; + if (entry == end_entry) + fs.fs_ext.e_end = whole_end; + else + fs.fs_ext.e_end = lsme->lsme_extent.e_end - 1; + fs.fs_length = fs.fs_ext.e_end - fs.fs_ext.e_start + 1; + + /* Calculate start stripe, last stripe and length of mapping */ + fs.fs_start_stripe = lov_stripe_number(lsm, entry, + fs.fs_ext.e_start); + fs.fs_last_stripe = fiemap_calc_last_stripe(lsm, entry, + &fs.fs_ext, + fs.fs_start_stripe, + &stripe_count); + fs.fs_end_offset = fiemap_calc_fm_end_offset(fiemap, lsm, entry, + &fs.fs_ext, + &fs.fs_start_stripe); + /* Check each stripe */ + for (cur_stripe = fs.fs_start_stripe; stripe_count > 0; + --stripe_count, + cur_stripe = (cur_stripe + 1) % lsme->lsme_stripe_count) { + rc = fiemap_for_stripe(env, obj, lsm, fiemap, buflen, + fmkey, entry, cur_stripe, &fs); + if (rc < 0) + goto out_fm_local; + if (fs.fs_enough) + goto finish; + if (fs.fs_finish_stripe) + break; + } /* for each stripe */ + } /* for covering layout component */ - /* Check each stripe */ - for (cur_stripe = fs.fs_start_stripe; stripe_count > 0; - --stripe_count, - cur_stripe = (cur_stripe + 1) % - lsm->lsm_entries[0]->lsme_stripe_count) { - rc = fiemap_for_stripe(env, obj, lsm, fiemap, buflen, - fmkey, 0, cur_stripe, &fs); - if (rc < 0) - goto out; - if (fs.fs_finish) - break; - } /* for each stripe */ + /* + * We've traversed all components, set @entry to the last component + * entry, it's for the last stripe check. + */ + entry--; +finish: /* * Indicate that we are returning device offsets unless file just has * single stripe */ - if (lsm->lsm_entries[0]->lsme_stripe_count > 1) + if (lsm->lsm_entry_count > 1 || + (lsm->lsm_entry_count == 1 && + lsm->lsm_entries[0]->lsme_stripe_count > 1)) fiemap->fm_flags |= FIEMAP_FLAG_DEVICE_ORDER; if (!fiemap->fm_extent_count) @@ -1565,8 +1603,9 @@ static int lov_object_fiemap(const struct lu_env *env, struct cl_object *obj, FIEMAP_EXTENT_LAST; skip_last_device_calc: fiemap->fm_mapped_extents = fs.fs_cur_extent; -out: +out_fm_local: kvfree(fm_local); +out_lsm: lov_lsm_put(lsm); return rc; } diff --git a/drivers/staging/lustre/lustre/lov/lov_offset.c b/drivers/staging/lustre/lustre/lov/lov_offset.c index 513f1fd..ab02c34 100644 --- a/drivers/staging/lustre/lustre/lov/lov_offset.c +++ b/drivers/staging/lustre/lustre/lov/lov_offset.c @@ -225,9 +225,19 @@ u64 lov_size_to_stripe(struct lov_stripe_md *lsm, int index, u64 file_size, * stripe does intersect with the lov extent. */ int lov_stripe_intersects(struct lov_stripe_md *lsm, int index, int stripeno, - u64 start, u64 end, u64 *obd_start, u64 *obd_end) + struct lu_extent *ext, u64 *obd_start, u64 *obd_end) { + struct lov_stripe_md_entry *entry = lsm->lsm_entries[index]; int start_side, end_side; + u64 start, end; + + if (!lu_extent_is_overlapped(ext, &entry->lsme_extent)) + return 0; + + start = max_t(u64, ext->e_start, entry->lsme_extent.e_start); + end = min_t(u64, ext->e_end, entry->lsme_extent.e_end); + if (end != OBD_OBJECT_EOF) + end--; start_side = lov_stripe_offset(lsm, index, start, stripeno, obd_start); end_side = lov_stripe_offset(lsm, index, end, stripeno, obd_end); diff --git a/drivers/staging/lustre/lustre/lov/lov_pack.c b/drivers/staging/lustre/lustre/lov/lov_pack.c index 8b7a572..ba7c488 100644 --- a/drivers/staging/lustre/lustre/lov/lov_pack.c +++ b/drivers/staging/lustre/lustre/lov/lov_pack.c @@ -189,8 +189,8 @@ int lov_free_memmd(struct lov_stripe_md **lsmp) int refc; *lsmp = NULL; - LASSERT(atomic_read(&lsm->lsm_refc) > 0); refc = atomic_dec_return(&lsm->lsm_refc); + LASSERT(refc >= 0); if (refc == 0) lsm_free(lsm); diff --git a/drivers/staging/lustre/lustre/lov/lov_page.c b/drivers/staging/lustre/lustre/lov/lov_page.c index e227279..f53379a 100644 --- a/drivers/staging/lustre/lustre/lov/lov_page.c +++ b/drivers/staging/lustre/lustre/lov/lov_page.c @@ -76,10 +76,16 @@ int lov_page_init_composite(const struct lu_env *env, struct cl_object *obj, u64 offset; u64 suboff; int stripe; - int entry = 0; + int entry; int rc; offset = cl_offset(obj, index); + entry = lov_lsm_entry(loo->lo_lsm, offset); + if (entry < 0) { + /* non-existing layout component */ + lov_page_init_empty(env, obj, page, index); + return 0; + } r0 = lov_r0(loo, entry); stripe = lov_stripe_number(loo->lo_lsm, entry, offset); diff --git a/drivers/staging/lustre/lustre/osc/osc_lock.c b/drivers/staging/lustre/lustre/osc/osc_lock.c index 4cc813d..824c655 100644 --- a/drivers/staging/lustre/lustre/osc/osc_lock.c +++ b/drivers/staging/lustre/lustre/osc/osc_lock.c @@ -1128,10 +1128,6 @@ static void osc_lock_set_writer(const struct lu_env *env, io_start = cl_index(obj, io->u.ci_rw.crw_pos); io_end = cl_index(obj, io->u.ci_rw.crw_pos + io->u.ci_rw.crw_count - 1); - if (cl_io_is_append(io)) { - io_start = 0; - io_end = CL_PAGE_EOF; - } } else { LASSERT(cl_io_is_mkwrite(io)); io_start = io->u.ci_fault.ft_index; @@ -1139,7 +1135,8 @@ static void osc_lock_set_writer(const struct lu_env *env, } if (descr->cld_mode >= CLM_WRITE && - descr->cld_start <= io_start && descr->cld_end >= io_end) { + (cl_io_is_append(io) || + (descr->cld_start <= io_start && descr->cld_end >= io_end))) { struct osc_io *oio = osc_env_io(env); /* There must be only one lock to match the write region */ -- 1.8.3.1 From jsimmons at infradead.org Sun Jan 6 22:14:15 2019 From: jsimmons at infradead.org (James Simmons) Date: Sun, 6 Jan 2019 17:14:15 -0500 Subject: [lustre-devel] [PATCH v2 20/33] lustre: ldlm: Transfer layout only if layout lock is granted In-Reply-To: <1546812868-11794-1-git-send-email-jsimmons@infradead.org> References: <1546812868-11794-1-git-send-email-jsimmons@infradead.org> Message-ID: <1546812868-11794-21-git-send-email-jsimmons@infradead.org> From: wang di Make sure that only valid layout is transferred; Client also checks if lock is granted before trusting the layout; Restore change LU-3299 commit e2335e5d because it breaks the assumption that l_lvb_data is immutable once assigned; Fixes: e2335e5d52b2 ("staging/lustre/llite: force lvb_data update after layout change") Signed-off-by: wang di Signed-off-by: Jinshan Xiong Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-6581 Reviewed-on: http://review.whamcloud.com/14726 Reviewed-by: jacques-Charles Lafoucriere Reviewed-by: Oleg Drokin Signed-off-by: James Simmons --- drivers/staging/lustre/lustre/ldlm/ldlm_lockd.c | 18 ------------------ drivers/staging/lustre/lustre/llite/file.c | 15 +++++++++------ drivers/staging/lustre/lustre/mdc/mdc_locks.c | 10 ++++++++-- 3 files changed, 17 insertions(+), 26 deletions(-) diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_lockd.c b/drivers/staging/lustre/lustre/ldlm/ldlm_lockd.c index 986c378..e766f798 100644 --- a/drivers/staging/lustre/lustre/ldlm/ldlm_lockd.c +++ b/drivers/staging/lustre/lustre/ldlm/ldlm_lockd.c @@ -187,24 +187,6 @@ static void ldlm_handle_cp_callback(struct ptlrpc_request *req, rc = -EINVAL; goto out; } - } else if (ldlm_has_layout(lock)) { /* for layout lock, lvb has - * variable length - */ - void *lvb_data; - - lvb_data = kzalloc(lvb_len, GFP_NOFS); - if (!lvb_data) { - LDLM_ERROR(lock, "No memory: %d.\n", lvb_len); - rc = -ENOMEM; - goto out; - } - - lock_res_and_lock(lock); - LASSERT(!lock->l_lvb_data); - lock->l_lvb_type = LVB_T_LAYOUT; - lock->l_lvb_data = lvb_data; - lock->l_lvb_len = lvb_len; - unlock_res_and_lock(lock); } } diff --git a/drivers/staging/lustre/lustre/llite/file.c b/drivers/staging/lustre/lustre/llite/file.c index a976e15..6a0a468 100644 --- a/drivers/staging/lustre/lustre/llite/file.c +++ b/drivers/staging/lustre/lustre/llite/file.c @@ -3641,7 +3641,7 @@ static int ll_layout_fetch(struct inode *inode, struct ldlm_lock *lock) PFID(ll_inode2fid(inode)), ldlm_is_lvb_ready(lock), lock->l_lvb_data, lock->l_lvb_len); - if (lock->l_lvb_data && ldlm_is_lvb_ready(lock)) + if (lock->l_lvb_data) return 0; /* if layout lock was granted right away, the layout is returned @@ -3683,13 +3683,16 @@ static int ll_layout_fetch(struct inode *inode, struct ldlm_lock *lock) memcpy(lvbdata, lmm, lmmsize); lock_res_and_lock(lock); - if (lock->l_lvb_data) - kvfree(lock->l_lvb_data); - - lock->l_lvb_data = lvbdata; - lock->l_lvb_len = lmmsize; + if (!lock->l_lvb_data) { + lock->l_lvb_type = LVB_T_LAYOUT; + lock->l_lvb_data = lvbdata; + lock->l_lvb_len = lmmsize; + lvbdata = NULL; + } unlock_res_and_lock(lock); + if (lvbdata) + kvfree(lvbdata); out: ptlrpc_req_finished(req); return rc; diff --git a/drivers/staging/lustre/lustre/mdc/mdc_locks.c b/drivers/staging/lustre/lustre/mdc/mdc_locks.c index 0abe426..a60959d 100644 --- a/drivers/staging/lustre/lustre/mdc/mdc_locks.c +++ b/drivers/staging/lustre/lustre/mdc/mdc_locks.c @@ -692,9 +692,15 @@ static int mdc_finish_enqueue(struct obd_export *exp, } } - /* fill in stripe data for layout lock */ + /* fill in stripe data for layout lock. + * LU-6581: trust layout data only if layout lock is granted. The MDT + * has stopped sending layout unless the layout lock is granted. The + * client still does this checking in case it's talking with an old + * server. - Jinshan + */ lock = ldlm_handle2lock(lockh); - if (lock && ldlm_has_layout(lock) && lvb_data) { + if (lock && ldlm_has_layout(lock) && lvb_data && + !(lockrep->lock_flags & LDLM_FL_BLOCKED_MASK)) { void *lmm; LDLM_DEBUG(lock, "layout lock returned by: %s, lvb_len: %d", -- 1.8.3.1 From jsimmons at infradead.org Sun Jan 6 22:14:14 2019 From: jsimmons at infradead.org (James Simmons) Date: Sun, 6 Jan 2019 17:14:14 -0500 Subject: [lustre-devel] [PATCH v2 19/33] lustre: pfl: dynamic layout modification with write/truncate In-Reply-To: <1546812868-11794-1-git-send-email-jsimmons@infradead.org> References: <1546812868-11794-1-git-send-email-jsimmons@infradead.org> Message-ID: <1546812868-11794-20-git-send-email-jsimmons@infradead.org> From: Bobi Jam * in lov_init_composite(), skip init sub object without LCME_FL_INIT layout component. * issue layout intent RPC during write/trunc ops when try to write to an un-init-ed component (even if at the lock stage). * After layout intent RPC issued, restart the IO. * get rid of unused lov_layout_operations::llo_install() interface. * add an empty mdt_layout_change() interface to handle intent layout write RPC. Signed-off-by: Bobi Jam WC-bug-id: https://jira.whamcloud.com/browse/LU-9008 Reviewed-on: https://review.whamcloud.com/25317 WC-bug-id: https://jira.whamcloud.com/browse/LU-9307 Reviewed-on: https://review.whamcloud.com/26456 WC-bug-id: https://jira.whamcloud.com/browse/LU-9311 Reviewed-on: https://review.whamcloud.com/26474 Reviewed-by: Niu Yawei Reviewed-by: Jinshan Xiong Reviewed-by: Andreas Dilger Signed-off-by: James Simmons --- .../lustre/include/uapi/linux/lustre/lustre_idl.h | 18 ++-- drivers/staging/lustre/lustre/include/cl_object.h | 5 + drivers/staging/lustre/lustre/include/lustre_sec.h | 4 +- drivers/staging/lustre/lustre/llite/file.c | 102 ++++++++++++++------- .../staging/lustre/lustre/llite/llite_internal.h | 1 + drivers/staging/lustre/lustre/llite/vvp_io.c | 36 +++++++- drivers/staging/lustre/lustre/lov/lov_ea.c | 51 ++++++++--- drivers/staging/lustre/lustre/lov/lov_internal.h | 22 +++++ drivers/staging/lustre/lustre/lov/lov_io.c | 49 ++++++++-- drivers/staging/lustre/lustre/lov/lov_lock.c | 11 ++- drivers/staging/lustre/lustre/lov/lov_object.c | 53 +++++------ drivers/staging/lustre/lustre/lov/lov_pack.c | 19 ++-- drivers/staging/lustre/lustre/lov/lov_page.c | 2 +- drivers/staging/lustre/lustre/mdc/mdc_locks.c | 79 +++++++++------- drivers/staging/lustre/lustre/obdclass/genops.c | 16 +++- drivers/staging/lustre/lustre/ptlrpc/layout.c | 6 +- .../staging/lustre/lustre/ptlrpc/ptlrpc_internal.h | 7 +- drivers/staging/lustre/lustre/ptlrpc/sec.c | 5 +- 18 files changed, 337 insertions(+), 149 deletions(-) diff --git a/drivers/staging/lustre/include/uapi/linux/lustre/lustre_idl.h b/drivers/staging/lustre/include/uapi/linux/lustre/lustre_idl.h index 695f1a1..5b4d9fc 100644 --- a/drivers/staging/lustre/include/uapi/linux/lustre/lustre_idl.h +++ b/drivers/staging/lustre/include/uapi/linux/lustre/lustre_idl.h @@ -2784,22 +2784,22 @@ struct getparent { } __packed; enum { - LAYOUT_INTENT_ACCESS = 0, - LAYOUT_INTENT_READ = 1, - LAYOUT_INTENT_WRITE = 2, - LAYOUT_INTENT_GLIMPSE = 3, - LAYOUT_INTENT_TRUNC = 4, - LAYOUT_INTENT_RELEASE = 5, - LAYOUT_INTENT_RESTORE = 6 + LAYOUT_INTENT_ACCESS = 0, /** generic access */ + LAYOUT_INTENT_READ = 1, /** not used */ + LAYOUT_INTENT_WRITE = 2, /** write file, for comp layout */ + LAYOUT_INTENT_GLIMPSE = 3, /** not used */ + LAYOUT_INTENT_TRUNC = 4, /** truncate file, for comp layout */ + LAYOUT_INTENT_RELEASE = 5, /** reserved for HSM release */ + LAYOUT_INTENT_RESTORE = 6 /** reserved for HSM restore */ }; /* enqueue layout lock with intent */ struct layout_intent { - __u32 li_opc; /* intent operation for enqueue, read, write etc */ + __u32 li_opc; /* intent operation for enqueue, read, write etc */ __u32 li_flags; __u64 li_start; __u64 li_end; -}; +} __packed; /** * On the wire version of hsm_progress structure. diff --git a/drivers/staging/lustre/lustre/include/cl_object.h b/drivers/staging/lustre/lustre/include/cl_object.h index d0edeb7c..57ced0f 100644 --- a/drivers/staging/lustre/lustre/include/cl_object.h +++ b/drivers/staging/lustre/lustre/include/cl_object.h @@ -1843,6 +1843,11 @@ struct cl_io { */ ci_ignore_layout:1, /** + * Need MDS intervention to complete a write. This usually means the + * corresponding component is not initialized for the writing extent. + */ + ci_need_write_intent:1, + /** * Check if layout changed after the IO finishes. Mainly for HSM * requirement. If IO occurs to openning files, it doesn't need to * verify layout because HSM won't release openning files. diff --git a/drivers/staging/lustre/lustre/include/lustre_sec.h b/drivers/staging/lustre/lustre/include/lustre_sec.h index d35bcbc..43ff594 100644 --- a/drivers/staging/lustre/lustre/include/lustre_sec.h +++ b/drivers/staging/lustre/lustre/include/lustre_sec.h @@ -65,6 +65,7 @@ struct ptlrpc_svc_ctx; struct ptlrpc_cli_ctx; struct ptlrpc_ctx_ops; +struct req_msg_field; /** * \addtogroup flavor flavor @@ -976,7 +977,8 @@ int cli_ctx_is_eternal(struct ptlrpc_cli_ctx *ctx) int sptlrpc_cli_alloc_repbuf(struct ptlrpc_request *req, int msgsize); void sptlrpc_cli_free_repbuf(struct ptlrpc_request *req); int sptlrpc_cli_enlarge_reqbuf(struct ptlrpc_request *req, - int segment, int newsize); + const struct req_msg_field *field, + int newsize); int sptlrpc_cli_unwrap_early_reply(struct ptlrpc_request *req, struct ptlrpc_request **req_ret); void sptlrpc_cli_finish_early_reply(struct ptlrpc_request *early_req); diff --git a/drivers/staging/lustre/lustre/llite/file.c b/drivers/staging/lustre/lustre/llite/file.c index 24a0948..a976e15 100644 --- a/drivers/staging/lustre/lustre/llite/file.c +++ b/drivers/staging/lustre/lustre/llite/file.c @@ -3780,38 +3780,37 @@ static int ll_layout_lock_set(struct lustre_handle *lockh, enum ldlm_mode mode, return rc; } -static int ll_layout_refresh_locked(struct inode *inode) +/** + * Issue layout intent RPC to MDS. + * @inode file inode + * @intent layout intent + * + * RETURNS: + * 0 on success + * retval < 0 error code + */ +static int ll_layout_intent(struct inode *inode, struct layout_intent *intent) { struct ll_inode_info *lli = ll_i2info(inode); struct ll_sb_info *sbi = ll_i2sbi(inode); struct md_op_data *op_data; struct lookup_intent it; - struct lustre_handle lockh; - enum ldlm_mode mode; struct ptlrpc_request *req; int rc; -again: - /* mostly layout lock is caching on the local side, so try to match - * it before grabbing layout lock mutex. - */ - mode = ll_take_md_lock(inode, MDS_INODELOCK_LAYOUT, &lockh, 0, - LCK_CR | LCK_CW | LCK_PR | LCK_PW); - if (mode != 0) { /* hit cached lock */ - rc = ll_layout_lock_set(&lockh, mode, inode); - if (rc == -EAGAIN) - goto again; - return rc; - } - op_data = ll_prep_md_op_data(NULL, inode, inode, NULL, 0, 0, LUSTRE_OPC_ANY, NULL); if (IS_ERR(op_data)) return PTR_ERR(op_data); - /* have to enqueue one */ + op_data->op_data = intent; + op_data->op_data_size = sizeof(*intent); + memset(&it, 0, sizeof(it)); it.it_op = IT_LAYOUT; + if (intent->li_opc == LAYOUT_INTENT_WRITE || + intent->li_opc == LAYOUT_INTENT_TRUNC) + it.it_flags = FMODE_WRITE; LDLM_DEBUG_NOLOCK("%s: requeue layout lock for file " DFID "(%p)", ll_get_fsname(inode->i_sb, NULL, 0), @@ -3824,18 +3823,11 @@ static int ll_layout_refresh_locked(struct inode *inode) ll_finish_md_op_data(op_data); - mode = it.it_lock_mode; - it.it_lock_mode = 0; - ll_intent_drop_lock(&it); - - if (rc == 0) { - /* set lock data in case this is a new lock */ + /* set lock data in case this is a new lock */ + if (!rc) ll_set_lock_data(sbi->ll_md_exp, inode, &it, NULL); - lockh.cookie = it.it_lock_handle; - rc = ll_layout_lock_set(&lockh, mode, inode); - if (rc == -EAGAIN) - goto again; - } + + ll_intent_drop_lock(&it); return rc; } @@ -3857,6 +3849,11 @@ int ll_layout_refresh(struct inode *inode, __u32 *gen) { struct ll_inode_info *lli = ll_i2info(inode); struct ll_sb_info *sbi = ll_i2sbi(inode); + struct layout_intent intent = { + .li_opc = LAYOUT_INTENT_ACCESS, + }; + struct lustre_handle lockh; + enum ldlm_mode mode; int rc; *gen = ll_layout_version_get(lli); @@ -3870,18 +3867,57 @@ int ll_layout_refresh(struct inode *inode, __u32 *gen) /* take layout lock mutex to enqueue layout lock exclusively. */ mutex_lock(&lli->lli_layout_mutex); - rc = ll_layout_refresh_locked(inode); - if (rc < 0) - goto out; + while (1) { + /* mostly layout lock is caching on the local side, so try to + * match it before grabbing layout lock mutex. + */ + mode = ll_take_md_lock(inode, MDS_INODELOCK_LAYOUT, &lockh, 0, + LCK_CR | LCK_CW | LCK_PR | LCK_PW); + if (mode != 0) { /* hit cached lock */ + rc = ll_layout_lock_set(&lockh, mode, inode); + if (rc == -EAGAIN) + continue; + break; + } - *gen = ll_layout_version_get(lli); -out: + rc = ll_layout_intent(inode, &intent); + if (rc != 0) + break; + } + + if (rc == 0) + *gen = ll_layout_version_get(lli); mutex_unlock(&lli->lli_layout_mutex); return rc; } /** + * Issue layout intent RPC indicating where in a file an IO is about to write. + * + * \param[in] inode file inode. + * \param[in] start start offset of fille in bytes where an IO is about to + * write. + * \param[in] end exclusive end offset in bytes of the write range. + * + * \retval 0 on success + * \retval < 0 error code + */ +int ll_layout_write_intent(struct inode *inode, u64 start, u64 end) +{ + struct layout_intent intent = { + .li_opc = LAYOUT_INTENT_WRITE, + .li_start = start, + .li_end = end, + }; + int rc; + + rc = ll_layout_intent(inode, &intent); + + return rc; +} + +/** * This function send a restore request to the MDT */ int ll_layout_restore(struct inode *inode, loff_t offset, __u64 length) diff --git a/drivers/staging/lustre/lustre/llite/llite_internal.h b/drivers/staging/lustre/lustre/llite/llite_internal.h index e3f5450..b2a1f54 100644 --- a/drivers/staging/lustre/lustre/llite/llite_internal.h +++ b/drivers/staging/lustre/lustre/llite/llite_internal.h @@ -1320,6 +1320,7 @@ static inline void d_lustre_revalidate(struct dentry *dentry) int ll_layout_conf(struct inode *inode, const struct cl_object_conf *conf); int ll_layout_refresh(struct inode *inode, __u32 *gen); int ll_layout_restore(struct inode *inode, loff_t start, __u64 length); +int ll_layout_write_intent(struct inode *inode, u64 start, u64 end); int ll_xattr_init(void); void ll_xattr_fini(void); diff --git a/drivers/staging/lustre/lustre/llite/vvp_io.c b/drivers/staging/lustre/lustre/llite/vvp_io.c index b772e25..c325eba 100644 --- a/drivers/staging/lustre/lustre/llite/vvp_io.c +++ b/drivers/staging/lustre/lustre/llite/vvp_io.c @@ -281,18 +281,18 @@ static void vvp_io_fini(const struct lu_env *env, const struct cl_io_slice *ios) struct cl_object *obj = io->ci_obj; struct vvp_io *vio = cl2vvp_io(env, ios); struct inode *inode = vvp_object_inode(obj); + int rc; CLOBINVRNT(env, obj, vvp_object_invariant(obj)); CDEBUG(D_VFSTRACE, DFID - " ignore/verify layout %d/%d, layout version %d restore needed %d\n", + " ignore/verify layout %d/%d, layout version %d need write layout %d, restore needed %d\n", PFID(lu_object_fid(&obj->co_lu)), io->ci_ignore_layout, io->ci_verify_layout, - vio->vui_layout_gen, io->ci_restore_needed); + vio->vui_layout_gen, io->ci_need_write_intent, + io->ci_restore_needed); if (io->ci_restore_needed) { - int rc; - /* file was detected release, we need to restore it * before finishing the io */ @@ -318,6 +318,34 @@ static void vvp_io_fini(const struct lu_env *env, const struct cl_io_slice *ios) } } + /** + * dynamic layout change needed, send layout intent + * RPC. + */ + if (io->ci_need_write_intent) { + loff_t start = 0; + loff_t end = 0; + + LASSERT(io->ci_type == CIT_WRITE || cl_io_is_trunc(io)); + + io->ci_need_write_intent = 0; + + if (io->ci_type == CIT_WRITE) { + start = io->u.ci_rw.crw_pos; + end = io->u.ci_rw.crw_pos + io->u.ci_rw.crw_count; + } else { + end = io->u.ci_setattr.sa_attr.lvb_size; + } + + CDEBUG(D_VFSTRACE, DFID" type %d [%llx, %llx)\n", + PFID(lu_object_fid(&obj->co_lu)), io->ci_type, + start, end); + rc = ll_layout_write_intent(inode, start, end); + io->ci_result = rc; + if (!rc) + io->ci_need_restart = 1; + } + if (!io->ci_ignore_layout && io->ci_verify_layout) { __u32 gen = 0; diff --git a/drivers/staging/lustre/lustre/lov/lov_ea.c b/drivers/staging/lustre/lustre/lov/lov_ea.c index 6e5b59e..6db4d5e 100644 --- a/drivers/staging/lustre/lustre/lov/lov_ea.c +++ b/drivers/staging/lustre/lustre/lov/lov_ea.c @@ -117,6 +117,10 @@ static void lsme_free(struct lov_stripe_md_entry *lsme) unsigned int stripe_count = lsme->lsme_stripe_count; unsigned int i; + if (!lsme_inited(lsme) || + lsme->lsme_pattern & LOV_PATTERN_F_RELEASED) + stripe_count = 0; + for (i = 0; i < stripe_count; i++) kmem_cache_free(lov_oinfo_slab, lsme->lsme_oinfo[i]); @@ -141,7 +145,7 @@ void lsm_free(struct lov_stripe_md *lsm) */ static struct lov_stripe_md_entry * lsme_unpack(struct lov_obd *lov, struct lov_mds_md *lmm, size_t buf_size, - const char *pool_name, struct lov_ost_data_v1 *objects, + const char *pool_name, bool inited, struct lov_ost_data_v1 *objects, loff_t *maxbytes) { struct lov_stripe_md_entry *lsme; @@ -159,7 +163,7 @@ void lsm_free(struct lov_stripe_md *lsm) return ERR_PTR(-EINVAL); pattern = le32_to_cpu(lmm->lmm_pattern); - if (pattern & LOV_PATTERN_F_RELEASED) + if (pattern & LOV_PATTERN_F_RELEASED || !inited) stripe_count = 0; else stripe_count = le16_to_cpu(lmm->lmm_stripe_count); @@ -185,8 +189,10 @@ void lsm_free(struct lov_stripe_md *lsm) lsme->lsme_magic = magic; lsme->lsme_pattern = pattern; + lsme->lsme_flags = 0; lsme->lsme_stripe_size = le32_to_cpu(lmm->lmm_stripe_size); - lsme->lsme_stripe_count = stripe_count; + /* preserve the possible -1 stripe count for uninstantiated component */ + lsme->lsme_stripe_count = le16_to_cpu(lmm->lmm_stripe_count); lsme->lsme_layout_gen = le16_to_cpu(lmm->lmm_layout_gen); if (pool_name) { @@ -282,10 +288,12 @@ void lsm_free(struct lov_stripe_md *lsm) pattern = le32_to_cpu(lmm->lmm_pattern); - lsme = lsme_unpack(lov, lmm, buf_size, pool_name, objects, &maxbytes); + lsme = lsme_unpack(lov, lmm, buf_size, pool_name, true, objects, + &maxbytes); if (IS_ERR(lsme)) return ERR_CAST(lsme); + lsme->lsme_flags = LCME_FL_INIT; lsme->lsme_extent.e_start = 0; lsme->lsme_extent.e_end = LUSTRE_EOF; @@ -371,7 +379,7 @@ static int lsm_verify_comp_md_v1(struct lov_comp_md_v1 *lcm, static struct lov_stripe_md_entry * lsme_unpack_comp(struct lov_obd *lov, struct lov_mds_md *lmm, - size_t lmm_buf_size, loff_t *maxbytes) + size_t lmm_buf_size, bool inited, loff_t *maxbytes) { unsigned int stripe_count; unsigned int magic; @@ -380,6 +388,10 @@ static int lsm_verify_comp_md_v1(struct lov_comp_md_v1 *lcm, if (stripe_count == 0) return ERR_PTR(-EINVAL); + /* un-instantiated lmm contains no ost id info, i.e. lov_ost_data_v1 */ + if (!inited) + stripe_count = 0; + magic = le32_to_cpu(lmm->lmm_magic); if (magic != LOV_MAGIC_V1 && magic != LOV_MAGIC_V3) return ERR_PTR(-EINVAL); @@ -389,12 +401,12 @@ static int lsm_verify_comp_md_v1(struct lov_comp_md_v1 *lcm, if (magic == LOV_MAGIC_V1) { return lsme_unpack(lov, lmm, lmm_buf_size, NULL, - lmm->lmm_objects, maxbytes); + inited, lmm->lmm_objects, maxbytes); } else { struct lov_mds_md_v3 *lmm3 = (struct lov_mds_md_v3 *)lmm; return lsme_unpack(lov, lmm, lmm_buf_size, lmm3->lmm_pool_name, - lmm3->lmm_objects, maxbytes); + inited, lmm3->lmm_objects, maxbytes); } } @@ -440,6 +452,7 @@ static int lsm_verify_comp_md_v1(struct lov_comp_md_v1 *lcm, blob = (char *)lcm + blob_offset; lsme = lsme_unpack_comp(lov, blob, blob_size, + le32_to_cpu(lcme->lcme_flags) & LCME_FL_INIT, (i == entry_count - 1) ? &maxbytes : NULL); if (IS_ERR(lsme)) { @@ -452,6 +465,7 @@ static int lsm_verify_comp_md_v1(struct lov_comp_md_v1 *lcm, lsm->lsm_entries[i] = lsme; lsme->lsme_id = le32_to_cpu(lcme->lcme_id); + lsme->lsme_flags = le32_to_cpu(lcme->lcme_flags); lu_extent_le_to_cpu(&lsme->lsme_extent, &lcme->lcme_extent); if (i == entry_count - 1) { @@ -507,7 +521,7 @@ const struct lsm_operations *lsm_op_find(int magic) void dump_lsm(unsigned int level, const struct lov_stripe_md *lsm) { - int i; + int i, j; CDEBUG(level, "lsm %p, objid " DOSTID ", maxbytes %#llx, magic 0x%08X, refc: %d, entry: %u, layout_gen %u\n", @@ -519,10 +533,23 @@ void dump_lsm(unsigned int level, const struct lov_stripe_md *lsm) struct lov_stripe_md_entry *lse = lsm->lsm_entries[i]; CDEBUG(level, - DEXT ": id: %u, magic 0x%08X, stripe count %u, size %u, layout_gen %u, pool: [" LOV_POOLNAMEF "]\n", - PEXT(&lse->lsme_extent), lse->lsme_id, lse->lsme_magic, - lse->lsme_stripe_count, lse->lsme_stripe_size, - lse->lsme_layout_gen, lse->lsme_pool_name); + DEXT ": id: %u, flags: %x, magic 0x%08X, layout_gen %u, stripe count %u, sstripe size %u, pool: [" LOV_POOLNAMEF "]\n", + PEXT(&lse->lsme_extent), lse->lsme_id, lse->lsme_flags, + lse->lsme_magic, lse->lsme_layout_gen, + lse->lsme_stripe_count, lse->lsme_stripe_size, + lse->lsme_pool_name); + if (!lsme_inited(lse) || + lse->lsme_pattern & LOV_PATTERN_F_RELEASED) + continue; + + for (j = 0; j < lse->lsme_stripe_count; j++) { + CDEBUG(level, + " oinfo:%p: ostid: " DOSTID " ost idx: %d gen: %d\n", + lse->lsme_oinfo[j], + POSTID(&lse->lsme_oinfo[j]->loi_oi), + lse->lsme_oinfo[j]->loi_ost_idx, + lse->lsme_oinfo[j]->loi_ost_gen); + } } } diff --git a/drivers/staging/lustre/lustre/lov/lov_internal.h b/drivers/staging/lustre/lustre/lov/lov_internal.h index e8102df..5e3eae7 100644 --- a/drivers/staging/lustre/lustre/lov/lov_internal.h +++ b/drivers/staging/lustre/lustre/lov/lov_internal.h @@ -48,6 +48,7 @@ struct lov_stripe_md_entry { struct lu_extent lsme_extent; u32 lsme_id; u32 lsme_magic; + u32 lsme_flags; u32 lsme_pattern; u32 lsme_stripe_size; u16 lsme_stripe_count; @@ -56,6 +57,17 @@ struct lov_stripe_md_entry { struct lov_oinfo *lsme_oinfo[]; }; +static inline void copy_lsm_entry(struct lov_stripe_md_entry *dst, + struct lov_stripe_md_entry *src) +{ + unsigned int i; + + for (i = 0; i < src->lsme_stripe_count; i++) + *dst->lsme_oinfo[i] = *src->lsme_oinfo[i]; + + memcpy(dst, src, offsetof(typeof(*src), lsme_oinfo)); +} + struct lov_stripe_md { atomic_t lsm_refc; spinlock_t lsm_lock; @@ -74,6 +86,16 @@ struct lov_stripe_md { struct lov_stripe_md_entry *lsm_entries[]; }; +static inline bool lsme_inited(const struct lov_stripe_md_entry *lsme) +{ + return lsme->lsme_flags & LCME_FL_INIT; +} + +static inline bool lsm_entry_inited(const struct lov_stripe_md *lsm, int index) +{ + return lsme_inited(lsm->lsm_entries[index]); +} + static inline size_t lov_comp_md_size(const struct lov_stripe_md *lsm) { struct lov_stripe_md_entry *lsme; diff --git a/drivers/staging/lustre/lustre/lov/lov_io.c b/drivers/staging/lustre/lustre/lov/lov_io.c index 70908b1..8a1bb85 100644 --- a/drivers/staging/lustre/lustre/lov/lov_io.c +++ b/drivers/staging/lustre/lustre/lov/lov_io.c @@ -394,6 +394,11 @@ static int lov_io_iter_init(const struct lu_env *env, u64 start; u64 end; + CDEBUG(D_VFSTRACE, "component[%d] flags %#x\n", + index, lsm->lsm_entries[index]->lsme_flags); + if (!lsm_entry_inited(lsm, index)) + break; + index++; if (!lu_extent_is_overlapped(&ext, &le->lle_extent)) continue; @@ -442,6 +447,7 @@ static int lov_io_rw_iter_init(const struct lu_env *env, const struct cl_io_slice *ios) { struct lov_io *lio = cl2lov_io(env, ios); + struct lov_stripe_md *lsm = lio->lis_object->lo_lsm; struct cl_io *io = ios->cis_io; u64 start = io->u.ci_rw.crw_pos; struct lov_stripe_md_entry *lse; @@ -454,7 +460,7 @@ static int lov_io_rw_iter_init(const struct lu_env *env, if (cl_io_is_append(io)) return lov_io_iter_init(env, ios); - index = lov_lsm_entry(lio->lis_object->lo_lsm, io->u.ci_rw.crw_pos); + index = lov_lsm_entry(lsm, io->u.ci_rw.crw_pos); if (index < 0) { /* non-existing layout component */ if (io->ci_type == CIT_READ) { /* TODO: it needs to detect the next component and @@ -476,7 +482,9 @@ static int lov_io_rw_iter_init(const struct lu_env *env, if (next <= start * ssize) next = ~0ull; - LASSERT(io->u.ci_rw.crw_pos >= lse->lsme_extent.e_start); + LASSERTF(io->u.ci_rw.crw_pos >= lse->lsme_extent.e_start, + "pos %lld, [%lld, %lld]\n", io->u.ci_rw.crw_pos, + lse->lsme_extent.e_start, lse->lsme_extent.e_end); next = min_t(u64, next, lse->lsme_extent.e_end); next = min_t(u64, next, lio->lis_io_endpos); @@ -486,9 +494,16 @@ static int lov_io_rw_iter_init(const struct lu_env *env, lio->lis_endpos = io->u.ci_rw.crw_pos + io->u.ci_rw.crw_count; CDEBUG(D_VFSTRACE, - "stripe: %llu chunk: [%llu, %llu) %llu\n", - (u64)start, lio->lis_pos, lio->lis_endpos, - (u64)lio->lis_io_endpos); + "stripe: %llu chunk: [%llu, %llu] %llu\n", + start, lio->lis_pos, lio->lis_endpos, + lio->lis_io_endpos); + + index = lov_lsm_entry(lsm, lio->lis_endpos - 1); + if (index > 0 && !lsm_entry_inited(lsm, index)) { + io->ci_need_write_intent = 1; + io->ci_result = -ENODATA; + return io->ci_result; + } /* * XXX The following call should be optimized: we know, that @@ -497,6 +512,26 @@ static int lov_io_rw_iter_init(const struct lu_env *env, return lov_io_iter_init(env, ios); } +static int lov_io_setattr_iter_init(const struct lu_env *env, + const struct cl_io_slice *ios) +{ + struct lov_io *lio = cl2lov_io(env, ios); + struct cl_io *io = ios->cis_io; + struct lov_stripe_md *lsm = lio->lis_object->lo_lsm; + int index; + + if (cl_io_is_trunc(io) && lio->lis_pos) { + index = lov_lsm_entry(lsm, lio->lis_pos - 1); + if (index > 0 && !lsm_entry_inited(lsm, index)) { + io->ci_need_write_intent = 1; + io->ci_result = -ENODATA; + return io->ci_result; + } + } + + return lov_io_iter_init(env, ios); +} + static int lov_io_call(const struct lu_env *env, struct lov_io *lio, int (*iofunc)(const struct lu_env *, struct cl_io *)) { @@ -617,7 +652,7 @@ static int lov_io_read_ahead(const struct lu_env *env, offset = cl_offset(obj, start); index = lov_lsm_entry(loo->lo_lsm, offset); - if (index < 0) + if (index < 0 || !lsm_entry_inited(loo->lo_lsm, index)) return -ENODATA; stripe = lov_stripe_number(loo->lo_lsm, index, offset); @@ -870,7 +905,7 @@ static void lov_io_fsync_end(const struct lu_env *env, }, [CIT_SETATTR] = { .cio_fini = lov_io_fini, - .cio_iter_init = lov_io_iter_init, + .cio_iter_init = lov_io_setattr_iter_init, .cio_iter_fini = lov_io_iter_fini, .cio_lock = lov_io_lock, .cio_unlock = lov_io_unlock, diff --git a/drivers/staging/lustre/lustre/lov/lov_lock.c b/drivers/staging/lustre/lustre/lov/lov_lock.c index ba31be4..9a46424 100644 --- a/drivers/staging/lustre/lustre/lov/lov_lock.c +++ b/drivers/staging/lustre/lustre/lov/lov_lock.c @@ -132,7 +132,7 @@ static struct lov_lock *lov_lock_sub_init(const struct lu_env *env, nr = 0; for (index = lov_lsm_entry(lov->lo_lsm, ext.e_start); - index != -1 && index < lov->lo_lsm->lsm_entry_count; index++) { + index >= 0 && index < lov->lo_lsm->lsm_entry_count; index++) { struct lov_layout_raid0 *r0 = lov_r0(lov, index); /* assume lsm entries are sorted. */ @@ -147,8 +147,11 @@ static struct lov_lock *lov_lock_sub_init(const struct lu_env *env, nr++; } } - if (nr == 0) - return ERR_PTR(-EINVAL); + /** + * Aggressive lock request (from cl_setattr_ost) which asks for + * [eof, -1) lock, could come across uninstantiated layout extent, + * hence a 0 nr is possible. + */ lovlck = kvzalloc(offsetof(struct lov_lock, lls_sub[nr]), GFP_NOFS); @@ -158,7 +161,7 @@ static struct lov_lock *lov_lock_sub_init(const struct lu_env *env, lovlck->lls_nr = nr; nr = 0; for (index = lov_lsm_entry(lov->lo_lsm, ext.e_start); - index < lov->lo_lsm->lsm_entry_count; index++) { + index >= 0 && index < lov->lo_lsm->lsm_entry_count; index++) { struct lov_layout_raid0 *r0 = lov_r0(lov, index); /* assume lsm entries are sorted. */ diff --git a/drivers/staging/lustre/lustre/lov/lov_object.c b/drivers/staging/lustre/lustre/lov/lov_object.c index 8596c2f..35c9403 100644 --- a/drivers/staging/lustre/lustre/lov/lov_object.c +++ b/drivers/staging/lustre/lustre/lov/lov_object.c @@ -64,8 +64,6 @@ struct lov_layout_operations { union lov_layout_state *state); void (*llo_fini)(const struct lu_env *env, struct lov_object *lov, union lov_layout_state *state); - void (*llo_install)(const struct lu_env *env, struct lov_object *lov, - union lov_layout_state *state); int (*llo_print)(const struct lu_env *env, void *cookie, lu_printer_t p, const struct lu_object *o); int (*llo_page_init)(const struct lu_env *env, struct cl_object *obj, @@ -92,16 +90,6 @@ static void lov_lsm_put(struct lov_stripe_md *lsm) * Lov object layout operations. * */ - -static void lov_install_empty(const struct lu_env *env, - struct lov_object *lov, - union lov_layout_state *state) -{ - /* - * File without objects. - */ -} - static int lov_init_empty(const struct lu_env *env, struct lov_device *dev, struct lov_object *lov, struct lov_stripe_md *lsm, const struct cl_object_conf *conf, @@ -110,12 +98,6 @@ static int lov_init_empty(const struct lu_env *env, struct lov_device *dev, return 0; } -static void lov_install_composite(const struct lu_env *env, - struct lov_object *lov, - union lov_layout_state *state) -{ -} - static struct cl_object *lov_sub_find(const struct lu_env *env, struct cl_device *dev, const struct lu_fid *fid, @@ -328,6 +310,14 @@ static int lov_init_composite(const struct lu_env *env, struct lov_device *dev, struct lov_layout_entry *le = &comp->lo_entries[i]; le->lle_extent = lsm->lsm_entries[i]->lsme_extent; + /** + * If the component has not been init-ed on MDS side, for + * PFL layout, we'd know that the components beyond this one + * will be dynamically init-ed later on file write/trunc ops. + */ + if (!lsm_entry_inited(lsm, i)) + continue; + result = lov_init_raid0(env, dev, lov, i, &le->lle_raid0); if (result < 0) break; @@ -471,13 +461,15 @@ static int lov_delete_composite(const struct lu_env *env, struct lov_object *lov, union lov_layout_state *state) { + struct lov_layout_composite *comp = &state->composite; struct lov_layout_entry *entry; dump_lsm(D_INODE, lov->lo_lsm); lov_layout_wait(env, lov); - lov_foreach_layout_entry(lov, entry) - lov_delete_raid0(env, lov, &entry->lle_raid0); + if (comp->lo_entries) + lov_foreach_layout_entry(lov, entry) + lov_delete_raid0(env, lov, &entry->lle_raid0); return 0; } @@ -565,9 +557,9 @@ static int lov_print_composite(const struct lu_env *env, void *cookie, for (i = 0; i < lsm->lsm_entry_count; i++) { struct lov_stripe_md_entry *lse = lsm->lsm_entries[i]; - (*p)(env, cookie, DEXT ": { 0x%08X, %u, %u, %u, %u }\n", + (*p)(env, cookie, DEXT ": { 0x%08X, %u, %u, %#x, %u, %u }\n", PEXT(&lse->lsme_extent), lse->lsme_magic, - lse->lsme_id, lse->lsme_layout_gen, + lse->lsme_id, lse->lsme_layout_gen, lse->lsme_flags, lse->lsme_stripe_count, lse->lsme_stripe_size); lov_print_raid0(env, cookie, p, lov_r0(lov, i)); } @@ -664,6 +656,10 @@ static int lov_attr_get_composite(const struct lu_env *env, struct lov_layout_raid0 *r0 = &entry->lle_raid0; struct cl_attr *lov_attr = &r0->lo_attr; + /* PFL: This component has not been init-ed. */ + if (!lsm_entry_inited(lov->lo_lsm, index)) + break; + result = lov_attr_get_raid0(env, lov, index, r0); if (result != 0) break; @@ -691,7 +687,6 @@ static int lov_attr_get_composite(const struct lu_env *env, .llo_init = lov_init_empty, .llo_delete = lov_delete_empty, .llo_fini = lov_fini_empty, - .llo_install = lov_install_empty, .llo_print = lov_print_empty, .llo_page_init = lov_page_init_empty, .llo_lock_init = lov_lock_init_empty, @@ -702,7 +697,6 @@ static int lov_attr_get_composite(const struct lu_env *env, .llo_init = lov_init_released, .llo_delete = lov_delete_empty, .llo_fini = lov_fini_released, - .llo_install = lov_install_empty, .llo_print = lov_print_released, .llo_page_init = lov_page_init_empty, .llo_lock_init = lov_lock_init_empty, @@ -713,7 +707,6 @@ static int lov_attr_get_composite(const struct lu_env *env, .llo_init = lov_init_composite, .llo_delete = lov_delete_composite, .llo_fini = lov_fini_composite, - .llo_install = lov_install_composite, .llo_print = lov_print_composite, .llo_page_init = lov_page_init_composite, .llo_lock_init = lov_lock_init_composite, @@ -894,7 +887,6 @@ static int lov_layout_change(const struct lu_env *unused, goto out; } - new_ops->llo_install(env, lov, state); lov->lo_type = llt; out: cl_env_put(env, &refcheck); @@ -937,8 +929,6 @@ int lov_object_init(const struct lu_env *env, struct lu_object *obj, lov->lo_type = lov_type(lsm); ops = &lov_dispatch[lov->lo_type]; rc = ops->llo_init(env, dev, lov, lsm, cconf, set); - if (!rc) - ops->llo_install(env, lov, set); lov_lsm_put(lsm); @@ -959,6 +949,7 @@ static int lov_conf_set(const struct lu_env *env, struct cl_object *obj, conf->u.coc_layout.lb_len); if (IS_ERR(lsm)) return PTR_ERR(lsm); + dump_lsm(D_INODE, lsm); } lov_conf_lock(lov); @@ -1541,6 +1532,9 @@ static int lov_object_fiemap(const struct lu_env *env, struct cl_object *obj, for (entry = start_entry; entry <= end_entry; entry++) { lsme = lsm->lsm_entries[entry]; + if (!lsme_inited(lsme)) + break; + if (entry == start_entry) fs.fs_ext.e_start = whole_start; else @@ -1751,6 +1745,9 @@ int lov_read_and_clear_async_rc(struct cl_object *clob) int j; lse = lsm->lsm_entries[i]; + if (!lsme_inited(lse)) + break; + for (j = 0; j < lse->lsme_stripe_count; j++) { struct lov_oinfo *loi; diff --git a/drivers/staging/lustre/lustre/lov/lov_pack.c b/drivers/staging/lustre/lustre/lov/lov_pack.c index 79d8a32..32e4b33 100644 --- a/drivers/staging/lustre/lustre/lov/lov_pack.c +++ b/drivers/staging/lustre/lustre/lov/lov_pack.c @@ -146,6 +146,9 @@ ssize_t lov_lsm_pack_v1v3(const struct lov_stripe_md *lsm, void *buf, lmm_objects = lmmv1->lmm_objects; } + if (lsm->lsm_is_released) + return lmm_size; + for (i = 0; i < lsm->lsm_entries[0]->lsme_stripe_count; i++) { struct lov_oinfo *loi = lsm->lsm_entries[0]->lsme_oinfo[i]; @@ -189,11 +192,13 @@ ssize_t lov_lsm_pack(const struct lov_stripe_md *lsm, void *buf, for (entry = 0; entry < lsm->lsm_entry_count; entry++) { struct lov_stripe_md_entry *lsme; struct lov_mds_md *lmm; + u16 stripecnt; lsme = lsm->lsm_entries[entry]; lcme = &lcmv1->lcm_entries[entry]; lcme->lcme_id = cpu_to_le32(lsme->lsme_id); + lcme->lcme_flags = cpu_to_le32(lsme->lsme_flags); lcme->lcme_extent.e_start = cpu_to_le64(lsme->lsme_extent.e_start); lcme->lcme_extent.e_end = @@ -220,7 +225,13 @@ ssize_t lov_lsm_pack(const struct lov_stripe_md *lsm, void *buf, lmm_objects = ((struct lov_mds_md_v1 *)lmm)->lmm_objects; } - for (i = 0; i < lsme->lsme_stripe_count; i++) { + if (lsme_inited(lsme) && + !(lsme->lsme_pattern & LOV_PATTERN_F_RELEASED)) + stripecnt = lsme->lsme_stripe_count; + else + stripecnt = 0; + + for (i = 0; i < stripecnt; i++) { struct lov_oinfo *loi = lsme->lsme_oinfo[i]; ostid_cpu_to_le(&loi->loi_oi, &lmm_objects[i].l_ost_oi); @@ -230,8 +241,7 @@ ssize_t lov_lsm_pack(const struct lov_stripe_md *lsm, void *buf, cpu_to_le32(loi->loi_ost_idx); } - size = lov_mds_md_size(lsme->lsme_stripe_count, - lsme->lsme_magic); + size = lov_mds_md_size(stripecnt, lsme->lsme_magic); lcme->lcme_size = cpu_to_le32(size); offset += size; } /* for each layout component */ @@ -314,9 +324,6 @@ int lov_getstripe(struct lov_object *obj, struct lov_stripe_md *lsm, size_t lmmk_size; int rc = 0; - if (!lsm) - return -ENODATA; - if (lsm->lsm_magic != LOV_MAGIC_V1 && lsm->lsm_magic != LOV_MAGIC_V3 && lsm->lsm_magic != LOV_MAGIC_COMP_V1) { CERROR("bad LSM MAGIC: 0x%08X != 0x%08X nor 0x%08X\n", diff --git a/drivers/staging/lustre/lustre/lov/lov_page.c b/drivers/staging/lustre/lustre/lov/lov_page.c index f53379a..8b68d3c 100644 --- a/drivers/staging/lustre/lustre/lov/lov_page.c +++ b/drivers/staging/lustre/lustre/lov/lov_page.c @@ -81,7 +81,7 @@ int lov_page_init_composite(const struct lu_env *env, struct cl_object *obj, offset = cl_offset(obj, index); entry = lov_lsm_entry(loo->lo_lsm, offset); - if (entry < 0) { + if (entry < 0 || !lsm_entry_inited(loo->lo_lsm, entry)) { /* non-existing layout component */ lov_page_init_empty(env, obj, page, index); return 0; diff --git a/drivers/staging/lustre/lustre/mdc/mdc_locks.c b/drivers/staging/lustre/lustre/mdc/mdc_locks.c index 7d4ba9c..0abe426 100644 --- a/drivers/staging/lustre/lustre/mdc/mdc_locks.c +++ b/drivers/staging/lustre/lustre/mdc/mdc_locks.c @@ -214,20 +214,32 @@ static inline void mdc_clear_replay_flag(struct ptlrpc_request *req, int rc) * but this is incredibly unlikely, and questionable whether the client * could do MDS recovery under OOM anyways... */ -static void mdc_realloc_openmsg(struct ptlrpc_request *req, - struct mdt_body *body) +static int mdc_save_lovea(struct ptlrpc_request *req, + const struct req_msg_field *field, + void *data, u32 size) { - int rc; - - /* FIXME: remove this explicit offset. */ - rc = sptlrpc_cli_enlarge_reqbuf(req, DLM_INTENT_REC_OFF + 4, - body->mbo_eadatasize); - if (rc) { - CERROR("Can't enlarge segment %d size to %d\n", - DLM_INTENT_REC_OFF + 4, body->mbo_eadatasize); - body->mbo_valid &= ~OBD_MD_FLEASIZE; - body->mbo_eadatasize = 0; + struct req_capsule *pill = &req->rq_pill; + int rc = 0; + void *lmm; + + if (req_capsule_get_size(pill, field, RCL_CLIENT) < size) { + rc = sptlrpc_cli_enlarge_reqbuf(req, field, size); + if (rc) { + CERROR("%s: Can't enlarge ea size to %d: rc = %d\n", + req->rq_export->exp_obd->obd_name, + size, rc); + return rc; + } + } else { + req_capsule_shrink(pill, field, size, RCL_CLIENT); } + + req_capsule_set_size(pill, field, RCL_CLIENT, size); + lmm = req_capsule_client_get(pill, field); + if (lmm) + memcpy(lmm, data, size); + + return rc; } static struct ptlrpc_request * @@ -470,7 +482,7 @@ static struct ptlrpc_request *mdc_intent_getattr_pack(struct obd_export *exp, static struct ptlrpc_request *mdc_intent_layout_pack(struct obd_export *exp, struct lookup_intent *it, - struct md_op_data *unused) + struct md_op_data *op_data) { struct obd_device *obd = class_exp2obd(exp); struct ptlrpc_request *req; @@ -496,10 +508,9 @@ static struct ptlrpc_request *mdc_intent_layout_pack(struct obd_export *exp, /* pack the layout intent request */ layout = req_capsule_client_get(&req->rq_pill, &RMF_LAYOUT_INTENT); - /* LAYOUT_INTENT_ACCESS is generic, specific operation will be - * set for replication - */ - layout->li_opc = LAYOUT_INTENT_ACCESS; + LASSERT(op_data->op_data); + LASSERT(op_data->op_data_size == sizeof(*layout)); + memcpy(layout, op_data->op_data, sizeof(*layout)); req_capsule_set_size(&req->rq_pill, &RMF_DLM_LVB, RCL_SERVER, obd->u.cli.cl_default_mds_easize); @@ -649,24 +660,13 @@ static int mdc_finish_enqueue(struct obd_export *exp, * (for example error one). */ if ((it->it_op & IT_OPEN) && req->rq_replay) { - void *lmm; - - if (req_capsule_get_size(pill, &RMF_EADATA, - RCL_CLIENT) < - body->mbo_eadatasize) - mdc_realloc_openmsg(req, body); - else - req_capsule_shrink(pill, &RMF_EADATA, - body->mbo_eadatasize, - RCL_CLIENT); - - req_capsule_set_size(pill, &RMF_EADATA, - RCL_CLIENT, - body->mbo_eadatasize); - - lmm = req_capsule_client_get(pill, &RMF_EADATA); - if (lmm) - memcpy(lmm, eadata, body->mbo_eadatasize); + rc = mdc_save_lovea(req, &RMF_EADATA, eadata, + body->mbo_eadatasize); + if (rc) { + body->mbo_valid &= ~OBD_MD_FLEASIZE; + body->mbo_eadatasize = 0; + rc = 0; + } } } } else if (it->it_op & IT_LAYOUT) { @@ -680,6 +680,15 @@ static int mdc_finish_enqueue(struct obd_export *exp, lvb_len); if (!lvb_data) return -EPROTO; + + /** + * save replied layout data to the request buffer for + * recovery consideration (lest MDS reinitialize + * another set of OST objects). + */ + if (req->rq_transno) + (void)mdc_save_lovea(req, &RMF_EADATA, lvb_data, + lvb_len); } } diff --git a/drivers/staging/lustre/lustre/obdclass/genops.c b/drivers/staging/lustre/lustre/obdclass/genops.c index 76bc73f..03df181 100644 --- a/drivers/staging/lustre/lustre/obdclass/genops.c +++ b/drivers/staging/lustre/lustre/obdclass/genops.c @@ -1546,6 +1546,16 @@ static inline bool obd_mod_rpc_slot_avail(struct client_obd *cli, return avail; } +static inline bool obd_skip_mod_rpc_slot(const struct lookup_intent *it) +{ + if (it && + (it->it_op == IT_GETATTR || it->it_op == IT_LOOKUP || + it->it_op == IT_READDIR || + (it->it_op == IT_LAYOUT && !(it->it_flags & FMODE_WRITE)))) + return true; + return false; +} + /* Get a modify RPC slot from the obd client @cli according * to the kind of operation @opc that is going to be sent * and the intent @it of the operation if it applies. @@ -1563,8 +1573,7 @@ u16 obd_get_mod_rpc_slot(struct client_obd *cli, __u32 opc, /* read-only metadata RPCs don't consume a slot on MDT * for reply reconstruction */ - if (it && (it->it_op == IT_GETATTR || it->it_op == IT_LOOKUP || - it->it_op == IT_LAYOUT || it->it_op == IT_READDIR)) + if (obd_skip_mod_rpc_slot(it)) return 0; if (opc == MDS_CLOSE) @@ -1610,8 +1619,7 @@ void obd_put_mod_rpc_slot(struct client_obd *cli, u32 opc, { bool close_req = false; - if (it && (it->it_op == IT_GETATTR || it->it_op == IT_LOOKUP || - it->it_op == IT_LAYOUT || it->it_op == IT_READDIR)) + if (obd_skip_mod_rpc_slot(it)) return; if (opc == MDS_CLOSE) diff --git a/drivers/staging/lustre/lustre/ptlrpc/layout.c b/drivers/staging/lustre/lustre/ptlrpc/layout.c index d3c0dd6..a155200 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/layout.c +++ b/drivers/staging/lustre/lustre/ptlrpc/layout.c @@ -1797,9 +1797,9 @@ int req_capsule_server_pack(struct req_capsule *pill) * Returns the PTLRPC request or reply (\a loc) buffer offset of a \a pill * corresponding to the given RMF (\a field). */ -static u32 __req_capsule_offset(const struct req_capsule *pill, - const struct req_msg_field *field, - enum req_location loc) +u32 __req_capsule_offset(const struct req_capsule *pill, + const struct req_msg_field *field, + enum req_location loc) { u32 offset; diff --git a/drivers/staging/lustre/lustre/ptlrpc/ptlrpc_internal.h b/drivers/staging/lustre/lustre/ptlrpc/ptlrpc_internal.h index 0e4a215..177010c 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/ptlrpc_internal.h +++ b/drivers/staging/lustre/lustre/ptlrpc/ptlrpc_internal.h @@ -88,7 +88,7 @@ void ptlrpc_set_add_new_req(struct ptlrpcd_ctl *pc, void ptlrpc_initiate_recovery(struct obd_import *imp); int lustre_unpack_req_ptlrpc_body(struct ptlrpc_request *req, int offset); -int lustre_unpack_rep_ptlrpc_body(struct ptlrpc_request *req, int offset); +int lustre_unpack_rep_ptlrpc_body(struct ptlrpc_request *req, int effset); int ptlrpc_sysfs_register_service(struct kset *parent, struct ptlrpc_service *svc); @@ -284,6 +284,11 @@ void sptlrpc_conf_choose_flavor(enum lustre_sec_part from, int sptlrpc_init(void); void sptlrpc_fini(void); +/* layout.c */ +u32 __req_capsule_offset(const struct req_capsule *pill, + const struct req_msg_field *field, + enum req_location loc); + static inline bool ptlrpc_recoverable_error(int rc) { return (rc == -ENOTCONN || rc == -ENODEV); diff --git a/drivers/staging/lustre/lustre/ptlrpc/sec.c b/drivers/staging/lustre/lustre/ptlrpc/sec.c index 9c59871..53f4d4f 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/sec.c +++ b/drivers/staging/lustre/lustre/ptlrpc/sec.c @@ -1611,11 +1611,14 @@ void _sptlrpc_enlarge_msg_inplace(struct lustre_msg *msg, * so caller should refresh its local pointers if needed. */ int sptlrpc_cli_enlarge_reqbuf(struct ptlrpc_request *req, - int segment, int newsize) + const struct req_msg_field *field, + int newsize) { + struct req_capsule *pill = &req->rq_pill; struct ptlrpc_cli_ctx *ctx = req->rq_cli_ctx; struct ptlrpc_sec_cops *cops; struct lustre_msg *msg = req->rq_reqmsg; + int segment = __req_capsule_offset(pill, field, RCL_CLIENT); LASSERT(ctx); LASSERT(msg); -- 1.8.3.1 From jsimmons at infradead.org Sun Jan 6 22:14:16 2019 From: jsimmons at infradead.org (James Simmons) Date: Sun, 6 Jan 2019 17:14:16 -0500 Subject: [lustre-devel] [PATCH v2 21/33] lustre: pfl: calculate PFL file LOVEA correctly In-Reply-To: <1546812868-11794-1-git-send-email-jsimmons@infradead.org> References: <1546812868-11794-1-git-send-email-jsimmons@infradead.org> Message-ID: <1546812868-11794-22-git-send-email-jsimmons@infradead.org> From: Bobi Jam PFL file could contain uninstantiated component, so it could still keeps the specified -1 stripe count, lov_mds_md_size()/lov_user_md_size() should heed this case, otherwise its LOVEA size could be errneous big. Signed-off-by: Bobi Jam WC-bug-id: https://jira.whamcloud.com/browse/LU-9335 Reviewed-on: https://review.whamcloud.com/26597 Reviewed-by: Andreas Dilger Reviewed-by: Niu Yawei Reviewed-by: Oleg Drokin Signed-off-by: James Simmons --- drivers/staging/lustre/include/uapi/linux/lustre/lustre_idl.h | 3 +++ drivers/staging/lustre/include/uapi/linux/lustre/lustre_user.h | 3 +++ 2 files changed, 6 insertions(+) diff --git a/drivers/staging/lustre/include/uapi/linux/lustre/lustre_idl.h b/drivers/staging/lustre/include/uapi/linux/lustre/lustre_idl.h index 5b4d9fc..42396dc 100644 --- a/drivers/staging/lustre/include/uapi/linux/lustre/lustre_idl.h +++ b/drivers/staging/lustre/include/uapi/linux/lustre/lustre_idl.h @@ -1036,6 +1036,9 @@ struct lov_mds_md_v3 { /* LOV EA mds/wire data (little-endian) */ static inline __u32 lov_mds_md_size(__u16 stripes, __u32 lmm_magic) { + if (stripes == (__u16)-1) + stripes = 0; + if (lmm_magic == LOV_MAGIC_V3) return sizeof(struct lov_mds_md_v3) + stripes * sizeof(struct lov_ost_data_v1); diff --git a/drivers/staging/lustre/include/uapi/linux/lustre/lustre_user.h b/drivers/staging/lustre/include/uapi/linux/lustre/lustre_user.h index 28d4e0c..0f401bb 100644 --- a/drivers/staging/lustre/include/uapi/linux/lustre/lustre_user.h +++ b/drivers/staging/lustre/include/uapi/linux/lustre/lustre_user.h @@ -463,6 +463,9 @@ struct lov_comp_md_v1 { static inline __u32 lov_user_md_size(__u16 stripes, __u32 lmm_magic) { + if (stripes == (__u16)-1) + stripes = 0; + if (lmm_magic == LOV_USER_MAGIC_V1) return sizeof(struct lov_user_md_v1) + stripes * sizeof(struct lov_user_ost_data_v1); -- 1.8.3.1 From jsimmons at infradead.org Sun Jan 6 22:14:26 2019 From: jsimmons at infradead.org (James Simmons) Date: Sun, 6 Jan 2019 17:14:26 -0500 Subject: [lustre-devel] [PATCH v2 31/33] lustre: lov: call cl_object_attr_get under cl_attr lock In-Reply-To: <1546812868-11794-1-git-send-email-jsimmons@infradead.org> References: <1546812868-11794-1-git-send-email-jsimmons@infradead.org> Message-ID: <1546812868-11794-32-git-send-email-jsimmons@infradead.org> From: Mike Pershin cl_object_attr_get() must be called under cl_object_attr_lock get. There is place in lov_getstripe where it is called without that lock. Signed-off-by: Mike Pershin WC-bug-id: https://jira.whamcloud.com/browse/LU-10232 Reviewed-on: https://review.whamcloud.com/30052 Reviewed-by: Fan Yong Reviewed-by: Oleg Drokin Signed-off-by: James Simmons --- drivers/staging/lustre/lustre/lov/lov_pack.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/staging/lustre/lustre/lov/lov_pack.c b/drivers/staging/lustre/lustre/lov/lov_pack.c index ef3c040..089e556 100644 --- a/drivers/staging/lustre/lustre/lov/lov_pack.c +++ b/drivers/staging/lustre/lustre/lov/lov_pack.c @@ -397,7 +397,9 @@ int lov_getstripe(const struct lu_env *env, struct lov_object *obj, attr.cat_size = 0; cl_obj = cl_object_top(&obj->lo_cl); + cl_object_attr_lock(cl_obj); cl_object_attr_get(env, cl_obj, &attr); + cl_object_attr_unlock(cl_obj); /* return the last instantiated component if file size * is non-zero, otherwise, return the last component. -- 1.8.3.1 From jsimmons at infradead.org Sun Jan 6 22:14:25 2019 From: jsimmons at infradead.org (James Simmons) Date: Sun, 6 Jan 2019 17:14:25 -0500 Subject: [lustre-devel] [PATCH v2 30/33] lustre: lov: do not split IO for single striped file In-Reply-To: <1546812868-11794-1-git-send-email-jsimmons@infradead.org> References: <1546812868-11794-1-git-send-email-jsimmons@infradead.org> Message-ID: <1546812868-11794-31-git-send-email-jsimmons@infradead.org> From: Jinshan Xiong stripe size for single striped file is not reliable, it shouldn't be used to split I/O. Signed-off-by: Jinshan Xiong WC-bug-id: https://jira.whamcloud.com/browse/LU-9841 Reviewed-on: https://review.whamcloud.com/28451 Reviewed-by: Bobi Jam Reviewed-by: Dmitry Eremin Reviewed-by: Oleg Drokin Signed-off-by: James Simmons --- drivers/staging/lustre/lustre/lov/lov_io.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/drivers/staging/lustre/lustre/lov/lov_io.c b/drivers/staging/lustre/lustre/lov/lov_io.c index 9a3352f..47bb618 100644 --- a/drivers/staging/lustre/lustre/lov/lov_io.c +++ b/drivers/staging/lustre/lustre/lov/lov_io.c @@ -466,7 +466,6 @@ static int lov_io_rw_iter_init(const struct lu_env *env, struct cl_io *io = ios->cis_io; u64 start = io->u.ci_rw.crw_pos; struct lov_stripe_md_entry *lse; - unsigned long ssize; int index; u64 next; @@ -491,11 +490,15 @@ static int lov_io_rw_iter_init(const struct lu_env *env, lse = lov_lse(lio->lis_object, index); - ssize = lse->lsme_stripe_size; - lov_do_div64(start, ssize); - next = (start + 1) * ssize; - if (next <= start * ssize) - next = ~0ull; + next = MAX_LFS_FILESIZE; + if (lse->lsme_stripe_count > 1) { + unsigned long ssize = lse->lsme_stripe_size; + + lov_do_div64(start, ssize); + next = (start + 1) * ssize; + if (next <= start * ssize) + next = MAX_LFS_FILESIZE; + } LASSERTF(io->u.ci_rw.crw_pos >= lse->lsme_extent.e_start, "pos %lld, [%lld, %lld]\n", io->u.ci_rw.crw_pos, -- 1.8.3.1 From jsimmons at infradead.org Sun Jan 6 22:14:19 2019 From: jsimmons at infradead.org (James Simmons) Date: Sun, 6 Jan 2019 17:14:19 -0500 Subject: [lustre-devel] [PATCH v2 24/33] lustre: pfl: fix hang with grouplocks In-Reply-To: <1546812868-11794-1-git-send-email-jsimmons@infradead.org> References: <1546812868-11794-1-git-send-email-jsimmons@infradead.org> Message-ID: <1546812868-11794-25-git-send-email-jsimmons@infradead.org> From: Bobi Jam This is a makeshift fix. When we hold a group lock of a file, there should no data written to the file, since during the write IO, the file's layout could possibly change, and the write IO will try to update its layout, which could be blocked by itself. Signed-off-by: Bobi Jam WC-bug-id: https://jira.whamcloud.com/browse/LU-9344 Reviewed-on: https://review.whamcloud.com/26646 Reviewed-by: Jinshan Xiong Reviewed-by: Andreas Dilger Signed-off-by: James Simmons --- drivers/staging/lustre/lustre/include/cl_object.h | 2 ++ drivers/staging/lustre/lustre/llite/file.c | 26 +++++++++++++++++++++++ drivers/staging/lustre/lustre/lov/lov_object.c | 1 + 3 files changed, 29 insertions(+) diff --git a/drivers/staging/lustre/lustre/include/cl_object.h b/drivers/staging/lustre/lustre/include/cl_object.h index 57ced0f..ee71f1c 100644 --- a/drivers/staging/lustre/lustre/include/cl_object.h +++ b/drivers/staging/lustre/lustre/include/cl_object.h @@ -288,6 +288,8 @@ struct cl_layout { size_t cl_size; /** Layout generation. */ u32 cl_layout_gen; + /** whether layout is a composite one */ + bool cl_is_composite; }; /** diff --git a/drivers/staging/lustre/lustre/llite/file.c b/drivers/staging/lustre/lustre/llite/file.c index 6a0a468..08ba8f7 100644 --- a/drivers/staging/lustre/lustre/llite/file.c +++ b/drivers/staging/lustre/lustre/llite/file.c @@ -1551,6 +1551,7 @@ static int ll_lov_setstripe(struct inode *inode, struct file *file, { struct ll_inode_info *lli = ll_i2info(inode); struct ll_file_data *fd = LUSTRE_FPRIVATE(file); + struct cl_object *obj = lli->lli_clob; struct ll_grouplock grouplock; int rc; @@ -1572,6 +1573,31 @@ static int ll_lov_setstripe(struct inode *inode, struct file *file, LASSERT(!fd->fd_grouplock.lg_lock); spin_unlock(&lli->lli_lock); + /** + * XXX: group lock needs to protect all OST objects while PFL + * can add new OST objects during the IO, so we'd instantiate + * all OST objects before getting its group lock. + */ + if (obj) { + struct cl_layout cl = { + .cl_is_composite = false, + }; + struct lu_env *env; + u16 refcheck; + + env = cl_env_get(&refcheck); + if (IS_ERR(env)) + return PTR_ERR(env); + + rc = cl_object_layout_get(env, obj, &cl); + if (!rc && cl.cl_is_composite) + rc = ll_layout_write_intent(inode, 0, OBD_OBJECT_EOF); + + cl_env_put(env, &refcheck); + if (rc) + return rc; + } + rc = cl_get_grouplock(ll_i2info(inode)->lli_clob, arg, (file->f_flags & O_NONBLOCK), &grouplock); if (rc) diff --git a/drivers/staging/lustre/lustre/lov/lov_object.c b/drivers/staging/lustre/lustre/lov/lov_object.c index 35c9403..968c49d 100644 --- a/drivers/staging/lustre/lustre/lov/lov_object.c +++ b/drivers/staging/lustre/lustre/lov/lov_object.c @@ -1637,6 +1637,7 @@ static int lov_object_layout_get(const struct lu_env *env, cl->cl_size = lov_comp_md_size(lsm); cl->cl_layout_gen = lsm->lsm_layout_gen; + cl->cl_is_composite = lsm_is_composite(lsm->lsm_magic); rc = lov_lsm_pack(lsm, buf->lb_buf, buf->lb_len); lov_lsm_put(lsm); -- 1.8.3.1 From jsimmons at infradead.org Sun Jan 6 22:14:13 2019 From: jsimmons at infradead.org (James Simmons) Date: Sun, 6 Jan 2019 17:14:13 -0500 Subject: [lustre-devel] [PATCH v2 18/33] lustre: pfl: enhance PFID EA for PFL In-Reply-To: <1546812868-11794-1-git-send-email-jsimmons@infradead.org> References: <1546812868-11794-1-git-send-email-jsimmons@infradead.org> Message-ID: <1546812868-11794-19-git-send-email-jsimmons@infradead.org> From: Fan Yong This is a misc patch that contains some adjustments to store more stripe information in the OST-object's PFID EA (XATTR_NAME_FID). It is client duty to transfer the stripe and PFL information to the OST via the write, setattr and punch RPC. Then OST will store these information in the PFID EA. Signed-off-by: Fan Yong WC-bug-id: https://jira.whamcloud.com/browse/LU-8998 Reviewed-on: https://review.whamcloud.com/24882 Reviewed-by: Andreas Dilger Reviewed-by: Jinshan Xiong Signed-off-by: James Simmons --- .../lustre/include/uapi/linux/lustre/lustre_idl.h | 14 ++++-- .../lustre/include/uapi/linux/lustre/lustre_user.h | 17 +++---- drivers/staging/lustre/lustre/include/cl_object.h | 1 + drivers/staging/lustre/lustre/lov/lov_internal.h | 16 ++++++ drivers/staging/lustre/lustre/lov/lov_io.c | 2 + drivers/staging/lustre/lustre/lov/lovsub_object.c | 4 ++ drivers/staging/lustre/lustre/osc/osc_io.c | 4 +- .../staging/lustre/lustre/ptlrpc/pack_generic.c | 13 ++++- drivers/staging/lustre/lustre/ptlrpc/wiretest.c | 58 +++++++++++++--------- 9 files changed, 89 insertions(+), 40 deletions(-) diff --git a/drivers/staging/lustre/include/uapi/linux/lustre/lustre_idl.h b/drivers/staging/lustre/include/uapi/linux/lustre/lustre_idl.h index 333b791..695f1a1 100644 --- a/drivers/staging/lustre/include/uapi/linux/lustre/lustre_idl.h +++ b/drivers/staging/lustre/include/uapi/linux/lustre/lustre_idl.h @@ -1134,6 +1134,7 @@ static inline __u32 lov_mds_md_size(__u16 stripes, __u32 lmm_magic) */ #define OBD_MD_DEFAULT_MEA (0x0040000000000000ULL) /* default MEA */ +#define OBD_MD_FLOSTLAYOUT (0x0080000000000000ULL) /* contain ost_layout */ #define OBD_MD_FLPROJID (0x0100000000000000ULL) /* project ID */ #define OBD_MD_FLALLQUOTA (OBD_MD_FLUSRQUOTA | \ @@ -2637,9 +2638,16 @@ struct obdo { __u32 o_parent_ver; struct lustre_handle o_handle; /* brw: lock handle to prolong locks */ - struct llog_cookie o_lcookie; /* destroy: unlink cookie from MDS, - * obsolete in 2.8, reused in OSP - */ + /* Originally, the field is llog_cookie for destroy with unlink cookie + * from MDS, it is obsolete in 2.8. Then reuse it by client to transfer + * layout and PFL information in IO, setattr RPCs. Since llog_cookie is + * not used on wire any longer, remove it from the obdo, then it can be + * enlarged freely in the further without affect related RPCs. + * + * sizeof(ost_layout) + sizeof(__u32) == sizeof(llog_cookie). + */ + struct ost_layout o_layout; + __u32 o_padding_3; __u32 o_uid_h; __u32 o_gid_h; diff --git a/drivers/staging/lustre/include/uapi/linux/lustre/lustre_user.h b/drivers/staging/lustre/include/uapi/linux/lustre/lustre_user.h index 8ef05f5..28d4e0c 100644 --- a/drivers/staging/lustre/include/uapi/linux/lustre/lustre_user.h +++ b/drivers/staging/lustre/include/uapi/linux/lustre/lustre_user.h @@ -154,16 +154,13 @@ static inline bool fid_is_zero(const struct lu_fid *fid) return !fid->f_seq && !fid->f_oid; } -struct filter_fid { - struct lu_fid ff_parent; /* ff_parent.f_ver == file stripe number */ -}; - -/* keep this one for compatibility */ -struct filter_fid_old { - struct lu_fid ff_parent; - __u64 ff_objid; - __u64 ff_seq; -}; +struct ost_layout { + __u32 ol_stripe_size; + __u32 ol_stripe_count; + __u64 ol_comp_start; + __u64 ol_comp_end; + __u32 ol_comp_id; +} __packed; /* Userspace should treat lu_fid as opaque, and only use the following methods * to print or parse them. Other functions (e.g. compare, swab) could be moved diff --git a/drivers/staging/lustre/lustre/include/cl_object.h b/drivers/staging/lustre/lustre/include/cl_object.h index a1e07f8..d0edeb7c 100644 --- a/drivers/staging/lustre/lustre/include/cl_object.h +++ b/drivers/staging/lustre/lustre/include/cl_object.h @@ -1784,6 +1784,7 @@ struct cl_io { unsigned int sa_avalid; unsigned int sa_xvalid; /* OP_XVALID */ int sa_stripe_index; + struct ost_layout sa_layout; const struct lu_fid *sa_parent_fid; } ci_setattr; struct cl_data_version_io { diff --git a/drivers/staging/lustre/lustre/lov/lov_internal.h b/drivers/staging/lustre/lustre/lov/lov_internal.h index 9c0a4f7..e8102df 100644 --- a/drivers/staging/lustre/lustre/lov/lov_internal.h +++ b/drivers/staging/lustre/lustre/lov/lov_internal.h @@ -304,4 +304,20 @@ static inline struct obd_device *lov2obd(const struct lov_obd *lov) return container_of_safe(lov, struct obd_device, u.lov); } +static inline void lov_lsm2layout(struct lov_stripe_md *lsm, + struct lov_stripe_md_entry *lsme, + struct ost_layout *ol) +{ + ol->ol_stripe_size = lsme->lsme_stripe_size; + ol->ol_stripe_count = lsme->lsme_stripe_count; + if (lsm->lsm_magic == LOV_MAGIC_COMP_V1) { + ol->ol_comp_start = lsme->lsme_extent.e_start; + ol->ol_comp_end = lsme->lsme_extent.e_end; + ol->ol_comp_id = lsme->lsme_id; + } else { + ol->ol_comp_start = 0; + ol->ol_comp_end = 0; + ol->ol_comp_id = 0; + } +} #endif diff --git a/drivers/staging/lustre/lustre/lov/lov_io.c b/drivers/staging/lustre/lustre/lov/lov_io.c index d9b2a81..70908b1 100644 --- a/drivers/staging/lustre/lustre/lov/lov_io.c +++ b/drivers/staging/lustre/lustre/lov/lov_io.c @@ -316,6 +316,8 @@ static void lov_io_sub_inherit(struct lov_io_sub *sub, struct lov_io *lio, stripe); io->u.ci_setattr.sa_attr.lvb_size = new_size; } + lov_lsm2layout(lsm, lsm->lsm_entries[index], + &io->u.ci_setattr.sa_layout); break; } case CIT_DATA_VERSION: { diff --git a/drivers/staging/lustre/lustre/lov/lovsub_object.c b/drivers/staging/lustre/lustre/lov/lovsub_object.c index ca7c8a0..da4b7f1 100644 --- a/drivers/staging/lustre/lustre/lov/lovsub_object.c +++ b/drivers/staging/lustre/lustre/lov/lovsub_object.c @@ -131,6 +131,7 @@ static void lovsub_req_attr_set(const struct lu_env *env, struct cl_object *obj, struct cl_req_attr *attr) { struct lovsub_object *subobj = cl2lovsub(obj); + struct lov_stripe_md *lsm = subobj->lso_super->lo_lsm; cl_req_attr_set(env, &subobj->lso_super->lo_cl, attr); @@ -139,6 +140,9 @@ static void lovsub_req_attr_set(const struct lu_env *env, struct cl_object *obj, * unconditionally. It never changes anyway. */ attr->cra_oa->o_stripe_idx = lov_comp_stripe(subobj->lso_index); + lov_lsm2layout(lsm, lsm->lsm_entries[lov_comp_entry(subobj->lso_index)], + &attr->cra_oa->o_layout); + attr->cra_oa->o_valid |= OBD_MD_FLOSTLAYOUT; } static const struct cl_object_operations lovsub_ops = { diff --git a/drivers/staging/lustre/lustre/osc/osc_io.c b/drivers/staging/lustre/lustre/osc/osc_io.c index dabdf6d..8cd0813 100644 --- a/drivers/staging/lustre/lustre/osc/osc_io.c +++ b/drivers/staging/lustre/lustre/osc/osc_io.c @@ -542,7 +542,9 @@ static int osc_io_setattr_start(const struct lu_env *env, oa->o_oi = loi->loi_oi; obdo_set_parent_fid(oa, io->u.ci_setattr.sa_parent_fid); oa->o_stripe_idx = io->u.ci_setattr.sa_stripe_index; - oa->o_valid |= OBD_MD_FLID | OBD_MD_FLGROUP; + oa->o_layout = io->u.ci_setattr.sa_layout; + oa->o_valid |= OBD_MD_FLID | OBD_MD_FLGROUP | + OBD_MD_FLOSTLAYOUT; if (ia_avalid & ATTR_CTIME) { oa->o_valid |= OBD_MD_FLCTIME; oa->o_ctime = attr->cat_ctime; diff --git a/drivers/staging/lustre/lustre/ptlrpc/pack_generic.c b/drivers/staging/lustre/lustre/ptlrpc/pack_generic.c index 9c5be30..5fadd5e 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/pack_generic.c +++ b/drivers/staging/lustre/lustre/ptlrpc/pack_generic.c @@ -1587,6 +1587,15 @@ void lustre_swab_connect(struct obd_connect_data *ocd) BUILD_BUG_ON(offsetof(typeof(*ocd), paddingF) == 0); } +static void lustre_swab_ost_layout(struct ost_layout *ol) +{ + __swab32s(&ol->ol_stripe_size); + __swab32s(&ol->ol_stripe_count); + __swab64s(&ol->ol_comp_start); + __swab64s(&ol->ol_comp_end); + __swab32s(&ol->ol_comp_id); +} + static void lustre_swab_obdo(struct obdo *o) { __swab64s(&o->o_valid); @@ -1609,8 +1618,8 @@ static void lustre_swab_obdo(struct obdo *o) __swab64s(&o->o_ioepoch); __swab32s(&o->o_stripe_idx); __swab32s(&o->o_parent_ver); - /* o_handle is opaque */ - /* o_lcookie is swabbed elsewhere */ + lustre_swab_ost_layout(&o->o_layout); + BUILD_BUG_ON(offsetof(typeof(*o), o_padding_3) == 0); __swab32s(&o->o_uid_h); __swab32s(&o->o_gid_h); __swab64s(&o->o_data_version); diff --git a/drivers/staging/lustre/lustre/ptlrpc/wiretest.c b/drivers/staging/lustre/lustre/ptlrpc/wiretest.c index 90e6b8c..639db24 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/wiretest.c +++ b/drivers/staging/lustre/lustre/ptlrpc/wiretest.c @@ -1128,6 +1128,30 @@ void lustre_assert_wire_constants(void) LASSERTF(OBD_CKSUM_CRC32C == 0x00000004UL, "found 0x%.8xUL\n", (unsigned int)OBD_CKSUM_CRC32C); + /* Checks for struct ost_layout */ + LASSERTF((int)sizeof(struct ost_layout) == 28, "found %lld\n", + (long long)(int)sizeof(struct ost_layout)); + LASSERTF((int)offsetof(struct ost_layout, ol_stripe_size) == 0, "found %lld\n", + (long long)(int)offsetof(struct ost_layout, ol_stripe_size)); + LASSERTF((int)sizeof(((struct ost_layout *)0)->ol_stripe_size) == 4, "found %lld\n", + (long long)(int)sizeof(((struct ost_layout *)0)->ol_stripe_size)); + LASSERTF((int)offsetof(struct ost_layout, ol_stripe_count) == 4, "found %lld\n", + (long long)(int)offsetof(struct ost_layout, ol_stripe_count)); + LASSERTF((int)sizeof(((struct ost_layout *)0)->ol_stripe_count) == 4, "found %lld\n", + (long long)(int)sizeof(((struct ost_layout *)0)->ol_stripe_count)); + LASSERTF((int)offsetof(struct ost_layout, ol_comp_start) == 8, "found %lld\n", + (long long)(int)offsetof(struct ost_layout, ol_comp_start)); + LASSERTF((int)sizeof(((struct ost_layout *)0)->ol_comp_start) == 8, "found %lld\n", + (long long)(int)sizeof(((struct ost_layout *)0)->ol_comp_start)); + LASSERTF((int)offsetof(struct ost_layout, ol_comp_end) == 16, "found %lld\n", + (long long)(int)offsetof(struct ost_layout, ol_comp_end)); + LASSERTF((int)sizeof(((struct ost_layout *)0)->ol_comp_end) == 8, "found %lld\n", + (long long)(int)sizeof(((struct ost_layout *)0)->ol_comp_end)); + LASSERTF((int)offsetof(struct ost_layout, ol_comp_id) == 24, "found %lld\n", + (long long)(int)offsetof(struct ost_layout, ol_comp_id)); + LASSERTF((int)sizeof(((struct ost_layout *)0)->ol_comp_id) == 4, "found %lld\n", + (long long)(int)sizeof(((struct ost_layout *)0)->ol_comp_id)); + /* Checks for struct obdo */ LASSERTF((int)sizeof(struct obdo) == 208, "found %lld\n", (long long)(int)sizeof(struct obdo)); @@ -1215,10 +1239,14 @@ void lustre_assert_wire_constants(void) (long long)(int)offsetof(struct obdo, o_handle)); LASSERTF((int)sizeof(((struct obdo *)0)->o_handle) == 8, "found %lld\n", (long long)(int)sizeof(((struct obdo *)0)->o_handle)); - LASSERTF((int)offsetof(struct obdo, o_lcookie) == 136, "found %lld\n", - (long long)(int)offsetof(struct obdo, o_lcookie)); - LASSERTF((int)sizeof(((struct obdo *)0)->o_lcookie) == 32, "found %lld\n", - (long long)(int)sizeof(((struct obdo *)0)->o_lcookie)); + LASSERTF((int)offsetof(struct obdo, o_layout) == 136, "found %lld\n", + (long long)(int)offsetof(struct obdo, o_layout)); + LASSERTF((int)sizeof(((struct obdo *)0)->o_layout) == 28, "found %lld\n", + (long long)(int)sizeof(((struct obdo *)0)->o_layout)); + LASSERTF((int)offsetof(struct obdo, o_padding_3) == 164, "found %lld\n", + (long long)(int)offsetof(struct obdo, o_padding_3)); + LASSERTF((int)sizeof(((struct obdo *)0)->o_padding_3) == 4, "found %lld\n", + (long long)(int)sizeof(((struct obdo *)0)->o_padding_3)); LASSERTF((int)offsetof(struct obdo, o_uid_h) == 168, "found %lld\n", (long long)(int)offsetof(struct obdo, o_uid_h)); LASSERTF((int)sizeof(((struct obdo *)0)->o_uid_h) == 4, "found %lld\n", @@ -1331,6 +1359,8 @@ void lustre_assert_wire_constants(void) OBD_MD_FLGETATTRLOCK); LASSERTF(OBD_MD_FLDATAVERSION == (0x0010000000000000ULL), "found 0x%.16llxULL\n", OBD_MD_FLDATAVERSION); + LASSERTF(OBD_MD_FLOSTLAYOUT == (0x0080000000000000ULL), "found 0x%.16llxULL\n", + OBD_MD_FLOSTLAYOUT); LASSERTF(OBD_MD_FLPROJID == (0x0100000000000000ULL), "found 0x%.16llxULL\n", OBD_MD_FLPROJID); @@ -3549,26 +3579,6 @@ void lustre_assert_wire_constants(void) LASSERTF((int)sizeof(((struct llog_log_hdr *)0)->llh_tail) == 8, "found %lld\n", (long long)(int)sizeof(((struct llog_log_hdr *)0)->llh_tail)); - /* Checks for struct llog_cookie */ - LASSERTF((int)sizeof(struct llog_cookie) == 32, "found %lld\n", - (long long)(int)sizeof(struct llog_cookie)); - LASSERTF((int)offsetof(struct llog_cookie, lgc_lgl) == 0, "found %lld\n", - (long long)(int)offsetof(struct llog_cookie, lgc_lgl)); - LASSERTF((int)sizeof(((struct llog_cookie *)0)->lgc_lgl) == 20, "found %lld\n", - (long long)(int)sizeof(((struct llog_cookie *)0)->lgc_lgl)); - LASSERTF((int)offsetof(struct llog_cookie, lgc_subsys) == 20, "found %lld\n", - (long long)(int)offsetof(struct llog_cookie, lgc_subsys)); - LASSERTF((int)sizeof(((struct llog_cookie *)0)->lgc_subsys) == 4, "found %lld\n", - (long long)(int)sizeof(((struct llog_cookie *)0)->lgc_subsys)); - LASSERTF((int)offsetof(struct llog_cookie, lgc_index) == 24, "found %lld\n", - (long long)(int)offsetof(struct llog_cookie, lgc_index)); - LASSERTF((int)sizeof(((struct llog_cookie *)0)->lgc_index) == 4, "found %lld\n", - (long long)(int)sizeof(((struct llog_cookie *)0)->lgc_index)); - LASSERTF((int)offsetof(struct llog_cookie, lgc_padding) == 28, "found %lld\n", - (long long)(int)offsetof(struct llog_cookie, lgc_padding)); - LASSERTF((int)sizeof(((struct llog_cookie *)0)->lgc_padding) == 4, "found %lld\n", - (long long)(int)sizeof(((struct llog_cookie *)0)->lgc_padding)); - /* Checks for struct llogd_body */ LASSERTF((int)sizeof(struct llogd_body) == 48, "found %lld\n", (long long)(int)sizeof(struct llogd_body)); -- 1.8.3.1 From jsimmons at infradead.org Sun Jan 6 22:14:17 2019 From: jsimmons at infradead.org (James Simmons) Date: Sun, 6 Jan 2019 17:14:17 -0500 Subject: [lustre-devel] [PATCH v2 22/33] lustre: lov: keep minimum LOVEA size In-Reply-To: <1546812868-11794-1-git-send-email-jsimmons@infradead.org> References: <1546812868-11794-1-git-send-email-jsimmons@infradead.org> Message-ID: <1546812868-11794-23-git-send-email-jsimmons@infradead.org> From: Bobi Jam For a PFL file, some of its component could be un-instantiated, and their lov_ost_data_v1 array is not needed, we should keep its LOVEA as small as possible. An unstantiated component's stripe offset should be set. Signed-off-by: Bobi Jam WC-bug-id: https://jira.whamcloud.com/browse/LU-9489 Reviewed-on: https://review.whamcloud.com/27089 WC-bug-id: https://jira.whamcloud.com/browse/LU-9941 Reviewed-on: https://review.whamcloud.com/28845 Reviewed-by: Jinshan Xiong Reviewed-by: Fan Yong Reviewed-by: Oleg Drokin Reviewed-by: Andreas Dilger Signed-off-by: James Simmons --- drivers/staging/lustre/lustre/lov/lov_internal.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/drivers/staging/lustre/lustre/lov/lov_internal.h b/drivers/staging/lustre/lustre/lov/lov_internal.h index 5e3eae7..dd4dd24 100644 --- a/drivers/staging/lustre/lustre/lov/lov_internal.h +++ b/drivers/staging/lustre/lustre/lov/lov_internal.h @@ -96,6 +96,11 @@ static inline bool lsm_entry_inited(const struct lov_stripe_md *lsm, int index) return lsme_inited(lsm->lsm_entries[index]); } +static inline bool lsm_is_composite(u32 magic) +{ + return magic == LOV_MAGIC_COMP_V1; +} + static inline size_t lov_comp_md_size(const struct lov_stripe_md *lsm) { struct lov_stripe_md_entry *lsme; @@ -110,8 +115,15 @@ static inline size_t lov_comp_md_size(const struct lov_stripe_md *lsm) size = sizeof(struct lov_comp_md_v1); for (entry = 0; entry < lsm->lsm_entry_count; entry++) { + u16 stripe_count; + lsme = lsm->lsm_entries[entry]; + if (lsme_inited(lsme)) + stripe_count = lsme->lsme_stripe_count; + else + stripe_count = 0; + size += sizeof(*lsme); size += lov_mds_md_size(lsme->lsme_stripe_count, lsme->lsme_magic); -- 1.8.3.1 From jsimmons at infradead.org Sun Jan 6 22:14:07 2019 From: jsimmons at infradead.org (James Simmons) Date: Sun, 6 Jan 2019 17:14:07 -0500 Subject: [lustre-devel] [PATCH v2 12/33] lustre: lov: move around PFL code and cleanups In-Reply-To: <1546812868-11794-1-git-send-email-jsimmons@infradead.org> References: <1546812868-11794-1-git-send-email-jsimmons@infradead.org> Message-ID: <1546812868-11794-13-git-send-email-jsimmons@infradead.org> From: Bobi Jam No code changes expect for sub_subio_index that changed type. Move some code around and some style cleanups. This makes it clear the real code changes from style updates. Signed-off-by: Jinshan Xiong Signed-off-by: Bobi Jam Signed-off-by: Niu Yawei WC-bug-id: https://jira.whamcloud.com/browse/LU-8998 Reviewed-on: https://review.whamcloud.com/24850 Reviewed-by: Lai Siyao Signed-off-by: James Simmons --- drivers/staging/lustre/lustre/llite/file.c | 2 +- .../staging/lustre/lustre/lov/lov_cl_internal.h | 45 ++--- drivers/staging/lustre/lustre/lov/lov_ea.c | 5 +- drivers/staging/lustre/lustre/lov/lov_io.c | 181 ++++++++++----------- drivers/staging/lustre/lustre/lov/lov_object.c | 25 +-- 5 files changed, 130 insertions(+), 128 deletions(-) diff --git a/drivers/staging/lustre/lustre/llite/file.c b/drivers/staging/lustre/lustre/llite/file.c index c018c5f..fae0111 100644 --- a/drivers/staging/lustre/lustre/llite/file.c +++ b/drivers/staging/lustre/lustre/llite/file.c @@ -3726,6 +3726,7 @@ static int ll_layout_lock_set(struct lustre_handle *lockh, enum ldlm_mode mode, lock_res_and_lock(lock); lvb_ready = ldlm_is_lvb_ready(lock); unlock_res_and_lock(lock); + /* checking lvb_ready is racy but this is okay. The worst case is * that multi processes may configure the file on the same time. */ @@ -3755,7 +3756,6 @@ static int ll_layout_lock_set(struct lustre_handle *lockh, enum ldlm_mode mode, /* refresh layout failed, need to wait */ wait_layout = rc == -EBUSY; - out: LDLM_LOCK_PUT(lock); ldlm_lock_decref(lockh, mode); diff --git a/drivers/staging/lustre/lustre/lov/lov_cl_internal.h b/drivers/staging/lustre/lustre/lov/lov_cl_internal.h index 99bd1c1..ce32823 100644 --- a/drivers/staging/lustre/lustre/lov/lov_cl_internal.h +++ b/drivers/staging/lustre/lustre/lov/lov_cl_internal.h @@ -315,12 +315,6 @@ struct lov_thread_info { */ struct lov_io_sub { /** - * environment's refcheck. - * - * \see cl_env_get() - */ - u16 sub_refcheck; - /** * true, iff cl_io_init() was successfully executed against * lov_io_sub::sub_io. */ @@ -334,18 +328,24 @@ struct lov_io_sub { * Linkage into a list (hanging off lov_io::lis_active) of all * sub-io's active for the current IO iteration. */ - struct list_head sub_linkage; - u16 sub_subio_index; + struct list_head sub_linkage; + unsigned int sub_subio_index; /** * sub-io for a stripe. Ideally sub-io's can be stopped and resumed * independently, with lov acting as a scheduler to maximize overall * throughput. */ - struct cl_io *sub_io; + struct cl_io *sub_io; /** * environment, in which sub-io executes. */ - struct lu_env *sub_env; + struct lu_env *sub_env; + /** + * environment's refcheck. + * + * \see cl_env_get() + */ + u16 sub_refcheck; }; /** @@ -367,37 +367,38 @@ struct lov_io { * * This is used only for CIT_READ and CIT_WRITE io's. */ - loff_t lis_io_endpos; + loff_t lis_io_endpos; /** * starting position within a file, for the current io loop iteration * (stripe), used by ci_io_loop(). */ - u64 lis_pos; + u64 lis_pos; /** * end position with in a file, for the current stripe io. This is * exclusive (i.e., next offset after last byte affected by io). */ - u64 lis_endpos; - - int lis_stripe_count; - int lis_active_subios; + u64 lis_endpos; + int lis_stripe_count; + int lis_active_subios; /** * the index of ls_single_subio in ls_subios array */ - int lis_single_subio_index; - struct cl_io lis_single_subio; + int lis_single_subio_index; + struct cl_io lis_single_subio; + + /** + * List of active sub-io's. Active sub-io's are under the range + * of [lis_pos, lis_endpos). + */ + struct list_head lis_active; /** * size of ls_subios array, actually the highest stripe # */ int lis_nr_subios; struct lov_io_sub *lis_subs; - /** - * List of active sub-io's. - */ - struct list_head lis_active; }; struct lov_session { diff --git a/drivers/staging/lustre/lustre/lov/lov_ea.c b/drivers/staging/lustre/lustre/lov/lov_ea.c index 7d86318..f2a5a60 100644 --- a/drivers/staging/lustre/lustre/lov/lov_ea.c +++ b/drivers/staging/lustre/lustre/lov/lov_ea.c @@ -338,7 +338,7 @@ void lsm_free(struct lov_stripe_md *lsm) const static struct lsm_operations lsm_v1_ops = { .lsm_stripe_by_index = lsm_stripe_by_index_plain, .lsm_stripe_by_offset = lsm_stripe_by_offset_plain, - .lsm_unpackmd = lsm_unpackmd_v1, + .lsm_unpackmd = lsm_unpackmd_v1, }; static struct lov_stripe_md * @@ -531,7 +531,8 @@ const struct lsm_operations *lsm_op_find(int magic) void dump_lsm(unsigned int level, const struct lov_stripe_md *lsm) { - CDEBUG(level, "lsm %p, objid " DOSTID ", maxbytes %#llx, magic 0x%08X, stripe_size %u, stripe_count %u, refc: %d, layout_gen %u, pool [" LOV_POOLNAMEF "]\n", + CDEBUG(level, + "lsm %p, objid " DOSTID ", maxbytes %#llx, magic 0x%08X, stripe_size %u, stripe_count %u, refc: %d, layout_gen %u, pool [" LOV_POOLNAMEF "]\n", lsm, POSTID(&lsm->lsm_oi), lsm->lsm_maxbytes, lsm->lsm_magic, lsm->lsm_entries[0]->lsme_stripe_size, lsm->lsm_entries[0]->lsme_stripe_count, diff --git a/drivers/staging/lustre/lustre/lov/lov_io.c b/drivers/staging/lustre/lustre/lov/lov_io.c index 26d0043..ab97326 100644 --- a/drivers/staging/lustre/lustre/lov/lov_io.c +++ b/drivers/staging/lustre/lustre/lov/lov_io.c @@ -43,7 +43,6 @@ /** \addtogroup lov * @{ */ - static void lov_io_sub_fini(const struct lu_env *env, struct lov_io *lio, struct lov_io_sub *sub) { @@ -66,76 +65,6 @@ static void lov_io_sub_fini(const struct lu_env *env, struct lov_io *lio, } } -static void lov_io_sub_inherit(struct cl_io *io, struct lov_io *lio, - int stripe, loff_t start, loff_t end) -{ - struct lov_stripe_md *lsm = lio->lis_object->lo_lsm; - struct cl_io *parent = lio->lis_cl.cis_io; - - switch (io->ci_type) { - case CIT_SETATTR: { - io->u.ci_setattr.sa_attr = parent->u.ci_setattr.sa_attr; - io->u.ci_setattr.sa_attr_flags = - parent->u.ci_setattr.sa_attr_flags; - io->u.ci_setattr.sa_avalid = parent->u.ci_setattr.sa_avalid; - io->u.ci_setattr.sa_xvalid = parent->u.ci_setattr.sa_xvalid; - io->u.ci_setattr.sa_stripe_index = stripe; - io->u.ci_setattr.sa_parent_fid = - parent->u.ci_setattr.sa_parent_fid; - if (cl_io_is_trunc(io)) { - loff_t new_size = parent->u.ci_setattr.sa_attr.lvb_size; - - new_size = lov_size_to_stripe(lsm, 0, new_size, stripe); - io->u.ci_setattr.sa_attr.lvb_size = new_size; - } - break; - } - case CIT_DATA_VERSION: { - io->u.ci_data_version.dv_data_version = 0; - io->u.ci_data_version.dv_flags = - parent->u.ci_data_version.dv_flags; - break; - } - case CIT_FAULT: { - struct cl_object *obj = parent->ci_obj; - loff_t off = cl_offset(obj, parent->u.ci_fault.ft_index); - - io->u.ci_fault = parent->u.ci_fault; - off = lov_size_to_stripe(lsm, 0, off, stripe); - io->u.ci_fault.ft_index = cl_index(obj, off); - break; - } - case CIT_FSYNC: { - io->u.ci_fsync.fi_start = start; - io->u.ci_fsync.fi_end = end; - io->u.ci_fsync.fi_fid = parent->u.ci_fsync.fi_fid; - io->u.ci_fsync.fi_mode = parent->u.ci_fsync.fi_mode; - break; - } - case CIT_READ: - case CIT_WRITE: { - io->u.ci_wr.wr_sync = cl_io_is_sync_write(parent); - if (cl_io_is_append(parent)) { - io->u.ci_wr.wr_append = 1; - } else { - io->u.ci_rw.crw_pos = start; - io->u.ci_rw.crw_count = end - start; - } - break; - } - case CIT_LADVISE: { - io->u.ci_ladvise.li_start = start; - io->u.ci_ladvise.li_end = end; - io->u.ci_ladvise.li_fid = parent->u.ci_ladvise.li_fid; - io->u.ci_ladvise.li_advice = parent->u.ci_ladvise.li_advice; - io->u.ci_ladvise.li_flags = parent->u.ci_ladvise.li_flags; - break; - } - default: - break; - } -} - static int lov_io_sub_init(const struct lu_env *env, struct lov_io *lio, struct lov_io_sub *sub) { @@ -228,7 +157,6 @@ struct lov_io_sub *lov_sub_get(const struct lu_env *env, * Lov io operations. * */ - static int lov_page_index(const struct cl_page *page) { const struct cl_page_slice *slice; @@ -358,6 +286,76 @@ static void lov_io_fini(const struct lu_env *env, const struct cl_io_slice *ios) wake_up_all(&lov->lo_waitq); } +static void lov_io_sub_inherit(struct cl_io *io, struct lov_io *lio, + int stripe, loff_t start, loff_t end) +{ + struct lov_stripe_md *lsm = lio->lis_object->lo_lsm; + struct cl_io *parent = lio->lis_cl.cis_io; + + switch (io->ci_type) { + case CIT_SETATTR: { + io->u.ci_setattr.sa_attr = parent->u.ci_setattr.sa_attr; + io->u.ci_setattr.sa_attr_flags = + parent->u.ci_setattr.sa_attr_flags; + io->u.ci_setattr.sa_avalid = parent->u.ci_setattr.sa_avalid; + io->u.ci_setattr.sa_xvalid = parent->u.ci_setattr.sa_xvalid; + io->u.ci_setattr.sa_stripe_index = stripe; + io->u.ci_setattr.sa_parent_fid = + parent->u.ci_setattr.sa_parent_fid; + if (cl_io_is_trunc(io)) { + loff_t new_size = parent->u.ci_setattr.sa_attr.lvb_size; + + new_size = lov_size_to_stripe(lsm, 0, new_size, stripe); + io->u.ci_setattr.sa_attr.lvb_size = new_size; + } + break; + } + case CIT_DATA_VERSION: { + io->u.ci_data_version.dv_data_version = 0; + io->u.ci_data_version.dv_flags = + parent->u.ci_data_version.dv_flags; + break; + } + case CIT_FAULT: { + struct cl_object *obj = parent->ci_obj; + loff_t off = cl_offset(obj, parent->u.ci_fault.ft_index); + + io->u.ci_fault = parent->u.ci_fault; + off = lov_size_to_stripe(lsm, 0, off, stripe); + io->u.ci_fault.ft_index = cl_index(obj, off); + break; + } + case CIT_FSYNC: { + io->u.ci_fsync.fi_start = start; + io->u.ci_fsync.fi_end = end; + io->u.ci_fsync.fi_fid = parent->u.ci_fsync.fi_fid; + io->u.ci_fsync.fi_mode = parent->u.ci_fsync.fi_mode; + break; + } + case CIT_READ: + case CIT_WRITE: { + io->u.ci_wr.wr_sync = cl_io_is_sync_write(parent); + if (cl_io_is_append(parent)) { + io->u.ci_wr.wr_append = 1; + } else { + io->u.ci_rw.crw_pos = start; + io->u.ci_rw.crw_count = end - start; + } + break; + } + case CIT_LADVISE: { + io->u.ci_ladvise.li_start = start; + io->u.ci_ladvise.li_end = end; + io->u.ci_ladvise.li_fid = parent->u.ci_ladvise.li_fid; + io->u.ci_ladvise.li_advice = parent->u.ci_ladvise.li_advice; + io->u.ci_ladvise.li_flags = parent->u.ci_ladvise.li_flags; + break; + } + default: + break; + } +} + static u64 lov_offset_mod(u64 val, int delta) { if (val != OBD_OBJECT_EOF) @@ -491,24 +489,6 @@ static int lov_io_end_wrapper(const struct lu_env *env, struct cl_io *io) return 0; } -static void -lov_io_data_version_end(const struct lu_env *env, const struct cl_io_slice *ios) -{ - struct lov_io *lio = cl2lov_io(env, ios); - struct cl_io *parent = lio->lis_cl.cis_io; - struct lov_io_sub *sub; - - list_for_each_entry(sub, &lio->lis_active, sub_linkage) { - lov_io_end_wrapper(sub->sub_env, sub->sub_io); - - parent->u.ci_data_version.dv_data_version += - sub->sub_io->u.ci_data_version.dv_data_version; - - if (!parent->ci_result) - parent->ci_result = sub->sub_io->ci_result; - } -} - static int lov_io_iter_fini_wrapper(const struct lu_env *env, struct cl_io *io) { cl_io_iter_fini(env, io); @@ -529,6 +509,24 @@ static void lov_io_end(const struct lu_env *env, const struct cl_io_slice *ios) LASSERT(rc == 0); } +static void +lov_io_data_version_end(const struct lu_env *env, const struct cl_io_slice *ios) +{ + struct lov_io *lio = cl2lov_io(env, ios); + struct cl_io *parent = lio->lis_cl.cis_io; + struct lov_io_sub *sub; + + list_for_each_entry(sub, &lio->lis_active, sub_linkage) { + lov_io_end_wrapper(sub->sub_env, sub->sub_io); + + parent->u.ci_data_version.dv_data_version += + sub->sub_io->u.ci_data_version.dv_data_version; + + if (!parent->ci_result) + parent->ci_result = sub->sub_io->ci_result; + } +} + static void lov_io_iter_fini(const struct lu_env *env, const struct cl_io_slice *ios) { @@ -602,7 +600,8 @@ static int lov_io_read_ahead(const struct lu_env *env, pps = loo->lo_lsm->lsm_entries[0]->lsme_stripe_size >> PAGE_SHIFT; - CDEBUG(D_READA, DFID " max_index = %lu, pps = %u, stripe_size = %u, stripe no = %u, start index = %lu\n", + CDEBUG(D_READA, + DFID " max_index = %lu, pps = %u, stripe_size = %u, stripe no = %u, start index = %lu\n", PFID(lu_object_fid(lov2lu(loo))), ra_end, pps, loo->lo_lsm->lsm_entries[0]->lsme_stripe_size, stripe, start); diff --git a/drivers/staging/lustre/lustre/lov/lov_object.c b/drivers/staging/lustre/lustre/lov/lov_object.c index de5e2a2..3677fac 100644 --- a/drivers/staging/lustre/lustre/lov/lov_object.c +++ b/drivers/staging/lustre/lustre/lov/lov_object.c @@ -600,6 +600,7 @@ static int lov_attr_get_raid0(const struct lu_env *env, struct lov_object *lov, return 0; memset(lvb, 0, sizeof(*lvb)); + /* XXX: timestamps can be negative by sanity:test_39m, * how can it be? */ @@ -1200,18 +1201,18 @@ static u64 fiemap_calc_fm_end_offset(struct fiemap *fiemap, } struct fiemap_state { - struct fiemap *fs_fm; - u64 fs_start; - u64 fs_length; - u64 fs_end; - u64 fs_end_offset; - int fs_cur_extent; - int fs_cnt_need; - int fs_start_stripe; - int fs_last_stripe; - bool fs_device_done; - bool fs_finish; - bool fs_enough; + struct fiemap *fs_fm; + u64 fs_start; + u64 fs_length; + u64 fs_end; + u64 fs_end_offset; + int fs_cur_extent; + int fs_cnt_need; + int fs_start_stripe; + int fs_last_stripe; + bool fs_device_done; + bool fs_finish; + bool fs_enough; }; static int fiemap_for_stripe(const struct lu_env *env, struct cl_object *obj, -- 1.8.3.1 From jsimmons at infradead.org Mon Jan 7 03:11:13 2019 From: jsimmons at infradead.org (James Simmons) Date: Mon, 7 Jan 2019 03:11:13 +0000 (GMT) Subject: [lustre-devel] linux lustre client progress Message-ID: Over the last few weeks the final major bugs have been resolved for the linux lustre client as well as a port of PFL. Once these patches are merged the client will be at a 2.10 LTS release level. A few minor patches are still out standing but they need more work before being acceptable in the kernel tree. The remaining test failures are the same ones seen in the latest OpenSFS tree testing. Before we jump into 2.11 porting I'm thinking some house cleaning with checkpatch etc and then moving lustre out of the staging tree to prepare for its eventual merger upstream. As for 2.11 I started to look at the what is missing and outside of the DoM feature most things have landed to the linux client. In fact the next patch missing in the git logs is the first DoM patch. Dynamic LNet discovery already has been landed so we are in good shape :-) From neilb at suse.com Mon Jan 7 05:17:33 2019 From: neilb at suse.com (NeilBrown) Date: Mon, 07 Jan 2019 16:17:33 +1100 Subject: [lustre-devel] [PATCH 00/14] lustre: fixes for many test failures In-Reply-To: <1546810607-6348-1-git-send-email-jsimmons@infradead.org> References: <1546810607-6348-1-git-send-email-jsimmons@infradead.org> Message-ID: <87ftu5jbbm.fsf@notabene.neil.brown.name> On Sun, Jan 06 2019, James Simmons wrote: > This patch series contains mostly fixes to resolve the majority of > the testing failures seen. Besides that are UAPI headers fixes to > prepare for when lustre will leave the staging tree. Include Neil's > dump_page_cache patch as well since it was landed in the OpenSFS > branch and the migration of lu_objects to rhashtables depended on > it. Thanks - I've applied these. I haven't received all of the PFL series yet ... 16,17,18 still in limbo - so I haven't applied those yet. When the stragglers here here, I suspect they'll all go in. Thanks, NeilBrown -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 832 bytes Desc: not available URL: From jsimmons at infradead.org Mon Jan 7 21:57:15 2019 From: jsimmons at infradead.org (James Simmons) Date: Mon, 7 Jan 2019 21:57:15 +0000 (GMT) Subject: [lustre-devel] [PATCH 00/14] lustre: fixes for many test failures In-Reply-To: <87ftu5jbbm.fsf@notabene.neil.brown.name> References: <1546810607-6348-1-git-send-email-jsimmons@infradead.org> <87ftu5jbbm.fsf@notabene.neil.brown.name> Message-ID: > On Sun, Jan 06 2019, James Simmons wrote: > > > This patch series contains mostly fixes to resolve the majority of > > the testing failures seen. Besides that are UAPI headers fixes to > > prepare for when lustre will leave the staging tree. Include Neil's > > dump_page_cache patch as well since it was landed in the OpenSFS > > branch and the migration of lu_objects to rhashtables depended on > > it. > > Thanks - I've applied these. > I haven't received all of the PFL series yet ... 16,17,18 still in limbo > - so I haven't applied those yet. > When the stragglers here here, I suspect they'll all go in. Do you recieve patch 16,17,18 ? I do see they made it to the mailing list archive : http://lists.lustre.org/pipermail/lustre-devel-lustre.org/2019-January/thread.html Also they are showing up at the patchwork site: https://patchwork.kernel.org/project/lustre-devel/list which is much easier to work with as a patch. Lastly if you need I can send you those patches directly to you again. Let me know what you want. From neilb at suse.com Mon Jan 7 23:09:56 2019 From: neilb at suse.com (NeilBrown) Date: Tue, 08 Jan 2019 10:09:56 +1100 Subject: [lustre-devel] [PATCH 00/14] lustre: fixes for many test failures In-Reply-To: References: <1546810607-6348-1-git-send-email-jsimmons@infradead.org> <87ftu5jbbm.fsf@notabene.neil.brown.name> Message-ID: <877efgjc8r.fsf@notabene.neil.brown.name> On Mon, Jan 07 2019, James Simmons wrote: >> On Sun, Jan 06 2019, James Simmons wrote: >> >> > This patch series contains mostly fixes to resolve the majority of >> > the testing failures seen. Besides that are UAPI headers fixes to >> > prepare for when lustre will leave the staging tree. Include Neil's >> > dump_page_cache patch as well since it was landed in the OpenSFS >> > branch and the migration of lu_objects to rhashtables depended on >> > it. >> >> Thanks - I've applied these. >> I haven't received all of the PFL series yet ... 16,17,18 still in limbo >> - so I haven't applied those yet. >> When the stragglers here here, I suspect they'll all go in. > > Do you recieve patch 16,17,18 ? I do see they made it to the mailing list > archive : Yes, they arrived eventually, thanks. The whole series seemed to be coming in dribs and drabs ... some mail server somewhere must have been a bit sick. I'll have a look through them all today. Thanks, NeilBrown > > http://lists.lustre.org/pipermail/lustre-devel-lustre.org/2019-January/thread.html > > Also they are showing up at the patchwork site: > > https://patchwork.kernel.org/project/lustre-devel/list > > which is much easier to work with as a patch. Lastly if you need I can > send you those patches directly to you again. Let me know what you want. -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 832 bytes Desc: not available URL: From neilb at suse.com Tue Jan 8 01:38:51 2019 From: neilb at suse.com (NeilBrown) Date: Tue, 08 Jan 2019 12:38:51 +1100 Subject: [lustre-devel] [PATCH v2 33/33] lustre: update version to 2.9.99 In-Reply-To: <1546812868-11794-34-git-send-email-jsimmons@infradead.org> References: <1546812868-11794-1-git-send-email-jsimmons@infradead.org> <1546812868-11794-34-git-send-email-jsimmons@infradead.org> Message-ID: <874lakj5ck.fsf@notabene.neil.brown.name> On Sun, Jan 06 2019, James Simmons wrote: > With the majority of missing patches and features from the lustre > 2.10 release merged upstream its time to update the upstream > client's version. :-) Thanks to some of these patches (this batch or previous) I have fewer failing tests now .. those not many fewer. The current summary is 45 status: FAIL 556 status: PASS 47 status: SKIP It used to be >50 FAIL. The failing tests are listed below. I know why the FID patches fail - we've discussed that. Maybe it is time to start working out why some of the others are failing. Your two recent series are in my lustre-testing branch now - thanks. NeilBrown sanity: FAIL: test_27G 'testpool' is not empty sanity: FAIL: test_56w /root/lustre-release/lustre/utils/lfs getstripe -c /mnt/lustre/d56w.sanity/file1 wrong: found 2, expected 1 sanity: FAIL: test_56x migrate failed rc = 11 sanity: FAIL: test_56xa migrate failed rc = 11 sanity: FAIL: test_56z /root/lustre-release/lustre/utils/lfs find did not continue after error sanity: FAIL: test_56aa lfs find --size wrong under striped dir sanity: FAIL: test_56ca create /mnt/lustre/d56ca.sanity/f56ca.sanity- failed sanity: FAIL: test_64b oos.sh failed: 1 sanity: FAIL: test_102c setstripe failed sanity: FAIL: test_102j file1-0-1: size != 65536 sanity: FAIL: test_103a misc test failed sanity: FAIL: test_104b lfs check servers test failed sanity: FAIL: test_130a filefrag /mnt/lustre/f130a.sanity failed sanity: FAIL: test_130b filefrag /mnt/lustre/f130b.sanity failed sanity: FAIL: test_130c filefrag /mnt/lustre/f130c.sanity failed sanity: FAIL: test_130e filefrag /mnt/lustre/f130e.sanity failed sanity: FAIL: test_130f filefrag /mnt/lustre/f130f.sanity failed sanity: FAIL: test_160a changelog 'f160a.sanity' fid != file fid [0x240002342:0xd:0x0] sanity: FAIL: test_161d cat failed sanity: FAIL: test_205 No jobstats for id.205.mkdir.9480 found on mds1::*.lustre-MDT0000.job_stats sanity: FAIL: test_208 get lease error sanity: FAIL: test_225a mds-survey with zero-stripe failed sanity: FAIL: test_225b mds-survey with stripe_count failed sanity: FAIL: test_233a cannot access /mnt/lustre using its FID '[0x200000007:0x1:0x0]' sanity: FAIL: test_233b cannot access /mnt/lustre/.lustre using its FID '[0x200000002:0x1:0x0]' sanity: FAIL: test_255c Ladvise test10 failed, 255 sanity: FAIL: test_270a Can't create DoM layout sanity: FAIL: test_270c bad pattern sanity: FAIL: test_270e lfs find -L: found 1, expected 20 sanity: FAIL: test_270f Can't create file with 262144 DoM stripe sanity: FAIL: test_271c Too few enqueues , expected > 2000 sanity: FAIL: test_271f expect 1 READ RPC, occured sanity: FAIL: test_300g create striped_dir failed sanity: FAIL: test_300n create striped dir fails with gid=-1 sanity: FAIL: test_300q create d300q.sanity fails sanity: FAIL: test_315 read is not accounted () sanity: FAIL: test_317 Expected Block 4096 got 10240 for f317.sanity sanity: FAIL: test_405 One layout swap locked test failed sanity: FAIL: test_406 mkdir d406.sanity failed sanity: FAIL: test_409 Fail to cleanup the env! sanity: FAIL: test_410 no inode match sanity: FAIL: test_412 mkdir failed sanity: FAIL: test_413 don't expect 1 sanity: FAIL: test_802 (5) Mount client with 'ro' should succeed -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 832 bytes Desc: not available URL: From jsimmons at infradead.org Tue Jan 8 04:26:39 2019 From: jsimmons at infradead.org (James Simmons) Date: Tue, 8 Jan 2019 04:26:39 +0000 (GMT) Subject: [lustre-devel] [PATCH v2 33/33] lustre: update version to 2.9.99 In-Reply-To: <874lakj5ck.fsf@notabene.neil.brown.name> References: <1546812868-11794-1-git-send-email-jsimmons@infradead.org> <1546812868-11794-34-git-send-email-jsimmons@infradead.org> <874lakj5ck.fsf@notabene.neil.brown.name> Message-ID: > On Sun, Jan 06 2019, James Simmons wrote: > > > With the majority of missing patches and features from the lustre > > 2.10 release merged upstream its time to update the upstream > > client's version. > > :-) > > Thanks to some of these patches (this batch or previous) I have fewer > failing tests now .. those not many fewer. > > The current summary is > 45 status: FAIL > 556 status: PASS > 47 status: SKIP > > It used to be >50 FAIL. > > The failing tests are listed below. > I know why the FID patches fail - we've discussed that. > Maybe it is time to start working out why some of the others are > failing. You are running a much newer test suite. Using the test suite from lustre 2.10 I see the following failures. sanity: FAIL: test_103a run_acl_subtest cp failed (real failure) sanity: FAIL: test_215 cannot read lnet.stats (not sysfs aware) sanity: FAIL: test_233a cannot access /lustre/lustre using its FID '[0x200000007:0x1:0x0]' sanity: FAIL: test_233b cannot access /lustre/lustre/.lustre using its FID '[0x200000002:0x1:0x0]' sanity: FAIL: test_256 Changelog catalog has wrong number of slots 0 (fails for 2.10 LTS release as well) > Your two recent series are in my lustre-testing branch now - thanks. > > NeilBrown > > > sanity: FAIL: test_27G 'testpool' is not empty See LU-11208. Test currently with older lustre versions. > sanity: FAIL: test_56w /root/lustre-release/lustre/utils/lfs getstripe -c /mnt/lustre/d56w.sanity/file1 wrong: found 2, expected 1 > sanity: FAIL: test_56x migrate failed rc = 11 > sanity: FAIL: test_56xa migrate failed rc = 11 > sanity: FAIL: test_56z /root/lustre-release/lustre/utils/lfs find did not continue after error > sanity: FAIL: test_56aa lfs find --size wrong under striped dir > sanity: FAIL: test_56ca create /mnt/lustre/d56ca.sanity/f56ca.sanity- failed > sanity: FAIL: test_64b oos.sh failed: 1 > sanity: FAIL: test_102c setstripe failed > sanity: FAIL: test_102j file1-0-1: size != 65536 I believe these are due to the DoM feature missing > sanity: FAIL: test_103a misc test failed 103a is real failure. Never solved yet. (LU-11594 and LU-10334 for Ubuntu) > sanity: FAIL: test_104b lfs check servers test failed sysfs bug. I have a patch for this. > sanity: FAIL: test_130a filefrag /mnt/lustre/f130a.sanity failed > sanity: FAIL: test_130b filefrag /mnt/lustre/f130b.sanity failed > sanity: FAIL: test_130c filefrag /mnt/lustre/f130c.sanity failed > sanity: FAIL: test_130e filefrag /mnt/lustre/f130e.sanity failed > sanity: FAIL: test_130f filefrag /mnt/lustre/f130f.sanity failed What version of e2fsprog are you running? You need a 1.44 version and this should go away. > sanity: FAIL: test_160a changelog 'f160a.sanity' fid != file fid [0x240002342:0xd:0x0] > sanity: FAIL: test_161d cat failed Might be missing some more changelog improvements. > sanity: FAIL: test_205 No jobstats for id.205.mkdir.9480 found on mds1::*.lustre-MDT0000.job_stats Strange? > sanity: FAIL: test_208 get lease error > sanity: FAIL: test_225a mds-survey with zero-stripe failed > sanity: FAIL: test_225b mds-survey with stripe_count failed Never ran that since its not in 2.10. > sanity: FAIL: test_233a cannot access /mnt/lustre using its FID '[0x200000007:0x1:0x0]' > sanity: FAIL: test_233b cannot access /mnt/lustre/.lustre using its FID '[0x200000002:0x1:0x0]' > sanity: FAIL: test_255c Ladvise test10 failed, 255 > sanity: FAIL: test_270a Can't create DoM layout > sanity: FAIL: test_270c bad pattern > sanity: FAIL: test_270e lfs find -L: found 1, expected 20 > sanity: FAIL: test_270f Can't create file with 262144 DoM stripe > sanity: FAIL: test_271c Too few enqueues , expected > 2000 > sanity: FAIL: test_271f expect 1 READ RPC, occured > sanity: FAIL: test_300g create striped_dir failed > sanity: FAIL: test_300n create striped dir fails with gid=-1 > sanity: FAIL: test_300q create d300q.sanity fails > sanity: FAIL: test_315 read is not accounted () > sanity: FAIL: test_317 Expected Block 4096 got 10240 for f317.sanity > sanity: FAIL: test_405 One layout swap locked test failed > sanity: FAIL: test_406 mkdir d406.sanity failed > sanity: FAIL: test_409 Fail to cleanup the env! More DoM issues? Could be FLR as well if you are running the latest test suite. > sanity: FAIL: test_410 no inode match This is a weird test running a local kernel module. > sanity: FAIL: test_412 mkdir failed > sanity: FAIL: test_413 don't expect 1 More DoM ???? Have to look at this. > sanity: FAIL: test_802 (5) Mount client with 'ro' should succeed Is test is broken. It assumes you have a specially patched kernel. Details are under ticket LU-684. The nice thing is with the linux client is that we are at a point it wouldn't be a huge leap to integrate DoM (Data on MetaData). The reason I suggest cleanups and moving out of staging first was to perserve git blame a bit better with future patches. Currently we see a lot of "0846e85ba2346 (NeilBrown 2018-06-07" with git blame. From adilger at whamcloud.com Tue Jan 8 10:13:53 2019 From: adilger at whamcloud.com (Andreas Dilger) Date: Tue, 8 Jan 2019 10:13:53 +0000 Subject: [lustre-devel] [PATCH v2 33/33] lustre: update version to 2.9.99 In-Reply-To: References: <1546812868-11794-1-git-send-email-jsimmons@infradead.org> <1546812868-11794-34-git-send-email-jsimmons@infradead.org> <874lakj5ck.fsf@notabene.neil.brown.name> Message-ID: <45806D2E-8AAD-48ED-8B14-6D5CC11D824E@whamcloud.com> On Jan 7, 2019, at 21:26, James Simmons wrote: > >> >> On Sun, Jan 06 2019, James Simmons wrote: >> >>> With the majority of missing patches and features from the lustre >>> 2.10 release merged upstream its time to update the upstream >>> client's version. >> >> :-) >> >> Thanks to some of these patches (this batch or previous) I have fewer >> failing tests now .. those not many fewer. >> >> The current summary is >> 45 status: FAIL >> 556 status: PASS >> 47 status: SKIP >> >> It used to be >50 FAIL. >> >> The failing tests are listed below. >> I know why the FID patches fail - we've discussed that. >> Maybe it is time to start working out why some of the others are >> failing. > > You are running a much newer test suite. Using the test suite from lustre > 2.10 I see the following failures. > > sanity: FAIL: test_103a run_acl_subtest cp failed (real failure) > sanity: FAIL: test_215 cannot read lnet.stats (not sysfs aware) > sanity: FAIL: test_233a cannot access /lustre/lustre using its FID '[0x200000007:0x1:0x0]' > sanity: FAIL: test_233b cannot access /lustre/lustre/.lustre using its FID '[0x200000002:0x1:0x0]' > sanity: FAIL: test_256 Changelog catalog has wrong number of slots 0 (fails for 2.10 LTS release as well) Yes, there are definitely some tests that do not have proper client/server version/feature checks, since the tests are introduced with the code they are testing. There are a number of patches in Gerrit that are adding the proper checks that I'd like to get landed, because we do run client/server version interop testing, but they always lag a bit behind and we never see test-script/client version issues in our testing. >> Your two recent series are in my lustre-testing branch now - thanks. >> >> NeilBrown >> >> >> sanity: FAIL: test_27G 'testpool' is not empty > > See LU-11208. Test currently with older lustre versions. > >> sanity: FAIL: test_56w /root/lustre-release/lustre/utils/lfs getstripe -c /mnt/lustre/d56w.sanity/file1 wrong: found 2, expected 1 >> sanity: FAIL: test_56x migrate failed rc = 11 >> sanity: FAIL: test_56xa migrate failed rc = 11 >> sanity: FAIL: test_56z /root/lustre-release/lustre/utils/lfs find did not continue after error >> sanity: FAIL: test_56aa lfs find --size wrong under striped dir >> sanity: FAIL: test_56ca create /mnt/lustre/d56ca.sanity/f56ca.sanity- failed >> sanity: FAIL: test_64b oos.sh failed: 1 >> sanity: FAIL: test_102c setstripe failed >> sanity: FAIL: test_102j file1-0-1: size != 65536 > > I believe these are due to the DoM feature missing > >> sanity: FAIL: test_103a misc test failed > > 103a is real failure. Never solved yet. (LU-11594 and LU-10334 for Ubuntu) > >> sanity: FAIL: test_104b lfs check servers test failed > > sysfs bug. I have a patch for this. > >> sanity: FAIL: test_130a filefrag /mnt/lustre/f130a.sanity failed >> sanity: FAIL: test_130b filefrag /mnt/lustre/f130b.sanity failed >> sanity: FAIL: test_130c filefrag /mnt/lustre/f130c.sanity failed >> sanity: FAIL: test_130e filefrag /mnt/lustre/f130e.sanity failed >> sanity: FAIL: test_130f filefrag /mnt/lustre/f130f.sanity failed > > What version of e2fsprog are you running? You need a 1.44 version and > this should go away. To be clear - the Lustre-patched "filefrag" at: https://downloads.whamcloud.com/public/e2fsprogs/1.44.3.wc1/ Once Lustre gets into upstream, or convince another filesystem to use the Lustre filefrag extension (multiple devices, which BtrFS and XFS could use) we can get the support landed into the upstream e2fsprogs. >> sanity: FAIL: test_160a changelog 'f160a.sanity' fid != file fid [0x240002342:0xd:0x0] >> sanity: FAIL: test_161d cat failed > > Might be missing some more changelog improvements. > >> sanity: FAIL: test_205 No jobstats for id.205.mkdir.9480 found on mds1::*.lustre-MDT0000.job_stats > > Strange? This might be because the upstream Lustre doesn't allow setting per-process JobID via environment variable, only as a single per-node value. The real unfortunate part is that the "get JobID from environment" actually works for every reasonable architecture (even the one which was originally broken fixed it), but it got yanked anyway. This is actually one of the features of Lustre that lots of HPC sites like to use, since it allows them to track on the servers which users/jobs/processes on the client are doing IO. >> sanity: FAIL: test_208 get lease error >> sanity: FAIL: test_225a mds-survey with zero-stripe failed >> sanity: FAIL: test_225b mds-survey with stripe_count failed > > Never ran that since its not in 2.10. > >> sanity: FAIL: test_233a cannot access /mnt/lustre using its FID '[0x200000007:0x1:0x0]' >> sanity: FAIL: test_233b cannot access /mnt/lustre/.lustre using its FID '[0x200000002:0x1:0x0]' > >> sanity: FAIL: test_255c Ladvise test10 failed, 255 >> sanity: FAIL: test_270a Can't create DoM layout >> sanity: FAIL: test_270c bad pattern >> sanity: FAIL: test_270e lfs find -L: found 1, expected 20 >> sanity: FAIL: test_270f Can't create file with 262144 DoM stripe >> sanity: FAIL: test_271c Too few enqueues , expected > 2000 >> sanity: FAIL: test_271f expect 1 READ RPC, occured >> sanity: FAIL: test_300g create striped_dir failed >> sanity: FAIL: test_300n create striped dir fails with gid=-1 >> sanity: FAIL: test_300q create d300q.sanity fails >> sanity: FAIL: test_315 read is not accounted () >> sanity: FAIL: test_317 Expected Block 4096 got 10240 for f317.sanity >> sanity: FAIL: test_405 One layout swap locked test failed >> sanity: FAIL: test_406 mkdir d406.sanity failed >> sanity: FAIL: test_409 Fail to cleanup the env! > > More DoM issues? Could be FLR as well if you are running the latest > test suite. > >> sanity: FAIL: test_410 no inode match > > This is a weird test running a local kernel module. > >> sanity: FAIL: test_412 mkdir failed >> sanity: FAIL: test_413 don't expect 1 > > More DoM ???? Have to look at this. > >> sanity: FAIL: test_802 (5) Mount client with 'ro' should succeed > > Is test is broken. It assumes you have a specially patched kernel. > Details are under ticket LU-684. > > The nice thing is with the linux client is that we are at a point > it wouldn't be a huge leap to integrate DoM (Data on MetaData). > The reason I suggest cleanups and moving out of staging first was > to perserve git blame a bit better with future patches. Currently > we see a lot of "0846e85ba2346 (NeilBrown 2018-06-07" with git blame. Cheers, Andreas --- Andreas Dilger CTO Whamcloud From jsimmons at infradead.org Tue Jan 8 21:47:42 2019 From: jsimmons at infradead.org (James Simmons) Date: Tue, 8 Jan 2019 21:47:42 +0000 (GMT) Subject: [lustre-devel] [PATCH v2 33/33] lustre: update version to 2.9.99 In-Reply-To: <45806D2E-8AAD-48ED-8B14-6D5CC11D824E@whamcloud.com> References: <1546812868-11794-1-git-send-email-jsimmons@infradead.org> <1546812868-11794-34-git-send-email-jsimmons@infradead.org> <874lakj5ck.fsf@notabene.neil.brown.name> <45806D2E-8AAD-48ED-8B14-6D5CC11D824E@whamcloud.com> Message-ID: > >> sanity: FAIL: test_104b lfs check servers test failed > > > > sysfs bug. I have a patch for this. > > > >> sanity: FAIL: test_130a filefrag /mnt/lustre/f130a.sanity failed > >> sanity: FAIL: test_130b filefrag /mnt/lustre/f130b.sanity failed > >> sanity: FAIL: test_130c filefrag /mnt/lustre/f130c.sanity failed > >> sanity: FAIL: test_130e filefrag /mnt/lustre/f130e.sanity failed > >> sanity: FAIL: test_130f filefrag /mnt/lustre/f130f.sanity failed > > > > What version of e2fsprog are you running? You need a 1.44 version and > > this should go away. > > To be clear - the Lustre-patched "filefrag" at: > > https://downloads.whamcloud.com/public/e2fsprogs/1.44.3.wc1/ > > Once Lustre gets into upstream, or convince another filesystem to use the > Lustre filefrag extension (multiple devices, which BtrFS and XFS could > use) we can get the support landed into the upstream e2fsprogs. I swore that Ubuntu18 testing passed with the default e2fsprogs (1.44.4). To let Neil know, this is why lustre_fiemap.h exist in the uapi headers directory. This kind of functionality would help the community at large. > >> sanity: FAIL: test_160a changelog 'f160a.sanity' fid != file fid [0x240002342:0xd:0x0] > >> sanity: FAIL: test_161d cat failed > > > > Might be missing some more changelog improvements. > > > >> sanity: FAIL: test_205 No jobstats for id.205.mkdir.9480 found on mds1::*.lustre-MDT0000.job_stats > > > > Strange? > > This might be because the upstream Lustre doesn't allow setting per-process > JobID via environment variable, only as a single per-node value. The real > unfortunate part is that the "get JobID from environment" actually works for > every reasonable architecture (even the one which was originally broken > fixed it), but it got yanked anyway. This is actually one of the features > of Lustre that lots of HPC sites like to use, since it allows them to track > on the servers which users/jobs/processes on the client are doing IO. To give background for Neil see thread: https://lore.kernel.org/patchwork/patch/416846 In this case I do agree with Greg. The latest jobid does implement an upcall and upcalls don't play niece with containers. Their is also the namespace issue pointed out. I think the namespace issue might be fixed in the latest OpenSFS code. The whole approach to stats in lustre is pretty awful. Take jobstats for example. Currently the approach is to poll inside the kernel at specific intervals. Part of the polling is scanning the running processes environment space. On top of this the administor ends up creating scripts to poll the proc / debugfs entry. Other types of lustre stat files take a similar approach. Scripts have to poll debugfs / procfs entries. I have been thinking what would be a better approach since I like to approach this problem for the 2.13 time frame. Our admins at my work place want to be able to collect application stats without being root. So placing stats in debugfs is not an option, which we currently do the linux client :-( The stats are not a good fit for sysfs. The solution I have been pondering is using netlink. Since netlink is socket based it can be treated as a pipe. Now you are thinking well you still need to poll on the netlink socket but you don't have too. systemd does it for you :-) We can create systemd service file which uses ListenNetlink=generic "multicast group" ... to launch a service to collect the stats. As for job stats we use another type of netlink class called process connector. The below link cover this little know feature. It is available on every system in the support matrix. https://www.slideshare.net/kerneltlv/kernel-proc-connector-and-containers In this case we parsen for the job schedular ids and pass that to lustre using system.d. From adilger at whamcloud.com Wed Jan 9 00:15:45 2019 From: adilger at whamcloud.com (Andreas Dilger) Date: Wed, 9 Jan 2019 00:15:45 +0000 Subject: [lustre-devel] [PATCH v2 33/33] lustre: update version to 2.9.99 In-Reply-To: References: <1546812868-11794-1-git-send-email-jsimmons@infradead.org> <1546812868-11794-34-git-send-email-jsimmons@infradead.org> <874lakj5ck.fsf@notabene.neil.brown.name> <45806D2E-8AAD-48ED-8B14-6D5CC11D824E@whamcloud.com> Message-ID: <9BDCA6A9-A826-49A7-9126-BC1DCC96AC1D@whamcloud.com> On Jan 8, 2019, at 14:47, James Simmons wrote: > >>>> sanity: FAIL: test_104b lfs check servers test failed >>> >>> sysfs bug. I have a patch for this. >>> >>>> sanity: FAIL: test_130a filefrag /mnt/lustre/f130a.sanity failed >>>> sanity: FAIL: test_130b filefrag /mnt/lustre/f130b.sanity failed >>>> sanity: FAIL: test_130c filefrag /mnt/lustre/f130c.sanity failed >>>> sanity: FAIL: test_130e filefrag /mnt/lustre/f130e.sanity failed >>>> sanity: FAIL: test_130f filefrag /mnt/lustre/f130f.sanity failed >>> >>> What version of e2fsprog are you running? You need a 1.44 version and >>> this should go away. >> >> To be clear - the Lustre-patched "filefrag" at: >> >> https://downloads.whamcloud.com/public/e2fsprogs/1.44.3.wc1/ >> >> Once Lustre gets into upstream, or convince another filesystem to use the >> Lustre filefrag extension (multiple devices, which BtrFS and XFS could >> use) we can get the support landed into the upstream e2fsprogs. > > I swore that Ubuntu18 testing passed with the default e2fsprogs (1.44.4). > To let Neil know, this is why lustre_fiemap.h exist in the uapi headers > directory. This kind of functionality would help the community at large. The returned data is identical for single-striped files, so the vanilla filefrag will work on Lustre in the common case. >>>> sanity: FAIL: test_160a changelog 'f160a.sanity' fid != file fid [0x240002342:0xd:0x0] >>>> sanity: FAIL: test_161d cat failed >>> >>> Might be missing some more changelog improvements. >>> >>>> sanity: FAIL: test_205 No jobstats for id.205.mkdir.9480 found on mds1::*.lustre-MDT0000.job_stats >>> >>> Strange? >> >> This might be because the upstream Lustre doesn't allow setting per-process >> JobID via environment variable, only as a single per-node value. The real >> unfortunate part is that the "get JobID from environment" actually works for >> every reasonable architecture (even the one which was originally broken >> fixed it), but it got yanked anyway. This is actually one of the features >> of Lustre that lots of HPC sites like to use, since it allows them to track >> on the servers which users/jobs/processes on the client are doing IO. > > To give background for Neil see thread: > > https://lore.kernel.org/patchwork/patch/416846 > > In this case I do agree with Greg. The latest jobid does implement an > upcall and upcalls don't play niece with containers. Their is also the > namespace issue pointed out. I think the namespace issue might be fixed > in the latest OpenSFS code. I'm not sure what you mean? AFAIK, there is no upcall for JobID, except maybe in the kernel client where we weren't allowed to parse the process environment directly. I agree an upcall is problematic with namespaces, in addition to being less functional (only a JobID per node instead of per process), which is why direct access to JOBENV is better IMHO. > The whole approach to stats in lustre is > pretty awful. Take jobstats for example. Currently the approach is > to poll inside the kernel at specific intervals. Part of the polling is > scanning the running processes environment space. On top of this the > administor ends up creating scripts to poll the proc / debugfs entry. > Other types of lustre stat files take a similar approach. Scripts have > to poll debugfs / procfs entries. I think that issue is orthogonal to getting the actual JobID. That is the stats collection from the kernel. We shouldn't be inventing a new way to process that. What does "top" do? Read a thousand /proc files every second because that is flexible for different use cases. There are much fewer Lustre stats files on a given node, and I haven't heard that the actual stats reading interface is a performance issue. > I have been thinking what would be a better approach since I like to > approach this problem for the 2.13 time frame. Our admins at my work > place want to be able to collect application stats without being root. > So placing stats in debugfs is not an option, which we currently do > the linux client :-( The stats are not a good fit for sysfs. The solution > I have been pondering is using netlink. Since netlink is socket based it > can be treated as a pipe. Now you are thinking well you still need to poll > on the netlink socket but you don't have too. systemd does it for you :-) > We can create systemd service file which uses For the love of all that is holy, do not make Lustre stats usage depend on Systemd to be usable. Cheers, Andreas --- Andreas Dilger Principal Lustre Architect Whamcloud From neilb at suse.com Wed Jan 9 06:24:00 2019 From: neilb at suse.com (NeilBrown) Date: Wed, 09 Jan 2019 17:24:00 +1100 Subject: [lustre-devel] [PATCH 00/29] assorted osc cleanups. Message-ID: <154701488711.26726.17363928508883972338.stgit@noble> I was reading through the osc code recently trying to understand it, and tripped over various things that made it harded to understand. So I wrote patches to clean those things up. As you can see below, this deleted nearly 300 lines of code. None of these are bug-fixes, and some may only be subjective improvements, so I can drop any that anyone objects to. This seems to fit well with James' recent suggesting to focus on house-cleaning for a while (which I support). Thanks, NeilBrown --- NeilBrown (29): lustre: osc_cache: discard oe_intree lustre: osc_cache: use assert_spin_locked() lustre: osc: simplify osc_extent_wait() lustre: osc: simplify list manipulation lustre: osc: convert oe_refc and oe_users to kref and refcount_ lustre: osc: use overlapped() consistently. lustre: osc: convert a while loop to for lustre: osc: simplify osc_extent_find() lustre: osc: remove test on 'found' being an error. lustre: osc_cache: avoid list_for_each_entry_safe when clearing list. lustre: osc_cache: simplify osc_wake_cache_waiters() lustre: osc_cache: avoid confusing variable reuse. lustre: osc_cache: change osc_enter_cache_try to return bool. lustre: osc_cache: convert cl_cache_waiters to a wait_queue. lustre: osc_cache: change osc_make_rpc() to return bool. lustre: osc_cache: use osc_makes_hprpc() more consistently. lustre: osc_cache: simplify list walk in get_write_extents(). lustre: osc_cache: avoid unnecessary tests. lustre: osc_cache: convert while to for in get_write_extents() lustre: osc_cache: don't drop a lock we didn't take. lustre: osc_cache: don't drop a lock we didn't take - two lustre: osc_cache: osc_prep_async_page() has meaningless return lustre: osc_cache: remove 'transient' arg from osc_enter_cache_try lustre: osc_cache: change need_release to bool lustre: remove cl_page_cancel() lustre: osc_cache: simplify osc_page_gang_lookup() lustre: osc_cache: white-space and other checkpatch fixes. lustre: osc_request: assorted white-space and check-patch fixes. lustre: centralize handling of PTLRPCD_SET drivers/staging/lustre/lustre/include/cl_object.h | 25 - drivers/staging/lustre/lustre/include/lustre_net.h | 2 drivers/staging/lustre/lustre/include/obd.h | 2 drivers/staging/lustre/lustre/ldlm/ldlm_lib.c | 2 drivers/staging/lustre/lustre/obdclass/cl_page.c | 20 - drivers/staging/lustre/lustre/osc/osc_cache.c | 722 +++++++------------- .../staging/lustre/lustre/osc/osc_cl_internal.h | 33 - drivers/staging/lustre/lustre/osc/osc_internal.h | 15 drivers/staging/lustre/lustre/osc/osc_io.c | 4 drivers/staging/lustre/lustre/osc/osc_lock.c | 27 - drivers/staging/lustre/lustre/osc/osc_page.c | 22 - drivers/staging/lustre/lustre/osc/osc_request.c | 199 +++--- drivers/staging/lustre/lustre/ptlrpc/client.c | 20 - 13 files changed, 399 insertions(+), 694 deletions(-) -- Signature From neilb at suse.com Wed Jan 9 06:24:00 2019 From: neilb at suse.com (NeilBrown) Date: Wed, 09 Jan 2019 17:24:00 +1100 Subject: [lustre-devel] [PATCH 01/29] lustre: osc_cache: discard oe_intree In-Reply-To: <154701488711.26726.17363928508883972338.stgit@noble> References: <154701488711.26726.17363928508883972338.stgit@noble> Message-ID: <154701504072.26726.12597270089564992131.stgit@noble> An rbnode knows if it is in the tree or not, using RB_EMPTY_NODE(). There is no need for an extra flag. Signed-off-by: NeilBrown --- drivers/staging/lustre/lustre/osc/osc_cache.c | 15 +++++++-------- .../staging/lustre/lustre/osc/osc_cl_internal.h | 3 +-- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/drivers/staging/lustre/lustre/osc/osc_cache.c b/drivers/staging/lustre/lustre/osc/osc_cache.c index 93330cb77e94..fbf16547003d 100644 --- a/drivers/staging/lustre/lustre/osc/osc_cache.c +++ b/drivers/staging/lustre/lustre/osc/osc_cache.c @@ -74,7 +74,7 @@ static inline char *ext_flags(struct osc_extent *ext, char *flags) { char *buf = flags; *buf++ = ext->oe_rw ? 'r' : 'w'; - if (ext->oe_intree) + if (!RB_EMPTY_NODE(&ext->oe_node)) *buf++ = 'i'; if (ext->oe_sync) *buf++ = 'S'; @@ -154,7 +154,7 @@ static inline struct osc_extent *next_extent(struct osc_extent *ext) if (!ext) return NULL; - LASSERT(ext->oe_intree); + LASSERT(!RB_EMPTY_NODE(&ext->oe_node)); return rb_extent(rb_next(&ext->oe_node)); } @@ -163,7 +163,7 @@ static inline struct osc_extent *prev_extent(struct osc_extent *ext) if (!ext) return NULL; - LASSERT(ext->oe_intree); + LASSERT(!RB_EMPTY_NODE(&ext->oe_node)); return rb_extent(rb_prev(&ext->oe_node)); } @@ -393,7 +393,7 @@ static void osc_extent_put(const struct lu_env *env, struct osc_extent *ext) LASSERT(list_empty(&ext->oe_link)); LASSERT(atomic_read(&ext->oe_users) == 0); LASSERT(ext->oe_state == OES_INV); - LASSERT(!ext->oe_intree); + LASSERT(RB_EMPTY_NODE(&ext->oe_node)); if (ext->oe_dlmlock) { lu_ref_add(&ext->oe_dlmlock->l_reference, @@ -465,7 +465,7 @@ static void osc_extent_insert(struct osc_object *obj, struct osc_extent *ext) struct rb_node *parent = NULL; struct osc_extent *tmp; - LASSERT(ext->oe_intree == 0); + LASSERT(RB_EMPTY_NODE(&ext->oe_node)); LASSERT(ext->oe_obj == obj); LASSERT(osc_object_is_locked(obj)); while (*n) { @@ -482,7 +482,6 @@ static void osc_extent_insert(struct osc_object *obj, struct osc_extent *ext) rb_link_node(&ext->oe_node, parent, n); rb_insert_color(&ext->oe_node, &obj->oo_root); osc_extent_get(ext); - ext->oe_intree = 1; } /* caller must have held object lock. */ @@ -491,9 +490,9 @@ static void osc_extent_erase(struct osc_extent *ext) struct osc_object *obj = ext->oe_obj; LASSERT(osc_object_is_locked(obj)); - if (ext->oe_intree) { + if (!RB_EMPTY_NODE(&ext->oe_node)) { rb_erase(&ext->oe_node, &obj->oo_root); - ext->oe_intree = 0; + RB_CLEAR_NODE(&ext->oe_node); /* rbtree held a refcount */ osc_extent_put_trust(ext); } diff --git a/drivers/staging/lustre/lustre/osc/osc_cl_internal.h b/drivers/staging/lustre/lustre/osc/osc_cl_internal.h index 077a2b183634..b78deef3963a 100644 --- a/drivers/staging/lustre/lustre/osc/osc_cl_internal.h +++ b/drivers/staging/lustre/lustre/osc/osc_cl_internal.h @@ -598,9 +598,8 @@ struct osc_extent { /* state of this extent */ enum osc_extent_state oe_state; /* flags for this extent. */ - unsigned int oe_intree:1, /* 0 is write, 1 is read */ - oe_rw:1, + unsigned int oe_rw:1, /* sync extent, queued by osc_queue_sync_pages() */ oe_sync:1, /* set if this extent has partial, sync pages. From neilb at suse.com Wed Jan 9 06:24:01 2019 From: neilb at suse.com (NeilBrown) Date: Wed, 09 Jan 2019 17:24:01 +1100 Subject: [lustre-devel] [PATCH 02/29] lustre: osc_cache: use assert_spin_locked() In-Reply-To: <154701488711.26726.17363928508883972338.stgit@noble> References: <154701488711.26726.17363928508883972338.stgit@noble> Message-ID: <154701504098.26726.7180667249484886220.stgit@noble> assert_spin_locked() is preferred to spin_is_locked() for affirming that a spinlock is locked. Signed-off-by: NeilBrown --- drivers/staging/lustre/lustre/osc/osc_cache.c | 29 +++++++++----------- .../staging/lustre/lustre/osc/osc_cl_internal.h | 15 +--------- 2 files changed, 15 insertions(+), 29 deletions(-) diff --git a/drivers/staging/lustre/lustre/osc/osc_cache.c b/drivers/staging/lustre/lustre/osc/osc_cache.c index fbf16547003d..1ce9f673f1bf 100644 --- a/drivers/staging/lustre/lustre/osc/osc_cache.c +++ b/drivers/staging/lustre/lustre/osc/osc_cache.c @@ -181,10 +181,7 @@ static int osc_extent_sanity_check0(struct osc_extent *ext, size_t page_count; int rc = 0; - if (!osc_object_is_locked(obj)) { - rc = 9; - goto out; - } + assert_osc_object_is_locked(obj); if (ext->oe_state >= OES_STATE_MAX) { rc = 10; @@ -324,7 +321,7 @@ static int osc_extent_is_overlapped(struct osc_object *obj, { struct osc_extent *tmp; - LASSERT(osc_object_is_locked(obj)); + assert_osc_object_is_locked(obj); if (!extent_debug) return 0; @@ -341,7 +338,7 @@ static int osc_extent_is_overlapped(struct osc_object *obj, static void osc_extent_state_set(struct osc_extent *ext, int state) { - LASSERT(osc_object_is_locked(ext->oe_obj)); + assert_osc_object_is_locked(ext->oe_obj); LASSERT(state >= OES_INV && state < OES_STATE_MAX); /* Never try to sanity check a state changing extent :-) */ @@ -414,7 +411,7 @@ static void osc_extent_put(const struct lu_env *env, struct osc_extent *ext) static void osc_extent_put_trust(struct osc_extent *ext) { LASSERT(atomic_read(&ext->oe_refc) > 1); - LASSERT(osc_object_is_locked(ext->oe_obj)); + assert_osc_object_is_locked(ext->oe_obj); atomic_dec(&ext->oe_refc); } @@ -428,7 +425,7 @@ static struct osc_extent *osc_extent_search(struct osc_object *obj, struct rb_node *n = obj->oo_root.rb_node; struct osc_extent *tmp, *p = NULL; - LASSERT(osc_object_is_locked(obj)); + assert_osc_object_is_locked(obj); while (n) { tmp = rb_extent(n); if (index < tmp->oe_start) { @@ -467,7 +464,7 @@ static void osc_extent_insert(struct osc_object *obj, struct osc_extent *ext) LASSERT(RB_EMPTY_NODE(&ext->oe_node)); LASSERT(ext->oe_obj == obj); - LASSERT(osc_object_is_locked(obj)); + assert_osc_object_is_locked(obj); while (*n) { tmp = rb_extent(*n); parent = *n; @@ -489,7 +486,7 @@ static void osc_extent_erase(struct osc_extent *ext) { struct osc_object *obj = ext->oe_obj; - LASSERT(osc_object_is_locked(obj)); + assert_osc_object_is_locked(obj); if (!RB_EMPTY_NODE(&ext->oe_node)) { rb_erase(&ext->oe_node, &obj->oo_root); RB_CLEAR_NODE(&ext->oe_node); @@ -502,7 +499,7 @@ static struct osc_extent *osc_extent_hold(struct osc_extent *ext) { struct osc_object *obj = ext->oe_obj; - LASSERT(osc_object_is_locked(obj)); + assert_osc_object_is_locked(obj); LASSERT(ext->oe_state == OES_ACTIVE || ext->oe_state == OES_CACHE); if (ext->oe_state == OES_CACHE) { osc_extent_state_set(ext, OES_ACTIVE); @@ -515,7 +512,7 @@ static struct osc_extent *osc_extent_hold(struct osc_extent *ext) static void __osc_extent_remove(struct osc_extent *ext) { - LASSERT(osc_object_is_locked(ext->oe_obj)); + assert_osc_object_is_locked(ext->oe_obj); LASSERT(list_empty(&ext->oe_pages)); osc_extent_erase(ext); list_del_init(&ext->oe_link); @@ -546,7 +543,7 @@ static int osc_extent_merge(const struct lu_env *env, struct osc_extent *cur, int ppc_bits; LASSERT(cur->oe_state == OES_CACHE); - LASSERT(osc_object_is_locked(obj)); + assert_osc_object_is_locked(obj); if (!victim) return -EINVAL; @@ -2079,7 +2076,7 @@ static unsigned int get_write_extents(struct osc_object *obj, .erd_max_extents = 256, }; - LASSERT(osc_object_is_locked(obj)); + assert_osc_object_is_locked(obj); while (!list_empty(&obj->oo_hp_exts)) { ext = list_entry(obj->oo_hp_exts.next, struct osc_extent, oe_link); @@ -2146,7 +2143,7 @@ osc_send_write_rpc(const struct lu_env *env, struct client_obd *cli, int srvlock = 0; int rc = 0; - LASSERT(osc_object_is_locked(osc)); + assert_osc_object_is_locked(osc); page_count = get_write_extents(osc, &rpclist); LASSERT(equi(page_count == 0, list_empty(&rpclist))); @@ -2224,7 +2221,7 @@ osc_send_read_rpc(const struct lu_env *env, struct client_obd *cli, }; int rc = 0; - LASSERT(osc_object_is_locked(osc)); + assert_osc_object_is_locked(osc); list_for_each_entry_safe(ext, next, &osc->oo_reading_exts, oe_link) { EASSERT(ext->oe_state == OES_LOCK_DONE, ext); if (!try_to_add_extent_for_io(cli, ext, &data)) diff --git a/drivers/staging/lustre/lustre/osc/osc_cl_internal.h b/drivers/staging/lustre/lustre/osc/osc_cl_internal.h index b78deef3963a..aa1b753fc88d 100644 --- a/drivers/staging/lustre/lustre/osc/osc_cl_internal.h +++ b/drivers/staging/lustre/lustre/osc/osc_cl_internal.h @@ -183,19 +183,8 @@ static inline void osc_object_unlock(struct osc_object *obj) spin_unlock(&obj->oo_lock); } -static inline int osc_object_is_locked(struct osc_object *obj) -{ -#if defined(CONFIG_SMP) || defined(CONFIG_DEBUG_SPINLOCK) - return spin_is_locked(&obj->oo_lock); -#else - /* - * It is not perfect to return true all the time. - * But since this function is only used for assertion - * and checking, it seems OK. - */ - return 1; -#endif -} +#define assert_osc_object_is_locked(obj) \ + assert_spin_locked(&obj->oo_lock) /* * Lock "micro-states" for osc layer. From neilb at suse.com Wed Jan 9 06:24:01 2019 From: neilb at suse.com (NeilBrown) Date: Wed, 09 Jan 2019 17:24:01 +1100 Subject: [lustre-devel] [PATCH 03/29] lustre: osc: simplify osc_extent_wait() In-Reply-To: <154701488711.26726.17363928508883972338.stgit@noble> References: <154701488711.26726.17363928508883972338.stgit@noble> Message-ID: <154701504111.26726.7861020038366907898.stgit@noble> Taking a spinlock to check the current value of the state is unnecessary. The wake_up() and wait_event() calls have sufficient barriers to ensure that the value will be seen and the wait will abort properly. In most cases, osc_extent_wait() is followed by osc_object_lock() before any shared data is touched - in those cases there is no need for osc_extent_wait() to wait for the spinlock to be released. The one case where osc_object_lock() does not immediately follow is in osc_cache_truncate_start(). The extra locking was introduced in a patch which fixed a problem with truncation, so it is likely that this is the call that was thought to be relevant. In that case, following osc_extent_wait(), an extent that had been detached from the per-object list (oe_link linkage) and proceeds to work on it without any locking. In this case the code is waiting for OES_TRUNC, so any changes that happen after the osc_extent_state_set(ext, OES_TRUNC) and when the lock is dropped, might not be seen by the woken code. The only thing changed is ->oe_trunc_pending, and the woken code doesn't look at that. The only remaining possible need for extra synchronization is if some other value was changed before the wakeup and is needed after the wait. According to memory-barriers.txt, a barrier might be needed to ensure that is visible. Such a barrier is most clearly presented by used smp_store_release() to set the state before wakeup, and smp_load_acquire() to view it after waiting. Also use a simple wake_up() instead of wake_up_all() - the latter is only needed when exclusive waiting is being used. Signed-off-by: NeilBrown --- drivers/staging/lustre/lustre/osc/osc_cache.c | 22 +++++++--------------- 1 file changed, 7 insertions(+), 15 deletions(-) diff --git a/drivers/staging/lustre/lustre/osc/osc_cache.c b/drivers/staging/lustre/lustre/osc/osc_cache.c index 1ce9f673f1bf..00056dffceb9 100644 --- a/drivers/staging/lustre/lustre/osc/osc_cache.c +++ b/drivers/staging/lustre/lustre/osc/osc_cache.c @@ -345,8 +345,8 @@ static void osc_extent_state_set(struct osc_extent *ext, int state) /* LASSERT(sanity_check_nolock(ext) == 0); */ /* TODO: validate the state machine */ - ext->oe_state = state; - wake_up_all(&ext->oe_waitq); + smp_store_release(&ext->oe_state, state); + wake_up(&ext->oe_waitq); } static struct osc_extent *osc_extent_alloc(struct osc_object *obj) @@ -948,17 +948,6 @@ int osc_extent_finish(const struct lu_env *env, struct osc_extent *ext, return 0; } -static int extent_wait_cb(struct osc_extent *ext, enum osc_extent_state state) -{ - int ret; - - osc_object_lock(ext->oe_obj); - ret = ext->oe_state == state; - osc_object_unlock(ext->oe_obj); - - return ret; -} - /** * Wait for the extent's state to become @state. */ @@ -989,13 +978,16 @@ static int osc_extent_wait(const struct lu_env *env, struct osc_extent *ext, /* wait for the extent until its state becomes @state */ rc = wait_event_idle_timeout(ext->oe_waitq, - extent_wait_cb(ext, state), 600 * HZ); + smp_load_acquire(&ext->oe_state) == state, + 600 * HZ); if (rc == 0) { OSC_EXTENT_DUMP(D_ERROR, ext, "%s: wait ext to %u timedout, recovery in progress?\n", cli_name(osc_cli(obj)), state); - wait_event_idle(ext->oe_waitq, extent_wait_cb(ext, state)); + wait_event_idle(ext->oe_waitq, + smp_load_acquire(&ext->oe_state) == state); + } if (ext->oe_rc < 0) rc = ext->oe_rc; From neilb at suse.com Wed Jan 9 06:24:01 2019 From: neilb at suse.com (NeilBrown) Date: Wed, 09 Jan 2019 17:24:01 +1100 Subject: [lustre-devel] [PATCH 04/29] lustre: osc: simplify list manipulation In-Reply-To: <154701488711.26726.17363928508883972338.stgit@noble> References: <154701488711.26726.17363928508883972338.stgit@noble> Message-ID: <154701504121.26726.13780223132597872019.stgit@noble> when A is empty, list_move_tail(&A, &B); is identical to list_add_tail(&A, &B); so always use list_move_tail() - it is easier to understand. Signed-off-by: NeilBrown --- drivers/staging/lustre/lustre/osc/osc_cache.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/drivers/staging/lustre/lustre/osc/osc_cache.c b/drivers/staging/lustre/lustre/osc/osc_cache.c index 00056dffceb9..6771675dd520 100644 --- a/drivers/staging/lustre/lustre/osc/osc_cache.c +++ b/drivers/staging/lustre/lustre/osc/osc_cache.c @@ -2885,10 +2885,7 @@ int osc_cache_truncate_start(const struct lu_env *env, struct osc_object *obj, } /* This extent could be on the full extents list, that's OK */ EASSERT(!ext->oe_hp && !ext->oe_urgent, ext); - if (!list_empty(&ext->oe_link)) - list_move_tail(&ext->oe_link, &list); - else - list_add_tail(&ext->oe_link, &list); + list_move_tail(&ext->oe_link, &list); ext = next_extent(ext); } From neilb at suse.com Wed Jan 9 06:24:01 2019 From: neilb at suse.com (NeilBrown) Date: Wed, 09 Jan 2019 17:24:01 +1100 Subject: [lustre-devel] [PATCH 05/29] lustre: osc: convert oe_refc and oe_users to kref and refcount_ In-Reply-To: <154701488711.26726.17363928508883972338.stgit@noble> References: <154701488711.26726.17363928508883972338.stgit@noble> Message-ID: <154701504126.26726.9018865558337243745.stgit@noble> oe_refc is used like a kref, so make it one. oe_users isn't quite, as it is initialised to 0, so make it a refcount_t. As cl_object_put() needs an 'env', we cannot quite use kref_put() as intended. Maybe that can be fixed one day. Signed-off-by: NeilBrown --- drivers/staging/lustre/lustre/osc/osc_cache.c | 73 ++++++++++++-------- .../staging/lustre/lustre/osc/osc_cl_internal.h | 4 + 2 files changed, 45 insertions(+), 32 deletions(-) diff --git a/drivers/staging/lustre/lustre/osc/osc_cache.c b/drivers/staging/lustre/lustre/osc/osc_cache.c index 6771675dd520..cab1a4f99cc2 100644 --- a/drivers/staging/lustre/lustre/osc/osc_cache.c +++ b/drivers/staging/lustre/lustre/osc/osc_cache.c @@ -114,8 +114,8 @@ static const char *oes_strings[] = { /* ----- extent part 0 ----- */ \ __ext, EXTPARA(__ext), \ /* ----- part 1 ----- */ \ - atomic_read(&__ext->oe_refc), \ - atomic_read(&__ext->oe_users), \ + kref_read(&__ext->oe_refc), \ + refcount_read(&__ext->oe_users), \ list_empty_marker(&__ext->oe_link), \ oes_strings[__ext->oe_state], ext_flags(__ext, __buf), \ __ext->oe_obj, \ @@ -188,12 +188,12 @@ static int osc_extent_sanity_check0(struct osc_extent *ext, goto out; } - if (atomic_read(&ext->oe_refc) <= 0) { + if (kref_read(&ext->oe_refc) <= 0) { rc = 20; goto out; } - if (atomic_read(&ext->oe_refc) < atomic_read(&ext->oe_users)) { + if (kref_read(&ext->oe_refc) < refcount_read(&ext->oe_users)) { rc = 30; goto out; } @@ -206,7 +206,7 @@ static int osc_extent_sanity_check0(struct osc_extent *ext, rc = 0; goto out; case OES_ACTIVE: - if (atomic_read(&ext->oe_users) == 0) { + if (refcount_read(&ext->oe_users) == 0) { rc = 40; goto out; } @@ -230,7 +230,7 @@ static int osc_extent_sanity_check0(struct osc_extent *ext, } /* fall through */ default: - if (atomic_read(&ext->oe_users) > 0) { + if (refcount_read(&ext->oe_users) > 0) { rc = 70; goto out; } @@ -360,8 +360,8 @@ static struct osc_extent *osc_extent_alloc(struct osc_object *obj) RB_CLEAR_NODE(&ext->oe_node); ext->oe_obj = obj; cl_object_get(osc2cl(obj)); - atomic_set(&ext->oe_refc, 1); - atomic_set(&ext->oe_users, 0); + kref_init(&ext->oe_refc); + refcount_set(&ext->oe_users, 0); INIT_LIST_HEAD(&ext->oe_link); ext->oe_state = OES_INV; INIT_LIST_HEAD(&ext->oe_pages); @@ -371,35 +371,48 @@ static struct osc_extent *osc_extent_alloc(struct osc_object *obj) return ext; } -static void osc_extent_free(struct osc_extent *ext) +static void osc_extent_free(struct kref *kref) { + struct osc_extent *ext = container_of(kref, struct osc_extent, + oe_refc); + + LASSERT(list_empty(&ext->oe_link)); + LASSERT(refcount_read(&ext->oe_users) == 0); + LASSERT(ext->oe_state == OES_INV); + LASSERT(RB_EMPTY_NODE(&ext->oe_node)); + + if (ext->oe_dlmlock) { + lu_ref_add(&ext->oe_dlmlock->l_reference, + "osc_extent", ext); + LDLM_LOCK_PUT(ext->oe_dlmlock); + ext->oe_dlmlock = NULL; + } +#if 0 + // When cl_object_put drop the need for 'env', + // this code can be enabled. + cl_object_put(osc2cl(ext->oe_obj)); + kmem_cache_free(osc_extent_kmem, ext); +#endif } static struct osc_extent *osc_extent_get(struct osc_extent *ext) { - LASSERT(atomic_read(&ext->oe_refc) >= 0); - atomic_inc(&ext->oe_refc); + LASSERT(kref_read(&ext->oe_refc) >= 0); + kref_get(&ext->oe_refc); return ext; } static void osc_extent_put(const struct lu_env *env, struct osc_extent *ext) { - LASSERT(atomic_read(&ext->oe_refc) > 0); - if (atomic_dec_and_test(&ext->oe_refc)) { - LASSERT(list_empty(&ext->oe_link)); - LASSERT(atomic_read(&ext->oe_users) == 0); - LASSERT(ext->oe_state == OES_INV); - LASSERT(RB_EMPTY_NODE(&ext->oe_node)); - - if (ext->oe_dlmlock) { - lu_ref_add(&ext->oe_dlmlock->l_reference, - "osc_extent", ext); - LDLM_LOCK_PUT(ext->oe_dlmlock); - ext->oe_dlmlock = NULL; - } + LASSERT(kref_read(&ext->oe_refc) > 0); + if (kref_put(&ext->oe_refc, osc_extent_free)) { + /* This should be in osc_extent_free(), but + * while we need to pass 'env' it cannot be. + */ cl_object_put(env, osc2cl(ext->oe_obj)); - osc_extent_free(ext); + + kmem_cache_free(osc_extent_kmem, ext); } } @@ -410,9 +423,9 @@ static void osc_extent_put(const struct lu_env *env, struct osc_extent *ext) */ static void osc_extent_put_trust(struct osc_extent *ext) { - LASSERT(atomic_read(&ext->oe_refc) > 1); + LASSERT(kref_read(&ext->oe_refc) > 1); assert_osc_object_is_locked(ext->oe_obj); - atomic_dec(&ext->oe_refc); + osc_extent_put(NULL, ext); } /** @@ -505,7 +518,7 @@ static struct osc_extent *osc_extent_hold(struct osc_extent *ext) osc_extent_state_set(ext, OES_ACTIVE); osc_update_pending(obj, OBD_BRW_WRITE, -ext->oe_nr_pages); } - atomic_inc(&ext->oe_users); + refcount_inc(&ext->oe_users); list_del_init(&ext->oe_link); return osc_extent_get(ext); } @@ -599,11 +612,11 @@ void osc_extent_release(const struct lu_env *env, struct osc_extent *ext) struct osc_object *obj = ext->oe_obj; struct client_obd *cli = osc_cli(obj); - LASSERT(atomic_read(&ext->oe_users) > 0); + LASSERT(refcount_read(&ext->oe_users) > 0); LASSERT(sanity_check(ext) == 0); LASSERT(ext->oe_grants > 0); - if (atomic_dec_and_lock(&ext->oe_users, &obj->oo_lock)) { + if (refcount_dec_and_lock(&ext->oe_users, &obj->oo_lock)) { LASSERT(ext->oe_state == OES_ACTIVE); if (ext->oe_trunc_pending) { /* a truncate process is waiting for this extent. diff --git a/drivers/staging/lustre/lustre/osc/osc_cl_internal.h b/drivers/staging/lustre/lustre/osc/osc_cl_internal.h index aa1b753fc88d..b1a1d241cc6c 100644 --- a/drivers/staging/lustre/lustre/osc/osc_cl_internal.h +++ b/drivers/staging/lustre/lustre/osc/osc_cl_internal.h @@ -579,9 +579,9 @@ struct osc_extent { /* osc_object of this extent */ struct osc_object *oe_obj; /* refcount, removed from red-black tree if reaches zero. */ - atomic_t oe_refc; + struct kref oe_refc; /* busy if non-zero */ - atomic_t oe_users; + refcount_t oe_users; /* link list of osc_object's oo_{hp|urgent|locking}_exts. */ struct list_head oe_link; /* state of this extent */ From neilb at suse.com Wed Jan 9 06:24:01 2019 From: neilb at suse.com (NeilBrown) Date: Wed, 09 Jan 2019 17:24:01 +1100 Subject: [lustre-devel] [PATCH 06/29] lustre: osc: use overlapped() consistently. In-Reply-To: <154701488711.26726.17363928508883972338.stgit@noble> References: <154701488711.26726.17363928508883972338.stgit@noble> Message-ID: <154701504133.26726.5055625028157924201.stgit@noble> osc_extent_is_overlapped() open-codes exactly the test that overlapped() performs. So use overlapped() instead, to make the code more obviously consistent. Signed-off-by: NeilBrown --- drivers/staging/lustre/lustre/osc/osc_cache.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/drivers/staging/lustre/lustre/osc/osc_cache.c b/drivers/staging/lustre/lustre/osc/osc_cache.c index cab1a4f99cc2..dd3c87124aa5 100644 --- a/drivers/staging/lustre/lustre/osc/osc_cache.c +++ b/drivers/staging/lustre/lustre/osc/osc_cache.c @@ -313,6 +313,11 @@ static int osc_extent_sanity_check0(struct osc_extent *ext, __res; \ }) +static inline int overlapped(struct osc_extent *ex1, struct osc_extent *ex2) +{ + return !(ex1->oe_end < ex2->oe_start || ex2->oe_end < ex1->oe_start); +} + /** * sanity check - to make sure there is no overlapped extent in the tree. */ @@ -329,8 +334,7 @@ static int osc_extent_is_overlapped(struct osc_object *obj, for (tmp = first_extent(obj); tmp; tmp = next_extent(tmp)) { if (tmp == ext) continue; - if (tmp->oe_end >= ext->oe_start && - tmp->oe_start <= ext->oe_end) + if (overlapped(tmp, ext)) return 1; } return 0; @@ -655,11 +659,6 @@ void osc_extent_release(const struct lu_env *env, struct osc_extent *ext) osc_extent_put(env, ext); } -static inline int overlapped(struct osc_extent *ex1, struct osc_extent *ex2) -{ - return !(ex1->oe_end < ex2->oe_start || ex2->oe_end < ex1->oe_start); -} - /** * Find or create an extent which includes @index, core function to manage * extent tree. From neilb at suse.com Wed Jan 9 06:24:01 2019 From: neilb at suse.com (NeilBrown) Date: Wed, 09 Jan 2019 17:24:01 +1100 Subject: [lustre-devel] [PATCH 07/29] lustre: osc: convert a while loop to for In-Reply-To: <154701488711.26726.17363928508883972338.stgit@noble> References: <154701488711.26726.17363928508883972338.stgit@noble> Message-ID: <154701504139.26726.16752476949923033869.stgit@noble> This loop uses 'continue' in several places, and each one is proceeded by ext = next_extent(ext) which also appears at the end. This is exactly the pattern that a 'for' loop simplifies. So change to a for loop. Signed-off-by: NeilBrown --- drivers/staging/lustre/lustre/osc/osc_cache.c | 21 +++++---------------- 1 file changed, 5 insertions(+), 16 deletions(-) diff --git a/drivers/staging/lustre/lustre/osc/osc_cache.c b/drivers/staging/lustre/lustre/osc/osc_cache.c index dd3c87124aa5..eb8de1503386 100644 --- a/drivers/staging/lustre/lustre/osc/osc_cache.c +++ b/drivers/staging/lustre/lustre/osc/osc_cache.c @@ -737,7 +737,7 @@ static struct osc_extent *osc_extent_find(const struct lu_env *env, ext = osc_extent_search(obj, cur->oe_start); if (!ext) ext = first_extent(obj); - while (ext) { + for (; ext; ext = next_extent(ext)) { pgoff_t ext_chk_start = ext->oe_start >> ppc_bits; pgoff_t ext_chk_end = ext->oe_end >> ppc_bits; @@ -750,15 +750,12 @@ static struct osc_extent *osc_extent_find(const struct lu_env *env, EASSERTF(!overlapped(ext, cur), ext, EXTSTR "\n", EXTPARA(cur)); - ext = next_extent(ext); continue; } /* discontiguous chunks? */ - if (chunk + 1 < ext_chk_start) { - ext = next_extent(ext); + if (chunk + 1 < ext_chk_start) continue; - } /* ok, from now on, ext and cur have these attrs: * 1. covered by the same lock @@ -786,33 +783,27 @@ static struct osc_extent *osc_extent_find(const struct lu_env *env, } /* non-overlapped extent */ - if (ext->oe_state != OES_CACHE || ext->oe_fsync_wait) { + if (ext->oe_state != OES_CACHE || ext->oe_fsync_wait) /* we can't do anything for a non OES_CACHE extent, or * if there is someone waiting for this extent to be * flushed, try next one. */ - ext = next_extent(ext); continue; - } /* check if they belong to the same rpc slot before trying to * merge. the extents are not overlapped and contiguous at * chunk level to get here. */ - if (ext->oe_max_end != max_end) { + if (ext->oe_max_end != max_end) /* if they don't belong to the same RPC slot or * max_pages_per_rpc has ever changed, do not merge. */ - ext = next_extent(ext); continue; - } /* check whether maximum extent size will be hit */ if ((ext_chk_end - ext_chk_start + 1) << ppc_bits > - cli->cl_max_extent_pages) { - ext = next_extent(ext); + cli->cl_max_extent_pages) continue; - } /* it's required that an extent must be contiguous at chunk * level so that we know the whole extent is covered by grant @@ -851,8 +842,6 @@ static struct osc_extent *osc_extent_find(const struct lu_env *env, } if (found) break; - - ext = next_extent(ext); } osc_extent_tree_dump(D_CACHE, obj); From neilb at suse.com Wed Jan 9 06:24:01 2019 From: neilb at suse.com (NeilBrown) Date: Wed, 09 Jan 2019 17:24:01 +1100 Subject: [lustre-devel] [PATCH 08/29] lustre: osc: simplify osc_extent_find() In-Reply-To: <154701488711.26726.17363928508883972338.stgit@noble> References: <154701488711.26726.17363928508883972338.stgit@noble> Message-ID: <154701504144.26726.6306839878824560964.stgit@noble> osc_extent_find() contains some code with the same functionality as osc_extent_merge(). So replace that code with a call to osc_extent_merge(). This requires that we: - set cur->oe_grants earlier, as osc_extent_merge() needs that - take an extra temporary ref to cur, as osc_extent_merge() will drop the ref we have on success. Signed-off-by: NeilBrown --- drivers/staging/lustre/lustre/osc/osc_cache.c | 50 ++++++------------------- 1 file changed, 12 insertions(+), 38 deletions(-) diff --git a/drivers/staging/lustre/lustre/osc/osc_cache.c b/drivers/staging/lustre/lustre/osc/osc_cache.c index eb8de1503386..848e440ae2a9 100644 --- a/drivers/staging/lustre/lustre/osc/osc_cache.c +++ b/drivers/staging/lustre/lustre/osc/osc_cache.c @@ -718,7 +718,8 @@ static struct osc_extent *osc_extent_find(const struct lu_env *env, cur->oe_start = descr->cld_start; if (cur->oe_end > max_end) cur->oe_end = max_end; - cur->oe_grants = 0; + LASSERT(*grants >= chunksize); + cur->oe_grants = chunksize; cur->oe_mppr = max_pages; if (olck->ols_dlmlock) { LASSERT(olck->ols_hold); @@ -790,58 +791,31 @@ static struct osc_extent *osc_extent_find(const struct lu_env *env, */ continue; - /* check if they belong to the same rpc slot before trying to - * merge. the extents are not overlapped and contiguous at - * chunk level to get here. - */ - if (ext->oe_max_end != max_end) - /* if they don't belong to the same RPC slot or - * max_pages_per_rpc has ever changed, do not merge. - */ - continue; - - /* check whether maximum extent size will be hit */ - if ((ext_chk_end - ext_chk_start + 1) << ppc_bits > - cli->cl_max_extent_pages) - continue; - /* it's required that an extent must be contiguous at chunk * level so that we know the whole extent is covered by grant * (the pages in the extent are NOT required to be contiguous). * Otherwise, it will be too much difficult to know which * chunks have grants allocated. */ - - /* try to do front merge - extend ext's start */ - if (chunk + 1 == ext_chk_start) { - /* ext must be chunk size aligned */ - EASSERT((ext->oe_start & ~chunk_mask) == 0, ext); - - /* pull ext's start back to cover cur */ - ext->oe_start = cur->oe_start; - ext->oe_grants += chunksize; - LASSERT(*grants >= chunksize); + /* On success, osc_extent_merge() will put cur, + * so we take an extra reference + */ + osc_extent_get(cur); + if (osc_extent_merge(env, ext, cur) == 0) { *grants -= chunksize; - found = osc_extent_hold(ext); - } else if (chunk == ext_chk_end + 1) { - /* rear merge */ - ext->oe_end = cur->oe_end; - ext->oe_grants += chunksize; - LASSERT(*grants >= chunksize); - *grants -= chunksize; - /* try to merge with the next one because we just fill - * in a gap + /* + * Try to merge with the next one too because we + * might have just filled in a gap. */ if (osc_extent_merge(env, ext, next_extent(ext)) == 0) /* we can save extent tax from next extent */ *grants += cli->cl_grant_extent_tax; - found = osc_extent_hold(ext); - } - if (found) break; + } + osc_extent_put(env, cur); } osc_extent_tree_dump(D_CACHE, obj); From neilb at suse.com Wed Jan 9 06:24:01 2019 From: neilb at suse.com (NeilBrown) Date: Wed, 09 Jan 2019 17:24:01 +1100 Subject: [lustre-devel] [PATCH 09/29] lustre: osc: remove test on 'found' being an error. In-Reply-To: <154701488711.26726.17363928508883972338.stgit@noble> References: <154701488711.26726.17363928508883972338.stgit@noble> Message-ID: <154701504152.26726.5389367058165286948.stgit@noble> Found cannot be IS_ERR() at this point in the code, as it is only ever assigned a value from osc_extent_hold() (or NULL). So discard the test. Signed-off-by: NeilBrown --- drivers/staging/lustre/lustre/osc/osc_cache.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/drivers/staging/lustre/lustre/osc/osc_cache.c b/drivers/staging/lustre/lustre/osc/osc_cache.c index 848e440ae2a9..e65d917336b9 100644 --- a/drivers/staging/lustre/lustre/osc/osc_cache.c +++ b/drivers/staging/lustre/lustre/osc/osc_cache.c @@ -821,11 +821,9 @@ static struct osc_extent *osc_extent_find(const struct lu_env *env, osc_extent_tree_dump(D_CACHE, obj); if (found) { LASSERT(!conflict); - if (!IS_ERR(found)) { - LASSERT(found->oe_dlmlock == cur->oe_dlmlock); - OSC_EXTENT_DUMP(D_CACHE, found, - "found caching ext for %lu.\n", index); - } + LASSERT(found->oe_dlmlock == cur->oe_dlmlock); + OSC_EXTENT_DUMP(D_CACHE, found, + "found caching ext for %lu.\n", index); } else if (!conflict) { /* create a new extent */ EASSERT(osc_extent_is_overlapped(obj, cur) == 0, cur); From neilb at suse.com Wed Jan 9 06:24:01 2019 From: neilb at suse.com (NeilBrown) Date: Wed, 09 Jan 2019 17:24:01 +1100 Subject: [lustre-devel] [PATCH 10/29] lustre: osc_cache: avoid list_for_each_entry_safe when clearing list. In-Reply-To: <154701488711.26726.17363928508883972338.stgit@noble> References: <154701488711.26726.17363928508883972338.stgit@noble> Message-ID: <154701504159.26726.15747465883750837429.stgit@noble> When removing some items from a list, list_for_each_entry_safe() is a good choice. When removing all items, it is clearer to use a while loop that repeatedly removes the first element, until there are none left. This makes it obvious that the list ends up empty. Signed-off-by: NeilBrown --- drivers/staging/lustre/lustre/osc/osc_cache.c | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/drivers/staging/lustre/lustre/osc/osc_cache.c b/drivers/staging/lustre/lustre/osc/osc_cache.c index e65d917336b9..5cd3732101e7 100644 --- a/drivers/staging/lustre/lustre/osc/osc_cache.c +++ b/drivers/staging/lustre/lustre/osc/osc_cache.c @@ -869,7 +869,6 @@ int osc_extent_finish(const struct lu_env *env, struct osc_extent *ext, { struct client_obd *cli = osc_cli(ext->oe_obj); struct osc_async_page *oap; - struct osc_async_page *tmp; int nr_pages = ext->oe_nr_pages; int lost_grant = 0; int blocksize = cli->cl_import->imp_obd->obd_osfs.os_bsize ? : 4096; @@ -882,7 +881,9 @@ int osc_extent_finish(const struct lu_env *env, struct osc_extent *ext, EASSERT(ergo(rc == 0, ext->oe_state == OES_RPC), ext); osc_lru_add_batch(cli, &ext->oe_pages); - list_for_each_entry_safe(oap, tmp, &ext->oe_pages, oap_pending_item) { + while ((oap = list_first_entry_or_null(&ext->oe_pages, + struct osc_async_page, + oap_pending_item))) { list_del_init(&oap->oap_rpc_item); list_del_init(&oap->oap_pending_item); if (last_off <= oap->oap_obj_off) { @@ -1686,11 +1687,11 @@ static int osc_enter_cache(const struct lu_env *env, struct client_obd *cli, /* caller must hold loi_list_lock */ void osc_wake_cache_waiters(struct client_obd *cli) { - struct list_head *l, *tmp; struct osc_cache_waiter *ocw; - list_for_each_safe(l, tmp, &cli->cl_cache_waiters) { - ocw = list_entry(l, struct osc_cache_waiter, ocw_entry); + while ((ocw = list_first_entry_or_null(&cli->cl_cache_waiters, + struct osc_cache_waiter, + ocw_entry))) { list_del_init(&ocw->ocw_entry); ocw->ocw_rc = -EDQUOT; @@ -2739,7 +2740,7 @@ int osc_queue_sync_pages(const struct lu_env *env, struct osc_object *obj, { struct client_obd *cli = osc_cli(obj); struct osc_extent *ext; - struct osc_async_page *oap, *tmp; + struct osc_async_page *oap; int page_count = 0; int mppr = cli->cl_max_pages_per_rpc; bool can_merge = true; @@ -2763,7 +2764,9 @@ int osc_queue_sync_pages(const struct lu_env *env, struct osc_object *obj, ext = osc_extent_alloc(obj); if (!ext) { - list_for_each_entry_safe(oap, tmp, list, oap_pending_item) { + while ((oap = list_first_entry_or_null(&oap->oap_pending_item, + struct osc_async_page, + oap_pending_item))) { list_del_init(&oap->oap_pending_item); osc_ap_completion(env, cli, oap, 0, -ENOMEM); } @@ -3093,11 +3096,12 @@ int osc_cache_writeback_range(const struct lu_env *env, struct osc_object *obj, LASSERT(ergo(!discard, list_empty(&discard_list))); if (!list_empty(&discard_list)) { - struct osc_extent *tmp; int rc; osc_list_maint(osc_cli(obj), obj); - list_for_each_entry_safe(ext, tmp, &discard_list, oe_link) { + while ((ext = list_first_entry_or_null(&discard_list, + struct osc_extent, + oe_link))) { list_del_init(&ext->oe_link); EASSERT(ext->oe_state == OES_LOCKING, ext); From neilb at suse.com Wed Jan 9 06:24:01 2019 From: neilb at suse.com (NeilBrown) Date: Wed, 09 Jan 2019 17:24:01 +1100 Subject: [lustre-devel] [PATCH 11/29] lustre: osc_cache: simplify osc_wake_cache_waiters() In-Reply-To: <154701488711.26726.17363928508883972338.stgit@noble> References: <154701488711.26726.17363928508883972338.stgit@noble> Message-ID: <154701504164.26726.1429367185304894591.stgit@noble> osc_wake_cache_waiters() performs a test, then possibly calls osc_enter_cache_try() which performs the same test. We don't benefit from this duplication except that it allows an extra debug message. I'm not certain that message is worth the complexity. Signed-off-by: NeilBrown --- drivers/staging/lustre/lustre/osc/osc_cache.c | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/drivers/staging/lustre/lustre/osc/osc_cache.c b/drivers/staging/lustre/lustre/osc/osc_cache.c index 5cd3732101e7..0c78b95e45a3 100644 --- a/drivers/staging/lustre/lustre/osc/osc_cache.c +++ b/drivers/staging/lustre/lustre/osc/osc_cache.c @@ -1694,20 +1694,11 @@ void osc_wake_cache_waiters(struct client_obd *cli) ocw_entry))) { list_del_init(&ocw->ocw_entry); - ocw->ocw_rc = -EDQUOT; - /* we can't dirty more */ - if ((cli->cl_dirty_pages > cli->cl_dirty_max_pages) || - (atomic_long_read(&obd_dirty_pages) + 1 > - obd_max_dirty_pages)) { - CDEBUG(D_CACHE, "no dirty room: dirty: %ld osc max %ld, sys max %ld\n", - cli->cl_dirty_pages, cli->cl_dirty_max_pages, - obd_max_dirty_pages); - goto wakeup; - } - if (osc_enter_cache_try(cli, ocw->ocw_oap, ocw->ocw_grant, 0)) ocw->ocw_rc = 0; -wakeup: + else + ocw->ocw_rc = -EDQUOT; + CDEBUG(D_CACHE, "wake up %p for oap %p, avail grant %ld, %d\n", ocw, ocw->ocw_oap, cli->cl_avail_grant, ocw->ocw_rc); From neilb at suse.com Wed Jan 9 06:24:01 2019 From: neilb at suse.com (NeilBrown) Date: Wed, 09 Jan 2019 17:24:01 +1100 Subject: [lustre-devel] [PATCH 12/29] lustre: osc_cache: avoid confusing variable reuse. In-Reply-To: <154701488711.26726.17363928508883972338.stgit@noble> References: <154701488711.26726.17363928508883972338.stgit@noble> Message-ID: <154701504179.26726.1340537377320556999.stgit@noble> In osc_extent_wait(), the 'rc' variable use used for three very different purposes. This makes the code a bit harder to read. For one of the purposes, introduce a boolean 'need_release'. For another, use a conditional expression instead. Signed-off-by: NeilBrown --- drivers/staging/lustre/lustre/osc/osc_cache.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/drivers/staging/lustre/lustre/osc/osc_cache.c b/drivers/staging/lustre/lustre/osc/osc_cache.c index 0c78b95e45a3..5a295799f177 100644 --- a/drivers/staging/lustre/lustre/osc/osc_cache.c +++ b/drivers/staging/lustre/lustre/osc/osc_cache.c @@ -929,7 +929,8 @@ static int osc_extent_wait(const struct lu_env *env, struct osc_extent *ext, enum osc_extent_state state) { struct osc_object *obj = ext->oe_obj; - int rc = 0; + bool need_release = false; + int rc; osc_object_lock(obj); LASSERT(sanity_check_nolock(ext) == 0); @@ -943,11 +944,11 @@ static int osc_extent_wait(const struct lu_env *env, struct osc_extent *ext, } else if (ext->oe_state == OES_CACHE) { ext->oe_urgent = 1; osc_extent_hold(ext); - rc = 1; + need_release = true; } } osc_object_unlock(obj); - if (rc == 1) + if (need_release) osc_extent_release(env, ext); /* wait for the extent until its state becomes @state */ @@ -963,11 +964,7 @@ static int osc_extent_wait(const struct lu_env *env, struct osc_extent *ext, smp_load_acquire(&ext->oe_state) == state); } - if (ext->oe_rc < 0) - rc = ext->oe_rc; - else - rc = 0; - return rc; + return ext->oe_rc < 0 ? ext->oe_rc : 0; } /** From neilb at suse.com Wed Jan 9 06:24:01 2019 From: neilb at suse.com (NeilBrown) Date: Wed, 09 Jan 2019 17:24:01 +1100 Subject: [lustre-devel] [PATCH 13/29] lustre: osc_cache: change osc_enter_cache_try to return bool. In-Reply-To: <154701488711.26726.17363928508883972338.stgit@noble> References: <154701488711.26726.17363928508883972338.stgit@noble> Message-ID: <154701504186.26726.10969814573194089501.stgit@noble> 'bool' is the natural type for this, so make that obvious. Signed-off-by: NeilBrown --- drivers/staging/lustre/lustre/osc/osc_cache.c | 26 +++++++++++-------------- 1 file changed, 11 insertions(+), 15 deletions(-) diff --git a/drivers/staging/lustre/lustre/osc/osc_cache.c b/drivers/staging/lustre/lustre/osc/osc_cache.c index 5a295799f177..e9987c187ecd 100644 --- a/drivers/staging/lustre/lustre/osc/osc_cache.c +++ b/drivers/staging/lustre/lustre/osc/osc_cache.c @@ -1533,17 +1533,14 @@ static void osc_exit_cache(struct client_obd *cli, struct osc_async_page *oap) * Non-blocking version of osc_enter_cache() that consumes grant only when it * is available. */ -static int osc_enter_cache_try(struct client_obd *cli, - struct osc_async_page *oap, - int bytes, int transient) +static bool osc_enter_cache_try(struct client_obd *cli, + struct osc_async_page *oap, + int bytes, int transient) { - int rc; - OSC_DUMP_GRANT(D_CACHE, cli, "need:%d\n", bytes); - rc = osc_reserve_grant(cli, bytes); - if (rc < 0) - return 0; + if (osc_reserve_grant(cli, bytes) < 0) + return false; if (cli->cl_dirty_pages < cli->cl_dirty_max_pages && atomic_long_read(&obd_dirty_pages) + 1 <= obd_max_dirty_pages) { @@ -1553,12 +1550,11 @@ static int osc_enter_cache_try(struct client_obd *cli, atomic_long_inc(&obd_dirty_transit_pages); oap->oap_brw_flags |= OBD_BRW_NOCACHE; } - rc = 1; + return true; } else { __osc_unreserve_grant(cli, bytes, bytes); - rc = 0; + return false; } - return rc; } static int ocw_granted(struct client_obd *cli, struct osc_cache_waiter *ocw) @@ -2457,12 +2453,12 @@ int osc_queue_async_io(const struct lu_env *env, struct cl_io *io, /* it doesn't need any grant to dirty this page */ spin_lock(&cli->cl_loi_list_lock); - rc = osc_enter_cache_try(cli, oap, grants, 0); - spin_unlock(&cli->cl_loi_list_lock); - if (rc == 0) { /* try failed */ + if (!osc_enter_cache_try(cli, oap, grants, 0)) { grants = 0; need_release = 1; - } else if (ext->oe_end < index) { + } + spin_unlock(&cli->cl_loi_list_lock); + if (!need_release && ext->oe_end < index) { tmp = grants; /* try to expand this extent */ rc = osc_extent_expand(ext, index, &tmp); From neilb at suse.com Wed Jan 9 06:24:02 2019 From: neilb at suse.com (NeilBrown) Date: Wed, 09 Jan 2019 17:24:02 +1100 Subject: [lustre-devel] [PATCH 14/29] lustre: osc_cache: convert cl_cache_waiters to a wait_queue. In-Reply-To: <154701488711.26726.17363928508883972338.stgit@noble> References: <154701488711.26726.17363928508883972338.stgit@noble> Message-ID: <154701504196.26726.10177553592840024331.stgit@noble> cli->cl_cache_waiters is a list of tasks that need to be woken when grant-space becomes available. This means it is acting much like a wait queue. So let's change it to really be a wait queue. The current implementation adds new waiters to the end of the list, and calls osc_enter_cache_try() on each in order. We can provide the same behaviour by using an exclusive wait, and having each waiter wake the next task when it succeeds. If a waiter notices that success has become impossible, it wakes all other waiters. If a waiter times out, it doesn't wake other - just leaves them to time out themselves. Note that the old code handled -EINTR from the wait function. That is not a possible return value when wait_event_idle* is used, so that case is discarded. For all this to work, we need a wait_event_idle_exclusive_timeout_cmd() macro. This fits the pattern of other macros in wait.h, and can be moved to wait.h when this code lands in mainline. Signed-off-by: NeilBrown --- drivers/staging/lustre/lustre/include/obd.h | 2 drivers/staging/lustre/lustre/ldlm/ldlm_lib.c | 2 drivers/staging/lustre/lustre/osc/osc_cache.c | 145 ++++++++-------------- drivers/staging/lustre/lustre/osc/osc_internal.h | 12 +- drivers/staging/lustre/lustre/osc/osc_page.c | 2 5 files changed, 57 insertions(+), 106 deletions(-) diff --git a/drivers/staging/lustre/lustre/include/obd.h b/drivers/staging/lustre/lustre/include/obd.h index d6a968ceb274..bb6f3e1fce6e 100644 --- a/drivers/staging/lustre/lustre/include/obd.h +++ b/drivers/staging/lustre/lustre/include/obd.h @@ -209,7 +209,7 @@ struct client_obd { * See osc_{reserve|unreserve}_grant for details. */ long cl_reserved_grant; - struct list_head cl_cache_waiters; /* waiting for cache/grant */ + wait_queue_head_t cl_cache_waiters; /* waiting for cache/grant */ unsigned long cl_next_shrink_grant; /* jiffies */ struct list_head cl_grant_shrink_list; /* Timeout event list */ int cl_grant_shrink_interval; /* seconds */ diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_lib.c b/drivers/staging/lustre/lustre/ldlm/ldlm_lib.c index 732ef3a64c72..609b9d04eb40 100644 --- a/drivers/staging/lustre/lustre/ldlm/ldlm_lib.c +++ b/drivers/staging/lustre/lustre/ldlm/ldlm_lib.c @@ -323,7 +323,7 @@ int client_obd_setup(struct obd_device *obddev, struct lustre_cfg *lcfg) * ptlrpc_connect_interpret(). */ client_adjust_max_dirty(cli); - INIT_LIST_HEAD(&cli->cl_cache_waiters); + init_waitqueue_head(&cli->cl_cache_waiters); INIT_LIST_HEAD(&cli->cl_loi_ready_list); INIT_LIST_HEAD(&cli->cl_loi_hp_ready_list); INIT_LIST_HEAD(&cli->cl_loi_write_list); diff --git a/drivers/staging/lustre/lustre/osc/osc_cache.c b/drivers/staging/lustre/lustre/osc/osc_cache.c index e9987c187ecd..ddfb61502f30 100644 --- a/drivers/staging/lustre/lustre/osc/osc_cache.c +++ b/drivers/staging/lustre/lustre/osc/osc_cache.c @@ -1557,15 +1557,22 @@ static bool osc_enter_cache_try(struct client_obd *cli, } } -static int ocw_granted(struct client_obd *cli, struct osc_cache_waiter *ocw) -{ - int rc; - - spin_lock(&cli->cl_loi_list_lock); - rc = list_empty(&ocw->ocw_entry); - spin_unlock(&cli->cl_loi_list_lock); - return rc; -} +#define __wait_event_idle_exclusive_timeout_cmd(wq_head, condition, \ + timeout, cmd1, cmd2) \ + ___wait_event(wq_head, ___wait_cond_timeout(condition), \ + TASK_IDLE, 1, timeout, \ + cmd1; __ret = schedule_timeout(__ret); cmd2) + +#define wait_event_idle_exclusive_timeout_cmd(wq_head, condition, timeout,\ + cmd1, cmd2) \ +({ \ + long __ret = timeout; \ + might_sleep(); \ + if (!___wait_cond_timeout(condition)) \ + __ret = __wait_event_idle_exclusive_timeout_cmd( \ + wq_head, condition, timeout, cmd1, cmd2); \ + __ret; \ +}) /** * The main entry to reserve dirty page accounting. Usually the grant reserved @@ -1579,9 +1586,10 @@ static int osc_enter_cache(const struct lu_env *env, struct client_obd *cli, { struct osc_object *osc = oap->oap_obj; struct lov_oinfo *loi = osc->oo_oinfo; - struct osc_cache_waiter ocw; unsigned long timeout = (AT_OFF ? obd_timeout : at_max) * HZ; int rc = -EDQUOT; + int remain; + bool entered = false; OSC_DUMP_GRANT(D_CACHE, cli, "need:%d\n", bytes); @@ -1598,107 +1606,54 @@ static int osc_enter_cache(const struct lu_env *env, struct client_obd *cli, goto out; } - /* Hopefully normal case - cache space and write credits available */ - if (osc_enter_cache_try(cli, oap, bytes, 0)) { - OSC_DUMP_GRANT(D_CACHE, cli, "granted from cache\n"); - rc = 0; - goto out; - } - - /* We can get here for two reasons: too many dirty pages in cache, or + /* + * We can wait here for two reasons: too many dirty pages in cache, or * run out of grants. In both cases we should write dirty pages out. * Adding a cache waiter will trigger urgent write-out no matter what * RPC size will be. - * The exiting condition is no avail grants and no dirty pages caching, - * that really means there is no space on the OST. + * The exiting condition (other then success) is no avail grants + * and no dirty pages caching, that really means there is no space + * on the OST. */ - init_waitqueue_head(&ocw.ocw_waitq); - ocw.ocw_oap = oap; - ocw.ocw_grant = bytes; - while (cli->cl_dirty_pages > 0 || cli->cl_w_in_flight > 0) { - list_add_tail(&ocw.ocw_entry, &cli->cl_cache_waiters); - ocw.ocw_rc = 0; - spin_unlock(&cli->cl_loi_list_lock); + remain = wait_event_idle_exclusive_timeout_cmd( + cli->cl_cache_waiters, + (entered = osc_enter_cache_try( + cli, oap, bytes, 0)) || + (cli->cl_dirty_pages == 0 && + cli->cl_w_in_flight == 0), + timeout, + spin_unlock(&cli->cl_loi_list_lock); osc_io_unplug_async(env, cli, NULL); - - CDEBUG(D_CACHE, "%s: sleeping for cache space @ %p for %p\n", - cli_name(cli), &ocw, oap); - - rc = wait_event_idle_timeout(ocw.ocw_waitq, - ocw_granted(cli, &ocw), timeout); - - spin_lock(&cli->cl_loi_list_lock); - - if (rc == 0) { - /* wait_event is interrupted by signal, or timed out */ - list_del_init(&ocw.ocw_entry); - rc = -ETIMEDOUT; - break; - } - LASSERT(list_empty(&ocw.ocw_entry)); - rc = ocw.ocw_rc; - - if (rc != -EDQUOT) - break; - if (osc_enter_cache_try(cli, oap, bytes, 0)) { - rc = 0; - break; - } - } - - switch (rc) { - case 0: - OSC_DUMP_GRANT(D_CACHE, cli, "finally got grant space\n"); - break; - case -ETIMEDOUT: + CDEBUG(D_CACHE, + "%s: sleeping for cache space for %p\n", + cli_name(cli), oap); + , + spin_lock(&cli->cl_loi_list_lock)); + + if (entered) { + if (remain == timeout) + OSC_DUMP_GRANT(D_CACHE, cli, "granted from cache\n"); + else + OSC_DUMP_GRANT(D_CACHE, cli, + "finally got grant space\n"); + wake_up(&cli->cl_cache_waiters); + rc = 0; + } else if (remain == 0) { OSC_DUMP_GRANT(D_CACHE, cli, "timeout, fall back to sync i/o\n"); osc_extent_tree_dump(D_CACHE, osc); /* fall back to synchronous I/O */ - rc = -EDQUOT; - break; - case -EINTR: - /* Ensures restartability - LU-3581 */ - OSC_DUMP_GRANT(D_CACHE, cli, "interrupted\n"); - rc = -ERESTARTSYS; - break; - case -EDQUOT: + } else { OSC_DUMP_GRANT(D_CACHE, cli, "no grant space, fall back to sync i/o\n"); - break; - default: - CDEBUG(D_CACHE, "%s: event for cache space @ %p never arrived due to %d, fall back to sync i/o\n", - cli_name(cli), &ocw, rc); - break; + wake_up_all(&cli->cl_cache_waiters); } out: spin_unlock(&cli->cl_loi_list_lock); return rc; } -/* caller must hold loi_list_lock */ -void osc_wake_cache_waiters(struct client_obd *cli) -{ - struct osc_cache_waiter *ocw; - - while ((ocw = list_first_entry_or_null(&cli->cl_cache_waiters, - struct osc_cache_waiter, - ocw_entry))) { - list_del_init(&ocw->ocw_entry); - - if (osc_enter_cache_try(cli, ocw->ocw_oap, ocw->ocw_grant, 0)) - ocw->ocw_rc = 0; - else - ocw->ocw_rc = -EDQUOT; - - CDEBUG(D_CACHE, "wake up %p for oap %p, avail grant %ld, %d\n", - ocw, ocw->ocw_oap, cli->cl_avail_grant, ocw->ocw_rc); - - wake_up(&ocw->ocw_waitq); - } -} - static int osc_max_rpc_in_flight(struct client_obd *cli, struct osc_object *osc) { int hprpc = !!list_empty(&osc->oo_hp_exts); @@ -1742,7 +1697,7 @@ static int osc_makes_rpc(struct client_obd *cli, struct osc_object *osc, * waiting for space. as they're waiting, they're not going to * create more pages to coalesce with what's waiting.. */ - if (!list_empty(&cli->cl_cache_waiters)) { + if (waitqueue_active(&cli->cl_cache_waiters)) { CDEBUG(D_CACHE, "cache waiters forcing RPC\n"); return 1; } @@ -2219,7 +2174,7 @@ static struct osc_object *osc_next_obj(struct client_obd *cli) * have filled up the cache and not been fired into rpcs because * they don't pass the nr_pending/object threshold */ - if (!list_empty(&cli->cl_cache_waiters) && + if (waitqueue_active(&cli->cl_cache_waiters) && !list_empty(&cli->cl_loi_write_list)) return list_to_obj(&cli->cl_loi_write_list, write_item); diff --git a/drivers/staging/lustre/lustre/osc/osc_internal.h b/drivers/staging/lustre/lustre/osc/osc_internal.h index 0de8a3ee826d..0354272fe192 100644 --- a/drivers/staging/lustre/lustre/osc/osc_internal.h +++ b/drivers/staging/lustre/lustre/osc/osc_internal.h @@ -87,15 +87,11 @@ static inline struct osc_async_page *brw_page2oap(struct brw_page *pga) return container_of(pga, struct osc_async_page, oap_brw_page); } -struct osc_cache_waiter { - struct list_head ocw_entry; - wait_queue_head_t ocw_waitq; - struct osc_async_page *ocw_oap; - int ocw_grant; - int ocw_rc; -}; +static inline void osc_wake_cache_waiters(struct client_obd *cli) +{ + wake_up(&cli->cl_cache_waiters); +} -void osc_wake_cache_waiters(struct client_obd *cli); int osc_shrink_grant_to_target(struct client_obd *cli, __u64 target_bytes); void osc_update_next_shrink(struct client_obd *cli); diff --git a/drivers/staging/lustre/lustre/osc/osc_page.c b/drivers/staging/lustre/lustre/osc/osc_page.c index ada1eda24614..28b12729d7e9 100644 --- a/drivers/staging/lustre/lustre/osc/osc_page.c +++ b/drivers/staging/lustre/lustre/osc/osc_page.c @@ -155,7 +155,7 @@ static int osc_page_print(const struct lu_env *env, cli->cl_r_in_flight, cli->cl_w_in_flight, cli->cl_max_rpcs_in_flight, cli->cl_avail_grant, - osc_list(&cli->cl_cache_waiters), + waitqueue_active(&cli->cl_cache_waiters) ? "+" : "-", osc_list(&cli->cl_loi_ready_list), osc_list(&cli->cl_loi_hp_ready_list), osc_list(&cli->cl_loi_write_list), From neilb at suse.com Wed Jan 9 06:24:02 2019 From: neilb at suse.com (NeilBrown) Date: Wed, 09 Jan 2019 17:24:02 +1100 Subject: [lustre-devel] [PATCH 15/29] lustre: osc_cache: change osc_make_rpc() to return bool. In-Reply-To: <154701488711.26726.17363928508883972338.stgit@noble> References: <154701488711.26726.17363928508883972338.stgit@noble> Message-ID: <154701504202.26726.9471170836147674405.stgit@noble> 'bool' more accurately reflects the nature of this function. Signed-off-by: NeilBrown --- drivers/staging/lustre/lustre/osc/osc_cache.c | 28 +++++++++++++------------ 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/drivers/staging/lustre/lustre/osc/osc_cache.c b/drivers/staging/lustre/lustre/osc/osc_cache.c index ddfb61502f30..9b78562d3366 100644 --- a/drivers/staging/lustre/lustre/osc/osc_cache.c +++ b/drivers/staging/lustre/lustre/osc/osc_cache.c @@ -1665,10 +1665,10 @@ static int osc_max_rpc_in_flight(struct client_obd *cli, struct osc_object *osc) * (lop). This is used by osc_check_rpcs->osc_next_obj() and osc_list_maint() * to quickly find objects that are ready to send an RPC. */ -static int osc_makes_rpc(struct client_obd *cli, struct osc_object *osc, - int cmd) +static bool osc_makes_rpc(struct client_obd *cli, struct osc_object *osc, + int cmd) { - int invalid_import = 0; + bool invalid_import = false; /* if we have an invalid import we want to drain the queued pages * by forcing them through rpcs that immediately fail and complete @@ -1676,22 +1676,22 @@ static int osc_makes_rpc(struct client_obd *cli, struct osc_object *osc, * before canceling the locks and evicting down the llite pages */ if (!cli->cl_import || cli->cl_import->imp_invalid) - invalid_import = 1; + invalid_import = true; if (cmd & OBD_BRW_WRITE) { if (atomic_read(&osc->oo_nr_writes) == 0) - return 0; + return false; if (invalid_import) { CDEBUG(D_CACHE, "invalid import forcing RPC\n"); - return 1; + return true; } if (!list_empty(&osc->oo_hp_exts)) { CDEBUG(D_CACHE, "high prio request forcing RPC\n"); - return 1; + return true; } if (!list_empty(&osc->oo_urgent_exts)) { CDEBUG(D_CACHE, "urgent request forcing RPC\n"); - return 1; + return true; } /* trigger a write rpc stream as long as there are dirtiers * waiting for space. as they're waiting, they're not going to @@ -1699,25 +1699,25 @@ static int osc_makes_rpc(struct client_obd *cli, struct osc_object *osc, */ if (waitqueue_active(&cli->cl_cache_waiters)) { CDEBUG(D_CACHE, "cache waiters forcing RPC\n"); - return 1; + return true; } if (!list_empty(&osc->oo_full_exts)) { CDEBUG(D_CACHE, "full extent ready, make an RPC\n"); - return 1; + return true; } } else { if (atomic_read(&osc->oo_nr_reads) == 0) - return 0; + return false; if (invalid_import) { CDEBUG(D_CACHE, "invalid import forcing RPC\n"); - return 1; + return true; } /* all read are urgent. */ if (!list_empty(&osc->oo_reading_exts)) - return 1; + return true; } - return 0; + return false; } static void osc_update_pending(struct osc_object *obj, int cmd, int delta) From neilb at suse.com Wed Jan 9 06:24:02 2019 From: neilb at suse.com (NeilBrown) Date: Wed, 09 Jan 2019 17:24:02 +1100 Subject: [lustre-devel] [PATCH 16/29] lustre: osc_cache: use osc_makes_hprpc() more consistently. In-Reply-To: <154701488711.26726.17363928508883972338.stgit@noble> References: <154701488711.26726.17363928508883972338.stgit@noble> Message-ID: <154701504207.26726.261002093793293176.stgit@noble> We have a function "osc_makes_hprpc()", and a few places that could use it, but instead open-code the content. Move the function earlier, and use it more broadly. Signed-off-by: NeilBrown --- drivers/staging/lustre/lustre/osc/osc_cache.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/staging/lustre/lustre/osc/osc_cache.c b/drivers/staging/lustre/lustre/osc/osc_cache.c index 9b78562d3366..d2d5867156ad 100644 --- a/drivers/staging/lustre/lustre/osc/osc_cache.c +++ b/drivers/staging/lustre/lustre/osc/osc_cache.c @@ -1654,9 +1654,14 @@ static int osc_enter_cache(const struct lu_env *env, struct client_obd *cli, return rc; } +static int osc_makes_hprpc(struct osc_object *obj) +{ + return !list_empty(&obj->oo_hp_exts); +} + static int osc_max_rpc_in_flight(struct client_obd *cli, struct osc_object *osc) { - int hprpc = !!list_empty(&osc->oo_hp_exts); + int hprpc = !osc_makes_hprpc(osc); return rpcs_in_flight(cli) >= cli->cl_max_rpcs_in_flight + hprpc; } @@ -1685,7 +1690,7 @@ static bool osc_makes_rpc(struct client_obd *cli, struct osc_object *osc, CDEBUG(D_CACHE, "invalid import forcing RPC\n"); return true; } - if (!list_empty(&osc->oo_hp_exts)) { + if (osc_makes_hprpc(osc)) { CDEBUG(D_CACHE, "high prio request forcing RPC\n"); return true; } @@ -1736,11 +1741,6 @@ static void osc_update_pending(struct osc_object *obj, int cmd, int delta) OSC_IO_DEBUG(obj, "update pending cmd %d delta %d.\n", cmd, delta); } -static int osc_makes_hprpc(struct osc_object *obj) -{ - return !list_empty(&obj->oo_hp_exts); -} - static void on_list(struct list_head *item, struct list_head *list, int should_be_on) { if (list_empty(item) && should_be_on) From neilb at suse.com Wed Jan 9 06:24:02 2019 From: neilb at suse.com (NeilBrown) Date: Wed, 09 Jan 2019 17:24:02 +1100 Subject: [lustre-devel] [PATCH 17/29] lustre: osc_cache: simplify list walk in get_write_extents(). In-Reply-To: <154701488711.26726.17363928508883972338.stgit@noble> References: <154701488711.26726.17363928508883972338.stgit@noble> Message-ID: <154701504211.26726.81439906958866826.stgit@noble> This iteration is exactly what list_first_entry_or_null() is for. Signed-off-by: NeilBrown --- drivers/staging/lustre/lustre/osc/osc_cache.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/lustre/lustre/osc/osc_cache.c b/drivers/staging/lustre/lustre/osc/osc_cache.c index d2d5867156ad..14e6efb4b80b 100644 --- a/drivers/staging/lustre/lustre/osc/osc_cache.c +++ b/drivers/staging/lustre/lustre/osc/osc_cache.c @@ -1982,9 +1982,9 @@ static unsigned int get_write_extents(struct osc_object *obj, }; assert_osc_object_is_locked(obj); - while (!list_empty(&obj->oo_hp_exts)) { - ext = list_entry(obj->oo_hp_exts.next, struct osc_extent, - oe_link); + while ((ext = list_first_entry_or_null(&obj->oo_hp_exts, + struct osc_extent, + oe_link))) { LASSERT(ext->oe_state == OES_CACHE); if (!try_to_add_extent_for_io(cli, ext, &data)) return data.erd_page_count; From neilb at suse.com Wed Jan 9 06:24:02 2019 From: neilb at suse.com (NeilBrown) Date: Wed, 09 Jan 2019 17:24:02 +1100 Subject: [lustre-devel] [PATCH 18/29] lustre: osc_cache: avoid unnecessary tests. In-Reply-To: <154701488711.26726.17363928508883972338.stgit@noble> References: <154701488711.26726.17363928508883972338.stgit@noble> Message-ID: <154701504226.26726.13771066469284363266.stgit@noble> These tests (have we reached page limit) are not necessary, as the next call to try_to_add_extent_for_io() will perform the same test, and fail if necessary. Having the tests don't add any clarity to the code, and are unlikely to help performance as they are likely to fail more often than they succeed. So discard them. Signed-off-by: NeilBrown --- drivers/staging/lustre/lustre/osc/osc_cache.c | 6 ------ 1 file changed, 6 deletions(-) diff --git a/drivers/staging/lustre/lustre/osc/osc_cache.c b/drivers/staging/lustre/lustre/osc/osc_cache.c index 14e6efb4b80b..5666f384ac6c 100644 --- a/drivers/staging/lustre/lustre/osc/osc_cache.c +++ b/drivers/staging/lustre/lustre/osc/osc_cache.c @@ -1990,8 +1990,6 @@ static unsigned int get_write_extents(struct osc_object *obj, return data.erd_page_count; EASSERT(ext->oe_nr_pages <= data.erd_max_pages, ext); } - if (data.erd_page_count == data.erd_max_pages) - return data.erd_page_count; while (!list_empty(&obj->oo_urgent_exts)) { ext = list_entry(obj->oo_urgent_exts.next, @@ -1999,8 +1997,6 @@ static unsigned int get_write_extents(struct osc_object *obj, if (!try_to_add_extent_for_io(cli, ext, &data)) return data.erd_page_count; } - if (data.erd_page_count == data.erd_max_pages) - return data.erd_page_count; /* * One key difference between full extents and other extents: full @@ -2015,8 +2011,6 @@ static unsigned int get_write_extents(struct osc_object *obj, if (!try_to_add_extent_for_io(cli, ext, &data)) break; } - if (data.erd_page_count == data.erd_max_pages) - return data.erd_page_count; ext = first_extent(obj); while (ext) { From neilb at suse.com Wed Jan 9 06:24:02 2019 From: neilb at suse.com (NeilBrown) Date: Wed, 09 Jan 2019 17:24:02 +1100 Subject: [lustre-devel] [PATCH 19/29] lustre: osc_cache: convert while to for in get_write_extents() In-Reply-To: <154701488711.26726.17363928508883972338.stgit@noble> References: <154701488711.26726.17363928508883972338.stgit@noble> Message-ID: <154701504232.26726.5168102908572630267.stgit@noble> This 'while' loop is really a 'for' loop in disguise. So change it to 'for'. Signed-off-by: NeilBrown --- drivers/staging/lustre/lustre/osc/osc_cache.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/drivers/staging/lustre/lustre/osc/osc_cache.c b/drivers/staging/lustre/lustre/osc/osc_cache.c index 5666f384ac6c..db28cc4d5ae8 100644 --- a/drivers/staging/lustre/lustre/osc/osc_cache.c +++ b/drivers/staging/lustre/lustre/osc/osc_cache.c @@ -2012,19 +2012,16 @@ static unsigned int get_write_extents(struct osc_object *obj, break; } - ext = first_extent(obj); - while (ext) { + for (ext = first_extent(obj); + ext; + ext = next_extent(ext)) { if ((ext->oe_state != OES_CACHE) || /* this extent may be already in current rpclist */ - (!list_empty(&ext->oe_link) && ext->oe_owner)) { - ext = next_extent(ext); + (!list_empty(&ext->oe_link) && ext->oe_owner)) continue; - } if (!try_to_add_extent_for_io(cli, ext, &data)) return data.erd_page_count; - - ext = next_extent(ext); } return data.erd_page_count; } From neilb at suse.com Wed Jan 9 06:24:02 2019 From: neilb at suse.com (NeilBrown) Date: Wed, 09 Jan 2019 17:24:02 +1100 Subject: [lustre-devel] [PATCH 20/29] lustre: osc_cache: don't drop a lock we didn't take. In-Reply-To: <154701488711.26726.17363928508883972338.stgit@noble> References: <154701488711.26726.17363928508883972338.stgit@noble> Message-ID: <154701504236.26726.14318399777937714593.stgit@noble> Dropping a lock in a function which didn't take the lock is best avoided as it makes it difficult to understand the code. Sometimes it is unavoidable, but not in this case. There is very little code in the (only) calling function which is also locked, so we can move that code into the called function, and then just take the lock inside the called function - the same function which drops it. Signed-off-by: NeilBrown --- drivers/staging/lustre/lustre/osc/osc_cache.c | 78 ++++++++++++------------- 1 file changed, 38 insertions(+), 40 deletions(-) diff --git a/drivers/staging/lustre/lustre/osc/osc_cache.c b/drivers/staging/lustre/lustre/osc/osc_cache.c index db28cc4d5ae8..863884cac028 100644 --- a/drivers/staging/lustre/lustre/osc/osc_cache.c +++ b/drivers/staging/lustre/lustre/osc/osc_cache.c @@ -2029,7 +2029,6 @@ static unsigned int get_write_extents(struct osc_object *obj, static int osc_send_write_rpc(const struct lu_env *env, struct client_obd *cli, struct osc_object *osc) - __must_hold(osc) { LIST_HEAD(rpclist); struct osc_extent *ext; @@ -2039,13 +2038,16 @@ osc_send_write_rpc(const struct lu_env *env, struct client_obd *cli, int srvlock = 0; int rc = 0; - assert_osc_object_is_locked(osc); + osc_object_lock(osc); + if (osc_makes_rpc(cli, osc, OBD_BRW_WRITE)) + page_count = get_write_extents(osc, &rpclist); - page_count = get_write_extents(osc, &rpclist); LASSERT(equi(page_count == 0, list_empty(&rpclist))); - if (list_empty(&rpclist)) + if (list_empty(&rpclist)) { + osc_object_unlock(osc); return 0; + } osc_update_pending(osc, OBD_BRW_WRITE, -page_count); @@ -2086,7 +2088,6 @@ osc_send_write_rpc(const struct lu_env *env, struct client_obd *cli, LASSERT(list_empty(&rpclist)); } - osc_object_lock(osc); return rc; } @@ -2103,7 +2104,6 @@ osc_send_write_rpc(const struct lu_env *env, struct client_obd *cli, static int osc_send_read_rpc(const struct lu_env *env, struct client_obd *cli, struct osc_object *osc) - __must_hold(osc) { struct osc_extent *ext; struct osc_extent *next; @@ -2117,7 +2117,12 @@ osc_send_read_rpc(const struct lu_env *env, struct client_obd *cli, }; int rc = 0; - assert_osc_object_is_locked(osc); + osc_object_lock(osc); + if (!osc_makes_rpc(cli, osc, OBD_BRW_READ)) { + osc_object_unlock(osc); + return rc; + } + list_for_each_entry_safe(ext, next, &osc->oo_reading_exts, oe_link) { EASSERT(ext->oe_state == OES_LOCK_DONE, ext); if (!try_to_add_extent_for_io(cli, ext, &data)) @@ -2129,13 +2134,12 @@ osc_send_read_rpc(const struct lu_env *env, struct client_obd *cli, osc_update_pending(osc, OBD_BRW_READ, -data.erd_page_count); + osc_object_unlock(osc); if (!list_empty(&rpclist)) { - osc_object_unlock(osc); rc = osc_build_rpc(env, cli, &rpclist, OBD_BRW_READ); LASSERT(list_empty(&rpclist)); - osc_object_lock(osc); } return rc; } @@ -2210,38 +2214,32 @@ static void osc_check_rpcs(const struct lu_env *env, struct client_obd *cli) * partial read pending queue when we're given this object to * do io on writes while there are cache waiters */ - osc_object_lock(osc); - if (osc_makes_rpc(cli, osc, OBD_BRW_WRITE)) { - rc = osc_send_write_rpc(env, cli, osc); - if (rc < 0) { - CERROR("Write request failed with %d\n", rc); - - /* osc_send_write_rpc failed, mostly because of - * memory pressure. - * - * It can't break here, because if: - * - a page was submitted by osc_io_submit, so - * page locked; - * - no request in flight - * - no subsequent request - * The system will be in live-lock state, - * because there is no chance to call - * osc_io_unplug() and osc_check_rpcs() any - * more. pdflush can't help in this case, - * because it might be blocked at grabbing - * the page lock as we mentioned. - * - * Anyway, continue to drain pages. - */ - /* break; */ - } - } - if (osc_makes_rpc(cli, osc, OBD_BRW_READ)) { - rc = osc_send_read_rpc(env, cli, osc); - if (rc < 0) - CERROR("Read request failed with %d\n", rc); + rc = osc_send_write_rpc(env, cli, osc); + if (rc < 0) { + CERROR("Write request failed with %d\n", rc); + + /* osc_send_write_rpc failed, mostly because of + * memory pressure. + * + * It can't break here, because if: + * - a page was submitted by osc_io_submit, so + * page locked; + * - no request in flight + * - no subsequent request + * The system will be in live-lock state, + * because there is no chance to call + * osc_io_unplug() and osc_check_rpcs() any + * more. pdflush can't help in this case, + * because it might be blocked at grabbing + * the page lock as we mentioned. + * + * Anyway, continue to drain pages. + */ + /* break; */ } - osc_object_unlock(osc); + rc = osc_send_read_rpc(env, cli, osc); + if (rc < 0) + CERROR("Read request failed with %d\n", rc); osc_list_maint(cli, osc); lu_object_ref_del_at(&obj->co_lu, &link, "check", current); From neilb at suse.com Wed Jan 9 06:24:02 2019 From: neilb at suse.com (NeilBrown) Date: Wed, 09 Jan 2019 17:24:02 +1100 Subject: [lustre-devel] [PATCH 21/29] lustre: osc_cache: don't drop a lock we didn't take - two In-Reply-To: <154701488711.26726.17363928508883972338.stgit@noble> References: <154701488711.26726.17363928508883972338.stgit@noble> Message-ID: <154701504241.26726.16825256312797481549.stgit@noble> osc_check_rpcs() drops a lock that it was called with, which can make it harder to understand the code. It is only called from one place, and that places takes the lock just to all this function. So instead, take the lock at the start of the function, and drop it at the end. This makes the code easier to follow. Signed-off-by: NeilBrown --- drivers/staging/lustre/lustre/osc/osc_cache.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/staging/lustre/lustre/osc/osc_cache.c b/drivers/staging/lustre/lustre/osc/osc_cache.c index 863884cac028..b2ad6a15014e 100644 --- a/drivers/staging/lustre/lustre/osc/osc_cache.c +++ b/drivers/staging/lustre/lustre/osc/osc_cache.c @@ -2187,11 +2187,11 @@ static struct osc_object *osc_next_obj(struct client_obd *cli) /* called with the loi list lock held */ static void osc_check_rpcs(const struct lu_env *env, struct client_obd *cli) - __must_hold(&cli->cl_loi_list_lock) { struct osc_object *osc; int rc = 0; + spin_lock(&cli->cl_loi_list_lock); while ((osc = osc_next_obj(cli)) != NULL) { struct cl_object *obj = osc2cl(osc); struct lu_ref_link link; @@ -2247,6 +2247,7 @@ static void osc_check_rpcs(const struct lu_env *env, struct client_obd *cli) spin_lock(&cli->cl_loi_list_lock); } + spin_unlock(&cli->cl_loi_list_lock); } static int osc_io_unplug0(const struct lu_env *env, struct client_obd *cli, @@ -2258,9 +2259,7 @@ static int osc_io_unplug0(const struct lu_env *env, struct client_obd *cli, return 0; if (!async) { - spin_lock(&cli->cl_loi_list_lock); osc_check_rpcs(env, cli); - spin_unlock(&cli->cl_loi_list_lock); } else { CDEBUG(D_CACHE, "Queue writeback work for client %p.\n", cli); LASSERT(cli->cl_writeback_work); From neilb at suse.com Wed Jan 9 06:24:02 2019 From: neilb at suse.com (NeilBrown) Date: Wed, 09 Jan 2019 17:24:02 +1100 Subject: [lustre-devel] [PATCH 22/29] lustre: osc_cache: osc_prep_async_page() has meaningless return In-Reply-To: <154701488711.26726.17363928508883972338.stgit@noble> References: <154701488711.26726.17363928508883972338.stgit@noble> Message-ID: <154701504248.26726.14014358069894794630.stgit@noble> osc_prep_async_page() is only called by osc_page_init(), which immediately returns any non-zero return value. osc_page_init is a ->coo_page_init() function, only called by cl_page_alloc(), which treats any non-zero return as a negative error number. So osc_prep_async_page() must return 0 or a negative error. Currently it can return cfs_size_round(sizeof(*oap)) which is either of those. Presumably this condition never happens, so the return value is irrelevant. We could make it an LASSERT(), but it is safer to just return an generic error. So make it return -EIO; Signed-off-by: NeilBrown --- drivers/staging/lustre/lustre/osc/osc_cache.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/lustre/lustre/osc/osc_cache.c b/drivers/staging/lustre/lustre/osc/osc_cache.c index b2ad6a15014e..8a68d3eb9314 100644 --- a/drivers/staging/lustre/lustre/osc/osc_cache.c +++ b/drivers/staging/lustre/lustre/osc/osc_cache.c @@ -2287,7 +2287,7 @@ int osc_prep_async_page(struct osc_object *osc, struct osc_page *ops, struct osc_async_page *oap = &ops->ops_oap; if (!page) - return cfs_size_round(sizeof(*oap)); + return -EIO; oap->oap_magic = OAP_MAGIC; oap->oap_cli = &exp->exp_obd->u.cli; From neilb at suse.com Wed Jan 9 06:24:02 2019 From: neilb at suse.com (NeilBrown) Date: Wed, 09 Jan 2019 17:24:02 +1100 Subject: [lustre-devel] [PATCH 23/29] lustre: osc_cache: remove 'transient' arg from osc_enter_cache_try In-Reply-To: <154701488711.26726.17363928508883972338.stgit@noble> References: <154701488711.26726.17363928508883972338.stgit@noble> Message-ID: <154701504254.26726.7702205638412400024.stgit@noble> This arg is always '0', so remove it. Signed-off-by: NeilBrown --- drivers/staging/lustre/lustre/osc/osc_cache.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/drivers/staging/lustre/lustre/osc/osc_cache.c b/drivers/staging/lustre/lustre/osc/osc_cache.c index 8a68d3eb9314..b4bb36926046 100644 --- a/drivers/staging/lustre/lustre/osc/osc_cache.c +++ b/drivers/staging/lustre/lustre/osc/osc_cache.c @@ -1535,7 +1535,7 @@ static void osc_exit_cache(struct client_obd *cli, struct osc_async_page *oap) */ static bool osc_enter_cache_try(struct client_obd *cli, struct osc_async_page *oap, - int bytes, int transient) + int bytes) { OSC_DUMP_GRANT(D_CACHE, cli, "need:%d\n", bytes); @@ -1545,11 +1545,6 @@ static bool osc_enter_cache_try(struct client_obd *cli, if (cli->cl_dirty_pages < cli->cl_dirty_max_pages && atomic_long_read(&obd_dirty_pages) + 1 <= obd_max_dirty_pages) { osc_consume_write_grant(cli, &oap->oap_brw_page); - if (transient) { - cli->cl_dirty_transit++; - atomic_long_inc(&obd_dirty_transit_pages); - oap->oap_brw_flags |= OBD_BRW_NOCACHE; - } return true; } else { __osc_unreserve_grant(cli, bytes, bytes); @@ -1618,7 +1613,7 @@ static int osc_enter_cache(const struct lu_env *env, struct client_obd *cli, remain = wait_event_idle_exclusive_timeout_cmd( cli->cl_cache_waiters, (entered = osc_enter_cache_try( - cli, oap, bytes, 0)) || + cli, oap, bytes)) || (cli->cl_dirty_pages == 0 && cli->cl_w_in_flight == 0), timeout, @@ -2396,7 +2391,7 @@ int osc_queue_async_io(const struct lu_env *env, struct cl_io *io, /* it doesn't need any grant to dirty this page */ spin_lock(&cli->cl_loi_list_lock); - if (!osc_enter_cache_try(cli, oap, grants, 0)) { + if (!osc_enter_cache_try(cli, oap, grants)) { grants = 0; need_release = 1; } From neilb at suse.com Wed Jan 9 06:24:02 2019 From: neilb at suse.com (NeilBrown) Date: Wed, 09 Jan 2019 17:24:02 +1100 Subject: [lustre-devel] [PATCH 24/29] lustre: osc_cache: change need_release to bool In-Reply-To: <154701488711.26726.17363928508883972338.stgit@noble> References: <154701488711.26726.17363928508883972338.stgit@noble> Message-ID: <154701504259.26726.10938592737685333082.stgit@noble> This variable is used like a bool, so declare it as one. Signed-off-by: NeilBrown --- drivers/staging/lustre/lustre/osc/osc_cache.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/staging/lustre/lustre/osc/osc_cache.c b/drivers/staging/lustre/lustre/osc/osc_cache.c index b4bb36926046..1476f84e6156 100644 --- a/drivers/staging/lustre/lustre/osc/osc_cache.c +++ b/drivers/staging/lustre/lustre/osc/osc_cache.c @@ -2316,7 +2316,7 @@ int osc_queue_async_io(const struct lu_env *env, struct cl_io *io, unsigned int grants = 0, tmp; int brw_flags = OBD_BRW_ASYNC; int cmd = OBD_BRW_WRITE; - int need_release = 0; + bool need_release = false; int rc = 0; if (oap->oap_magic != OAP_MAGIC) @@ -2393,7 +2393,7 @@ int osc_queue_async_io(const struct lu_env *env, struct cl_io *io, spin_lock(&cli->cl_loi_list_lock); if (!osc_enter_cache_try(cli, oap, grants)) { grants = 0; - need_release = 1; + need_release = true; } spin_unlock(&cli->cl_loi_list_lock); if (!need_release && ext->oe_end < index) { @@ -2401,7 +2401,7 @@ int osc_queue_async_io(const struct lu_env *env, struct cl_io *io, /* try to expand this extent */ rc = osc_extent_expand(ext, index, &tmp); if (rc < 0) { - need_release = 1; + need_release = true; /* don't free reserved grant */ } else { OSC_EXTENT_DUMP(D_CACHE, ext, @@ -2413,7 +2413,7 @@ int osc_queue_async_io(const struct lu_env *env, struct cl_io *io, rc = 0; } else if (ext) { /* index is located outside of active extent */ - need_release = 1; + need_release = true; } if (need_release) { osc_extent_release(env, ext); From neilb at suse.com Wed Jan 9 06:24:02 2019 From: neilb at suse.com (NeilBrown) Date: Wed, 09 Jan 2019 17:24:02 +1100 Subject: [lustre-devel] [PATCH 25/29] lustre: remove cl_page_cancel() In-Reply-To: <154701488711.26726.17363928508883972338.stgit@noble> References: <154701488711.26726.17363928508883972338.stgit@noble> Message-ID: <154701504264.26726.17608454548660581136.stgit@noble> cl_page_cancel() is never used, so remove it and various other things that it is the only user of. Signed-off-by: NeilBrown --- drivers/staging/lustre/lustre/include/cl_object.h | 18 ----- drivers/staging/lustre/lustre/include/lustre_net.h | 1 drivers/staging/lustre/lustre/obdclass/cl_page.c | 20 ------ drivers/staging/lustre/lustre/osc/osc_cache.c | 67 -------------------- .../staging/lustre/lustre/osc/osc_cl_internal.h | 1 drivers/staging/lustre/lustre/osc/osc_internal.h | 1 drivers/staging/lustre/lustre/osc/osc_page.c | 20 ------ drivers/staging/lustre/lustre/osc/osc_request.c | 9 --- drivers/staging/lustre/lustre/ptlrpc/client.c | 15 +--- 9 files changed, 4 insertions(+), 148 deletions(-) diff --git a/drivers/staging/lustre/lustre/include/cl_object.h b/drivers/staging/lustre/lustre/include/cl_object.h index a1e07f8b5eda..de5d68879740 100644 --- a/drivers/staging/lustre/lustre/include/cl_object.h +++ b/drivers/staging/lustre/lustre/include/cl_object.h @@ -969,23 +969,6 @@ struct cl_page_operations { void (*cpo_clip)(const struct lu_env *env, const struct cl_page_slice *slice, int from, int to); - /** - * \pre the page was queued for transferring. - * \post page is removed from client's pending list, or -EBUSY - * is returned if it has already been in transferring. - * - * This is one of seldom page operation which is: - * 0. called from top level; - * 1. don't have vmpage locked; - * 2. every layer should synchronize execution of its ->cpo_cancel() - * with completion handlers. Osc uses client obd lock for this - * purpose. Based on there is no vvp_page_cancel and - * lov_page_cancel(), cpo_cancel is defacto protected by client lock. - * - * \see osc_page_cancel(). - */ - int (*cpo_cancel)(const struct lu_env *env, - const struct cl_page_slice *slice); /** * Write out a page by kernel. This is only called by ll_writepage * right now. @@ -2159,7 +2142,6 @@ int cl_page_cache_add(const struct lu_env *env, struct cl_io *io, struct cl_page *pg, enum cl_req_type crt); void cl_page_clip(const struct lu_env *env, struct cl_page *pg, int from, int to); -int cl_page_cancel(const struct lu_env *env, struct cl_page *page); int cl_page_flush(const struct lu_env *env, struct cl_io *io, struct cl_page *pg); diff --git a/drivers/staging/lustre/lustre/include/lustre_net.h b/drivers/staging/lustre/lustre/include/lustre_net.h index 468a03edefd9..6d328b48a96b 100644 --- a/drivers/staging/lustre/lustre/include/lustre_net.h +++ b/drivers/staging/lustre/lustre/include/lustre_net.h @@ -1830,7 +1830,6 @@ struct ptlrpc_request_set *ptlrpc_prep_fcset(int max, set_producer_func func, void *arg); int ptlrpc_check_set(const struct lu_env *env, struct ptlrpc_request_set *set); int ptlrpc_set_wait(struct ptlrpc_request_set *); -void ptlrpc_mark_interrupted(struct ptlrpc_request *req); void ptlrpc_set_destroy(struct ptlrpc_request_set *); void ptlrpc_set_add_req(struct ptlrpc_request_set *, struct ptlrpc_request *); diff --git a/drivers/staging/lustre/lustre/obdclass/cl_page.c b/drivers/staging/lustre/lustre/obdclass/cl_page.c index 00df94b87606..217a5ebe1691 100644 --- a/drivers/staging/lustre/lustre/obdclass/cl_page.c +++ b/drivers/staging/lustre/lustre/obdclass/cl_page.c @@ -932,26 +932,6 @@ void cl_page_print(const struct lu_env *env, void *cookie, } EXPORT_SYMBOL(cl_page_print); -/** - * Cancel a page which is still in a transfer. - */ -int cl_page_cancel(const struct lu_env *env, struct cl_page *page) -{ - const struct cl_page_slice *slice; - int result = 0; - - list_for_each_entry(slice, &page->cp_layers, cpl_linkage) { - if (slice->cpl_ops->cpo_cancel) - result = (*slice->cpl_ops->cpo_cancel)(env, slice); - if (result != 0) - break; - } - if (result > 0) - result = 0; - - return result; -} - /** * Converts a byte offset within object \a obj into a page index. */ diff --git a/drivers/staging/lustre/lustre/osc/osc_cache.c b/drivers/staging/lustre/lustre/osc/osc_cache.c index 1476f84e6156..79bcaa212339 100644 --- a/drivers/staging/lustre/lustre/osc/osc_cache.c +++ b/drivers/staging/lustre/lustre/osc/osc_cache.c @@ -1822,7 +1822,6 @@ static void osc_ap_completion(const struct lu_env *env, struct client_obd *cli, spin_lock(&oap->oap_lock); oap->oap_async_flags = 0; spin_unlock(&oap->oap_lock); - oap->oap_interrupted = 0; if (oap->oap_cmd & OBD_BRW_WRITE && xid > 0) { spin_lock(&cli->cl_loi_list_lock); @@ -2591,72 +2590,6 @@ int osc_flush_async_page(const struct lu_env *env, struct cl_io *io, return rc; } -/** - * this is called when a sync waiter receives an interruption. Its job is to - * get the caller woken as soon as possible. If its page hasn't been put in an - * rpc yet it can dequeue immediately. Otherwise it has to mark the rpc as - * desiring interruption which will forcefully complete the rpc once the rpc - * has timed out. - */ -int osc_cancel_async_page(const struct lu_env *env, struct osc_page *ops) -{ - struct osc_async_page *oap = &ops->ops_oap; - struct osc_object *obj = oap->oap_obj; - struct client_obd *cli = osc_cli(obj); - struct osc_extent *ext; - struct osc_extent *found = NULL; - struct list_head *plist; - pgoff_t index = osc_index(ops); - int rc = -EBUSY; - int cmd; - - LASSERT(!oap->oap_interrupted); - oap->oap_interrupted = 1; - - /* Find out the caching extent */ - osc_object_lock(obj); - if (oap->oap_cmd & OBD_BRW_WRITE) { - plist = &obj->oo_urgent_exts; - cmd = OBD_BRW_WRITE; - } else { - plist = &obj->oo_reading_exts; - cmd = OBD_BRW_READ; - } - list_for_each_entry(ext, plist, oe_link) { - if (ext->oe_start <= index && ext->oe_end >= index) { - LASSERT(ext->oe_state == OES_LOCK_DONE); - /* For OES_LOCK_DONE state extent, it has already held - * a refcount for RPC. - */ - found = osc_extent_get(ext); - break; - } - } - if (found) { - list_del_init(&found->oe_link); - osc_update_pending(obj, cmd, -found->oe_nr_pages); - osc_object_unlock(obj); - - osc_extent_finish(env, found, 0, -EINTR); - osc_extent_put(env, found); - rc = 0; - } else { - osc_object_unlock(obj); - /* ok, it's been put in an rpc. only one oap gets a request - * reference - */ - if (oap->oap_request) { - ptlrpc_mark_interrupted(oap->oap_request); - ptlrpcd_wake(oap->oap_request); - ptlrpc_req_finished(oap->oap_request); - oap->oap_request = NULL; - } - } - - osc_list_maint(cli, obj); - return rc; -} - int osc_queue_sync_pages(const struct lu_env *env, struct osc_object *obj, struct list_head *list, int cmd, int brw_flags) { diff --git a/drivers/staging/lustre/lustre/osc/osc_cl_internal.h b/drivers/staging/lustre/lustre/osc/osc_cl_internal.h index b1a1d241cc6c..3af096e0dbdd 100644 --- a/drivers/staging/lustre/lustre/osc/osc_cl_internal.h +++ b/drivers/staging/lustre/lustre/osc/osc_cl_internal.h @@ -380,7 +380,6 @@ int osc_lvb_print(const struct lu_env *env, void *cookie, void osc_lru_add_batch(struct client_obd *cli, struct list_head *list); void osc_page_submit(const struct lu_env *env, struct osc_page *opg, enum cl_req_type crt, int brw_flags); -int osc_cancel_async_page(const struct lu_env *env, struct osc_page *ops); int osc_set_async_flags(struct osc_object *obj, struct osc_page *opg, u32 async_flags); int osc_prep_async_page(struct osc_object *osc, struct osc_page *ops, diff --git a/drivers/staging/lustre/lustre/osc/osc_internal.h b/drivers/staging/lustre/lustre/osc/osc_internal.h index 0354272fe192..586f0dfe3790 100644 --- a/drivers/staging/lustre/lustre/osc/osc_internal.h +++ b/drivers/staging/lustre/lustre/osc/osc_internal.h @@ -60,7 +60,6 @@ enum async_flags { struct osc_async_page { int oap_magic; unsigned short oap_cmd; - unsigned short oap_interrupted:1; struct list_head oap_pending_item; struct list_head oap_rpc_item; diff --git a/drivers/staging/lustre/lustre/osc/osc_page.c b/drivers/staging/lustre/lustre/osc/osc_page.c index 28b12729d7e9..e0187fafcc37 100644 --- a/drivers/staging/lustre/lustre/osc/osc_page.c +++ b/drivers/staging/lustre/lustre/osc/osc_page.c @@ -137,11 +137,10 @@ static int osc_page_print(const struct lu_env *env, struct osc_object *obj = cl2osc(slice->cpl_obj); struct client_obd *cli = &osc_export(obj)->exp_obd->u.cli; - return (*printer)(env, cookie, LUSTRE_OSC_NAME "-page@%p %lu: 1< %#x %d %u %s %s > 2< %llu %u %u %#x %#x | %p %p %p > 3< %d %lu %d > 4< %d %d %d %lu %s | %s %s %s %s > 5< %s %s %s %s | %d %s | %d %s %s>\n", + return (*printer)(env, cookie, LUSTRE_OSC_NAME "-page@%p %lu: 1< %#x %d %s %s > 2< %llu %u %u %#x %#x | %p %p %p > 3< %d %lu %d > 4< %d %d %d %lu %s | %s %s %s %s > 5< %s %s %s %s | %d %s | %d %s %s>\n", opg, osc_index(opg), /* 1 */ oap->oap_magic, oap->oap_cmd, - oap->oap_interrupted, osc_list(&oap->oap_pending_item), osc_list(&oap->oap_rpc_item), /* 2 */ @@ -216,22 +215,6 @@ static void osc_page_clip(const struct lu_env *env, spin_unlock(&oap->oap_lock); } -static int osc_page_cancel(const struct lu_env *env, - const struct cl_page_slice *slice) -{ - struct osc_page *opg = cl2osc_page(slice); - int rc = 0; - - /* Check if the transferring against this page - * is completed, or not even queued. - */ - if (opg->ops_transfer_pinned) - /* FIXME: may not be interrupted.. */ - rc = osc_cancel_async_page(env, opg); - LASSERT(ergo(rc == 0, opg->ops_transfer_pinned == 0)); - return rc; -} - static int osc_page_flush(const struct lu_env *env, const struct cl_page_slice *slice, struct cl_io *io) @@ -247,7 +230,6 @@ static const struct cl_page_operations osc_page_ops = { .cpo_print = osc_page_print, .cpo_delete = osc_page_delete, .cpo_clip = osc_page_clip, - .cpo_cancel = osc_page_cancel, .cpo_flush = osc_page_flush }; diff --git a/drivers/staging/lustre/lustre/osc/osc_request.c b/drivers/staging/lustre/lustre/osc/osc_request.c index b28fbacbcfbf..ccc491efa982 100644 --- a/drivers/staging/lustre/lustre/osc/osc_request.c +++ b/drivers/staging/lustre/lustre/osc/osc_request.c @@ -1635,10 +1635,6 @@ static int osc_brw_redo_request(struct ptlrpc_request *request, LASSERTF(request == oap->oap_request, "request %p != oap_request %p\n", request, oap->oap_request); - if (oap->oap_interrupted) { - ptlrpc_req_finished(new_req); - return -EINTR; - } } } /* New request takes over pga and oaps from old request. @@ -1879,7 +1875,6 @@ int osc_build_rpc(const struct lu_env *env, struct client_obd *cli, int mem_tight = 0; int page_count = 0; bool soft_sync = false; - bool interrupted = false; int grant = 0; int i; int rc; @@ -1937,8 +1932,6 @@ int osc_build_rpc(const struct lu_env *env, struct client_obd *cli, else LASSERT(oap->oap_page_off + oap->oap_count == PAGE_SIZE); - if (oap->oap_interrupted) - interrupted = true; } } @@ -1968,8 +1961,6 @@ int osc_build_rpc(const struct lu_env *env, struct client_obd *cli, req->rq_memalloc = mem_tight != 0; oap->oap_request = ptlrpc_request_addref(req); - if (interrupted && !req->rq_intr) - ptlrpc_mark_interrupted(req); /* Need to update the timestamps after the request is built in case * we race with setattr (locally or in queue at OST). If OST gets diff --git a/drivers/staging/lustre/lustre/ptlrpc/client.c b/drivers/staging/lustre/lustre/ptlrpc/client.c index 8fafc8dc3f57..f90a3eef5daf 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/client.c +++ b/drivers/staging/lustre/lustre/ptlrpc/client.c @@ -2148,17 +2148,6 @@ void ptlrpc_expired_set(struct ptlrpc_request_set *set) } } -/** - * Sets rq_intr flag in \a req under spinlock. - */ -void ptlrpc_mark_interrupted(struct ptlrpc_request *req) -{ - spin_lock(&req->rq_lock); - req->rq_intr = 1; - spin_unlock(&req->rq_lock); -} -EXPORT_SYMBOL(ptlrpc_mark_interrupted); - /** * Interrupts (sets interrupted flag) all uncompleted requests in * a set \a data. Called when l_wait_event_abortable_timeout receives signal. @@ -2174,7 +2163,9 @@ static void ptlrpc_interrupted_set(struct ptlrpc_request_set *set) req->rq_phase != RQ_PHASE_UNREG_RPC) continue; - ptlrpc_mark_interrupted(req); + spin_lock(&req->rq_lock); + req->rq_intr = 1; + spin_unlock(&req->rq_lock); } } From neilb at suse.com Wed Jan 9 06:24:02 2019 From: neilb at suse.com (NeilBrown) Date: Wed, 09 Jan 2019 17:24:02 +1100 Subject: [lustre-devel] [PATCH 26/29] lustre: osc_cache: simplify osc_page_gang_lookup() In-Reply-To: <154701488711.26726.17363928508883972338.stgit@noble> References: <154701488711.26726.17363928508883972338.stgit@noble> Message-ID: <154701504269.26726.8061168646539306509.stgit@noble> osc_page_gang_lookup() has 4 values that it can receive from a callback, and that it can return to the caller: CLP_GANG_OKAY, CLP_GANG_RESCHED, CLP_GANG_AGAIN, CLP_GANG_ABORT "AGAIN" is never used. "RESCHED" is not needed as a cond_resched() can safely be called at the point this is returned, rather than returning it. That leaves "OKAY" and "ABORT" which can simply by "true" and "false" boolean values. Internalizing the RESCHED case means the callers don't need to loop themselves. This simplify calling patterns. Signed-off-by: NeilBrown --- drivers/staging/lustre/lustre/include/cl_object.h | 7 ---- drivers/staging/lustre/lustre/osc/osc_cache.c | 40 ++++++++------------ .../staging/lustre/lustre/osc/osc_cl_internal.h | 10 +++-- drivers/staging/lustre/lustre/osc/osc_io.c | 4 +- drivers/staging/lustre/lustre/osc/osc_lock.c | 27 ++++++-------- 5 files changed, 33 insertions(+), 55 deletions(-) diff --git a/drivers/staging/lustre/lustre/include/cl_object.h b/drivers/staging/lustre/lustre/include/cl_object.h index de5d68879740..57d8fe676995 100644 --- a/drivers/staging/lustre/lustre/include/cl_object.h +++ b/drivers/staging/lustre/lustre/include/cl_object.h @@ -2076,14 +2076,7 @@ static inline int cl_object_refc(struct cl_object *clob) /** \defgroup cl_page cl_page * @{ */ -enum { - CLP_GANG_OKAY = 0, - CLP_GANG_RESCHED, - CLP_GANG_AGAIN, - CLP_GANG_ABORT -}; -/* callback of cl_page_gang_lookup() */ struct cl_page *cl_page_find(const struct lu_env *env, struct cl_object *obj, pgoff_t idx, struct page *vmpage, enum cl_page_type type); diff --git a/drivers/staging/lustre/lustre/osc/osc_cache.c b/drivers/staging/lustre/lustre/osc/osc_cache.c index 79bcaa212339..e01f3815978c 100644 --- a/drivers/staging/lustre/lustre/osc/osc_cache.c +++ b/drivers/staging/lustre/lustre/osc/osc_cache.c @@ -2994,18 +2994,14 @@ int osc_cache_writeback_range(const struct lu_env *env, struct osc_object *obj, /** * Returns a list of pages by a given [start, end] of \a obj. * - * \param resched If not NULL, then we give up before hogging CPU for too - * long and set *resched = 1, in that case caller should implement a retry - * logic. - * * Gang tree lookup (radix_tree_gang_lookup()) optimization is absolutely * crucial in the face of [offset, EOF] locks. * * Return at least one page in @queue unless there is no covered page. */ -int osc_page_gang_lookup(const struct lu_env *env, struct cl_io *io, - struct osc_object *osc, pgoff_t start, pgoff_t end, - osc_page_gang_cbt cb, void *cbdata) +bool osc_page_gang_lookup(const struct lu_env *env, struct cl_io *io, + struct osc_object *osc, pgoff_t start, pgoff_t end, + osc_page_gang_cbt cb, void *cbdata) { struct osc_page *ops; void **pvec; @@ -3013,7 +3009,7 @@ int osc_page_gang_lookup(const struct lu_env *env, struct cl_io *io, unsigned int nr; unsigned int i; unsigned int j; - int res = CLP_GANG_OKAY; + bool res = true; bool tree_lock = true; idx = start; @@ -3059,7 +3055,7 @@ int osc_page_gang_lookup(const struct lu_env *env, struct cl_io *io, for (i = 0; i < j; ++i) { ops = pvec[i]; - if (res == CLP_GANG_OKAY) + if (res) res = (*cb)(env, io, ops, cbdata); page = ops->ops_cl.cpl_page; @@ -3069,10 +3065,10 @@ int osc_page_gang_lookup(const struct lu_env *env, struct cl_io *io, if (nr < OTI_PVEC_SIZE || end_of_region) break; - if (res == CLP_GANG_OKAY && need_resched()) - res = CLP_GANG_RESCHED; - if (res != CLP_GANG_OKAY) + if (!res) break; + if (need_resched()) + cond_resched(); spin_lock(&osc->oo_tree_lock); tree_lock = true; @@ -3085,7 +3081,7 @@ int osc_page_gang_lookup(const struct lu_env *env, struct cl_io *io, /** * Check if page @page is covered by an extra lock or discard it. */ -static int check_and_discard_cb(const struct lu_env *env, struct cl_io *io, +static bool check_and_discard_cb(const struct lu_env *env, struct cl_io *io, struct osc_page *ops, void *cbdata) { struct osc_thread_info *info = osc_env_info(env); @@ -3121,10 +3117,10 @@ static int check_and_discard_cb(const struct lu_env *env, struct cl_io *io, } info->oti_next_index = index + 1; - return CLP_GANG_OKAY; + return true; } -static int discard_cb(const struct lu_env *env, struct cl_io *io, +static bool discard_cb(const struct lu_env *env, struct cl_io *io, struct osc_page *ops, void *cbdata) { struct osc_thread_info *info = osc_env_info(env); @@ -3145,7 +3141,7 @@ static int discard_cb(const struct lu_env *env, struct cl_io *io, LASSERT(page->cp_state == CPS_FREEING); } - return CLP_GANG_OKAY; + return true; } /** @@ -3162,7 +3158,7 @@ int osc_lock_discard_pages(const struct lu_env *env, struct osc_object *osc, struct osc_thread_info *info = osc_env_info(env); struct cl_io *io = &info->oti_io; osc_page_gang_cbt cb; - int res; + bool res; int result; io->ci_obj = cl_object_top(osc2cl(osc)); @@ -3174,15 +3170,9 @@ int osc_lock_discard_pages(const struct lu_env *env, struct osc_object *osc, cb = discard ? discard_cb : check_and_discard_cb; info->oti_fn_index = start; info->oti_next_index = start; - do { - res = osc_page_gang_lookup(env, io, osc, - info->oti_next_index, end, cb, osc); - if (info->oti_next_index > end) - break; - if (res == CLP_GANG_RESCHED) - cond_resched(); - } while (res != CLP_GANG_OKAY); + res = osc_page_gang_lookup(env, io, osc, + info->oti_next_index, end, cb, osc); out: cl_io_fini(env, io); return result; diff --git a/drivers/staging/lustre/lustre/osc/osc_cl_internal.h b/drivers/staging/lustre/lustre/osc/osc_cl_internal.h index 3af096e0dbdd..c0f58f41513f 100644 --- a/drivers/staging/lustre/lustre/osc/osc_cl_internal.h +++ b/drivers/staging/lustre/lustre/osc/osc_cl_internal.h @@ -660,11 +660,11 @@ void osc_extent_release(const struct lu_env *env, struct osc_extent *ext); int osc_lock_discard_pages(const struct lu_env *env, struct osc_object *osc, pgoff_t start, pgoff_t end, bool discard_pages); -typedef int (*osc_page_gang_cbt)(const struct lu_env *, struct cl_io *, - struct osc_page *, void *); -int osc_page_gang_lookup(const struct lu_env *env, struct cl_io *io, - struct osc_object *osc, pgoff_t start, pgoff_t end, - osc_page_gang_cbt cb, void *cbdata); +typedef bool (*osc_page_gang_cbt)(const struct lu_env *, struct cl_io *, + struct osc_page *, void *); +bool osc_page_gang_lookup(const struct lu_env *env, struct cl_io *io, + struct osc_object *osc, pgoff_t start, pgoff_t end, + osc_page_gang_cbt cb, void *cbdata); /* @} osc */ #endif /* OSC_CL_INTERNAL_H */ diff --git a/drivers/staging/lustre/lustre/osc/osc_io.c b/drivers/staging/lustre/lustre/osc/osc_io.c index dabdf6da8b38..b95e0358d7ff 100644 --- a/drivers/staging/lustre/lustre/osc/osc_io.c +++ b/drivers/staging/lustre/lustre/osc/osc_io.c @@ -449,7 +449,7 @@ static int osc_async_upcall(void *a, int rc) /** * Checks that there are no pages being written in the extent being truncated. */ -static int trunc_check_cb(const struct lu_env *env, struct cl_io *io, +static bool trunc_check_cb(const struct lu_env *env, struct cl_io *io, struct osc_page *ops, void *cbdata) { struct cl_page *page = ops->ops_cl.cpl_page; @@ -466,7 +466,7 @@ static int trunc_check_cb(const struct lu_env *env, struct cl_io *io, CDEBUG(D_CACHE, "page %p index %lu locked for %d.\n", ops, osc_index(ops), oap->oap_cmd & OBD_BRW_RWMASK); - return CLP_GANG_OKAY; + return true; } static void osc_trunc_check(const struct lu_env *env, struct cl_io *io, diff --git a/drivers/staging/lustre/lustre/osc/osc_lock.c b/drivers/staging/lustre/lustre/osc/osc_lock.c index 4cc813d192d9..1eab61d720e2 100644 --- a/drivers/staging/lustre/lustre/osc/osc_lock.c +++ b/drivers/staging/lustre/lustre/osc/osc_lock.c @@ -630,18 +630,18 @@ static int osc_ldlm_glimpse_ast(struct ldlm_lock *dlmlock, void *data) return result; } -static int weigh_cb(const struct lu_env *env, struct cl_io *io, - struct osc_page *ops, void *cbdata) +static bool weigh_cb(const struct lu_env *env, struct cl_io *io, + struct osc_page *ops, void *cbdata) { struct cl_page *page = ops->ops_cl.cpl_page; if (cl_page_is_vmlocked(env, page) || PageDirty(page->cp_vmpage) || PageWriteback(page->cp_vmpage) ) - return CLP_GANG_ABORT; + return false; *(pgoff_t *)cbdata = osc_index(ops) + 1; - return CLP_GANG_OKAY; + return true; } static unsigned long osc_lock_weight(const struct lu_env *env, @@ -651,7 +651,7 @@ static unsigned long osc_lock_weight(const struct lu_env *env, struct cl_io *io = &osc_env_info(env)->oti_io; struct cl_object *obj = cl_object_top(&oscobj->oo_cl); pgoff_t page_index; - int result; + bool result; io->ci_obj = obj; io->ci_ignore_layout = 1; @@ -660,19 +660,14 @@ static unsigned long osc_lock_weight(const struct lu_env *env, return result; page_index = cl_index(obj, extent->start); - do { - result = osc_page_gang_lookup(env, io, oscobj, - page_index, - cl_index(obj, extent->end), - weigh_cb, (void *)&page_index); - if (result == CLP_GANG_ABORT) - break; - if (result == CLP_GANG_RESCHED) - cond_resched(); - } while (result != CLP_GANG_OKAY); + + result = osc_page_gang_lookup(env, io, oscobj, + page_index, + cl_index(obj, extent->end), + weigh_cb, (void *)&page_index); cl_io_fini(env, io); - return result == CLP_GANG_ABORT ? 1 : 0; + return result ? 1 : 0; } /** From neilb at suse.com Wed Jan 9 06:24:02 2019 From: neilb at suse.com (NeilBrown) Date: Wed, 09 Jan 2019 17:24:02 +1100 Subject: [lustre-devel] [PATCH 27/29] lustre: osc_cache: white-space and other checkpatch fixes. In-Reply-To: <154701488711.26726.17363928508883972338.stgit@noble> References: <154701488711.26726.17363928508883972338.stgit@noble> Message-ID: <154701504274.26726.6932313520085605572.stgit@noble> Assorted minor checkpatch issues fixed. Signed-off-by: NeilBrown --- drivers/staging/lustre/lustre/osc/osc_cache.c | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/drivers/staging/lustre/lustre/osc/osc_cache.c b/drivers/staging/lustre/lustre/osc/osc_cache.c index e01f3815978c..019854b78277 100644 --- a/drivers/staging/lustre/lustre/osc/osc_cache.c +++ b/drivers/staging/lustre/lustre/osc/osc_cache.c @@ -101,7 +101,7 @@ static inline char list_empty_marker(struct list_head *list) #define EXTSTR "[%lu -> %lu/%lu]" #define EXTPARA(ext) (ext)->oe_start, (ext)->oe_end, (ext)->oe_max_end -static const char *oes_strings[] = { +static const char * const oes_strings[] = { "inv", "active", "cache", "locking", "lockdone", "rpc", "trunc", NULL }; #define OSC_EXTENT_DUMP(lvl, extent, fmt, ...) do { \ @@ -668,7 +668,7 @@ static struct osc_extent *osc_extent_find(const struct lu_env *env, unsigned int *grants) { struct client_obd *cli = osc_cli(obj); - struct osc_lock *olck; + struct osc_lock *olck; struct cl_lock_descr *descr; struct osc_extent *cur; struct osc_extent *ext; @@ -962,7 +962,6 @@ static int osc_extent_wait(const struct lu_env *env, struct osc_extent *ext, wait_event_idle(ext->oe_waitq, smp_load_acquire(&ext->oe_state) == state); - } return ext->oe_rc < 0 ? ext->oe_rc : 0; } @@ -1020,7 +1019,8 @@ static int osc_extent_truncate(struct osc_extent *ext, pgoff_t trunc_index, if (index < trunc_index || (index == trunc_index && partial)) { /* accounting how many pages remaining in the chunk - * so that we can calculate grants correctly. */ + * so that we can calculate grants correctly. + */ if (index >> ppc_bits == trunc_chunk) ++pages_in_chunk; continue; @@ -1141,7 +1141,8 @@ static int osc_extent_make_ready(const struct lu_env *env, * the size of file. */ if (!(last->oap_async_flags & ASYNC_COUNT_STABLE)) { - int last_oap_count = osc_refresh_count(env, last, OBD_BRW_WRITE); + int last_oap_count = osc_refresh_count(env, last, + OBD_BRW_WRITE); LASSERT(last_oap_count > 0); LASSERT(last->oap_page_off + last_oap_count <= PAGE_SIZE); @@ -1337,7 +1338,7 @@ static int osc_completion(const struct lu_env *env, struct osc_async_page *oap, int cmd, int rc) { struct osc_page *opg = oap2osc_page(oap); - struct cl_page *page = oap2cl_page(oap); + struct cl_page *page = oap2cl_page(oap); enum cl_req_type crt; int srvlock; @@ -1736,7 +1737,8 @@ static void osc_update_pending(struct osc_object *obj, int cmd, int delta) OSC_IO_DEBUG(obj, "update pending cmd %d delta %d.\n", cmd, delta); } -static void on_list(struct list_head *item, struct list_head *list, int should_be_on) +static void on_list(struct list_head *item, struct list_head *list, + int should_be_on) { if (list_empty(item) && should_be_on) list_add_tail(item, list); @@ -1898,7 +1900,8 @@ static int try_to_add_extent_for_io(struct client_obd *cli, oap_pending_item); EASSERT(tmp->oe_owner == current, tmp); if (oap2cl_page(oap)->cp_type != oap2cl_page(oap2)->cp_type) { - CDEBUG(D_CACHE, "Do not permit different type of IO in one RPC\n"); + CDEBUG(D_CACHE, + "Do not permit different type of IO in one RPC\n"); return 0; } @@ -2130,10 +2133,8 @@ osc_send_read_rpc(const struct lu_env *env, struct client_obd *cli, osc_object_unlock(osc); if (!list_empty(&rpclist)) { - rc = osc_build_rpc(env, cli, &rpclist, OBD_BRW_READ); LASSERT(list_empty(&rpclist)); - } return rc; } @@ -3082,7 +3083,7 @@ bool osc_page_gang_lookup(const struct lu_env *env, struct cl_io *io, * Check if page @page is covered by an extra lock or discard it. */ static bool check_and_discard_cb(const struct lu_env *env, struct cl_io *io, - struct osc_page *ops, void *cbdata) + struct osc_page *ops, void *cbdata) { struct osc_thread_info *info = osc_env_info(env); struct osc_object *osc = cbdata; @@ -3121,7 +3122,7 @@ static bool check_and_discard_cb(const struct lu_env *env, struct cl_io *io, } static bool discard_cb(const struct lu_env *env, struct cl_io *io, - struct osc_page *ops, void *cbdata) + struct osc_page *ops, void *cbdata) { struct osc_thread_info *info = osc_env_info(env); struct cl_page *page = ops->ops_cl.cpl_page; From neilb at suse.com Wed Jan 9 06:24:02 2019 From: neilb at suse.com (NeilBrown) Date: Wed, 09 Jan 2019 17:24:02 +1100 Subject: [lustre-devel] [PATCH 28/29] lustre: osc_request: assorted white-space and check-patch fixes. In-Reply-To: <154701488711.26726.17363928508883972338.stgit@noble> References: <154701488711.26726.17363928508883972338.stgit@noble> Message-ID: <154701504282.26726.12048576544354457365.stgit@noble> Just misc formatting fixes. Some minot code change where an 'else' after 'return' was discarded. Signed-off-by: NeilBrown --- drivers/staging/lustre/lustre/osc/osc_request.c | 163 +++++++++++++---------- 1 file changed, 89 insertions(+), 74 deletions(-) diff --git a/drivers/staging/lustre/lustre/osc/osc_request.c b/drivers/staging/lustre/lustre/osc/osc_request.c index ccc491efa982..c2239c99a7b2 100644 --- a/drivers/staging/lustre/lustre/osc/osc_request.c +++ b/drivers/staging/lustre/lustre/osc/osc_request.c @@ -63,37 +63,37 @@ static unsigned int osc_reqpool_mem_max = 5; module_param(osc_reqpool_mem_max, uint, 0444); struct osc_brw_async_args { - struct obdo *aa_oa; - int aa_requested_nob; - int aa_nio_count; - u32 aa_page_count; - int aa_resends; - struct brw_page **aa_ppga; - struct client_obd *aa_cli; - struct list_head aa_oaps; - struct list_head aa_exts; + struct obdo *aa_oa; + int aa_requested_nob; + int aa_nio_count; + u32 aa_page_count; + int aa_resends; + struct brw_page **aa_ppga; + struct client_obd *aa_cli; + struct list_head aa_oaps; + struct list_head aa_exts; }; struct osc_async_args { - struct obd_info *aa_oi; + struct obd_info *aa_oi; }; struct osc_setattr_args { - struct obdo *sa_oa; - obd_enqueue_update_f sa_upcall; - void *sa_cookie; + struct obdo *sa_oa; + obd_enqueue_update_f sa_upcall; + void *sa_cookie; }; struct osc_fsync_args { struct osc_object *fa_obj; struct obdo *fa_oa; - obd_enqueue_update_f fa_upcall; - void *fa_cookie; + obd_enqueue_update_f fa_upcall; + void *fa_cookie; }; struct osc_ladvise_args { struct obdo *la_oa; - obd_enqueue_update_f la_upcall; + obd_enqueue_update_f la_upcall; void *la_cookie; }; @@ -101,12 +101,12 @@ struct osc_enqueue_args { struct obd_export *oa_exp; enum ldlm_type oa_type; enum ldlm_mode oa_mode; - __u64 *oa_flags; + __u64 *oa_flags; osc_enqueue_upcall_f oa_upcall; - void *oa_cookie; - struct ost_lvb *oa_lvb; + void *oa_cookie; + struct ost_lvb *oa_lvb; struct lustre_handle oa_lockh; - unsigned int oa_agl:1; + unsigned int oa_agl:1; }; static void osc_release_ppga(struct brw_page **ppga, u32 count); @@ -331,8 +331,7 @@ int osc_ladvise_base(struct obd_export *exp, struct obdo *oa, body = req_capsule_client_get(&req->rq_pill, &RMF_OST_BODY); LASSERT(body); - lustre_set_wire_obdo(&req->rq_import->imp_connect_data, &body->oa, - oa); + lustre_set_wire_obdo(&req->rq_import->imp_connect_data, &body->oa, oa); req_ladvise_hdr = req_capsule_client_get(&req->rq_pill, &RMF_OST_LADVISE_HDR); @@ -652,8 +651,8 @@ static int osc_destroy(const struct lu_env *env, struct obd_export *exp, * Wait until the number of on-going destroy RPCs drops * under max_rpc_in_flight */ - rc = l_wait_event_abortable_exclusive(cli->cl_destroy_waitq, - osc_can_send_destroy(cli)); + rc = l_wait_event_abortable_exclusive( + cli->cl_destroy_waitq, osc_can_send_destroy(cli)); if (rc) { ptlrpc_req_finished(req); return rc; @@ -716,7 +715,8 @@ static void osc_announce_cached(struct client_obd *cli, struct obdo *oa, * take extent tax into account when asking for more * grant space */ - nrextents = DIV_ROUND_UP(nrpages, cli->cl_max_extent_pages); + nrextents = DIV_ROUND_UP(nrpages, + cli->cl_max_extent_pages); oa->o_undirty += nrextents * cli->cl_grant_extent_tax; } } @@ -930,7 +930,8 @@ static void osc_init_grant(struct client_obd *cli, struct obd_connect_data *ocd) if (OCD_HAS_FLAG(ocd, GRANT_PARAM)) cli->cl_avail_grant -= cli->cl_dirty_grant; else - cli->cl_avail_grant -= cli->cl_dirty_pages << PAGE_SHIFT; + cli->cl_avail_grant -= + cli->cl_dirty_pages << PAGE_SHIFT; } if (OCD_HAS_FLAG(ocd, GRANT_PARAM)) { @@ -1181,11 +1182,12 @@ static int osc_brw_prep_request(int cmd, struct client_obd *cli, */ req->rq_no_retry_einprogress = 1; - desc = ptlrpc_prep_bulk_imp(req, page_count, + desc = ptlrpc_prep_bulk_imp( + req, page_count, cli->cl_import->imp_connect_data.ocd_brw_size >> LNET_MTU_BITS, (opc == OST_WRITE ? PTLRPC_BULK_GET_SOURCE : PTLRPC_BULK_PUT_SINK) | PTLRPC_BULK_BUF_KIOV, OST_BULK_PORTAL, - &ptlrpc_bulk_kiov_pin_ops); + &ptlrpc_bulk_kiov_pin_ops); if (!desc) { rc = -ENOMEM; @@ -1252,7 +1254,8 @@ static int osc_brw_prep_request(int cmd, struct client_obd *cli, "want %p - real %p\n", req_capsule_client_get(&req->rq_pill, &RMF_NIOBUF_REMOTE), (void *)(niobuf - niocount)); - osc_announce_cached(cli, &body->oa, opc == OST_WRITE ? requested_nob:0); + osc_announce_cached(cli, &body->oa, + opc == OST_WRITE ? requested_nob : 0); if (resend) { if ((body->oa.o_valid & OBD_MD_FLFLAGS) == 0) { body->oa.o_valid |= OBD_MD_FLFLAGS; @@ -1436,18 +1439,21 @@ static int check_write_checksum(struct obdo *oa, msg = "changed in transit AND doesn't match the original - likely false positive due to mmap IO (bug 11742)" ; - LCONSOLE_ERROR_MSG(0x132, - "%s: BAD WRITE CHECKSUM: %s: from %s inode " DFID " object " DOSTID " extent [%llu-%llu], original client csum %x (type %x), server csum %x (type %x), client csum now %x\n", - aa->aa_cli->cl_import->imp_obd->obd_name, - msg, libcfs_nid2str(peer->nid), - oa->o_valid & OBD_MD_FLFID ? oa->o_parent_seq : (u64)0, - oa->o_valid & OBD_MD_FLFID ? oa->o_parent_oid : 0, - oa->o_valid & OBD_MD_FLFID ? oa->o_parent_ver : 0, - POSTID(&oa->o_oi), aa->aa_ppga[0]->off, - aa->aa_ppga[aa->aa_page_count - 1]->off + - aa->aa_ppga[aa->aa_page_count - 1]->count - 1, - client_cksum, cksum_type_unpack(aa->aa_oa->o_flags), - server_cksum, cksum_type, new_cksum); + LCONSOLE_ERROR_MSG( + 0x132, + "%s: BAD WRITE CHECKSUM: %s: from %s inode " DFID + " object " DOSTID + " extent [%llu-%llu], original client csum %x (type %x), server csum %x (type %x), client csum now %x\n", + aa->aa_cli->cl_import->imp_obd->obd_name, + msg, libcfs_nid2str(peer->nid), + oa->o_valid & OBD_MD_FLFID ? oa->o_parent_seq : (u64)0, + oa->o_valid & OBD_MD_FLFID ? oa->o_parent_oid : 0, + oa->o_valid & OBD_MD_FLFID ? oa->o_parent_ver : 0, + POSTID(&oa->o_oi), aa->aa_ppga[0]->off, + aa->aa_ppga[aa->aa_page_count - 1]->off + + aa->aa_ppga[aa->aa_page_count - 1]->count - 1, + client_cksum, cksum_type_unpack(aa->aa_oa->o_flags), + server_cksum, cksum_type, new_cksum); return 1; } @@ -1480,7 +1486,8 @@ static int osc_brw_fini_request(struct ptlrpc_request *req, int rc) unsigned int qid[MAXQUOTAS] = { body->oa.o_uid, body->oa.o_gid, body->oa.o_projid }; - CDEBUG(D_QUOTA, "setdq for [%u %u %u] with valid %#llx, flags %x\n", + CDEBUG(D_QUOTA, + "setdq for [%u %u %u] with valid %#llx, flags %x\n", body->oa.o_uid, body->oa.o_gid, body->oa.o_projid, body->oa.o_valid, body->oa.o_flags); osc_quota_setdq(cli, qid, body->oa.o_valid, body->oa.o_flags); @@ -1569,23 +1576,26 @@ static int osc_brw_fini_request(struct ptlrpc_request *req, int rc) aa->aa_ppga, server_cksum, client_cksum); - LCONSOLE_ERROR_MSG(0x133, - "%s: BAD READ CHECKSUM: from %s%s%s inode " DFID " object " DOSTID " extent [%llu-%llu], client %x, server %x, cksum_type %x\n", - req->rq_import->imp_obd->obd_name, - libcfs_nid2str(peer->nid), - via, router, - clbody->oa.o_valid & OBD_MD_FLFID ? - clbody->oa.o_parent_seq : (u64)0, - clbody->oa.o_valid & OBD_MD_FLFID ? - clbody->oa.o_parent_oid : 0, - clbody->oa.o_valid & OBD_MD_FLFID ? - clbody->oa.o_parent_ver : 0, - POSTID(&body->oa.o_oi), - aa->aa_ppga[0]->off, - aa->aa_ppga[page_count - 1]->off + - aa->aa_ppga[page_count - 1]->count - 1, - client_cksum, server_cksum, - cksum_type); + LCONSOLE_ERROR_MSG( + 0x133, + "%s: BAD READ CHECKSUM: from %s%s%s inode " DFID + " object " DOSTID + " extent [%llu-%llu], client %x, server %x, cksum_type %x\n", + req->rq_import->imp_obd->obd_name, + libcfs_nid2str(peer->nid), + via, router, + clbody->oa.o_valid & OBD_MD_FLFID ? + clbody->oa.o_parent_seq : (u64)0, + clbody->oa.o_valid & OBD_MD_FLFID ? + clbody->oa.o_parent_oid : 0, + clbody->oa.o_valid & OBD_MD_FLFID ? + clbody->oa.o_parent_ver : 0, + POSTID(&body->oa.o_oi), + aa->aa_ppga[0]->off, + aa->aa_ppga[page_count - 1]->off + + aa->aa_ppga[page_count - 1]->count - 1, + client_cksum, server_cksum, + cksum_type); cksum_counter = 0; aa->aa_oa->o_cksum = client_cksum; rc = -EAGAIN; @@ -1622,8 +1632,8 @@ static int osc_brw_redo_request(struct ptlrpc_request *request, DEBUG_REQ(rc == -EINPROGRESS ? D_RPCTRACE : D_ERROR, request, "redo for recoverable error %d", rc); - rc = osc_brw_prep_request(lustre_msg_get_opc(request->rq_reqmsg) == - OST_WRITE ? OBD_BRW_WRITE : OBD_BRW_READ, + rc = osc_brw_prep_request((lustre_msg_get_opc(request->rq_reqmsg) == + OST_WRITE) ? OBD_BRW_WRITE : OBD_BRW_READ, aa->aa_cli, aa->aa_oa, aa->aa_page_count, aa->aa_ppga, &new_req, 0, 1); @@ -1648,7 +1658,8 @@ static int osc_brw_redo_request(struct ptlrpc_request *request, * what ptlrpc does (see after_reply()) */ if (aa->aa_resends > new_req->rq_timeout) - new_req->rq_sent = ktime_get_real_seconds() + new_req->rq_timeout; + new_req->rq_sent = (ktime_get_real_seconds() + + new_req->rq_timeout); else new_req->rq_sent = ktime_get_real_seconds() + aa->aa_resends; new_req->rq_generation_set = 1; @@ -1702,7 +1713,8 @@ static void sort_brw_pages(struct brw_page **array, int num) for (i = stride ; i < num ; i++) { tmp = array[i]; j = i; - while (j >= stride && array[j - stride]->off > tmp->off) { + while (j >= stride && + array[j - stride]->off > tmp->off) { array[j] = array[j - stride]; j -= stride; } @@ -1733,7 +1745,9 @@ static int brw_interpret(const struct lu_env *env, if (osc_recoverable_error(rc)) { if (req->rq_import_generation != req->rq_import->imp_generation) { - CDEBUG(D_HA, "%s: resend cross eviction for object: " DOSTID ", rc = %d.\n", + CDEBUG(D_HA, + "%s: resend cross eviction for object: " DOSTID + ", rc = %d.\n", req->rq_import->imp_obd->obd_name, POSTID(&aa->aa_oa->o_oi), rc); } else if (rc == -EINPROGRESS || @@ -2093,7 +2107,6 @@ static int osc_enqueue_interpret(const struct lu_env *env, __u32 lvb_len = sizeof(*lvb); __u64 flags = 0; - /* ldlm_cli_enqueue is holding a reference on the lock, so it must * be valid. */ @@ -2212,7 +2225,8 @@ int osc_enqueue_base(struct obd_export *exp, struct ldlm_res_id *res_id, ldlm_lock_decref(&lockh, mode); LDLM_LOCK_PUT(matched); return -ECANCELED; - } else if (osc_set_lock_data(matched, einfo->ei_cbdata)) { + } + if (osc_set_lock_data(matched, einfo->ei_cbdata)) { *flags |= LDLM_FL_LVB_READY; /* We already have a lock, and it's referenced. */ (*upcall)(cookie, &lockh, ELDLM_LOCK_MATCHED); @@ -2220,10 +2234,9 @@ int osc_enqueue_base(struct obd_export *exp, struct ldlm_res_id *res_id, ldlm_lock_decref(&lockh, mode); LDLM_LOCK_PUT(matched); return ELDLM_OK; - } else { - ldlm_lock_decref(&lockh, mode); - LDLM_LOCK_PUT(matched); } + ldlm_lock_decref(&lockh, mode); + LDLM_LOCK_PUT(matched); } no_match: @@ -2269,9 +2282,9 @@ int osc_enqueue_base(struct obd_export *exp, struct ldlm_res_id *res_id, aa->oa_lvb = lvb; } else { /* AGL is essentially to enqueue an DLM lock - * in advance, so we don't care about the - * result of AGL enqueue. - */ + * in advance, so we don't care about the + * result of AGL enqueue. + */ aa->oa_lvb = NULL; aa->oa_flags = NULL; } @@ -2663,7 +2676,8 @@ static int osc_reconnect(const struct lu_env *env, cli->cl_lost_grant = 0; spin_unlock(&cli->cl_loi_list_lock); - CDEBUG(D_RPCTRACE, "ocd_connect_flags: %#llx ocd_version: %d ocd_grant: %d, lost: %ld.\n", + CDEBUG(D_RPCTRACE, + "ocd_connect_flags: %#llx ocd_version: %d ocd_grant: %d, lost: %ld.\n", data->ocd_connect_flags, data->ocd_version, data->ocd_grant, lost_grant); } @@ -2788,7 +2802,8 @@ static int osc_import_event(struct obd_device *obd, /* See bug 7198 */ if (ocd->ocd_connect_flags & OBD_CONNECT_REQPORTAL) - imp->imp_client->cli_request_portal = OST_REQUEST_PORTAL; + imp->imp_client->cli_request_portal = + OST_REQUEST_PORTAL; rc = obd_notify_observer(obd, obd, OBD_NOTIFY_OCD); break; From neilb at suse.com Wed Jan 9 06:24:03 2019 From: neilb at suse.com (NeilBrown) Date: Wed, 09 Jan 2019 17:24:03 +1100 Subject: [lustre-devel] [PATCH 29/29] lustre: centralize handling of PTLRPCD_SET In-Reply-To: <154701488711.26726.17363928508883972338.stgit@noble> References: <154701488711.26726.17363928508883972338.stgit@noble> Message-ID: <154701504291.26726.3018163382085938859.stgit@noble> Various places test if a given rqset is PTLRPCD_SET and call either ptlrpcd_add_req() or ptlrpc_set_add_req() depending on the result. This can be unified by putting the test of PTLRPCD_SET in ptlrpc_set_add_req(), and always calling that function. This results in the being only one place that tests PTLRPCD_SET. Signed-off-by: NeilBrown --- drivers/staging/lustre/lustre/include/lustre_net.h | 1 + drivers/staging/lustre/lustre/osc/osc_internal.h | 2 - drivers/staging/lustre/lustre/osc/osc_request.c | 27 ++++---------------- drivers/staging/lustre/lustre/ptlrpc/client.c | 5 ++++ 4 files changed, 11 insertions(+), 24 deletions(-) diff --git a/drivers/staging/lustre/lustre/include/lustre_net.h b/drivers/staging/lustre/lustre/include/lustre_net.h index 6d328b48a96b..e665f70e54a8 100644 --- a/drivers/staging/lustre/lustre/include/lustre_net.h +++ b/drivers/staging/lustre/lustre/include/lustre_net.h @@ -1832,6 +1832,7 @@ int ptlrpc_check_set(const struct lu_env *env, struct ptlrpc_request_set *set); int ptlrpc_set_wait(struct ptlrpc_request_set *); void ptlrpc_set_destroy(struct ptlrpc_request_set *); void ptlrpc_set_add_req(struct ptlrpc_request_set *, struct ptlrpc_request *); +#define PTLRPCD_SET ((struct ptlrpc_request_set*)1) void ptlrpc_free_rq_pool(struct ptlrpc_request_pool *pool); int ptlrpc_add_rqs_to_pool(struct ptlrpc_request_pool *pool, int num_rq); diff --git a/drivers/staging/lustre/lustre/osc/osc_internal.h b/drivers/staging/lustre/lustre/osc/osc_internal.h index 586f0dfe3790..c61ef894177b 100644 --- a/drivers/staging/lustre/lustre/osc/osc_internal.h +++ b/drivers/staging/lustre/lustre/osc/osc_internal.h @@ -99,8 +99,6 @@ void osc_update_next_shrink(struct client_obd *cli); */ #include -extern struct ptlrpc_request_set *PTLRPCD_SET; - typedef int (*osc_enqueue_upcall_f)(void *cookie, struct lustre_handle *lockh, int rc); diff --git a/drivers/staging/lustre/lustre/osc/osc_request.c b/drivers/staging/lustre/lustre/osc/osc_request.c index c2239c99a7b2..87cc8c72f6e6 100644 --- a/drivers/staging/lustre/lustre/osc/osc_request.c +++ b/drivers/staging/lustre/lustre/osc/osc_request.c @@ -266,10 +266,7 @@ int osc_setattr_async(struct obd_export *exp, struct obdo *oa, sa->sa_upcall = upcall; sa->sa_cookie = cookie; - if (rqset == PTLRPCD_SET) - ptlrpcd_add_req(req); - else - ptlrpc_set_add_req(rqset, req); + ptlrpc_set_add_req(rqset, req); } return 0; @@ -354,10 +351,7 @@ int osc_ladvise_base(struct obd_export *exp, struct obdo *oa, la->la_upcall = upcall; la->la_cookie = cookie; - if (rqset == PTLRPCD_SET) - ptlrpcd_add_req(req); - else - ptlrpc_set_add_req(rqset, req); + ptlrpc_set_add_req(rqset, req); return 0; } @@ -450,10 +444,7 @@ int osc_punch_base(struct obd_export *exp, struct obdo *oa, sa->sa_oa = oa; sa->sa_upcall = upcall; sa->sa_cookie = cookie; - if (rqset == PTLRPCD_SET) - ptlrpcd_add_req(req); - else - ptlrpc_set_add_req(rqset, req); + ptlrpc_set_add_req(rqset, req); return 0; } @@ -533,10 +524,7 @@ int osc_sync_base(struct osc_object *obj, struct obdo *oa, fa->fa_upcall = upcall; fa->fa_cookie = cookie; - if (rqset == PTLRPCD_SET) - ptlrpcd_add_req(req); - else - ptlrpc_set_add_req(rqset, req); + ptlrpc_set_add_req(rqset, req); return 0; } @@ -2148,8 +2136,6 @@ static int osc_enqueue_interpret(const struct lu_env *env, return rc; } -struct ptlrpc_request_set *PTLRPCD_SET = (void *)1; - /* When enqueuing asynchronously, locks are not ordered, we can obtain a lock * from the 2nd OSC before a lock from the 1st one. This does not deadlock with * other synchronous requests, however keeping some locks and trying to obtain @@ -2291,10 +2277,7 @@ int osc_enqueue_base(struct obd_export *exp, struct ldlm_res_id *res_id, req->rq_interpret_reply = (ptlrpc_interpterer_t)osc_enqueue_interpret; - if (rqset == PTLRPCD_SET) - ptlrpcd_add_req(req); - else - ptlrpc_set_add_req(rqset, req); + ptlrpc_set_add_req(rqset, req); } else if (intent) { ptlrpc_req_finished(req); } diff --git a/drivers/staging/lustre/lustre/ptlrpc/client.c b/drivers/staging/lustre/lustre/ptlrpc/client.c index f90a3eef5daf..110bb5d8f767 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/client.c +++ b/drivers/staging/lustre/lustre/ptlrpc/client.c @@ -1048,6 +1048,11 @@ EXPORT_SYMBOL(ptlrpc_set_destroy); void ptlrpc_set_add_req(struct ptlrpc_request_set *set, struct ptlrpc_request *req) { + if (set == PTLRPCD_SET) { + ptlrpcd_add_req(req); + return; + } + LASSERT(list_empty(&req->rq_set_chain)); /* The set takes over the caller's request reference */ From jsimmons at infradead.org Wed Jan 9 18:28:27 2019 From: jsimmons at infradead.org (James Simmons) Date: Wed, 9 Jan 2019 18:28:27 +0000 (GMT) Subject: [lustre-devel] [PATCH v2 33/33] lustre: update version to 2.9.99 In-Reply-To: <9BDCA6A9-A826-49A7-9126-BC1DCC96AC1D@whamcloud.com> References: <1546812868-11794-1-git-send-email-jsimmons@infradead.org> <1546812868-11794-34-git-send-email-jsimmons@infradead.org> <874lakj5ck.fsf@notabene.neil.brown.name> <45806D2E-8AAD-48ED-8B14-6D5CC11D824E@whamcloud.com> <9BDCA6A9-A826-49A7-9126-BC1DCC96AC1D@whamcloud.com> Message-ID: > >> This might be because the upstream Lustre doesn't allow setting per-process > >> JobID via environment variable, only as a single per-node value. The real > >> unfortunate part is that the "get JobID from environment" actually works for > >> every reasonable architecture (even the one which was originally broken > >> fixed it), but it got yanked anyway. This is actually one of the features > >> of Lustre that lots of HPC sites like to use, since it allows them to track > >> on the servers which users/jobs/processes on the client are doing IO. > > > > To give background for Neil see thread: > > > > https://lore.kernel.org/patchwork/patch/416846 > > > > In this case I do agree with Greg. The latest jobid does implement an > > upcall and upcalls don't play niece with containers. Their is also the > > namespace issue pointed out. I think the namespace issue might be fixed > > in the latest OpenSFS code. > > I'm not sure what you mean? AFAIK, there is no upcall for JobID, except > maybe in the kernel client where we weren't allowed to parse the process > environment directly. I agree an upcall is problematic with namespaces, > in addition to being less functional (only a JobID per node instead of > per process), which is why direct access to JOBENV is better IMHO. I have some evil ideas about this. Need to think about it some more since this is a more complex problem. > > The whole approach to stats in lustre is > > pretty awful. Take jobstats for example. Currently the approach is > > to poll inside the kernel at specific intervals. Part of the polling is > > scanning the running processes environment space. On top of this the > > administor ends up creating scripts to poll the proc / debugfs entry. > > Other types of lustre stat files take a similar approach. Scripts have > > to poll debugfs / procfs entries. > > I think that issue is orthogonal to getting the actual JobID. That is > the stats collection from the kernel. We shouldn't be inventing a new > way to process that. What does "top" do? Read a thousand /proc files > every second because that is flexible for different use cases. There > are much fewer Lustre stats files on a given node, and I haven't heard > that the actual stats reading interface is a performance issue. Because the policy for the linux kernel is not to add non processes related information in procfs anymore. "top" reads process information from procfs which is okay. This means the stats lustre generates are required to be placed in debugfs. The problem their is you need to be root to access this information. I told the administrator about this and they told me in no way will they run an application as root just to read stats. We really don't want to require users to mount their debugfs partitions to allow non root uses to access it. So I looked into alteranatives. Actually with netlink you have far more power for handling stats then polling some proc file. Also while for most cases the stat files are not huge in general but if we do end up having a stat seq_file with a huge amount of data then polling that file can really spike the load on an node. > > I have been thinking what would be a better approach since I like to > > approach this problem for the 2.13 time frame. Our admins at my work > > place want to be able to collect application stats without being root. > > So placing stats in debugfs is not an option, which we currently do > > the linux client :-( The stats are not a good fit for sysfs. The solution > > I have been pondering is using netlink. Since netlink is socket based it > > can be treated as a pipe. Now you are thinking well you still need to poll > > on the netlink socket but you don't have too. systemd does it for you :-) > > We can create systemd service file which uses > > For the love of all that is holy, do not make Lustre stats usage depend > on Systemd to be usable. I never write code that locks in one approach ever. Take for example the lctl conf_param / set_param -P handling with the move to sysfs. Instead of the old upcall method to lctl now we have a udev rule. That rule is not law!!! A site could create their own udev rule if they want to say log changes to the lustre tunables. Keep in mind udev rules need to be simple since they block until completed much like upcalls do. If you want to run a heavy application you can create a system.d service to handle the tunable uevent. If you are really clever you can use dbus to send that the tuning event to external nodes. Their are many creative options. The same is true with the stats netlink approach. I was up late last night pondering a design for the netlink stats. I have to put together a list of my ideas and run it by my admins. So no systemd is not a hard requirment. Just an option for people into that sort of thing. Using udev and netlink opens up a whole new stack to take advantage of. From adilger at whamcloud.com Wed Jan 9 23:16:19 2019 From: adilger at whamcloud.com (Andreas Dilger) Date: Wed, 9 Jan 2019 23:16:19 +0000 Subject: [lustre-devel] [PATCH v2 33/33] lustre: update version to 2.9.99 In-Reply-To: References: <1546812868-11794-1-git-send-email-jsimmons@infradead.org> <1546812868-11794-34-git-send-email-jsimmons@infradead.org> <874lakj5ck.fsf@notabene.neil.brown.name> <45806D2E-8AAD-48ED-8B14-6D5CC11D824E@whamcloud.com> <9BDCA6A9-A826-49A7-9126-BC1DCC96AC1D@whamcloud.com> Message-ID: <53F17B0D-5FB3-4B69-B483-7AA4FBCA259B@whamcloud.com> On Jan 9, 2019, at 11:28, James Simmons wrote: > > >>>> This might be because the upstream Lustre doesn't allow setting per-process >>>> JobID via environment variable, only as a single per-node value. The real >>>> unfortunate part is that the "get JobID from environment" actually works for >>>> every reasonable architecture (even the one which was originally broken >>>> fixed it), but it got yanked anyway. This is actually one of the features >>>> of Lustre that lots of HPC sites like to use, since it allows them to track >>>> on the servers which users/jobs/processes on the client are doing IO. >>> >>> To give background for Neil see thread: >>> >>> https://lore.kernel.org/patchwork/patch/416846 >>> >>> In this case I do agree with Greg. The latest jobid does implement an >>> upcall and upcalls don't play niece with containers. Their is also the >>> namespace issue pointed out. I think the namespace issue might be fixed >>> in the latest OpenSFS code. >> >> I'm not sure what you mean? AFAIK, there is no upcall for JobID, except >> maybe in the kernel client where we weren't allowed to parse the process >> environment directly. I agree an upcall is problematic with namespaces, >> in addition to being less functional (only a JobID per node instead of >> per process), which is why direct access to JOBENV is better IMHO. > > I have some evil ideas about this. Need to think about it some more since > this is a more complex problem. Since the kernel manages the environment variables via getenv() and setenv(), I honestly don't see why accessing them directly is a huge issue? >>> The whole approach to stats in lustre is >>> pretty awful. Take jobstats for example. Currently the approach is >>> to poll inside the kernel at specific intervals. Part of the polling is >>> scanning the running processes environment space. On top of this the >>> administor ends up creating scripts to poll the proc / debugfs entry. >>> Other types of lustre stat files take a similar approach. Scripts have >>> to poll debugfs / procfs entries. >> >> I think that issue is orthogonal to getting the actual JobID. That is >> the stats collection from the kernel. We shouldn't be inventing a new >> way to process that. What does "top" do? Read a thousand /proc files >> every second because that is flexible for different use cases. There >> are much fewer Lustre stats files on a given node, and I haven't heard >> that the actual stats reading interface is a performance issue. > > Because the policy for the linux kernel is not to add non processes > related information in procfs anymore. "top" reads process information > from procfs which is okay. The location of the stats (procfs vs. sysfs vs. debugfs) wasn't my point. My point was that a *very* core kernel performance monitoring utility is doing open/read/close from virtual kernel files, so before we go ahead and invent our own performance monitoring framework (which may be frowned upon by upstream for arbitrary reasons because it isn't using /proc or /sys files). > This means the stats lustre generates are > required to be placed in debugfs. The problem their is you need to be > root to access this information. That is a self-inflicted problem because of upstream kernel policy to move the existing files out of /proc and being unable to use /sys either. > I told the administrator about this > and they told me in no way will they run an application as root just > to read stats. We really don't want to require users to mount their > debugfs partitions to allow non root uses to access it. So I looked > into alteranatives. Actually with netlink you have far more power for > handling stats then polling some proc file. Also while for most cases the > stat files are not huge in general but if we do end up having a stat > seq_file with a huge amount of data then polling that file can really > spike the load on an node. I agree it is not ideal. One option (AFAIK) would be a udev rule that changes the /sys/kernel/debug/lustre/* files to be at readable by a non-root group (e.g. admin or perftools or whatever) for the collector. >>> I have been thinking what would be a better approach since I like to >>> approach this problem for the 2.13 time frame. Our admins at my work >>> place want to be able to collect application stats without being root. >>> So placing stats in debugfs is not an option, which we currently do >>> the linux client :-( The stats are not a good fit for sysfs. The solution >>> I have been pondering is using netlink. Since netlink is socket based it >>> can be treated as a pipe. Now you are thinking well you still need to poll >>> on the netlink socket but you don't have too. systemd does it for you :-) >>> We can create systemd service file which uses >> >> For the love of all that is holy, do not make Lustre stats usage depend >> on Systemd to be usable. > > I never write code that locks in one approach ever. Take for example the > lctl conf_param / set_param -P handling with the move to sysfs. Instead > of the old upcall method to lctl now we have a udev rule. That rule is not > law!!! A site could create their own udev rule if they want to say log > changes to the lustre tunables. Keep in mind udev rules need to be simple > since they block until completed much like upcalls do. If you want to > run a heavy application you can create a system.d service to handle the > tunable uevent. If you are really clever you can use dbus to send that > the tuning event to external nodes. Their are many creative options. > > The same is true with the stats netlink approach. I was up late last night > pondering a design for the netlink stats. I have to put together a list > of my ideas and run it by my admins. So no systemd is not a hard > requirment. Just an option for people into that sort of thing. Using > udev and netlink opens up a whole new stack to take advantage of. Sorry to be negative, but I was just having fun with systemd over the weekend on one of my home systems, and I really don't want to entangle it into our stats. If the existing procfs/sysfs/debugfs scraping will continue to work in the future then I'm fine with that. Cheers, Andreas --- Andreas Dilger Principal Lustre Architect Whamcloud From neilb at suse.com Thu Jan 10 00:40:35 2019 From: neilb at suse.com (NeilBrown) Date: Thu, 10 Jan 2019 11:40:35 +1100 Subject: [lustre-devel] [PATCH v2 33/33] lustre: update version to 2.9.99 In-Reply-To: <45806D2E-8AAD-48ED-8B14-6D5CC11D824E@whamcloud.com> References: <1546812868-11794-1-git-send-email-jsimmons@infradead.org> <1546812868-11794-34-git-send-email-jsimmons@infradead.org> <874lakj5ck.fsf@notabene.neil.brown.name> <45806D2E-8AAD-48ED-8B14-6D5CC11D824E@whamcloud.com> Message-ID: <87muo9ibuk.fsf@notabene.neil.brown.name> On Tue, Jan 08 2019, Andreas Dilger wrote: > On Jan 7, 2019, at 21:26, James Simmons wrote: >> >>> >>> On Sun, Jan 06 2019, James Simmons wrote: >>> >>>> With the majority of missing patches and features from the lustre >>>> 2.10 release merged upstream its time to update the upstream >>>> client's version. >>> >>> :-) >>> >>> Thanks to some of these patches (this batch or previous) I have fewer >>> failing tests now .. those not many fewer. >>> >>> The current summary is >>> 45 status: FAIL >>> 556 status: PASS >>> 47 status: SKIP >>> >>> It used to be >50 FAIL. >>> >>> The failing tests are listed below. >>> I know why the FID patches fail - we've discussed that. >>> Maybe it is time to start working out why some of the others are >>> failing. >> >> You are running a much newer test suite. Using the test suite from lustre >> 2.10 I see the following failures. >> >> sanity: FAIL: test_103a run_acl_subtest cp failed (real failure) >> sanity: FAIL: test_215 cannot read lnet.stats (not sysfs aware) >> sanity: FAIL: test_233a cannot access /lustre/lustre using its FID '[0x200000007:0x1:0x0]' >> sanity: FAIL: test_233b cannot access /lustre/lustre/.lustre using its FID '[0x200000002:0x1:0x0]' >> sanity: FAIL: test_256 Changelog catalog has wrong number of slots 0 (fails for 2.10 LTS release as well) > > Yes, there are definitely some tests that do not have proper client/server version/feature checks, since the tests are introduced with the code they > are testing. There are a number of patches in Gerrit that are adding the > proper checks that I'd like to get landed, because we do run client/server > version interop testing, but they always lag a bit behind and we never see > test-script/client version issues in our testing. > >>> Your two recent series are in my lustre-testing branch now - thanks. >>> >>> NeilBrown >>> >>> >>> sanity: FAIL: test_27G 'testpool' is not empty >> >> See LU-11208. Test currently with older lustre versions. >> >>> sanity: FAIL: test_56w /root/lustre-release/lustre/utils/lfs getstripe -c /mnt/lustre/d56w.sanity/file1 wrong: found 2, expected 1 >>> sanity: FAIL: test_56x migrate failed rc = 11 >>> sanity: FAIL: test_56xa migrate failed rc = 11 >>> sanity: FAIL: test_56z /root/lustre-release/lustre/utils/lfs find did not continue after error >>> sanity: FAIL: test_56aa lfs find --size wrong under striped dir >>> sanity: FAIL: test_56ca create /mnt/lustre/d56ca.sanity/f56ca.sanity- failed >>> sanity: FAIL: test_64b oos.sh failed: 1 >>> sanity: FAIL: test_102c setstripe failed >>> sanity: FAIL: test_102j file1-0-1: size != 65536 >> >> I believe these are due to the DoM feature missing >> >>> sanity: FAIL: test_103a misc test failed >> >> 103a is real failure. Never solved yet. (LU-11594 and LU-10334 for Ubuntu) >> >>> sanity: FAIL: test_104b lfs check servers test failed >> >> sysfs bug. I have a patch for this. >> >>> sanity: FAIL: test_130a filefrag /mnt/lustre/f130a.sanity failed >>> sanity: FAIL: test_130b filefrag /mnt/lustre/f130b.sanity failed >>> sanity: FAIL: test_130c filefrag /mnt/lustre/f130c.sanity failed >>> sanity: FAIL: test_130e filefrag /mnt/lustre/f130e.sanity failed >>> sanity: FAIL: test_130f filefrag /mnt/lustre/f130f.sanity failed >> >> What version of e2fsprog are you running? You need a 1.44 version and >> this should go away. > > To be clear - the Lustre-patched "filefrag" at: > > https://downloads.whamcloud.com/public/e2fsprogs/1.44.3.wc1/ > I looked at Commit 41aee4226789 ("filefrag: Lustre changes to filefrag FIEMAP handling") in the git tree instead. This appears to add 3, features. - It adds an optional device to struct fiemap. Presumably this is always returned if available, else zero is provided which means "the device". - It adds a flag FIEMAP_EXTENT_NET which indicates that the device number is *not* dev_t, but is some fs-specific value - It allows FIEMAP_FLAG_DEVICE_ORDER to be requested. I can't quite work out what this does. Presumably it changes the order that entries are returned (why?) and maybe returns multiple entries for a region that is mirrored ??? As you say, I can see how these might be useful to other filesystems. Maybe we should try upstreaming the support sooner rather than later. NeilBrown -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 832 bytes Desc: not available URL: From neilb at suse.com Thu Jan 10 01:36:33 2019 From: neilb at suse.com (NeilBrown) Date: Thu, 10 Jan 2019 12:36:33 +1100 Subject: [lustre-devel] [PATCH v2 33/33] lustre: update version to 2.9.99 In-Reply-To: <53F17B0D-5FB3-4B69-B483-7AA4FBCA259B@whamcloud.com> References: <1546812868-11794-1-git-send-email-jsimmons@infradead.org> <1546812868-11794-34-git-send-email-jsimmons@infradead.org> <874lakj5ck.fsf@notabene.neil.brown.name> <45806D2E-8AAD-48ED-8B14-6D5CC11D824E@whamcloud.com> <9BDCA6A9-A826-49A7-9126-BC1DCC96AC1D@whamcloud.com> <53F17B0D-5FB3-4B69-B483-7AA4FBCA259B@whamcloud.com> Message-ID: <87k1jdi99a.fsf@notabene.neil.brown.name> On Wed, Jan 09 2019, Andreas Dilger wrote: > On Jan 9, 2019, at 11:28, James Simmons wrote: >> >> >>>>> This might be because the upstream Lustre doesn't allow setting per-process >>>>> JobID via environment variable, only as a single per-node value. The real >>>>> unfortunate part is that the "get JobID from environment" actually works for >>>>> every reasonable architecture (even the one which was originally broken >>>>> fixed it), but it got yanked anyway. This is actually one of the features >>>>> of Lustre that lots of HPC sites like to use, since it allows them to track >>>>> on the servers which users/jobs/processes on the client are doing IO. >>>> >>>> To give background for Neil see thread: >>>> >>>> https://lore.kernel.org/patchwork/patch/416846 >>>> >>>> In this case I do agree with Greg. The latest jobid does implement an >>>> upcall and upcalls don't play niece with containers. Their is also the >>>> namespace issue pointed out. I think the namespace issue might be fixed >>>> in the latest OpenSFS code. >>> >>> I'm not sure what you mean? AFAIK, there is no upcall for JobID, except >>> maybe in the kernel client where we weren't allowed to parse the process >>> environment directly. I agree an upcall is problematic with namespaces, >>> in addition to being less functional (only a JobID per node instead of >>> per process), which is why direct access to JOBENV is better IMHO. >> >> I have some evil ideas about this. Need to think about it some more since >> this is a more complex problem. > > Since the kernel manages the environment variables via getenv() and setenv(), > I honestly don't see why accessing them directly is a huge issue? This is, at best, an over-simplification. The kernel doesn't "manage" the environment variables. When a process calls execve() (or similar) a collection of strings called "arguments" and another collection of strings called "environment" are extracted from the processes vm, and used for initializing part of the newly created vm. That is all the kernel does with either. (except for providing /proc/*/cmdline and /proc/*/environ, which is best-effort). getenv() ad setenv() are entirely implemented in user-space. It is quite possible for a process to mess-up its args or environment in a way that will make /proc/*/{cmdline,environ} fail to return anything useful. It is quite possible for the memory storing args and env to be swapped out. If a driver tried to accesses either, it might trigger page-in of that part of the address space, which would probably work but might not be a good idea. As I understand it, the goal here is to have a cluster-wide identifier that can be attached to groups of processes on different nodes. Then stats relating to all of those processes can be collected together. If I didn't think that control-groups were an abomination I would probably suggest using them to define a group of processes, then to attach a tag to that group. Both the netcl and net_prio cgroups do exactly this. perf_event does as well, and even uses the tag exactly for collecting performance-data together for a set of processes. Maybe we could try to champion an fs_event control group? However it is a long time since I've looked at control groups, and they might have moved on a bit. But as I do think that control-groups are an abomination, I couldn't possible suggest any such thing. Unix already has a perfectly good grouping abstraction - process groups (unfortunately there are about 3 sorts of these, but that needn't be a big problem). Stats can be collected based on pgid, and a mapping from client+pgid->jobid can be communicated to whatever collects the statistics ... somehow. NeilBrown -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 832 bytes Desc: not available URL: From neilb at suse.com Thu Jan 10 01:46:49 2019 From: neilb at suse.com (NeilBrown) Date: Thu, 10 Jan 2019 12:46:49 +1100 Subject: [lustre-devel] [PATCH v2 33/33] lustre: update version to 2.9.99 In-Reply-To: References: <1546812868-11794-1-git-send-email-jsimmons@infradead.org> <1546812868-11794-34-git-send-email-jsimmons@infradead.org> <874lakj5ck.fsf@notabene.neil.brown.name> <45806D2E-8AAD-48ED-8B14-6D5CC11D824E@whamcloud.com> Message-ID: <87h8ehi8s6.fsf@notabene.neil.brown.name> On Tue, Jan 08 2019, James Simmons wrote: > > I have been thinking what would be a better approach since I like to > approach this problem for the 2.13 time frame. Our admins at my work > place want to be able to collect application stats without being root. > So placing stats in debugfs is not an option, which we currently do > the linux client :-( The stats are not a good fit for sysfs. How much statistics data are we talking about here? /proc/self/mountstats shows over 2K of stats for NFS filesystems. Is this in the ball-park or do you need an order-of-magnitude more? NeilBrown -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 832 bytes Desc: not available URL: From adilger at whamcloud.com Thu Jan 10 01:56:08 2019 From: adilger at whamcloud.com (Andreas Dilger) Date: Thu, 10 Jan 2019 01:56:08 +0000 Subject: [lustre-devel] [PATCH 02/29] lustre: osc_cache: use assert_spin_locked() In-Reply-To: <154701504098.26726.7180667249484886220.stgit@noble> References: <154701488711.26726.17363928508883972338.stgit@noble> <154701504098.26726.7180667249484886220.stgit@noble> Message-ID: <87942812-3A47-49E3-B7C9-75DC2D426305@whamcloud.com> On Jan 8, 2019, at 23:24, NeilBrown wrote: > > assert_spin_locked() is preferred to > spin_is_locked() for affirming that a > spinlock is locked. > > Signed-off-by: NeilBrown We used to have an LASSERT_SPIN_LOCKED() macro, but it was removed a few years ago. It is nice to get better checking in the kernel. One question inline below: > --- > drivers/staging/lustre/lustre/osc/osc_cache.c | 29 +++++++++----------- > .../staging/lustre/lustre/osc/osc_cl_internal.h | 15 +--------- > 2 files changed, 15 insertions(+), 29 deletions(-) > > diff --git a/drivers/staging/lustre/lustre/osc/osc_cache.c b/drivers/staging/lustre/lustre/osc/osc_cache.c > index fbf16547003d..1ce9f673f1bf 100644 > --- a/drivers/staging/lustre/lustre/osc/osc_cache.c > +++ b/drivers/staging/lustre/lustre/osc/osc_cache.c > @@ -181,10 +181,7 @@ static int osc_extent_sanity_check0(struct osc_extent *ext, > size_t page_count; > int rc = 0; > > - if (!osc_object_is_locked(obj)) { > - rc = 9; > - goto out; > - } > + assert_osc_object_is_locked(obj); Is this actually a fatal error? It looks like if the object is not locked then the checking isn't consistent and could just be skipped? There is a macro that lends credence to this: #define sanity_check_nolock(ext) \ osc_extent_sanity_check0(ext, __func__, __LINE__) #define sanity_check(ext) ({ \ int __res; \ osc_object_lock((ext)->oe_obj); \ __res = sanity_check_nolock(ext); \ osc_object_unlock((ext)->oe_obj); \ __res; \ }) However, reading deeper into the code sanity_check_nolock() looks like is only ever called when the object is already locked, so indeed it does seem like a valid change that should be described in the commit message like: __osc_extent_sanity_check() is only ever called with obj already locked, so change the check into an assertion. It might also be an improvement to rename sanity_check{,_nolock}() to osc_extent_sanity_check() and osc_extent_sanity_check_nolock(), and use __osc_extent_sanity_check() instead of ...0() (which is not standard)? I was going to suggest making sanity_check() an inline function, but that would break the __func__ and __LINE__ expansion and isn't onerous. Reviewed-by: Andreas Dilger > > if (ext->oe_state >= OES_STATE_MAX) { > rc = 10; > @@ -324,7 +321,7 @@ static int osc_extent_is_overlapped(struct osc_object *obj, > { > struct osc_extent *tmp; > > - LASSERT(osc_object_is_locked(obj)); > + assert_osc_object_is_locked(obj); > > if (!extent_debug) > return 0; > @@ -341,7 +338,7 @@ static int osc_extent_is_overlapped(struct osc_object *obj, > > static void osc_extent_state_set(struct osc_extent *ext, int state) > { > - LASSERT(osc_object_is_locked(ext->oe_obj)); > + assert_osc_object_is_locked(ext->oe_obj); > LASSERT(state >= OES_INV && state < OES_STATE_MAX); > > /* Never try to sanity check a state changing extent :-) */ > @@ -414,7 +411,7 @@ static void osc_extent_put(const struct lu_env *env, struct osc_extent *ext) > static void osc_extent_put_trust(struct osc_extent *ext) > { > LASSERT(atomic_read(&ext->oe_refc) > 1); > - LASSERT(osc_object_is_locked(ext->oe_obj)); > + assert_osc_object_is_locked(ext->oe_obj); > atomic_dec(&ext->oe_refc); > } > > @@ -428,7 +425,7 @@ static struct osc_extent *osc_extent_search(struct osc_object *obj, > struct rb_node *n = obj->oo_root.rb_node; > struct osc_extent *tmp, *p = NULL; > > - LASSERT(osc_object_is_locked(obj)); > + assert_osc_object_is_locked(obj); > while (n) { > tmp = rb_extent(n); > if (index < tmp->oe_start) { > @@ -467,7 +464,7 @@ static void osc_extent_insert(struct osc_object *obj, struct osc_extent *ext) > > LASSERT(RB_EMPTY_NODE(&ext->oe_node)); > LASSERT(ext->oe_obj == obj); > - LASSERT(osc_object_is_locked(obj)); > + assert_osc_object_is_locked(obj); > while (*n) { > tmp = rb_extent(*n); > parent = *n; > @@ -489,7 +486,7 @@ static void osc_extent_erase(struct osc_extent *ext) > { > struct osc_object *obj = ext->oe_obj; > > - LASSERT(osc_object_is_locked(obj)); > + assert_osc_object_is_locked(obj); > if (!RB_EMPTY_NODE(&ext->oe_node)) { > rb_erase(&ext->oe_node, &obj->oo_root); > RB_CLEAR_NODE(&ext->oe_node); > @@ -502,7 +499,7 @@ static struct osc_extent *osc_extent_hold(struct osc_extent *ext) > { > struct osc_object *obj = ext->oe_obj; > > - LASSERT(osc_object_is_locked(obj)); > + assert_osc_object_is_locked(obj); > LASSERT(ext->oe_state == OES_ACTIVE || ext->oe_state == OES_CACHE); > if (ext->oe_state == OES_CACHE) { > osc_extent_state_set(ext, OES_ACTIVE); > @@ -515,7 +512,7 @@ static struct osc_extent *osc_extent_hold(struct osc_extent *ext) > > static void __osc_extent_remove(struct osc_extent *ext) > { > - LASSERT(osc_object_is_locked(ext->oe_obj)); > + assert_osc_object_is_locked(ext->oe_obj); > LASSERT(list_empty(&ext->oe_pages)); > osc_extent_erase(ext); > list_del_init(&ext->oe_link); > @@ -546,7 +543,7 @@ static int osc_extent_merge(const struct lu_env *env, struct osc_extent *cur, > int ppc_bits; > > LASSERT(cur->oe_state == OES_CACHE); > - LASSERT(osc_object_is_locked(obj)); > + assert_osc_object_is_locked(obj); > if (!victim) > return -EINVAL; > > @@ -2079,7 +2076,7 @@ static unsigned int get_write_extents(struct osc_object *obj, > .erd_max_extents = 256, > }; > > - LASSERT(osc_object_is_locked(obj)); > + assert_osc_object_is_locked(obj); > while (!list_empty(&obj->oo_hp_exts)) { > ext = list_entry(obj->oo_hp_exts.next, struct osc_extent, > oe_link); > @@ -2146,7 +2143,7 @@ osc_send_write_rpc(const struct lu_env *env, struct client_obd *cli, > int srvlock = 0; > int rc = 0; > > - LASSERT(osc_object_is_locked(osc)); > + assert_osc_object_is_locked(osc); > > page_count = get_write_extents(osc, &rpclist); > LASSERT(equi(page_count == 0, list_empty(&rpclist))); > @@ -2224,7 +2221,7 @@ osc_send_read_rpc(const struct lu_env *env, struct client_obd *cli, > }; > int rc = 0; > > - LASSERT(osc_object_is_locked(osc)); > + assert_osc_object_is_locked(osc); > list_for_each_entry_safe(ext, next, &osc->oo_reading_exts, oe_link) { > EASSERT(ext->oe_state == OES_LOCK_DONE, ext); > if (!try_to_add_extent_for_io(cli, ext, &data)) > diff --git a/drivers/staging/lustre/lustre/osc/osc_cl_internal.h b/drivers/staging/lustre/lustre/osc/osc_cl_internal.h > index b78deef3963a..aa1b753fc88d 100644 > --- a/drivers/staging/lustre/lustre/osc/osc_cl_internal.h > +++ b/drivers/staging/lustre/lustre/osc/osc_cl_internal.h > @@ -183,19 +183,8 @@ static inline void osc_object_unlock(struct osc_object *obj) > spin_unlock(&obj->oo_lock); > } > > -static inline int osc_object_is_locked(struct osc_object *obj) > -{ > -#if defined(CONFIG_SMP) || defined(CONFIG_DEBUG_SPINLOCK) > - return spin_is_locked(&obj->oo_lock); > -#else > - /* > - * It is not perfect to return true all the time. > - * But since this function is only used for assertion > - * and checking, it seems OK. > - */ > - return 1; > -#endif > -} > +#define assert_osc_object_is_locked(obj) \ > + assert_spin_locked(&obj->oo_lock) > > /* > * Lock "micro-states" for osc layer. > > Cheers, Andreas --- Andreas Dilger CTO Whamcloud From adilger at whamcloud.com Thu Jan 10 01:57:21 2019 From: adilger at whamcloud.com (Andreas Dilger) Date: Thu, 10 Jan 2019 01:57:21 +0000 Subject: [lustre-devel] [PATCH 01/29] lustre: osc_cache: discard oe_intree In-Reply-To: <154701504072.26726.12597270089564992131.stgit@noble> References: <154701488711.26726.17363928508883972338.stgit@noble> <154701504072.26726.12597270089564992131.stgit@noble> Message-ID: On Jan 8, 2019, at 23:24, NeilBrown wrote: > > An rbnode knows if it is in the tree or not, using RB_EMPTY_NODE(). > There is no need for an extra flag. > > Signed-off-by: NeilBrown Reviewed-by: Andreas Dilger > --- > drivers/staging/lustre/lustre/osc/osc_cache.c | 15 +++++++-------- > .../staging/lustre/lustre/osc/osc_cl_internal.h | 3 +-- > 2 files changed, 8 insertions(+), 10 deletions(-) > > diff --git a/drivers/staging/lustre/lustre/osc/osc_cache.c b/drivers/staging/lustre/lustre/osc/osc_cache.c > index 93330cb77e94..fbf16547003d 100644 > --- a/drivers/staging/lustre/lustre/osc/osc_cache.c > +++ b/drivers/staging/lustre/lustre/osc/osc_cache.c > @@ -74,7 +74,7 @@ static inline char *ext_flags(struct osc_extent *ext, char *flags) > { > char *buf = flags; > *buf++ = ext->oe_rw ? 'r' : 'w'; > - if (ext->oe_intree) > + if (!RB_EMPTY_NODE(&ext->oe_node)) > *buf++ = 'i'; > if (ext->oe_sync) > *buf++ = 'S'; > @@ -154,7 +154,7 @@ static inline struct osc_extent *next_extent(struct osc_extent *ext) > if (!ext) > return NULL; > > - LASSERT(ext->oe_intree); > + LASSERT(!RB_EMPTY_NODE(&ext->oe_node)); > return rb_extent(rb_next(&ext->oe_node)); > } > > @@ -163,7 +163,7 @@ static inline struct osc_extent *prev_extent(struct osc_extent *ext) > if (!ext) > return NULL; > > - LASSERT(ext->oe_intree); > + LASSERT(!RB_EMPTY_NODE(&ext->oe_node)); > return rb_extent(rb_prev(&ext->oe_node)); > } > > @@ -393,7 +393,7 @@ static void osc_extent_put(const struct lu_env *env, struct osc_extent *ext) > LASSERT(list_empty(&ext->oe_link)); > LASSERT(atomic_read(&ext->oe_users) == 0); > LASSERT(ext->oe_state == OES_INV); > - LASSERT(!ext->oe_intree); > + LASSERT(RB_EMPTY_NODE(&ext->oe_node)); > > if (ext->oe_dlmlock) { > lu_ref_add(&ext->oe_dlmlock->l_reference, > @@ -465,7 +465,7 @@ static void osc_extent_insert(struct osc_object *obj, struct osc_extent *ext) > struct rb_node *parent = NULL; > struct osc_extent *tmp; > > - LASSERT(ext->oe_intree == 0); > + LASSERT(RB_EMPTY_NODE(&ext->oe_node)); > LASSERT(ext->oe_obj == obj); > LASSERT(osc_object_is_locked(obj)); > while (*n) { > @@ -482,7 +482,6 @@ static void osc_extent_insert(struct osc_object *obj, struct osc_extent *ext) > rb_link_node(&ext->oe_node, parent, n); > rb_insert_color(&ext->oe_node, &obj->oo_root); > osc_extent_get(ext); > - ext->oe_intree = 1; > } > > /* caller must have held object lock. */ > @@ -491,9 +490,9 @@ static void osc_extent_erase(struct osc_extent *ext) > struct osc_object *obj = ext->oe_obj; > > LASSERT(osc_object_is_locked(obj)); > - if (ext->oe_intree) { > + if (!RB_EMPTY_NODE(&ext->oe_node)) { > rb_erase(&ext->oe_node, &obj->oo_root); > - ext->oe_intree = 0; > + RB_CLEAR_NODE(&ext->oe_node); > /* rbtree held a refcount */ > osc_extent_put_trust(ext); > } > diff --git a/drivers/staging/lustre/lustre/osc/osc_cl_internal.h b/drivers/staging/lustre/lustre/osc/osc_cl_internal.h > index 077a2b183634..b78deef3963a 100644 > --- a/drivers/staging/lustre/lustre/osc/osc_cl_internal.h > +++ b/drivers/staging/lustre/lustre/osc/osc_cl_internal.h > @@ -598,9 +598,8 @@ struct osc_extent { > /* state of this extent */ > enum osc_extent_state oe_state; > /* flags for this extent. */ > - unsigned int oe_intree:1, > /* 0 is write, 1 is read */ > - oe_rw:1, > + unsigned int oe_rw:1, > /* sync extent, queued by osc_queue_sync_pages() */ > oe_sync:1, > /* set if this extent has partial, sync pages. > > Cheers, Andreas --- Andreas Dilger Principal Lustre Architect Whamcloud From adilger at whamcloud.com Thu Jan 10 01:58:56 2019 From: adilger at whamcloud.com (Andreas Dilger) Date: Thu, 10 Jan 2019 01:58:56 +0000 Subject: [lustre-devel] [PATCH 04/29] lustre: osc: simplify list manipulation In-Reply-To: <154701504121.26726.13780223132597872019.stgit@noble> References: <154701488711.26726.17363928508883972338.stgit@noble> <154701504121.26726.13780223132597872019.stgit@noble> Message-ID: <979713A4-385F-41EB-82C1-75CF68F7EA71@whamcloud.com> > On Jan 8, 2019, at 23:24, NeilBrown wrote: > > when A is empty, > list_move_tail(&A, &B); > is identical to > list_add_tail(&A, &B); > > so always use list_move_tail() - it is easier to understand. > > Signed-off-by: NeilBrown Reviewed-by: Andreas Dilger > --- > drivers/staging/lustre/lustre/osc/osc_cache.c | 5 +---- > 1 file changed, 1 insertion(+), 4 deletions(-) > > diff --git a/drivers/staging/lustre/lustre/osc/osc_cache.c b/drivers/staging/lustre/lustre/osc/osc_cache.c > index 00056dffceb9..6771675dd520 100644 > --- a/drivers/staging/lustre/lustre/osc/osc_cache.c > +++ b/drivers/staging/lustre/lustre/osc/osc_cache.c > @@ -2885,10 +2885,7 @@ int osc_cache_truncate_start(const struct lu_env *env, struct osc_object *obj, > } > /* This extent could be on the full extents list, that's OK */ > EASSERT(!ext->oe_hp && !ext->oe_urgent, ext); > - if (!list_empty(&ext->oe_link)) > - list_move_tail(&ext->oe_link, &list); > - else > - list_add_tail(&ext->oe_link, &list); > + list_move_tail(&ext->oe_link, &list); > > ext = next_extent(ext); > } > > Cheers, Andreas --- Andreas Dilger CTO Whamcloud From adilger at whamcloud.com Thu Jan 10 02:01:08 2019 From: adilger at whamcloud.com (Andreas Dilger) Date: Thu, 10 Jan 2019 02:01:08 +0000 Subject: [lustre-devel] [PATCH 06/29] lustre: osc: use overlapped() consistently. In-Reply-To: <154701504133.26726.5055625028157924201.stgit@noble> References: <154701488711.26726.17363928508883972338.stgit@noble> <154701504133.26726.5055625028157924201.stgit@noble> Message-ID: <7876846D-0A62-4785-90E7-DFE9523412B0@whamcloud.com> On Jan 8, 2019, at 23:24, NeilBrown wrote: > > osc_extent_is_overlapped() open-codes exactly the test that > overlapped() performs. > So use overlapped() instead, to make the code more obviously > consistent. > > Signed-off-by: NeilBrown Reviewed-by: Andreas Dilger > --- > drivers/staging/lustre/lustre/osc/osc_cache.c | 13 ++++++------- > 1 file changed, 6 insertions(+), 7 deletions(-) > > diff --git a/drivers/staging/lustre/lustre/osc/osc_cache.c b/drivers/staging/lustre/lustre/osc/osc_cache.c > index cab1a4f99cc2..dd3c87124aa5 100644 > --- a/drivers/staging/lustre/lustre/osc/osc_cache.c > +++ b/drivers/staging/lustre/lustre/osc/osc_cache.c > @@ -313,6 +313,11 @@ static int osc_extent_sanity_check0(struct osc_extent *ext, > __res; \ > }) > > +static inline int overlapped(struct osc_extent *ex1, struct osc_extent *ex2) > +{ > + return !(ex1->oe_end < ex2->oe_start || ex2->oe_end < ex1->oe_start); > +} > + > /** > * sanity check - to make sure there is no overlapped extent in the tree. > */ > @@ -329,8 +334,7 @@ static int osc_extent_is_overlapped(struct osc_object *obj, > for (tmp = first_extent(obj); tmp; tmp = next_extent(tmp)) { > if (tmp == ext) > continue; > - if (tmp->oe_end >= ext->oe_start && > - tmp->oe_start <= ext->oe_end) > + if (overlapped(tmp, ext)) > return 1; > } > return 0; > @@ -655,11 +659,6 @@ void osc_extent_release(const struct lu_env *env, struct osc_extent *ext) > osc_extent_put(env, ext); > } > > -static inline int overlapped(struct osc_extent *ex1, struct osc_extent *ex2) > -{ > - return !(ex1->oe_end < ex2->oe_start || ex2->oe_end < ex1->oe_start); > -} > - > /** > * Find or create an extent which includes @index, core function to manage > * extent tree. > > Cheers, Andreas --- Andreas Dilger CTO Whamcloud From adilger at whamcloud.com Thu Jan 10 02:03:13 2019 From: adilger at whamcloud.com (Andreas Dilger) Date: Thu, 10 Jan 2019 02:03:13 +0000 Subject: [lustre-devel] [PATCH 21/29] lustre: osc_cache: don't drop a lock we didn't take - two In-Reply-To: <154701504241.26726.16825256312797481549.stgit@noble> References: <154701488711.26726.17363928508883972338.stgit@noble> <154701504241.26726.16825256312797481549.stgit@noble> Message-ID: > On Jan 8, 2019, at 23:24, NeilBrown wrote: > > osc_check_rpcs() drops a lock that it was called with, which can make > it harder to understand the code. > > It is only called from one place, and that places takes the lock just > to all this function. (typo) "call" > So instead, take the lock at the start of the function, > and drop it at the end. > This makes the code easier to follow. > > Signed-off-by: NeilBrown Reviewed-by: Andreas Dilger > --- > drivers/staging/lustre/lustre/osc/osc_cache.c | 5 ++--- > 1 file changed, 2 insertions(+), 3 deletions(-) > > diff --git a/drivers/staging/lustre/lustre/osc/osc_cache.c b/drivers/staging/lustre/lustre/osc/osc_cache.c > index 863884cac028..b2ad6a15014e 100644 > --- a/drivers/staging/lustre/lustre/osc/osc_cache.c > +++ b/drivers/staging/lustre/lustre/osc/osc_cache.c > @@ -2187,11 +2187,11 @@ static struct osc_object *osc_next_obj(struct client_obd *cli) > > /* called with the loi list lock held */ > static void osc_check_rpcs(const struct lu_env *env, struct client_obd *cli) > - __must_hold(&cli->cl_loi_list_lock) > { > struct osc_object *osc; > int rc = 0; > > + spin_lock(&cli->cl_loi_list_lock); > while ((osc = osc_next_obj(cli)) != NULL) { > struct cl_object *obj = osc2cl(osc); > struct lu_ref_link link; > @@ -2247,6 +2247,7 @@ static void osc_check_rpcs(const struct lu_env *env, struct client_obd *cli) > > spin_lock(&cli->cl_loi_list_lock); > } > + spin_unlock(&cli->cl_loi_list_lock); > } > > static int osc_io_unplug0(const struct lu_env *env, struct client_obd *cli, > @@ -2258,9 +2259,7 @@ static int osc_io_unplug0(const struct lu_env *env, struct client_obd *cli, > return 0; > > if (!async) { > - spin_lock(&cli->cl_loi_list_lock); > osc_check_rpcs(env, cli); > - spin_unlock(&cli->cl_loi_list_lock); > } else { > CDEBUG(D_CACHE, "Queue writeback work for client %p.\n", cli); > LASSERT(cli->cl_writeback_work); > > Cheers, Andreas --- Andreas Dilger CTO Whamcloud From adilger at whamcloud.com Thu Jan 10 02:04:00 2019 From: adilger at whamcloud.com (Andreas Dilger) Date: Thu, 10 Jan 2019 02:04:00 +0000 Subject: [lustre-devel] [PATCH 07/29] lustre: osc: convert a while loop to for In-Reply-To: <154701504139.26726.16752476949923033869.stgit@noble> References: <154701488711.26726.17363928508883972338.stgit@noble> <154701504139.26726.16752476949923033869.stgit@noble> Message-ID: On Jan 8, 2019, at 23:24, NeilBrown wrote: > > This loop uses 'continue' in several places, > and each one is proceeded by > ext = next_extent(ext) > which also appears at the end. > This is exactly the pattern that a 'for' loop > simplifies. So change to a for loop. > > Signed-off-by: NeilBrown Much nicer and less error prone, Reviewed-by: Andreas Dilger > --- > drivers/staging/lustre/lustre/osc/osc_cache.c | 21 +++++---------------- > 1 file changed, 5 insertions(+), 16 deletions(-) > > diff --git a/drivers/staging/lustre/lustre/osc/osc_cache.c b/drivers/staging/lustre/lustre/osc/osc_cache.c > index dd3c87124aa5..eb8de1503386 100644 > --- a/drivers/staging/lustre/lustre/osc/osc_cache.c > +++ b/drivers/staging/lustre/lustre/osc/osc_cache.c > @@ -737,7 +737,7 @@ static struct osc_extent *osc_extent_find(const struct lu_env *env, > ext = osc_extent_search(obj, cur->oe_start); > if (!ext) > ext = first_extent(obj); > - while (ext) { > + for (; ext; ext = next_extent(ext)) { > pgoff_t ext_chk_start = ext->oe_start >> ppc_bits; > pgoff_t ext_chk_end = ext->oe_end >> ppc_bits; > > @@ -750,15 +750,12 @@ static struct osc_extent *osc_extent_find(const struct lu_env *env, > EASSERTF(!overlapped(ext, cur), ext, > EXTSTR "\n", EXTPARA(cur)); > > - ext = next_extent(ext); > continue; > } > > /* discontiguous chunks? */ > - if (chunk + 1 < ext_chk_start) { > - ext = next_extent(ext); > + if (chunk + 1 < ext_chk_start) > continue; > - } > > /* ok, from now on, ext and cur have these attrs: > * 1. covered by the same lock > @@ -786,33 +783,27 @@ static struct osc_extent *osc_extent_find(const struct lu_env *env, > } > > /* non-overlapped extent */ > - if (ext->oe_state != OES_CACHE || ext->oe_fsync_wait) { > + if (ext->oe_state != OES_CACHE || ext->oe_fsync_wait) > /* we can't do anything for a non OES_CACHE extent, or > * if there is someone waiting for this extent to be > * flushed, try next one. > */ > - ext = next_extent(ext); > continue; > - } > > /* check if they belong to the same rpc slot before trying to > * merge. the extents are not overlapped and contiguous at > * chunk level to get here. > */ > - if (ext->oe_max_end != max_end) { > + if (ext->oe_max_end != max_end) > /* if they don't belong to the same RPC slot or > * max_pages_per_rpc has ever changed, do not merge. > */ > - ext = next_extent(ext); > continue; > - } > > /* check whether maximum extent size will be hit */ > if ((ext_chk_end - ext_chk_start + 1) << ppc_bits > > - cli->cl_max_extent_pages) { > - ext = next_extent(ext); > + cli->cl_max_extent_pages) > continue; > - } > > /* it's required that an extent must be contiguous at chunk > * level so that we know the whole extent is covered by grant > @@ -851,8 +842,6 @@ static struct osc_extent *osc_extent_find(const struct lu_env *env, > } > if (found) > break; > - > - ext = next_extent(ext); > } > > osc_extent_tree_dump(D_CACHE, obj); > > Cheers, Andreas --- Andreas Dilger CTO Whamcloud From adilger at whamcloud.com Thu Jan 10 02:07:23 2019 From: adilger at whamcloud.com (Andreas Dilger) Date: Thu, 10 Jan 2019 02:07:23 +0000 Subject: [lustre-devel] [PATCH 09/29] lustre: osc: remove test on 'found' being an error. In-Reply-To: <154701504152.26726.5389367058165286948.stgit@noble> References: <154701488711.26726.17363928508883972338.stgit@noble> <154701504152.26726.5389367058165286948.stgit@noble> Message-ID: <837BC658-D143-4706-91E4-93F45DAFDA6B@whamcloud.com> On Jan 8, 2019, at 23:24, NeilBrown wrote: > > Found cannot be IS_ERR() at this point in the code, as it is only ever > assigned a value from osc_extent_hold() (or NULL). > > So discard the test. > > Signed-off-by: NeilBrown Reviewed-by: Andreas Dilger > --- > drivers/staging/lustre/lustre/osc/osc_cache.c | 8 +++----- > 1 file changed, 3 insertions(+), 5 deletions(-) > > diff --git a/drivers/staging/lustre/lustre/osc/osc_cache.c b/drivers/staging/lustre/lustre/osc/osc_cache.c > index 848e440ae2a9..e65d917336b9 100644 > --- a/drivers/staging/lustre/lustre/osc/osc_cache.c > +++ b/drivers/staging/lustre/lustre/osc/osc_cache.c > @@ -821,11 +821,9 @@ static struct osc_extent *osc_extent_find(const struct lu_env *env, > osc_extent_tree_dump(D_CACHE, obj); > if (found) { > LASSERT(!conflict); > - if (!IS_ERR(found)) { > - LASSERT(found->oe_dlmlock == cur->oe_dlmlock); > - OSC_EXTENT_DUMP(D_CACHE, found, > - "found caching ext for %lu.\n", index); > - } > + LASSERT(found->oe_dlmlock == cur->oe_dlmlock); > + OSC_EXTENT_DUMP(D_CACHE, found, > + "found caching ext for %lu.\n", index); > } else if (!conflict) { > /* create a new extent */ > EASSERT(osc_extent_is_overlapped(obj, cur) == 0, cur); > > Cheers, Andreas --- Andreas Dilger Principal Lustre Architect Whamcloud From adilger at whamcloud.com Thu Jan 10 02:10:41 2019 From: adilger at whamcloud.com (Andreas Dilger) Date: Thu, 10 Jan 2019 02:10:41 +0000 Subject: [lustre-devel] [PATCH 10/29] lustre: osc_cache: avoid list_for_each_entry_safe when clearing list. In-Reply-To: <154701504159.26726.15747465883750837429.stgit@noble> References: <154701488711.26726.17363928508883972338.stgit@noble> <154701504159.26726.15747465883750837429.stgit@noble> Message-ID: <6B68F66C-5503-4ADA-8313-8625BC97F035@whamcloud.com> On Jan 8, 2019, at 23:24, NeilBrown wrote: > > When removing some items from a list, list_for_each_entry_safe() is a > good choice. > When removing all items, it is clearer to use a while loop > that repeatedly removes the first element, until there are > none left. This makes it obvious that the list ends up > empty. > > Signed-off-by: NeilBrown I've never heard of list_first_entry_or_null() before? Looks like it was added in 3.10, but definitely seems useful. There are a bunch of places that iterate lists this way while deleteing entries that could be similarly improved. Reviewed-by: Andreas Dilger > --- > drivers/staging/lustre/lustre/osc/osc_cache.c | 22 +++++++++++++--------- > 1 file changed, 13 insertions(+), 9 deletions(-) > > diff --git a/drivers/staging/lustre/lustre/osc/osc_cache.c b/drivers/staging/lustre/lustre/osc/osc_cache.c > index e65d917336b9..5cd3732101e7 100644 > --- a/drivers/staging/lustre/lustre/osc/osc_cache.c > +++ b/drivers/staging/lustre/lustre/osc/osc_cache.c > @@ -869,7 +869,6 @@ int osc_extent_finish(const struct lu_env *env, struct osc_extent *ext, > { > struct client_obd *cli = osc_cli(ext->oe_obj); > struct osc_async_page *oap; > - struct osc_async_page *tmp; > int nr_pages = ext->oe_nr_pages; > int lost_grant = 0; > int blocksize = cli->cl_import->imp_obd->obd_osfs.os_bsize ? : 4096; > @@ -882,7 +881,9 @@ int osc_extent_finish(const struct lu_env *env, struct osc_extent *ext, > EASSERT(ergo(rc == 0, ext->oe_state == OES_RPC), ext); > > osc_lru_add_batch(cli, &ext->oe_pages); > - list_for_each_entry_safe(oap, tmp, &ext->oe_pages, oap_pending_item) { > + while ((oap = list_first_entry_or_null(&ext->oe_pages, > + struct osc_async_page, > + oap_pending_item))) { > list_del_init(&oap->oap_rpc_item); > list_del_init(&oap->oap_pending_item); > if (last_off <= oap->oap_obj_off) { > @@ -1686,11 +1687,11 @@ static int osc_enter_cache(const struct lu_env *env, struct client_obd *cli, > /* caller must hold loi_list_lock */ > void osc_wake_cache_waiters(struct client_obd *cli) > { > - struct list_head *l, *tmp; > struct osc_cache_waiter *ocw; > > - list_for_each_safe(l, tmp, &cli->cl_cache_waiters) { > - ocw = list_entry(l, struct osc_cache_waiter, ocw_entry); > + while ((ocw = list_first_entry_or_null(&cli->cl_cache_waiters, > + struct osc_cache_waiter, > + ocw_entry))) { > list_del_init(&ocw->ocw_entry); > > ocw->ocw_rc = -EDQUOT; > @@ -2739,7 +2740,7 @@ int osc_queue_sync_pages(const struct lu_env *env, struct osc_object *obj, > { > struct client_obd *cli = osc_cli(obj); > struct osc_extent *ext; > - struct osc_async_page *oap, *tmp; > + struct osc_async_page *oap; > int page_count = 0; > int mppr = cli->cl_max_pages_per_rpc; > bool can_merge = true; > @@ -2763,7 +2764,9 @@ int osc_queue_sync_pages(const struct lu_env *env, struct osc_object *obj, > > ext = osc_extent_alloc(obj); > if (!ext) { > - list_for_each_entry_safe(oap, tmp, list, oap_pending_item) { > + while ((oap = list_first_entry_or_null(&oap->oap_pending_item, > + struct osc_async_page, > + oap_pending_item))) { > list_del_init(&oap->oap_pending_item); > osc_ap_completion(env, cli, oap, 0, -ENOMEM); > } > @@ -3093,11 +3096,12 @@ int osc_cache_writeback_range(const struct lu_env *env, struct osc_object *obj, > > LASSERT(ergo(!discard, list_empty(&discard_list))); > if (!list_empty(&discard_list)) { > - struct osc_extent *tmp; > int rc; > > osc_list_maint(osc_cli(obj), obj); > - list_for_each_entry_safe(ext, tmp, &discard_list, oe_link) { > + while ((ext = list_first_entry_or_null(&discard_list, > + struct osc_extent, > + oe_link))) { > list_del_init(&ext->oe_link); > EASSERT(ext->oe_state == OES_LOCKING, ext); > > > Cheers, Andreas --- Andreas Dilger Principal Lustre Architect Whamcloud From adilger at whamcloud.com Thu Jan 10 02:12:27 2019 From: adilger at whamcloud.com (Andreas Dilger) Date: Thu, 10 Jan 2019 02:12:27 +0000 Subject: [lustre-devel] [PATCH 27/29] lustre: osc_cache: white-space and other checkpatch fixes. In-Reply-To: <154701504274.26726.6932313520085605572.stgit@noble> References: <154701488711.26726.17363928508883972338.stgit@noble> <154701504274.26726.6932313520085605572.stgit@noble> Message-ID: <058406C4-B01E-4DD5-8EBB-3014A23CA963@whamcloud.com> On Jan 8, 2019, at 23:24, NeilBrown wrote: > > Assorted minor checkpatch issues fixed. > > Signed-off-by: NeilBrown > --- > drivers/staging/lustre/lustre/osc/osc_cache.c | 25 +++++++++++++------------ > 1 file changed, 13 insertions(+), 12 deletions(-) > > diff --git a/drivers/staging/lustre/lustre/osc/osc_cache.c b/drivers/staging/lustre/lustre/osc/osc_cache.c > index e01f3815978c..019854b78277 100644 > --- a/drivers/staging/lustre/lustre/osc/osc_cache.c > +++ b/drivers/staging/lustre/lustre/osc/osc_cache.c > @@ -962,7 +962,6 @@ static int osc_extent_wait(const struct lu_env *env, struct osc_extent *ext, > > wait_event_idle(ext->oe_waitq, > smp_load_acquire(&ext->oe_state) == state); > - > } > return ext->oe_rc < 0 ? ext->oe_rc : 0; > } Typically we prefer a blank line before return. Otherwise fine. Reviewed-by: Andreas Dilger > @@ -1020,7 +1019,8 @@ static int osc_extent_truncate(struct osc_extent *ext, pgoff_t trunc_index, > if (index < trunc_index || > (index == trunc_index && partial)) { > /* accounting how many pages remaining in the chunk > - * so that we can calculate grants correctly. */ > + * so that we can calculate grants correctly. > + */ > if (index >> ppc_bits == trunc_chunk) > ++pages_in_chunk; > continue; > @@ -1141,7 +1141,8 @@ static int osc_extent_make_ready(const struct lu_env *env, > * the size of file. > */ > if (!(last->oap_async_flags & ASYNC_COUNT_STABLE)) { > - int last_oap_count = osc_refresh_count(env, last, OBD_BRW_WRITE); > + int last_oap_count = osc_refresh_count(env, last, > + OBD_BRW_WRITE); > > LASSERT(last_oap_count > 0); > LASSERT(last->oap_page_off + last_oap_count <= PAGE_SIZE); > @@ -1337,7 +1338,7 @@ static int osc_completion(const struct lu_env *env, struct osc_async_page *oap, > int cmd, int rc) > { > struct osc_page *opg = oap2osc_page(oap); > - struct cl_page *page = oap2cl_page(oap); > + struct cl_page *page = oap2cl_page(oap); > enum cl_req_type crt; > int srvlock; > > @@ -1736,7 +1737,8 @@ static void osc_update_pending(struct osc_object *obj, int cmd, int delta) > OSC_IO_DEBUG(obj, "update pending cmd %d delta %d.\n", cmd, delta); > } > > -static void on_list(struct list_head *item, struct list_head *list, int should_be_on) > +static void on_list(struct list_head *item, struct list_head *list, > + int should_be_on) > { > if (list_empty(item) && should_be_on) > list_add_tail(item, list); > @@ -1898,7 +1900,8 @@ static int try_to_add_extent_for_io(struct client_obd *cli, > oap_pending_item); > EASSERT(tmp->oe_owner == current, tmp); > if (oap2cl_page(oap)->cp_type != oap2cl_page(oap2)->cp_type) { > - CDEBUG(D_CACHE, "Do not permit different type of IO in one RPC\n"); > + CDEBUG(D_CACHE, > + "Do not permit different type of IO in one RPC\n"); > return 0; > } > > @@ -2130,10 +2133,8 @@ osc_send_read_rpc(const struct lu_env *env, struct client_obd *cli, > > osc_object_unlock(osc); > if (!list_empty(&rpclist)) { > - > rc = osc_build_rpc(env, cli, &rpclist, OBD_BRW_READ); > LASSERT(list_empty(&rpclist)); > - > } > return rc; > } > @@ -3082,7 +3083,7 @@ bool osc_page_gang_lookup(const struct lu_env *env, struct cl_io *io, > * Check if page @page is covered by an extra lock or discard it. > */ > static bool check_and_discard_cb(const struct lu_env *env, struct cl_io *io, > - struct osc_page *ops, void *cbdata) > + struct osc_page *ops, void *cbdata) > { > struct osc_thread_info *info = osc_env_info(env); > struct osc_object *osc = cbdata; > @@ -3121,7 +3122,7 @@ static bool check_and_discard_cb(const struct lu_env *env, struct cl_io *io, > } > > static bool discard_cb(const struct lu_env *env, struct cl_io *io, > - struct osc_page *ops, void *cbdata) > + struct osc_page *ops, void *cbdata) > { > struct osc_thread_info *info = osc_env_info(env); > struct cl_page *page = ops->ops_cl.cpl_page; > > Cheers, Andreas --- Andreas Dilger Principal Lustre Architect Whamcloud From adilger at whamcloud.com Thu Jan 10 02:19:47 2019 From: adilger at whamcloud.com (Andreas Dilger) Date: Thu, 10 Jan 2019 02:19:47 +0000 Subject: [lustre-devel] [PATCH 28/29] lustre: osc_request: assorted white-space and check-patch fixes. In-Reply-To: <154701504282.26726.12048576544354457365.stgit@noble> References: <154701488711.26726.17363928508883972338.stgit@noble> <154701504282.26726.12048576544354457365.stgit@noble> Message-ID: On Jan 8, 2019, at 23:24, NeilBrown wrote: > > Just misc formatting fixes. Some minot code change (typo) "minor" > where an 'else' after 'return' was discarded. > > Signed-off-by: NeilBrown > --- > drivers/staging/lustre/lustre/osc/osc_request.c | 163 +++++++++++++---------- > 1 file changed, 89 insertions(+), 74 deletions(-) > > diff --git a/drivers/staging/lustre/lustre/osc/osc_request.c b/drivers/staging/lustre/lustre/osc/osc_request.c > index ccc491efa982..c2239c99a7b2 100644 > --- a/drivers/staging/lustre/lustre/osc/osc_request.c > +++ b/drivers/staging/lustre/lustre/osc/osc_request.c > > @@ -652,8 +651,8 @@ static int osc_destroy(const struct lu_env *env, struct obd_export *exp, > * Wait until the number of on-going destroy RPCs drops > * under max_rpc_in_flight > */ > - rc = l_wait_event_abortable_exclusive(cli->cl_destroy_waitq, > - osc_can_send_destroy(cli)); > + rc = l_wait_event_abortable_exclusive( > + cli->cl_destroy_waitq, osc_can_send_destroy(cli)); > if (rc) { > ptlrpc_req_finished(req); > return rc; I don't really see this change as an improvement? I'd instead just de-indent the osc_can_send_destroy() by a space or two so it fits within 80 colunmns. That is IMHO closer to the normal coding style. Cheers, Andreas --- Andreas Dilger Principal Lustre Architect Whamcloud From adilger at whamcloud.com Thu Jan 10 02:23:13 2019 From: adilger at whamcloud.com (Andreas Dilger) Date: Thu, 10 Jan 2019 02:23:13 +0000 Subject: [lustre-devel] [PATCH 29/29] lustre: centralize handling of PTLRPCD_SET In-Reply-To: <154701504291.26726.3018163382085938859.stgit@noble> References: <154701488711.26726.17363928508883972338.stgit@noble> <154701504291.26726.3018163382085938859.stgit@noble> Message-ID: <2FEE80A4-7331-4877-B488-900266493524@whamcloud.com> On Jan 8, 2019, at 23:24, NeilBrown wrote: > > Various places test if a given rqset is PTLRPCD_SET > and call either ptlrpcd_add_req() or ptlrpc_set_add_req() > depending on the result. > > This can be unified by putting the test of PTLRPCD_SET in > ptlrpc_set_add_req(), and always calling that function. > > This results in the being only one place that tests PTLRPCD_SET. > > Signed-off-by: NeilBrown > --- > > diff --git a/drivers/staging/lustre/lustre/include/lustre_net.h b/drivers/staging/lustre/lustre/include/lustre_net.h > index 6d328b48a96b..e665f70e54a8 100644 > --- a/drivers/staging/lustre/lustre/include/lustre_net.h > +++ b/drivers/staging/lustre/lustre/include/lustre_net.h > @@ -1832,6 +1832,7 @@ int ptlrpc_check_set(const struct lu_env *env, struct ptlrpc_request_set *set); > int ptlrpc_set_wait(struct ptlrpc_request_set *); > void ptlrpc_set_destroy(struct ptlrpc_request_set *); > void ptlrpc_set_add_req(struct ptlrpc_request_set *, struct ptlrpc_request *); > +#define PTLRPCD_SET ((struct ptlrpc_request_set*)1) (style) space before that '*' Nice cleanup otherwise. Definitely removes a bunch of boilerplate code. Reviewed-by: Andreas Dilger Cheers, Andreas --- Andreas Dilger Principal Lustre Architect Whamcloud From adilger at whamcloud.com Thu Jan 10 02:40:30 2019 From: adilger at whamcloud.com (Andreas Dilger) Date: Thu, 10 Jan 2019 02:40:30 +0000 Subject: [lustre-devel] [PATCH 26/29] lustre: osc_cache: simplify osc_page_gang_lookup() In-Reply-To: <154701504269.26726.8061168646539306509.stgit@noble> References: <154701488711.26726.17363928508883972338.stgit@noble> <154701504269.26726.8061168646539306509.stgit@noble> Message-ID: On Jan 8, 2019, at 23:24, NeilBrown wrote: > > osc_page_gang_lookup() has 4 values that it can receive from a > callback, and that it can return to the caller: > CLP_GANG_OKAY, > CLP_GANG_RESCHED, > CLP_GANG_AGAIN, > CLP_GANG_ABORT > > "AGAIN" is never used. > "RESCHED" is not needed as a cond_resched() can safely be called at > the point this is returned, rather than returning it. > That leaves "OKAY" and "ABORT" which can simply by "true" and "false" > boolean values. > > Internalizing the RESCHED case means the callers don't need to loop > themselves. This simplify calling patterns. > > Signed-off-by: NeilBrown > --- > drivers/staging/lustre/lustre/include/cl_object.h | 7 ---- > drivers/staging/lustre/lustre/osc/osc_cache.c | 40 ++++++++------------ > .../staging/lustre/lustre/osc/osc_cl_internal.h | 10 +++-- > drivers/staging/lustre/lustre/osc/osc_io.c | 4 +- > drivers/staging/lustre/lustre/osc/osc_lock.c | 27 ++++++-------- > 5 files changed, 33 insertions(+), 55 deletions(-) > > diff --git a/drivers/staging/lustre/lustre/osc/osc_cache.c b/drivers/staging/lustre/lustre/osc/osc_cache.c > index 79bcaa212339..e01f3815978c 100644 > --- a/drivers/staging/lustre/lustre/osc/osc_cache.c > +++ b/drivers/staging/lustre/lustre/osc/osc_cache.c > @@ -3069,10 +3065,10 @@ int osc_page_gang_lookup(const struct lu_env *env, struct cl_io *io, > if (nr < OTI_PVEC_SIZE || end_of_region) > break; > > - if (res == CLP_GANG_OKAY && need_resched()) > - res = CLP_GANG_RESCHED; > - if (res != CLP_GANG_OKAY) > + if (!res) > break; > + if (need_resched()) > + cond_resched(); > > spin_lock(&osc->oo_tree_lock); > tree_lock = true; The one thing I notice here is that if the CLP_GANG_RESCHED is not returned to the caller, it doesn't have the chance to finish the work before it is rescheduled: do { res = osc_page_gang_lookup(env, io, osc, info->oti_next_index, end, cb, osc); if (info->oti_next_index > end) break; if (res == CLP_GANG_RESCHED) cond_resched(); } while (res != CLP_GANG_OKAY); That means if the thread did a lot of work in osc_page_gang_lookup() but is otherwise finished, it will block at the internal cond_resched() rather than detecting it is finishing and returning to the caller without any reschedule at all. However, looking into the osc_page_gang_lookup() code more closely, I see "end_of_region" would already be set in this case (it is just at the start of the context in the above patch hunk) so CLP_GANG_RESCHED should never be set in that case. So it looks OK. Reviewed-by: Andreas Dilger > diff --git a/drivers/staging/lustre/lustre/osc/osc_lock.c b/drivers/staging/lustre/lustre/osc/osc_lock.c > index 4cc813d192d9..1eab61d720e2 100644 > --- a/drivers/staging/lustre/lustre/osc/osc_lock.c > +++ b/drivers/staging/lustre/lustre/osc/osc_lock.c > @@ -630,18 +630,18 @@ static int osc_ldlm_glimpse_ast(struct ldlm_lock *dlmlock, void *data) > return result; > } > > -static int weigh_cb(const struct lu_env *env, struct cl_io *io, > - struct osc_page *ops, void *cbdata) > +static bool weigh_cb(const struct lu_env *env, struct cl_io *io, > + struct osc_page *ops, void *cbdata) > { > struct cl_page *page = ops->ops_cl.cpl_page; > > if (cl_page_is_vmlocked(env, page) || > PageDirty(page->cp_vmpage) || PageWriteback(page->cp_vmpage) > ) This is a bit oddly formatted. I see in our tree it looks like: if (cl_page_is_vmlocked(env, page) || PageDirty(page->cp_vmpage) || PageWriteback(page->cp_vmpage)) which is more normal. > @@ -660,19 +660,14 @@ static unsigned long osc_lock_weight(const struct lu_env *env, > return result; > > page_index = cl_index(obj, extent->start); > + > + result = osc_page_gang_lookup(env, io, oscobj, > + page_index, > + cl_index(obj, extent->end), > + weigh_cb, (void *)&page_index); > cl_io_fini(env, io); > > - return result == CLP_GANG_ABORT ? 1 : 0; > + return result ? 1 : 0; > } Per your commit comment above: > That leaves "OKAY" and "ABORT" which can simply by "true" and "false" > boolean values. So if "ABORT" is now "false", this should be: return !result; otherwise your return code logic is backward? Cheers, Andreas --- Andreas Dilger Principal Lustre Architect Whamcloud From adilger at whamcloud.com Thu Jan 10 02:43:12 2019 From: adilger at whamcloud.com (Andreas Dilger) Date: Thu, 10 Jan 2019 02:43:12 +0000 Subject: [lustre-devel] [PATCH 24/29] lustre: osc_cache: change need_release to bool In-Reply-To: <154701504259.26726.10938592737685333082.stgit@noble> References: <154701488711.26726.17363928508883972338.stgit@noble> <154701504259.26726.10938592737685333082.stgit@noble> Message-ID: <8F602893-D0CE-4746-B48C-1FDD1C27BDAC@whamcloud.com> On Jan 8, 2019, at 23:24, NeilBrown wrote: > > This variable is used like a bool, so declare it as one. > > Signed-off-by: NeilBrown Reviewed-by: Andreas Dilger > --- > drivers/staging/lustre/lustre/osc/osc_cache.c | 8 ++++---- > 1 file changed, 4 insertions(+), 4 deletions(-) > > diff --git a/drivers/staging/lustre/lustre/osc/osc_cache.c b/drivers/staging/lustre/lustre/osc/osc_cache.c > index b4bb36926046..1476f84e6156 100644 > --- a/drivers/staging/lustre/lustre/osc/osc_cache.c > +++ b/drivers/staging/lustre/lustre/osc/osc_cache.c > @@ -2316,7 +2316,7 @@ int osc_queue_async_io(const struct lu_env *env, struct cl_io *io, > unsigned int grants = 0, tmp; > int brw_flags = OBD_BRW_ASYNC; > int cmd = OBD_BRW_WRITE; > - int need_release = 0; > + bool need_release = false; > int rc = 0; > > if (oap->oap_magic != OAP_MAGIC) > @@ -2393,7 +2393,7 @@ int osc_queue_async_io(const struct lu_env *env, struct cl_io *io, > spin_lock(&cli->cl_loi_list_lock); > if (!osc_enter_cache_try(cli, oap, grants)) { > grants = 0; > - need_release = 1; > + need_release = true; > } > spin_unlock(&cli->cl_loi_list_lock); > if (!need_release && ext->oe_end < index) { > @@ -2401,7 +2401,7 @@ int osc_queue_async_io(const struct lu_env *env, struct cl_io *io, > /* try to expand this extent */ > rc = osc_extent_expand(ext, index, &tmp); > if (rc < 0) { > - need_release = 1; > + need_release = true; > /* don't free reserved grant */ > } else { > OSC_EXTENT_DUMP(D_CACHE, ext, > @@ -2413,7 +2413,7 @@ int osc_queue_async_io(const struct lu_env *env, struct cl_io *io, > rc = 0; > } else if (ext) { > /* index is located outside of active extent */ > - need_release = 1; > + need_release = true; > } > if (need_release) { > osc_extent_release(env, ext); > > Cheers, Andreas --- Andreas Dilger Principal Lustre Architect Whamcloud From adilger at whamcloud.com Thu Jan 10 03:02:45 2019 From: adilger at whamcloud.com (Andreas Dilger) Date: Thu, 10 Jan 2019 03:02:45 +0000 Subject: [lustre-devel] [PATCH 23/29] lustre: osc_cache: remove 'transient' arg from osc_enter_cache_try In-Reply-To: <154701504254.26726.7702205638412400024.stgit@noble> References: <154701488711.26726.17363928508883972338.stgit@noble> <154701504254.26726.7702205638412400024.stgit@noble> Message-ID: <87E1C21A-052C-46A7-81AA-2183EB3BB178@whamcloud.com> On Jan 8, 2019, at 23:24, NeilBrown wrote: > > This arg is always '0', so remove it. > > Signed-off-by: NeilBrown Out of curiosity, how would you find something like this? Just through code reading, or do you have some sort of static analysis tool that shows this is dead code? Digging into this a bit more, it looks like this is the only place that increments cl_dirty_transit and sets OBD_BRW_NOCACHE, which means the corresponding code in osc_release_write_grant() that checks OBD_BRW_NOCACHE and decrements cl_dirty_transit is also dead, which is good otherwise there would have been some kind of accounting leak. That further implies that cl_dirty_transit is unused and can be removed, along with obd_dirty_transit_pages. The OBD_BRW_NOCACHE flag is part of the wire protocol, but it looks like this was never actually sent on the wire, just an internal housekeeping flag, so it should be marked like: /* #define OBD_BRW_NOCACHE 0x400 internal use only 2.2.57-2.12 */ The follow-on cleanup could be part of this patch or a separate one. Reviewed-by: Andreas Dilger > --- > drivers/staging/lustre/lustre/osc/osc_cache.c | 11 +++-------- > 1 file changed, 3 insertions(+), 8 deletions(-) > > diff --git a/drivers/staging/lustre/lustre/osc/osc_cache.c b/drivers/staging/lustre/lustre/osc/osc_cache.c > index 8a68d3eb9314..b4bb36926046 100644 > --- a/drivers/staging/lustre/lustre/osc/osc_cache.c > +++ b/drivers/staging/lustre/lustre/osc/osc_cache.c > @@ -1535,7 +1535,7 @@ static void osc_exit_cache(struct client_obd *cli, struct osc_async_page *oap) > */ > static bool osc_enter_cache_try(struct client_obd *cli, > struct osc_async_page *oap, > - int bytes, int transient) > + int bytes) > { > OSC_DUMP_GRANT(D_CACHE, cli, "need:%d\n", bytes); > > @@ -1545,11 +1545,6 @@ static bool osc_enter_cache_try(struct client_obd *cli, > if (cli->cl_dirty_pages < cli->cl_dirty_max_pages && > atomic_long_read(&obd_dirty_pages) + 1 <= obd_max_dirty_pages) { > osc_consume_write_grant(cli, &oap->oap_brw_page); > - if (transient) { > - cli->cl_dirty_transit++; > - atomic_long_inc(&obd_dirty_transit_pages); > - oap->oap_brw_flags |= OBD_BRW_NOCACHE; > - } > return true; > } else { > __osc_unreserve_grant(cli, bytes, bytes); > @@ -1618,7 +1613,7 @@ static int osc_enter_cache(const struct lu_env *env, struct client_obd *cli, > remain = wait_event_idle_exclusive_timeout_cmd( > cli->cl_cache_waiters, > (entered = osc_enter_cache_try( > - cli, oap, bytes, 0)) || > + cli, oap, bytes)) || > (cli->cl_dirty_pages == 0 && > cli->cl_w_in_flight == 0), > timeout, > @@ -2396,7 +2391,7 @@ int osc_queue_async_io(const struct lu_env *env, struct cl_io *io, > > /* it doesn't need any grant to dirty this page */ > spin_lock(&cli->cl_loi_list_lock); > - if (!osc_enter_cache_try(cli, oap, grants, 0)) { > + if (!osc_enter_cache_try(cli, oap, grants)) { > grants = 0; > need_release = 1; > } > > Cheers, Andreas --- Andreas Dilger CTO Whamcloud From adilger at whamcloud.com Thu Jan 10 03:15:05 2019 From: adilger at whamcloud.com (Andreas Dilger) Date: Thu, 10 Jan 2019 03:15:05 +0000 Subject: [lustre-devel] [PATCH 25/29] lustre: remove cl_page_cancel() In-Reply-To: <154701504264.26726.17608454548660581136.stgit@noble> References: <154701488711.26726.17363928508883972338.stgit@noble> <154701504264.26726.17608454548660581136.stgit@noble> Message-ID: <5CE07684-AFF5-47D2-B43B-477E4BDABEE8@whamcloud.com> On Jan 8, 2019, at 23:24, NeilBrown wrote: > > cl_page_cancel() is never used, so remove it and various > other things that it is the only user of. > > Signed-off-by: NeilBrown Looks good. Nice to see so much dead code being removed. Reviewed-by: Andreas Dilger > --- > drivers/staging/lustre/lustre/include/cl_object.h | 18 ----- > drivers/staging/lustre/lustre/include/lustre_net.h | 1 > drivers/staging/lustre/lustre/obdclass/cl_page.c | 20 ------ > drivers/staging/lustre/lustre/osc/osc_cache.c | 67 -------------------- > .../staging/lustre/lustre/osc/osc_cl_internal.h | 1 > drivers/staging/lustre/lustre/osc/osc_internal.h | 1 > drivers/staging/lustre/lustre/osc/osc_page.c | 20 ------ > drivers/staging/lustre/lustre/osc/osc_request.c | 9 --- > drivers/staging/lustre/lustre/ptlrpc/client.c | 15 +--- > 9 files changed, 4 insertions(+), 148 deletions(-) > > diff --git a/drivers/staging/lustre/lustre/include/cl_object.h b/drivers/staging/lustre/lustre/include/cl_object.h > index a1e07f8b5eda..de5d68879740 100644 > --- a/drivers/staging/lustre/lustre/include/cl_object.h > +++ b/drivers/staging/lustre/lustre/include/cl_object.h > @@ -969,23 +969,6 @@ struct cl_page_operations { > void (*cpo_clip)(const struct lu_env *env, > const struct cl_page_slice *slice, > int from, int to); > - /** > - * \pre the page was queued for transferring. > - * \post page is removed from client's pending list, or -EBUSY > - * is returned if it has already been in transferring. > - * > - * This is one of seldom page operation which is: > - * 0. called from top level; > - * 1. don't have vmpage locked; > - * 2. every layer should synchronize execution of its ->cpo_cancel() > - * with completion handlers. Osc uses client obd lock for this > - * purpose. Based on there is no vvp_page_cancel and > - * lov_page_cancel(), cpo_cancel is defacto protected by client lock. > - * > - * \see osc_page_cancel(). > - */ > - int (*cpo_cancel)(const struct lu_env *env, > - const struct cl_page_slice *slice); > /** > * Write out a page by kernel. This is only called by ll_writepage > * right now. > @@ -2159,7 +2142,6 @@ int cl_page_cache_add(const struct lu_env *env, struct cl_io *io, > struct cl_page *pg, enum cl_req_type crt); > void cl_page_clip(const struct lu_env *env, struct cl_page *pg, > int from, int to); > -int cl_page_cancel(const struct lu_env *env, struct cl_page *page); > int cl_page_flush(const struct lu_env *env, struct cl_io *io, > struct cl_page *pg); > > diff --git a/drivers/staging/lustre/lustre/include/lustre_net.h b/drivers/staging/lustre/lustre/include/lustre_net.h > index 468a03edefd9..6d328b48a96b 100644 > --- a/drivers/staging/lustre/lustre/include/lustre_net.h > +++ b/drivers/staging/lustre/lustre/include/lustre_net.h > @@ -1830,7 +1830,6 @@ struct ptlrpc_request_set *ptlrpc_prep_fcset(int max, set_producer_func func, > void *arg); > int ptlrpc_check_set(const struct lu_env *env, struct ptlrpc_request_set *set); > int ptlrpc_set_wait(struct ptlrpc_request_set *); > -void ptlrpc_mark_interrupted(struct ptlrpc_request *req); > void ptlrpc_set_destroy(struct ptlrpc_request_set *); > void ptlrpc_set_add_req(struct ptlrpc_request_set *, struct ptlrpc_request *); > > diff --git a/drivers/staging/lustre/lustre/obdclass/cl_page.c b/drivers/staging/lustre/lustre/obdclass/cl_page.c > index 00df94b87606..217a5ebe1691 100644 > --- a/drivers/staging/lustre/lustre/obdclass/cl_page.c > +++ b/drivers/staging/lustre/lustre/obdclass/cl_page.c > @@ -932,26 +932,6 @@ void cl_page_print(const struct lu_env *env, void *cookie, > } > EXPORT_SYMBOL(cl_page_print); > > -/** > - * Cancel a page which is still in a transfer. > - */ > -int cl_page_cancel(const struct lu_env *env, struct cl_page *page) > -{ > - const struct cl_page_slice *slice; > - int result = 0; > - > - list_for_each_entry(slice, &page->cp_layers, cpl_linkage) { > - if (slice->cpl_ops->cpo_cancel) > - result = (*slice->cpl_ops->cpo_cancel)(env, slice); > - if (result != 0) > - break; > - } > - if (result > 0) > - result = 0; > - > - return result; > -} > - > /** > * Converts a byte offset within object \a obj into a page index. > */ > diff --git a/drivers/staging/lustre/lustre/osc/osc_cache.c b/drivers/staging/lustre/lustre/osc/osc_cache.c > index 1476f84e6156..79bcaa212339 100644 > --- a/drivers/staging/lustre/lustre/osc/osc_cache.c > +++ b/drivers/staging/lustre/lustre/osc/osc_cache.c > @@ -1822,7 +1822,6 @@ static void osc_ap_completion(const struct lu_env *env, struct client_obd *cli, > spin_lock(&oap->oap_lock); > oap->oap_async_flags = 0; > spin_unlock(&oap->oap_lock); > - oap->oap_interrupted = 0; > > if (oap->oap_cmd & OBD_BRW_WRITE && xid > 0) { > spin_lock(&cli->cl_loi_list_lock); > @@ -2591,72 +2590,6 @@ int osc_flush_async_page(const struct lu_env *env, struct cl_io *io, > return rc; > } > > -/** > - * this is called when a sync waiter receives an interruption. Its job is to > - * get the caller woken as soon as possible. If its page hasn't been put in an > - * rpc yet it can dequeue immediately. Otherwise it has to mark the rpc as > - * desiring interruption which will forcefully complete the rpc once the rpc > - * has timed out. > - */ > -int osc_cancel_async_page(const struct lu_env *env, struct osc_page *ops) > -{ > - struct osc_async_page *oap = &ops->ops_oap; > - struct osc_object *obj = oap->oap_obj; > - struct client_obd *cli = osc_cli(obj); > - struct osc_extent *ext; > - struct osc_extent *found = NULL; > - struct list_head *plist; > - pgoff_t index = osc_index(ops); > - int rc = -EBUSY; > - int cmd; > - > - LASSERT(!oap->oap_interrupted); > - oap->oap_interrupted = 1; > - > - /* Find out the caching extent */ > - osc_object_lock(obj); > - if (oap->oap_cmd & OBD_BRW_WRITE) { > - plist = &obj->oo_urgent_exts; > - cmd = OBD_BRW_WRITE; > - } else { > - plist = &obj->oo_reading_exts; > - cmd = OBD_BRW_READ; > - } > - list_for_each_entry(ext, plist, oe_link) { > - if (ext->oe_start <= index && ext->oe_end >= index) { > - LASSERT(ext->oe_state == OES_LOCK_DONE); > - /* For OES_LOCK_DONE state extent, it has already held > - * a refcount for RPC. > - */ > - found = osc_extent_get(ext); > - break; > - } > - } > - if (found) { > - list_del_init(&found->oe_link); > - osc_update_pending(obj, cmd, -found->oe_nr_pages); > - osc_object_unlock(obj); > - > - osc_extent_finish(env, found, 0, -EINTR); > - osc_extent_put(env, found); > - rc = 0; > - } else { > - osc_object_unlock(obj); > - /* ok, it's been put in an rpc. only one oap gets a request > - * reference > - */ > - if (oap->oap_request) { > - ptlrpc_mark_interrupted(oap->oap_request); > - ptlrpcd_wake(oap->oap_request); > - ptlrpc_req_finished(oap->oap_request); > - oap->oap_request = NULL; > - } > - } > - > - osc_list_maint(cli, obj); > - return rc; > -} > - > int osc_queue_sync_pages(const struct lu_env *env, struct osc_object *obj, > struct list_head *list, int cmd, int brw_flags) > { > diff --git a/drivers/staging/lustre/lustre/osc/osc_cl_internal.h b/drivers/staging/lustre/lustre/osc/osc_cl_internal.h > index b1a1d241cc6c..3af096e0dbdd 100644 > --- a/drivers/staging/lustre/lustre/osc/osc_cl_internal.h > +++ b/drivers/staging/lustre/lustre/osc/osc_cl_internal.h > @@ -380,7 +380,6 @@ int osc_lvb_print(const struct lu_env *env, void *cookie, > void osc_lru_add_batch(struct client_obd *cli, struct list_head *list); > void osc_page_submit(const struct lu_env *env, struct osc_page *opg, > enum cl_req_type crt, int brw_flags); > -int osc_cancel_async_page(const struct lu_env *env, struct osc_page *ops); > int osc_set_async_flags(struct osc_object *obj, struct osc_page *opg, > u32 async_flags); > int osc_prep_async_page(struct osc_object *osc, struct osc_page *ops, > diff --git a/drivers/staging/lustre/lustre/osc/osc_internal.h b/drivers/staging/lustre/lustre/osc/osc_internal.h > index 0354272fe192..586f0dfe3790 100644 > --- a/drivers/staging/lustre/lustre/osc/osc_internal.h > +++ b/drivers/staging/lustre/lustre/osc/osc_internal.h > @@ -60,7 +60,6 @@ enum async_flags { > struct osc_async_page { > int oap_magic; > unsigned short oap_cmd; > - unsigned short oap_interrupted:1; > > struct list_head oap_pending_item; > struct list_head oap_rpc_item; > diff --git a/drivers/staging/lustre/lustre/osc/osc_page.c b/drivers/staging/lustre/lustre/osc/osc_page.c > index 28b12729d7e9..e0187fafcc37 100644 > --- a/drivers/staging/lustre/lustre/osc/osc_page.c > +++ b/drivers/staging/lustre/lustre/osc/osc_page.c > @@ -137,11 +137,10 @@ static int osc_page_print(const struct lu_env *env, > struct osc_object *obj = cl2osc(slice->cpl_obj); > struct client_obd *cli = &osc_export(obj)->exp_obd->u.cli; > > - return (*printer)(env, cookie, LUSTRE_OSC_NAME "-page@%p %lu: 1< %#x %d %u %s %s > 2< %llu %u %u %#x %#x | %p %p %p > 3< %d %lu %d > 4< %d %d %d %lu %s | %s %s %s %s > 5< %s %s %s %s | %d %s | %d %s %s>\n", > + return (*printer)(env, cookie, LUSTRE_OSC_NAME "-page@%p %lu: 1< %#x %d %s %s > 2< %llu %u %u %#x %#x | %p %p %p > 3< %d %lu %d > 4< %d %d %d %lu %s | %s %s %s %s > 5< %s %s %s %s | %d %s | %d %s %s>\n", > opg, osc_index(opg), > /* 1 */ > oap->oap_magic, oap->oap_cmd, > - oap->oap_interrupted, > osc_list(&oap->oap_pending_item), > osc_list(&oap->oap_rpc_item), > /* 2 */ > @@ -216,22 +215,6 @@ static void osc_page_clip(const struct lu_env *env, > spin_unlock(&oap->oap_lock); > } > > -static int osc_page_cancel(const struct lu_env *env, > - const struct cl_page_slice *slice) > -{ > - struct osc_page *opg = cl2osc_page(slice); > - int rc = 0; > - > - /* Check if the transferring against this page > - * is completed, or not even queued. > - */ > - if (opg->ops_transfer_pinned) > - /* FIXME: may not be interrupted.. */ > - rc = osc_cancel_async_page(env, opg); > - LASSERT(ergo(rc == 0, opg->ops_transfer_pinned == 0)); > - return rc; > -} > - > static int osc_page_flush(const struct lu_env *env, > const struct cl_page_slice *slice, > struct cl_io *io) > @@ -247,7 +230,6 @@ static const struct cl_page_operations osc_page_ops = { > .cpo_print = osc_page_print, > .cpo_delete = osc_page_delete, > .cpo_clip = osc_page_clip, > - .cpo_cancel = osc_page_cancel, > .cpo_flush = osc_page_flush > }; > > diff --git a/drivers/staging/lustre/lustre/osc/osc_request.c b/drivers/staging/lustre/lustre/osc/osc_request.c > index b28fbacbcfbf..ccc491efa982 100644 > --- a/drivers/staging/lustre/lustre/osc/osc_request.c > +++ b/drivers/staging/lustre/lustre/osc/osc_request.c > @@ -1635,10 +1635,6 @@ static int osc_brw_redo_request(struct ptlrpc_request *request, > LASSERTF(request == oap->oap_request, > "request %p != oap_request %p\n", > request, oap->oap_request); > - if (oap->oap_interrupted) { > - ptlrpc_req_finished(new_req); > - return -EINTR; > - } > } > } > /* New request takes over pga and oaps from old request. > @@ -1879,7 +1875,6 @@ int osc_build_rpc(const struct lu_env *env, struct client_obd *cli, > int mem_tight = 0; > int page_count = 0; > bool soft_sync = false; > - bool interrupted = false; > int grant = 0; > int i; > int rc; > @@ -1937,8 +1932,6 @@ int osc_build_rpc(const struct lu_env *env, struct client_obd *cli, > else > LASSERT(oap->oap_page_off + oap->oap_count == > PAGE_SIZE); > - if (oap->oap_interrupted) > - interrupted = true; > } > } > > @@ -1968,8 +1961,6 @@ int osc_build_rpc(const struct lu_env *env, struct client_obd *cli, > > req->rq_memalloc = mem_tight != 0; > oap->oap_request = ptlrpc_request_addref(req); > - if (interrupted && !req->rq_intr) > - ptlrpc_mark_interrupted(req); > > /* Need to update the timestamps after the request is built in case > * we race with setattr (locally or in queue at OST). If OST gets > diff --git a/drivers/staging/lustre/lustre/ptlrpc/client.c b/drivers/staging/lustre/lustre/ptlrpc/client.c > index 8fafc8dc3f57..f90a3eef5daf 100644 > --- a/drivers/staging/lustre/lustre/ptlrpc/client.c > +++ b/drivers/staging/lustre/lustre/ptlrpc/client.c > @@ -2148,17 +2148,6 @@ void ptlrpc_expired_set(struct ptlrpc_request_set *set) > } > } > > -/** > - * Sets rq_intr flag in \a req under spinlock. > - */ > -void ptlrpc_mark_interrupted(struct ptlrpc_request *req) > -{ > - spin_lock(&req->rq_lock); > - req->rq_intr = 1; > - spin_unlock(&req->rq_lock); > -} > -EXPORT_SYMBOL(ptlrpc_mark_interrupted); > - > /** > * Interrupts (sets interrupted flag) all uncompleted requests in > * a set \a data. Called when l_wait_event_abortable_timeout receives signal. > @@ -2174,7 +2163,9 @@ static void ptlrpc_interrupted_set(struct ptlrpc_request_set *set) > req->rq_phase != RQ_PHASE_UNREG_RPC) > continue; > > - ptlrpc_mark_interrupted(req); > + spin_lock(&req->rq_lock); > + req->rq_intr = 1; > + spin_unlock(&req->rq_lock); > } > } > > > Cheers, Andreas --- Andreas Dilger CTO Whamcloud From neilb at suse.com Thu Jan 10 04:04:05 2019 From: neilb at suse.com (NeilBrown) Date: Thu, 10 Jan 2019 15:04:05 +1100 Subject: [lustre-devel] [PATCH 23/29] lustre: osc_cache: remove 'transient' arg from osc_enter_cache_try In-Reply-To: <87E1C21A-052C-46A7-81AA-2183EB3BB178@whamcloud.com> References: <154701488711.26726.17363928508883972338.stgit@noble> <154701504254.26726.7702205638412400024.stgit@noble> <87E1C21A-052C-46A7-81AA-2183EB3BB178@whamcloud.com> Message-ID: <87bm4pi2fe.fsf@notabene.neil.brown.name> On Thu, Jan 10 2019, Andreas Dilger wrote: > On Jan 8, 2019, at 23:24, NeilBrown wrote: >> >> This arg is always '0', so remove it. >> >> Signed-off-by: NeilBrown > > Out of curiosity, how would you find something like this? Just > through code reading, or do you have some sort of static analysis > tool that shows this is dead code? Just through code inspection - exactly as you demonstrate below :-) I'll add the changes you suggest, probably all in the one patch if that ends up looking OK. Thanks, NeilBrown > > Digging into this a bit more, it looks like this is the only place > that increments cl_dirty_transit and sets OBD_BRW_NOCACHE, which > means the corresponding code in osc_release_write_grant() that checks > OBD_BRW_NOCACHE and decrements cl_dirty_transit is also dead, which > is good otherwise there would have been some kind of accounting leak. > > That further implies that cl_dirty_transit is unused and can be removed, > along with obd_dirty_transit_pages. The OBD_BRW_NOCACHE flag is part > of the wire protocol, but it looks like this was never actually sent on > the wire, just an internal housekeeping flag, so it should be marked like: > > /* #define OBD_BRW_NOCACHE 0x400 internal use only 2.2.57-2.12 */ > > The follow-on cleanup could be part of this patch or a separate one. > > Reviewed-by: Andreas Dilger > >> --- >> drivers/staging/lustre/lustre/osc/osc_cache.c | 11 +++-------- >> 1 file changed, 3 insertions(+), 8 deletions(-) >> >> diff --git a/drivers/staging/lustre/lustre/osc/osc_cache.c b/drivers/staging/lustre/lustre/osc/osc_cache.c >> index 8a68d3eb9314..b4bb36926046 100644 >> --- a/drivers/staging/lustre/lustre/osc/osc_cache.c >> +++ b/drivers/staging/lustre/lustre/osc/osc_cache.c >> @@ -1535,7 +1535,7 @@ static void osc_exit_cache(struct client_obd *cli, struct osc_async_page *oap) >> */ >> static bool osc_enter_cache_try(struct client_obd *cli, >> struct osc_async_page *oap, >> - int bytes, int transient) >> + int bytes) >> { >> OSC_DUMP_GRANT(D_CACHE, cli, "need:%d\n", bytes); >> >> @@ -1545,11 +1545,6 @@ static bool osc_enter_cache_try(struct client_obd *cli, >> if (cli->cl_dirty_pages < cli->cl_dirty_max_pages && >> atomic_long_read(&obd_dirty_pages) + 1 <= obd_max_dirty_pages) { >> osc_consume_write_grant(cli, &oap->oap_brw_page); >> - if (transient) { >> - cli->cl_dirty_transit++; >> - atomic_long_inc(&obd_dirty_transit_pages); >> - oap->oap_brw_flags |= OBD_BRW_NOCACHE; >> - } >> return true; >> } else { >> __osc_unreserve_grant(cli, bytes, bytes); >> @@ -1618,7 +1613,7 @@ static int osc_enter_cache(const struct lu_env *env, struct client_obd *cli, >> remain = wait_event_idle_exclusive_timeout_cmd( >> cli->cl_cache_waiters, >> (entered = osc_enter_cache_try( >> - cli, oap, bytes, 0)) || >> + cli, oap, bytes)) || >> (cli->cl_dirty_pages == 0 && >> cli->cl_w_in_flight == 0), >> timeout, >> @@ -2396,7 +2391,7 @@ int osc_queue_async_io(const struct lu_env *env, struct cl_io *io, >> >> /* it doesn't need any grant to dirty this page */ >> spin_lock(&cli->cl_loi_list_lock); >> - if (!osc_enter_cache_try(cli, oap, grants, 0)) { >> + if (!osc_enter_cache_try(cli, oap, grants)) { >> grants = 0; >> need_release = 1; >> } >> >> > > Cheers, Andreas > --- > Andreas Dilger > CTO Whamcloud -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 832 bytes Desc: not available URL: From neilb at suse.com Thu Jan 10 05:04:19 2019 From: neilb at suse.com (NeilBrown) Date: Thu, 10 Jan 2019 16:04:19 +1100 Subject: [lustre-devel] [PATCH 02/29] lustre: osc_cache: use assert_spin_locked() In-Reply-To: <87942812-3A47-49E3-B7C9-75DC2D426305@whamcloud.com> References: <154701488711.26726.17363928508883972338.stgit@noble> <154701504098.26726.7180667249484886220.stgit@noble> <87942812-3A47-49E3-B7C9-75DC2D426305@whamcloud.com> Message-ID: <8736q1hzn0.fsf@notabene.neil.brown.name> On Thu, Jan 10 2019, Andreas Dilger wrote: > On Jan 8, 2019, at 23:24, NeilBrown wrote: >> >> assert_spin_locked() is preferred to >> spin_is_locked() for affirming that a >> spinlock is locked. >> >> Signed-off-by: NeilBrown > > We used to have an LASSERT_SPIN_LOCKED() macro, but it was removed a few > years ago. It is nice to get better checking in the kernel. > > One question inline below: > >> --- >> drivers/staging/lustre/lustre/osc/osc_cache.c | 29 +++++++++----------- >> .../staging/lustre/lustre/osc/osc_cl_internal.h | 15 +--------- >> 2 files changed, 15 insertions(+), 29 deletions(-) >> >> diff --git a/drivers/staging/lustre/lustre/osc/osc_cache.c b/drivers/staging/lustre/lustre/osc/osc_cache.c >> index fbf16547003d..1ce9f673f1bf 100644 >> --- a/drivers/staging/lustre/lustre/osc/osc_cache.c >> +++ b/drivers/staging/lustre/lustre/osc/osc_cache.c >> @@ -181,10 +181,7 @@ static int osc_extent_sanity_check0(struct osc_extent *ext, >> size_t page_count; >> int rc = 0; >> >> - if (!osc_object_is_locked(obj)) { >> - rc = 9; >> - goto out; >> - } >> + assert_osc_object_is_locked(obj); > > Is this actually a fatal error? It looks like if the object is not > locked then the checking isn't consistent and could just be skipped? The assert is fatal (-> BUG_ON()). > > There is a macro that lends credence to this: > > #define sanity_check_nolock(ext) \ > osc_extent_sanity_check0(ext, __func__, __LINE__) > > #define sanity_check(ext) ({ \ > int __res; \ > osc_object_lock((ext)->oe_obj); \ > __res = sanity_check_nolock(ext); \ > osc_object_unlock((ext)->oe_obj); \ > __res; \ > }) > > However, reading deeper into the code sanity_check_nolock() looks > like is only ever called when the object is already locked, so > indeed it does seem like a valid change that should be described > in the commit message like: Agreed. > > __osc_extent_sanity_check() is only ever called with obj > already locked, so change the check into an assertion. Good suggestion - I've added this text. > > It might also be an improvement to rename sanity_check{,_nolock}() > to osc_extent_sanity_check() and osc_extent_sanity_check_nolock(), > and use __osc_extent_sanity_check() instead of ...0() (which is not > standard)? I was going to suggest making sanity_check() an inline > function, but that would break the __func__ and __LINE__ expansion > and isn't onerous. That renaming makes sense - I'll add it as another patch. > > Reviewed-by: Andreas Dilger Thanks, NeilBrown -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 832 bytes Desc: not available URL: From neilb at suse.com Thu Jan 10 05:25:34 2019 From: neilb at suse.com (NeilBrown) Date: Thu, 10 Jan 2019 16:25:34 +1100 Subject: [lustre-devel] [PATCH 28/29] lustre: osc_request: assorted white-space and check-patch fixes. In-Reply-To: References: <154701488711.26726.17363928508883972338.stgit@noble> <154701504282.26726.12048576544354457365.stgit@noble> Message-ID: <87zhs9gk35.fsf@notabene.neil.brown.name> On Thu, Jan 10 2019, Andreas Dilger wrote: > On Jan 8, 2019, at 23:24, NeilBrown wrote: >> >> Just misc formatting fixes. Some minot code change > > (typo) "minor" > >> where an 'else' after 'return' was discarded. >> >> Signed-off-by: NeilBrown >> --- >> drivers/staging/lustre/lustre/osc/osc_request.c | 163 +++++++++++++---------- >> 1 file changed, 89 insertions(+), 74 deletions(-) >> >> diff --git a/drivers/staging/lustre/lustre/osc/osc_request.c b/drivers/staging/lustre/lustre/osc/osc_request.c >> index ccc491efa982..c2239c99a7b2 100644 >> --- a/drivers/staging/lustre/lustre/osc/osc_request.c >> +++ b/drivers/staging/lustre/lustre/osc/osc_request.c >> >> @@ -652,8 +651,8 @@ static int osc_destroy(const struct lu_env *env, struct obd_export *exp, >> * Wait until the number of on-going destroy RPCs drops >> * under max_rpc_in_flight >> */ >> - rc = l_wait_event_abortable_exclusive(cli->cl_destroy_waitq, >> - osc_can_send_destroy(cli)); >> + rc = l_wait_event_abortable_exclusive( >> + cli->cl_destroy_waitq, osc_can_send_destroy(cli)); >> if (rc) { >> ptlrpc_req_finished(req); >> return rc; > > I don't really see this change as an improvement? I'd instead just de-indent > the osc_can_send_destroy() by a space or two so it fits within 80 colunmns. > That is IMHO closer to the normal coding style. That would result in: CHECK: Alignment should match open parenthesis #655: FILE: drivers/staging/lustre/lustre/osc/osc_request.c:655: + rc = l_wait_event_abortable_exclusive(cli->cl_destroy_waitq, + osc_can_send_destroy(cli)); though now we have: CHECK: Lines should not end with a '(' #654: FILE: drivers/staging/lustre/lustre/osc/osc_request.c:654: + rc = l_wait_event_abortable_exclusive( I might just leave it as it is, with an 81-column line. Thanks, NeilBrown > > Cheers, Andreas > --- > Andreas Dilger > Principal Lustre Architect > Whamcloud -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 832 bytes Desc: not available URL: From adilger at whamcloud.com Thu Jan 10 07:28:15 2019 From: adilger at whamcloud.com (Andreas Dilger) Date: Thu, 10 Jan 2019 07:28:15 +0000 Subject: [lustre-devel] [PATCH v2 33/33] lustre: update version to 2.9.99 In-Reply-To: <87muo9ibuk.fsf@notabene.neil.brown.name> References: <1546812868-11794-1-git-send-email-jsimmons@infradead.org> <1546812868-11794-34-git-send-email-jsimmons@infradead.org> <874lakj5ck.fsf@notabene.neil.brown.name> <45806D2E-8AAD-48ED-8B14-6D5CC11D824E@whamcloud.com> <87muo9ibuk.fsf@notabene.neil.brown.name> Message-ID: On Jan 9, 2019, at 17:40, NeilBrown wrote: > > On Tue, Jan 08 2019, Andreas Dilger wrote: >> On Jan 7, 2019, at 21:26, James Simmons wrote: >>> >>>> sanity: FAIL: test_130a filefrag /mnt/lustre/f130a.sanity failed >>>> sanity: FAIL: test_130b filefrag /mnt/lustre/f130b.sanity failed >>>> sanity: FAIL: test_130c filefrag /mnt/lustre/f130c.sanity failed >>>> sanity: FAIL: test_130e filefrag /mnt/lustre/f130e.sanity failed >>>> sanity: FAIL: test_130f filefrag /mnt/lustre/f130f.sanity failed >>> >>> What version of e2fsprog are you running? You need a 1.44 version and >>> this should go away. >> >> To be clear - the Lustre-patched "filefrag" at: >> >> https://downloads.whamcloud.com/public/e2fsprogs/1.44.3.wc1/ > > I looked at Commit 41aee4226789 ("filefrag: Lustre changes to filefrag] FIEMAP handling") in the git tree instead. > > This appears to add 3 features. > > - It adds an optional device to struct fiemap. > Presumably this is always returned if available, else zero is provided > which means "the device". Vanilla filefrag just returns 0 today. For Lustre filefrag it returns the OST index on which the blocks are located. For local filesystems I'm expecting it to return the rdev of the block device, like 0x801 or similar. > - It adds a flag FIEMAP_EXTENT_NET which indicates that the device > number is *not* dev_t, but is some fs-specific value Right. > - It allows FIEMAP_FLAG_DEVICE_ORDER to be requested. I can't quite > work out what this does. The logic makes sense once you understand it. Consider a striped Lustre file, or perhaps on an MD RAID device. If you returned the blocks in file-logical order (i.e. block 0...EOF), then the largest extent that could be returned for the same device would be stripe_size/chunk_size. This would be very verbose (e.g. 1TB file with 1MB stripe_size would be 1M lines of output, though still better than the 256M lines from the old FIBMAP-based filefrag). This would make it very hard to see if the file allocation is contiguous or fragmented, which was our original goal for implementing FIEMAP. The DEVICE_ORDER flag means "return blocks in the underlying device order". This allows returning block extents of the maximum size for the underlying filesystem (128MB for ext4), and much more clearly shows whether the underlying file allocation is contiguous or fragmented. It also simplifies the implementation at the Lustre side, because we are essentially doing a series of per-OST FIEMAP calls until the OST object is done, then moving on to the next object in the file. The alternative (which I've thought of impementing, just for compatibility reasons) would be to interleave the FIEMAP output from each OST by the logical file offset, but it would be ugly and not very useful, except for tools that want to see if a file has holes or not. $ filefrag -v /myth/tmp/4stripe Filesystem type is: bd00bd0 File size of /myth/tmp/4stripe is 104857600 (102400 blocks of 1024 bytes) ext: device_logical: physical_offset: length: dev: flags: 0: 0.. 28671: 1837711360..1837740031: 28672: 0004: net 1: 0.. 24575: 1280876544..1280901119: 24576: 0000: net 2: 0.. 24575: 1535643648..1535668223: 24576: 0001: net 3: 0.. 24575: 4882608128..4882632703: 24576: 0003: last,net > Presumably it changes the order that entries are returned (why?) and > maybe returns multiple entries for a region that is mirrored ??? The multiple entries per region is needed for mirrored files. > As you say, I can see how these might be useful to other filesystems. > Maybe we should try upstreaming the support sooner rather than later. I've tried a few times, but have been rebuffed because Lustre isn't in the mainline. Originally, BtrFS wasn't going to have multiple device support, but that has changed since the time FIEMAP was introduced. I'd of course be happy if it was in mainline, or at least the fields in struct fiemap_extent reserved to avoid future conflicts. There was also a proposal from SuSE for BtrFS to add support for compressed extents, but it never quite made it over the finish line: David Serba "fiemap: introduce EXTENT_DATA_COMPRESSED flag" Cheers, Andreas --- Andreas Dilger Principal Lustre Architect Whamcloud From adilger at whamcloud.com Thu Jan 10 07:41:58 2019 From: adilger at whamcloud.com (Andreas Dilger) Date: Thu, 10 Jan 2019 07:41:58 +0000 Subject: [lustre-devel] [PATCH v2 33/33] lustre: update version to 2.9.99 In-Reply-To: <87h8ehi8s6.fsf@notabene.neil.brown.name> References: <1546812868-11794-1-git-send-email-jsimmons@infradead.org> <1546812868-11794-34-git-send-email-jsimmons@infradead.org> <874lakj5ck.fsf@notabene.neil.brown.name> <45806D2E-8AAD-48ED-8B14-6D5CC11D824E@whamcloud.com> <87h8ehi8s6.fsf@notabene.neil.brown.name> Message-ID: On Jan 9, 2019, at 18:46, NeilBrown wrote: > > On Tue, Jan 08 2019, James Simmons wrote: >> >> I have been thinking what would be a better approach since I like to >> approach this problem for the 2.13 time frame. Our admins at my work >> place want to be able to collect application stats without being root. >> So placing stats in debugfs is not an option, which we currently do >> the linux client :-( The stats are not a good fit for sysfs. > > How much statistics data are we talking about here? > /proc/self/mountstats > shows over 2K of stats for NFS filesystems. > Is this in the ball-park or do you need an order-of-magnitude more? Ah, the joys of being grandfathered into the code... One of the larger normal /proc files is the "obdfilter.*.brw_stats" files, which I agree is a bit of an abomination of ASCII formatted output. Most of the regular stats files are about 1KB in size, like: wc /proc/fs/lustre//osc/myth-OST000*/stats 14 107 1028 /proc/fs/lustre//osc/myth-OST0000-osc-ffff880429ee7c00/stats 14 107 1011 /proc/fs/lustre//osc/myth-OST0001-osc-ffff880429ee7c00/stats 13 99 989 /proc/fs/lustre//osc/myth-OST0002-osc-ffff880429ee7c00/stats 14 107 1043 /proc/fs/lustre//osc/myth-OST0003-osc-ffff880429ee7c00/stats 14 107 1075 /proc/fs/lustre//osc/myth-OST0004-osc-ffff880429ee7c00/stats The {obdfilter,mdt}.*.job_stats files can become quite big on a large system if there are lots of jobs running. James would have to report on what kind of sizes they get on their nearly-largest-in-the-world filesystem. Definitely into the MB range. I don't think there would be a need to poll that super frequently, maybe in the 60s range, as it keeps the stats for some minutes after a job stops IO, or it would be impossible to gather accurate stats for the whole job. Cheers, Andreas --- Andreas Dilger Principal Lustre Architect Whamcloud From adilger at whamcloud.com Thu Jan 10 09:10:53 2019 From: adilger at whamcloud.com (Andreas Dilger) Date: Thu, 10 Jan 2019 09:10:53 +0000 Subject: [lustre-devel] [PATCH v2 33/33] lustre: update version to 2.9.99 In-Reply-To: <87k1jdi99a.fsf@notabene.neil.brown.name> References: <1546812868-11794-1-git-send-email-jsimmons@infradead.org> <1546812868-11794-34-git-send-email-jsimmons@infradead.org> <874lakj5ck.fsf@notabene.neil.brown.name> <45806D2E-8AAD-48ED-8B14-6D5CC11D824E@whamcloud.com> <9BDCA6A9-A826-49A7-9126-BC1DCC96AC1D@whamcloud.com> <53F17B0D-5FB3-4B69-B483-7AA4FBCA259B@whamcloud.com> <87k1jdi99a.fsf@notabene.neil.brown.name> Message-ID: On Jan 9, 2019, at 18:36, NeilBrown wrote: > > On Wed, Jan 09 2019, Andreas Dilger wrote: > >> On Jan 9, 2019, at 11:28, James Simmons wrote: >>> >>>>>> This might be because the upstream Lustre doesn't allow setting >>>>>> per-process JobID via environment variable, only as a single >>>>>> per-node value. The real unfortunate part is that the "get JobID >>>>>> from environment" actually works for every reasonable architecture >>>>>> (even the one which was originally broken fixed it), but it got >>>>>> yanked anyway. This is actually one of the features of Lustre that >>>>>> lots of HPC sites like to use, since it allows them to track on the >>>>>> servers which users/jobs/processes on the client are doing IO. >>>>> >>>>> To give background for Neil see thread: >>>>> >>>>> https://lore.kernel.org/patchwork/patch/416846 >>>>> >>>>> In this case I do agree with Greg. The latest jobid does implement an >>>>> upcall and upcalls don't play niece with containers. Their is also the >>>>> namespace issue pointed out. I think the namespace issue might be fixed >>>>> in the latest OpenSFS code. >>>> >>>> I'm not sure what you mean? AFAIK, there is no upcall for JobID, except >>>> maybe in the kernel client where we weren't allowed to parse the process >>>> environment directly. I agree an upcall is problematic with namespaces, >>>> in addition to being less functional (only a JobID per node instead of >>>> per process), which is why direct access to JOBENV is better IMHO. >>> >>> I have some evil ideas about this. Need to think about it some more since >>> this is a more complex problem. >> >> Since the kernel manages the environment variables via getenv() and setenv(), I honestly don't see why accessing them directly is a huge issue? > > This is, at best, an over-simplification. The kernel doesn't "manage" the > environment variables. > When a process calls execve() (or similar) a collection of strings called > "arguments" and another collection of strings called "environment" are > extracted from the processes vm, and used for initializing part of the > newly created vm. That is all the kernel does with either. > (except for providing /proc/*/cmdline and /proc/*/environ, which is best-effort). Sure, and we only provide a best effort at parsing it as a series of NUL- terminated strings. Userspace can't corrupt the kernel VMA mappings, so at worst we don't find anything we are looking for, which can also happen if no JobID is set in the first place. It's not really any more dangerous than any copy_from_user() in the filesystem/ioctl code. > getenv() ad setenv() are entirely implemented in user-space. It is quite > possible for a process to mess-up its args or environment in a way that > will make /proc/*/{cmdline,environ} fail to return anything useful. If userspace has also messed it up so badly that it can't parse the environment variables themselves, then even a userspace upcall isn't going to work. > It is quite possible for the memory storing args and env to be swapped > out. If a driver tried to accesses either, it might trigger page-in of > that part of the address space, which would probably work but might not > be a good idea. I've never seen a report of problems like this. Processes that are swapped out are probably not going to be submitting IO either... We cache the JobID in the kernel so it is only fetched on the first IO for that process ID. There once was a bug where the JobID was fetched during mmap IO which caused a deadlock, and was since fixed. We also added the JobID cache, which has reduced the overhead significantly. > As I understand it, the goal here is to have a cluster-wide identifier > that can be attached to groups of processes on different nodes. Then > stats relating to all of those processes can be collected together. Correct, but it isn't just _any_ system-wide identifier. The large parallel MPI applications already get assigned an identifier by the batch scheduler before they are run, and a large number of tools in these systems use JobID for tracking logs, CPU/IO accounting, etc. The JobID is stored in an environment variable (e.g. SLURM_JOB_ID) by the batch scheduler before the actual job is forked. See the comment at the start of lustre/obdclass/lprocfs_jobstats.c for examples. We can also set artificial jobid values for debugging or use with systems not using MPI (e.g. procname_uid), but they do not need access to the process environment. For Lustre, the admin does a one-time configuration of the name of the environment variable ("lctl conf_param jobid_var=SLURM_JOB_ID") to tell the kernel which environment variable to use. > ... But as I do think that control-groups are an abomination, I couldn't > possible suggest any such thing. > Unix already has a perfectly good grouping abstraction - process groups > (unfortunately there are about 3 sorts of these, but that needn't be a > big problem). Stats can be collected based on pgid, and a mapping from > client+pgid->jobid can be communicated to whatever collects the > statistics ... somehow. So, right now we have "scan a few KB of kernel memory for a string" periodically in the out-of-tree client (see jobid_get_from_environ() and cfs_get_environ()), and then a hash table that caches the JobID internally and maps the pid to the JobID when it is needed. Most of the code is an simplified copy of access_process_vm() for kernels after v2.6.24-rc1-652-g02c3530da6b9 when it was un-EXPORT_SYMBOL'd, but since kernel v4.9-rc3-36-gfcd35857d662 it is again exported so it makes sense to add a configure check. Most of the rest is for when the variable or value crosses a page boundary. Conversely, the kernel client has something like "upcall a userspace process, fork a program (millions of cycles), have that program do the same scan of the kernel environment memory, but now it is doing it in userspace, open a file, write the environment variable to the kernel, exit and clean up the process that was created" to do the same thing. Using a pgid seems mostly unusable, since the stats are not collected on the client, they are collected on the server (the JobID is sent with every userspace-driven RPC to the server), which is the centralized location where all clients submit their IO. JobStats gives us relatively easy and direct method to see which client process(es) are going a lot of IO or RPCs, just looking into a /proc file if necessary (though they are typically further centralized and monitored from the multiple servers). We can't send a different pgid from each client along with the RPCs and hope to aggregate that at the server without adding huge complexity. We would need real-time mapping from every new pgid on each client (maybe thousands per second per client) to the JobID then passed to the MDS/OSS so that they can reverse-map the pgid back into a JobID before the first RPC arrives at the server. Alternately, track separate stats for each client:pgid combination on the server (num_cores * clients = millions of times more than today if there are multiple jobs per client) until they are fetched into userspace for mapping and re-aggregation. Thanks, but I'd rather stick with the relatively simple and direct method we are using today. It's worked without problems for 10 years of kernels. I think that is one of the big obstacles that we face with many of the upstream kernel maintainers, is that they are focussed on issues that are local to a one or a few nodes, but we have to deal with issues that may involve hundreds or thousands of different nodes working as a single task (unlike cloud stuff where there may be many nodes, but they are all doing things independently). It's not that we develop crazy things because we have spare time to burn, but because they are needed to deal sanely with such environments. Cheers, Andreas --- Andreas Dilger Principal Lustre Architect Whamcloud From neilb at suse.com Fri Jan 11 00:00:45 2019 From: neilb at suse.com (NeilBrown) Date: Fri, 11 Jan 2019 11:00:45 +1100 Subject: [lustre-devel] [PATCH 0/4] lustre: rename foo0() to __foo() Message-ID: <154716475327.28978.3817067697027604609.stgit@noble> This change was suggested by Andreas - I liked it so much I applied it to all of lustre. Except cl_env_init0 - it didn't quite fit the pattern, so I haven't changed that. NeilBrown --- NeilBrown (4): lustre: osc: change some foo0() to __foo() lustre: llite: change some foo0() to __foo() lustre: obdclass: change some foo0() to __foo() lustre: ptlrpc: change some foo0() to __foo() drivers/staging/lustre/lustre/include/cl_object.h | 6 +-- drivers/staging/lustre/lustre/llite/glimpse.c | 2 - .../staging/lustre/lustre/llite/llite_internal.h | 6 +-- drivers/staging/lustre/lustre/llite/llite_mmap.c | 11 ++--- drivers/staging/lustre/lustre/llite/vvp_object.c | 8 ++-- drivers/staging/lustre/lustre/obdclass/cl_io.c | 14 +++--- drivers/staging/lustre/lustre/obdclass/cl_lock.c | 8 ++-- drivers/staging/lustre/lustre/obdclass/cl_page.c | 36 ++++++++-------- .../staging/lustre/lustre/obdecho/echo_client.c | 20 +++++---- drivers/staging/lustre/lustre/osc/osc_cache.c | 44 ++++++++++---------- drivers/staging/lustre/lustre/osc/osc_lock.c | 8 ++-- drivers/staging/lustre/lustre/ptlrpc/nrs.c | 20 +++++---- drivers/staging/lustre/lustre/ptlrpc/nrs_fifo.c | 2 - .../staging/lustre/lustre/ptlrpc/ptlrpc_internal.h | 6 +-- 14 files changed, 95 insertions(+), 96 deletions(-) -- Signature From neilb at suse.com Fri Jan 11 00:00:45 2019 From: neilb at suse.com (NeilBrown) Date: Fri, 11 Jan 2019 11:00:45 +1100 Subject: [lustre-devel] [PATCH 1/4] lustre: osc: change some foo0() to __foo() In-Reply-To: <154716475327.28978.3817067697027604609.stgit@noble> References: <154716475327.28978.3817067697027604609.stgit@noble> Message-ID: <154716484583.28978.14863799416083470252.stgit@noble> It is standard practice in Linux, when naming a helper-function which is not meant to be called directly, to use a name starting __. e.g. foo() and foo_too() might call __foo(), which is otherwise not directly called. Lustre has a similar convention, but instead uses names like foo0(). This patch convert osc_extent_tree_dump0 -> __osc_extent_tree_dump osc_extent_sanity_check0 -> __osc_extent_sanity_check osc_io_unplug0 -> __osc_io_unplug osc_dlm_blocking_ast0 -> __osc_dlm_blocking_ast Suggested-by: Andreas Dilger Signed-off-by: NeilBrown --- drivers/staging/lustre/lustre/osc/osc_cache.c | 44 +++++++++++++------------ drivers/staging/lustre/lustre/osc/osc_lock.c | 8 ++--- 2 files changed, 26 insertions(+), 26 deletions(-) diff --git a/drivers/staging/lustre/lustre/osc/osc_cache.c b/drivers/staging/lustre/lustre/osc/osc_cache.c index 1ce9f673f1bf..57046d355eda 100644 --- a/drivers/staging/lustre/lustre/osc/osc_cache.c +++ b/drivers/staging/lustre/lustre/osc/osc_cache.c @@ -57,10 +57,10 @@ static int osc_io_unplug_async(const struct lu_env *env, static void osc_free_grant(struct client_obd *cli, unsigned int nr_pages, unsigned int lost_grant, unsigned int dirty_grant); -static void osc_extent_tree_dump0(int level, struct osc_object *obj, - const char *func, int line); +static void __osc_extent_tree_dump(int level, struct osc_object *obj, + const char *func, int line); #define osc_extent_tree_dump(lvl, obj) \ - osc_extent_tree_dump0(lvl, obj, __func__, __LINE__) + __osc_extent_tree_dump(lvl, obj, __func__, __LINE__) static void osc_unreserve_grant(struct client_obd *cli, unsigned int reserved, unsigned int unused); @@ -173,8 +173,8 @@ static inline struct osc_extent *first_extent(struct osc_object *obj) } /* object must be locked by caller. */ -static int osc_extent_sanity_check0(struct osc_extent *ext, - const char *func, const int line) +static int __osc_extent_sanity_check(struct osc_extent *ext, + const char *func, const int line) { struct osc_object *obj = ext->oe_obj; struct osc_async_page *oap; @@ -302,13 +302,13 @@ static int osc_extent_sanity_check0(struct osc_extent *ext, return rc; } -#define sanity_check_nolock(ext) \ - osc_extent_sanity_check0(ext, __func__, __LINE__) +#define osc_extent_sanity_check_nolock(ext) \ + __osc_extent_sanity_check(ext, __func__, __LINE__) -#define sanity_check(ext) ({ \ +#define osc_extent_sanity_check(ext) ({ \ int __res; \ osc_object_lock((ext)->oe_obj); \ - __res = sanity_check_nolock(ext); \ + __res = osc_extent_sanity_check_nolock(ext); \ osc_object_unlock((ext)->oe_obj); \ __res; \ }) @@ -342,7 +342,7 @@ static void osc_extent_state_set(struct osc_extent *ext, int state) LASSERT(state >= OES_INV && state < OES_STATE_MAX); /* Never try to sanity check a state changing extent :-) */ - /* LASSERT(sanity_check_nolock(ext) == 0); */ + /* LASSERT(osc_extent_sanity_check_nolock(ext) == 0); */ /* TODO: validate the state machine */ ext->oe_state = state; @@ -600,7 +600,7 @@ void osc_extent_release(const struct lu_env *env, struct osc_extent *ext) struct client_obd *cli = osc_cli(obj); LASSERT(atomic_read(&ext->oe_users) > 0); - LASSERT(sanity_check(ext) == 0); + LASSERT(osc_extent_sanity_check(ext) == 0); LASSERT(ext->oe_grants > 0); if (atomic_dec_and_lock(&ext->oe_users, &obj->oo_lock)) { @@ -729,7 +729,7 @@ static struct osc_extent *osc_extent_find(const struct lu_env *env, pgoff_t ext_chk_start = ext->oe_start >> ppc_bits; pgoff_t ext_chk_end = ext->oe_end >> ppc_bits; - LASSERT(sanity_check_nolock(ext) == 0); + LASSERT(osc_extent_sanity_check_nolock(ext) == 0); if (chunk > ext_chk_end + 1) break; @@ -969,7 +969,7 @@ static int osc_extent_wait(const struct lu_env *env, struct osc_extent *ext, int rc = 0; osc_object_lock(obj); - LASSERT(sanity_check_nolock(ext) == 0); + LASSERT(osc_extent_sanity_check_nolock(ext) == 0); /* `Kick' this extent only if the caller is waiting for it to be * written out. */ @@ -1025,7 +1025,7 @@ static int osc_extent_truncate(struct osc_extent *ext, pgoff_t trunc_index, int rc = 0; u16 refcheck; - LASSERT(sanity_check(ext) == 0); + LASSERT(osc_extent_sanity_check(ext) == 0); EASSERT(ext->oe_state == OES_TRUNC, ext); EASSERT(!ext->oe_urgent, ext); @@ -1141,7 +1141,7 @@ static int osc_extent_make_ready(const struct lu_env *env, int rc; /* we're going to grab page lock, so object lock must not be taken. */ - LASSERT(sanity_check(ext) == 0); + LASSERT(osc_extent_sanity_check(ext) == 0); /* in locking state, any process should not touch this extent. */ EASSERT(ext->oe_state == OES_LOCKING, ext); EASSERT(ext->oe_owner, ext); @@ -1229,7 +1229,7 @@ static int osc_extent_expand(struct osc_extent *ext, pgoff_t index, LASSERT(ext->oe_max_end >= index && ext->oe_start <= index); osc_object_lock(obj); - LASSERT(sanity_check_nolock(ext) == 0); + LASSERT(osc_extent_sanity_check_nolock(ext) == 0); end_chunk = ext->oe_end >> ppc_bits; if (chunk > end_chunk + 1) { rc = -ERANGE; @@ -1273,8 +1273,8 @@ static int osc_extent_expand(struct osc_extent *ext, pgoff_t index, return rc; } -static void osc_extent_tree_dump0(int level, struct osc_object *obj, - const char *func, int line) +static void __osc_extent_tree_dump(int level, struct osc_object *obj, + const char *func, int line) { struct osc_extent *ext; int cnt; @@ -2355,8 +2355,8 @@ static void osc_check_rpcs(const struct lu_env *env, struct client_obd *cli) } } -static int osc_io_unplug0(const struct lu_env *env, struct client_obd *cli, - struct osc_object *osc, int async) +static int __osc_io_unplug(const struct lu_env *env, struct client_obd *cli, + struct osc_object *osc, int async) { int rc = 0; @@ -2378,13 +2378,13 @@ static int osc_io_unplug0(const struct lu_env *env, struct client_obd *cli, static int osc_io_unplug_async(const struct lu_env *env, struct client_obd *cli, struct osc_object *osc) { - return osc_io_unplug0(env, cli, osc, 1); + return __osc_io_unplug(env, cli, osc, 1); } void osc_io_unplug(const struct lu_env *env, struct client_obd *cli, struct osc_object *osc) { - (void)osc_io_unplug0(env, cli, osc, 0); + (void)__osc_io_unplug(env, cli, osc, 0); } int osc_prep_async_page(struct osc_object *osc, struct osc_page *ops, diff --git a/drivers/staging/lustre/lustre/osc/osc_lock.c b/drivers/staging/lustre/lustre/osc/osc_lock.c index 824c655b4ce0..01b6bf7df3b7 100644 --- a/drivers/staging/lustre/lustre/osc/osc_lock.c +++ b/drivers/staging/lustre/lustre/osc/osc_lock.c @@ -413,9 +413,9 @@ static int osc_lock_flush(struct osc_object *obj, pgoff_t start, pgoff_t end, * Helper for osc_dlm_blocking_ast() handling discrepancies between cl_lock * and ldlm_lock caches. */ -static int osc_dlm_blocking_ast0(const struct lu_env *env, - struct ldlm_lock *dlmlock, - void *data, int flag) +static int __osc_dlm_blocking_ast(const struct lu_env *env, + struct ldlm_lock *dlmlock, + void *data, int flag) { enum cl_lock_mode mode = CLM_READ; struct cl_object *obj = NULL; @@ -556,7 +556,7 @@ static int osc_ldlm_blocking_ast(struct ldlm_lock *dlmlock, break; } - result = osc_dlm_blocking_ast0(env, dlmlock, data, flag); + result = __osc_dlm_blocking_ast(env, dlmlock, data, flag); cl_env_put(env, &refcheck); break; } From neilb at suse.com Fri Jan 11 00:00:46 2019 From: neilb at suse.com (NeilBrown) Date: Fri, 11 Jan 2019 11:00:46 +1100 Subject: [lustre-devel] [PATCH 2/4] lustre: llite: change some foo0() to __foo() In-Reply-To: <154716475327.28978.3817067697027604609.stgit@noble> References: <154716475327.28978.3817067697027604609.stgit@noble> Message-ID: <154716484597.28978.7362652816645934722.stgit@noble> Change: cl_glimpse_size0 -> __cl_glimpse_size ll_page_mkwrite0 -> __ll_page_mkwrite ll_fault0 -> __ll_fault vvp_object_init0 -> __vvp_object_init This is more consistent with Linux naming style. Signed-off-by: NeilBrown --- drivers/staging/lustre/lustre/llite/glimpse.c | 2 +- .../staging/lustre/lustre/llite/llite_internal.h | 6 +++--- drivers/staging/lustre/lustre/llite/llite_mmap.c | 11 +++++------ drivers/staging/lustre/lustre/llite/vvp_object.c | 8 ++++---- 4 files changed, 13 insertions(+), 14 deletions(-) diff --git a/drivers/staging/lustre/lustre/llite/glimpse.c b/drivers/staging/lustre/lustre/llite/glimpse.c index ce0d51767da3..d8712a392e58 100644 --- a/drivers/staging/lustre/lustre/llite/glimpse.c +++ b/drivers/staging/lustre/lustre/llite/glimpse.c @@ -163,7 +163,7 @@ static int cl_io_get(struct inode *inode, struct lu_env **envout, return result; } -int cl_glimpse_size0(struct inode *inode, int agl) +int __cl_glimpse_size(struct inode *inode, int agl) { /* * We don't need ast_flags argument to cl_glimpse_size(), because diff --git a/drivers/staging/lustre/lustre/llite/llite_internal.h b/drivers/staging/lustre/lustre/llite/llite_internal.h index b2a1f54ab228..c680a49d900c 100644 --- a/drivers/staging/lustre/lustre/llite/llite_internal.h +++ b/drivers/staging/lustre/lustre/llite/llite_internal.h @@ -1161,18 +1161,18 @@ void ll_deauthorize_statahead(struct inode *dir, void *key); blkcnt_t dirty_cnt(struct inode *inode); -int cl_glimpse_size0(struct inode *inode, int agl); +int __cl_glimpse_size(struct inode *inode, int agl); int cl_glimpse_lock(const struct lu_env *env, struct cl_io *io, struct inode *inode, struct cl_object *clob, int agl); static inline int cl_glimpse_size(struct inode *inode) { - return cl_glimpse_size0(inode, 0); + return __cl_glimpse_size(inode, 0); } static inline int cl_agl(struct inode *inode) { - return cl_glimpse_size0(inode, 1); + return __cl_glimpse_size(inode, 1); } static inline int ll_glimpse_size(struct inode *inode) diff --git a/drivers/staging/lustre/lustre/llite/llite_mmap.c b/drivers/staging/lustre/lustre/llite/llite_mmap.c index 023d62e53051..33e23ee4aff4 100644 --- a/drivers/staging/lustre/lustre/llite/llite_mmap.c +++ b/drivers/staging/lustre/lustre/llite/llite_mmap.c @@ -143,9 +143,8 @@ ll_fault_io_init(struct lu_env *env, struct vm_area_struct *vma, return io; } -/* Sharing code of page_mkwrite method for rhel5 and rhel6 */ -static int ll_page_mkwrite0(struct vm_area_struct *vma, struct page *vmpage, - bool *retry) +static int __ll_page_mkwrite(struct vm_area_struct *vma, struct page *vmpage, + bool *retry) { struct lu_env *env; struct cl_io *io; @@ -262,7 +261,7 @@ static inline vm_fault_t to_fault_error(int result) * \retval VM_FAULT_ERROR on general error * \retval NOPAGE_OOM not have memory for allocate new page */ -static vm_fault_t ll_fault0(struct vm_area_struct *vma, struct vm_fault *vmf) +static vm_fault_t __ll_fault(struct vm_area_struct *vma, struct vm_fault *vmf) { struct lu_env *env; struct cl_io *io; @@ -365,7 +364,7 @@ static vm_fault_t ll_fault(struct vm_fault *vmf) LPROC_LL_FAULT, 1); restart: - result = ll_fault0(vmf->vma, vmf); + result = __ll_fault(vmf->vma, vmf); if (!(result & (VM_FAULT_RETRY | VM_FAULT_ERROR | VM_FAULT_LOCKED))) { struct page *vmpage = vmf->page; @@ -406,7 +405,7 @@ static vm_fault_t ll_page_mkwrite(struct vm_fault *vmf) file_update_time(vma->vm_file); do { retry = false; - err = ll_page_mkwrite0(vma, vmf->page, &retry); + err = __ll_page_mkwrite(vma, vmf->page, &retry); if (!printed && ++count > 16) { const struct dentry *de = vma->vm_file->f_path.dentry; diff --git a/drivers/staging/lustre/lustre/llite/vvp_object.c b/drivers/staging/lustre/lustre/llite/vvp_object.c index e1000f6b7f22..86e077bd516b 100644 --- a/drivers/staging/lustre/lustre/llite/vvp_object.c +++ b/drivers/staging/lustre/lustre/llite/vvp_object.c @@ -220,9 +220,9 @@ static const struct cl_object_operations vvp_ops = { .coo_req_attr_set = vvp_req_attr_set }; -static int vvp_object_init0(const struct lu_env *env, - struct vvp_object *vob, - const struct cl_object_conf *conf) +static int __vvp_object_init(const struct lu_env *env, + struct vvp_object *vob, + const struct cl_object_conf *conf) { vob->vob_inode = conf->coc_inode; atomic_set(&vob->vob_transient_pages, 0); @@ -246,7 +246,7 @@ static int vvp_object_init(const struct lu_env *env, struct lu_object *obj, cconf = lu2cl_conf(conf); lu_object_add(obj, below); - result = vvp_object_init0(env, vob, cconf); + result = __vvp_object_init(env, vob, cconf); } else { result = -ENOMEM; } From neilb at suse.com Fri Jan 11 00:00:46 2019 From: neilb at suse.com (NeilBrown) Date: Fri, 11 Jan 2019 11:00:46 +1100 Subject: [lustre-devel] [PATCH 3/4] lustre: obdclass: change some foo0() to __foo() In-Reply-To: <154716475327.28978.3817067697027604609.stgit@noble> References: <154716475327.28978.3817067697027604609.stgit@noble> Message-ID: <154716484605.28978.3593304564414994720.stgit@noble> Change: cl_io_init0 -> __cl_io_init cl_lock_trace0 -> __cl_lock_trace cl_page_delete0 -> __cl_page_delete cl_page_state_set0 -> __cl_page_state_set cl_page_own0 -> __cl_page_own cl_page_disown0 -> __cl_page_disown cl_page_delete0 -> __cl_page_delete cl_echo_enqueue0 -> __cl_echo_enqueue cl_echo_cancel0 -> __cl_echo_cancel This is more consistent with Linux naming style. Signed-off-by: NeilBrown --- drivers/staging/lustre/lustre/include/cl_object.h | 6 ++- drivers/staging/lustre/lustre/obdclass/cl_io.c | 14 ++++---- drivers/staging/lustre/lustre/obdclass/cl_lock.c | 8 ++-- drivers/staging/lustre/lustre/obdclass/cl_page.c | 36 ++++++++++---------- .../staging/lustre/lustre/obdecho/echo_client.c | 20 ++++++----- 5 files changed, 42 insertions(+), 42 deletions(-) diff --git a/drivers/staging/lustre/lustre/include/cl_object.h b/drivers/staging/lustre/lustre/include/cl_object.h index 4f0e8e271452..d0e61e503f9d 100644 --- a/drivers/staging/lustre/lustre/include/cl_object.h +++ b/drivers/staging/lustre/lustre/include/cl_object.h @@ -803,7 +803,7 @@ struct cl_page_operations { /** * cl_page<->struct page methods. Only one layer in the stack has to * implement these. Current code assumes that this functionality is - * provided by the topmost layer, see cl_page_disown0() as an example. + * provided by the topmost layer, see __cl_page_disown() as an example. */ /** @@ -2144,8 +2144,8 @@ void cl_page_unassume(const struct lu_env *env, struct cl_io *io, struct cl_page *pg); void cl_page_disown(const struct lu_env *env, struct cl_io *io, struct cl_page *page); -void cl_page_disown0(const struct lu_env *env, - struct cl_io *io, struct cl_page *pg); +void __cl_page_disown(const struct lu_env *env, + struct cl_io *io, struct cl_page *pg); int cl_page_is_owned(const struct cl_page *pg, const struct cl_io *io); /** @} ownership */ diff --git a/drivers/staging/lustre/lustre/obdclass/cl_io.c b/drivers/staging/lustre/lustre/obdclass/cl_io.c index 0da731cfeb30..84c7710f80d7 100644 --- a/drivers/staging/lustre/lustre/obdclass/cl_io.c +++ b/drivers/staging/lustre/lustre/obdclass/cl_io.c @@ -131,8 +131,8 @@ void cl_io_fini(const struct lu_env *env, struct cl_io *io) } EXPORT_SYMBOL(cl_io_fini); -static int cl_io_init0(const struct lu_env *env, struct cl_io *io, - enum cl_io_type iot, struct cl_object *obj) +static int __cl_io_init(const struct lu_env *env, struct cl_io *io, + enum cl_io_type iot, struct cl_object *obj) { struct cl_object *scan; int result; @@ -169,7 +169,7 @@ int cl_io_sub_init(const struct lu_env *env, struct cl_io *io, { LASSERT(obj != cl_object_top(obj)); - return cl_io_init0(env, io, iot, obj); + return __cl_io_init(env, io, iot, obj); } EXPORT_SYMBOL(cl_io_sub_init); @@ -188,7 +188,7 @@ int cl_io_init(const struct lu_env *env, struct cl_io *io, { LASSERT(obj == cl_object_top(obj)); - return cl_io_init0(env, io, iot, obj); + return __cl_io_init(env, io, iot, obj); } EXPORT_SYMBOL(cl_io_init); @@ -897,14 +897,14 @@ void cl_page_list_disown(const struct lu_env *env, list_del_init(&page->cp_batch); --plist->pl_nr; /* - * cl_page_disown0 rather than usual cl_page_disown() is used, + * __cl_page_disown rather than usual cl_page_disown() is used, * because pages are possibly in CPS_FREEING state already due * to the call to cl_page_list_discard(). */ /* - * XXX cl_page_disown0() will fail if page is not locked. + * XXX __cl_page_disown() will fail if page is not locked. */ - cl_page_disown0(env, io, page); + __cl_page_disown(env, io, page); lu_ref_del_at(&page->cp_reference, &page->cp_queue_ref, "queue", plist); cl_page_put(env, page); diff --git a/drivers/staging/lustre/lustre/obdclass/cl_lock.c b/drivers/staging/lustre/lustre/obdclass/cl_lock.c index 9ca29a26a38b..23c1609415a3 100644 --- a/drivers/staging/lustre/lustre/obdclass/cl_lock.c +++ b/drivers/staging/lustre/lustre/obdclass/cl_lock.c @@ -45,9 +45,9 @@ #include #include "cl_internal.h" -static void cl_lock_trace0(int level, const struct lu_env *env, - const char *prefix, const struct cl_lock *lock, - const char *func, const int line) +static void __cl_lock_trace(int level, const struct lu_env *env, + const char *prefix, const struct cl_lock *lock, + const char *func, const int line) { struct cl_object_header *h = cl_object_header(lock->cll_descr.cld_obj); @@ -55,7 +55,7 @@ static void cl_lock_trace0(int level, const struct lu_env *env, prefix, lock, env, h->coh_nesting, func, line); } #define cl_lock_trace(level, env, prefix, lock) \ - cl_lock_trace0(level, env, prefix, lock, __func__, __LINE__) + __cl_lock_trace(level, env, prefix, lock, __func__, __LINE__) /** * Adds lock slice to the compound lock. diff --git a/drivers/staging/lustre/lustre/obdclass/cl_page.c b/drivers/staging/lustre/lustre/obdclass/cl_page.c index 00df94b87606..5794b1cbfb54 100644 --- a/drivers/staging/lustre/lustre/obdclass/cl_page.c +++ b/drivers/staging/lustre/lustre/obdclass/cl_page.c @@ -45,7 +45,7 @@ #include #include "cl_internal.h" -static void cl_page_delete0(const struct lu_env *env, struct cl_page *pg); +static void __cl_page_delete(const struct lu_env *env, struct cl_page *pg); # define PASSERT(env, page, expr) \ do { \ @@ -156,7 +156,7 @@ struct cl_page *cl_page_alloc(const struct lu_env *env, result = o->co_ops->coo_page_init(env, o, page, ind); if (result != 0) { - cl_page_delete0(env, page); + __cl_page_delete(env, page); cl_page_free(env, page); page = ERR_PTR(result); break; @@ -228,8 +228,8 @@ static inline int cl_page_invariant(const struct cl_page *pg) return cl_page_in_use_noref(pg); } -static void cl_page_state_set0(const struct lu_env *env, - struct cl_page *page, enum cl_page_state state) +static void __cl_page_state_set(const struct lu_env *env, + struct cl_page *page, enum cl_page_state state) { enum cl_page_state old; @@ -286,7 +286,7 @@ static void cl_page_state_set0(const struct lu_env *env, static void cl_page_state_set(const struct lu_env *env, struct cl_page *page, enum cl_page_state state) { - cl_page_state_set0(env, page, state); + __cl_page_state_set(env, page, state); } /** @@ -377,7 +377,7 @@ static void cl_page_owner_set(struct cl_page *page) page->cp_owner->ci_owned_nr++; } -void cl_page_disown0(const struct lu_env *env, +void __cl_page_disown(const struct lu_env *env, struct cl_io *io, struct cl_page *pg) { const struct cl_page_slice *slice; @@ -433,8 +433,8 @@ EXPORT_SYMBOL(cl_page_is_owned); * \see cl_page_own_try() * \see cl_page_own */ -static int cl_page_own0(const struct lu_env *env, struct cl_io *io, - struct cl_page *pg, int nonblock) +static int __cl_page_own(const struct lu_env *env, struct cl_io *io, + struct cl_page *pg, int nonblock) { const struct cl_page_slice *slice; int result = 0; @@ -465,7 +465,7 @@ static int cl_page_own0(const struct lu_env *env, struct cl_io *io, if (pg->cp_state != CPS_FREEING) { cl_page_state_set(env, pg, CPS_OWNED); } else { - cl_page_disown0(env, io, pg); + __cl_page_disown(env, io, pg); result = -ENOENT; } } @@ -477,23 +477,23 @@ static int cl_page_own0(const struct lu_env *env, struct cl_io *io, /** * Own a page, might be blocked. * - * \see cl_page_own0() + * \see __cl_page_own() */ int cl_page_own(const struct lu_env *env, struct cl_io *io, struct cl_page *pg) { - return cl_page_own0(env, io, pg, 0); + return __cl_page_own(env, io, pg, 0); } EXPORT_SYMBOL(cl_page_own); /** * Nonblock version of cl_page_own(). * - * \see cl_page_own0() + * \see __cl_page_own() */ int cl_page_own_try(const struct lu_env *env, struct cl_io *io, struct cl_page *pg) { - return cl_page_own0(env, io, pg, 1); + return __cl_page_own(env, io, pg, 1); } EXPORT_SYMBOL(cl_page_own_try); @@ -576,7 +576,7 @@ void cl_page_disown(const struct lu_env *env, pg->cp_state == CPS_FREEING); io = cl_io_top(io); - cl_page_disown0(env, io, pg); + __cl_page_disown(env, io, pg); } EXPORT_SYMBOL(cl_page_disown); @@ -607,10 +607,10 @@ EXPORT_SYMBOL(cl_page_discard); /** * Version of cl_page_delete() that can be called for not fully constructed - * pages, e.g,. in a error handling cl_page_find()->cl_page_delete0() + * pages, e.g,. in a error handling cl_page_find()->__cl_page_delete() * path. Doesn't check page invariant. */ -static void cl_page_delete0(const struct lu_env *env, struct cl_page *pg) +static void __cl_page_delete(const struct lu_env *env, struct cl_page *pg) { const struct cl_page_slice *slice; @@ -620,7 +620,7 @@ static void cl_page_delete0(const struct lu_env *env, struct cl_page *pg) * Sever all ways to obtain new pointers to @pg. */ cl_page_owner_clear(pg); - cl_page_state_set0(env, pg, CPS_FREEING); + __cl_page_state_set(env, pg, CPS_FREEING); list_for_each_entry_reverse(slice, &pg->cp_layers, cpl_linkage) { if (slice->cpl_ops->cpo_delete) @@ -655,7 +655,7 @@ static void cl_page_delete0(const struct lu_env *env, struct cl_page *pg) void cl_page_delete(const struct lu_env *env, struct cl_page *pg) { PINVRNT(env, pg, cl_page_invariant(pg)); - cl_page_delete0(env, pg); + __cl_page_delete(env, pg); } EXPORT_SYMBOL(cl_page_delete); diff --git a/drivers/staging/lustre/lustre/obdecho/echo_client.c b/drivers/staging/lustre/lustre/obdecho/echo_client.c index 887df7ce6b5c..39b7ab1447a4 100644 --- a/drivers/staging/lustre/lustre/obdecho/echo_client.c +++ b/drivers/staging/lustre/lustre/obdecho/echo_client.c @@ -910,9 +910,9 @@ static int cl_echo_object_put(struct echo_object *eco) return 0; } -static int cl_echo_enqueue0(struct lu_env *env, struct echo_object *eco, - u64 start, u64 end, int mode, - __u64 *cookie, __u32 enqflags) +static int __cl_echo_enqueue(struct lu_env *env, struct echo_object *eco, + u64 start, u64 end, int mode, + __u64 *cookie, __u32 enqflags) { struct cl_io *io; struct cl_lock *lck; @@ -953,8 +953,8 @@ static int cl_echo_enqueue0(struct lu_env *env, struct echo_object *eco, return rc; } -static int cl_echo_cancel0(struct lu_env *env, struct echo_device *ed, - __u64 cookie) +static int __cl_echo_cancel(struct lu_env *env, struct echo_device *ed, + __u64 cookie) { struct echo_client_obd *ec = ed->ed_ec; struct echo_lock *ecl = NULL; @@ -1028,10 +1028,10 @@ static int cl_echo_object_brw(struct echo_object *eco, int rw, u64 offset, goto out; LASSERT(rc == 0); - rc = cl_echo_enqueue0(env, eco, offset, - offset + npages * PAGE_SIZE - 1, - rw == READ ? LCK_PR : LCK_PW, &lh.cookie, - CEF_NEVER); + rc = __cl_echo_enqueue(env, eco, offset, + offset + npages * PAGE_SIZE - 1, + rw == READ ? LCK_PR : LCK_PW, &lh.cookie, + CEF_NEVER); if (rc < 0) goto error_lock; @@ -1079,7 +1079,7 @@ static int cl_echo_object_brw(struct echo_object *eco, int rw, u64 offset, async ? "async" : "sync", rc); } - cl_echo_cancel0(env, ed, lh.cookie); + __cl_echo_cancel(env, ed, lh.cookie); error_lock: cl_2queue_discard(env, io, queue); cl_2queue_disown(env, io, queue); From neilb at suse.com Fri Jan 11 00:00:46 2019 From: neilb at suse.com (NeilBrown) Date: Fri, 11 Jan 2019 11:00:46 +1100 Subject: [lustre-devel] [PATCH 4/4] lustre: ptlrpc: change some foo0() to __foo() In-Reply-To: <154716475327.28978.3817067697027604609.stgit@noble> References: <154716475327.28978.3817067697027604609.stgit@noble> Message-ID: <154716484609.28978.296505839179223953.stgit@noble> Change: nrs_policy_stop0 -> __nrs_policy_stop nrs_svcpt_setup_locked0 -> __nrs_svcpt_setup_locked ptlrpc_nrs_req_get_nolock0 -> __ptlrpc_nrs_req_get_nolock This is more consistent with Linux naming style. Signed-off-by: NeilBrown --- drivers/staging/lustre/lustre/ptlrpc/nrs.c | 20 ++++++++++---------- drivers/staging/lustre/lustre/ptlrpc/nrs_fifo.c | 2 +- .../staging/lustre/lustre/ptlrpc/ptlrpc_internal.h | 6 +++--- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/drivers/staging/lustre/lustre/ptlrpc/nrs.c b/drivers/staging/lustre/lustre/ptlrpc/nrs.c index e09b86529c5d..248ba045fb79 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/nrs.c +++ b/drivers/staging/lustre/lustre/ptlrpc/nrs.c @@ -82,7 +82,7 @@ static int nrs_policy_ctl_locked(struct ptlrpc_nrs_policy *policy, -ENOSYS; } -static void nrs_policy_stop0(struct ptlrpc_nrs_policy *policy) +static void __nrs_policy_stop(struct ptlrpc_nrs_policy *policy) { if (policy->pol_desc->pd_ops->op_policy_stop) policy->pol_desc->pd_ops->op_policy_stop(policy); @@ -126,7 +126,7 @@ static int nrs_policy_stop_locked(struct ptlrpc_nrs_policy *policy) /* I have the only refcount */ if (policy->pol_ref == 1) - nrs_policy_stop0(policy); + __nrs_policy_stop(policy); return 0; } @@ -151,7 +151,7 @@ static void nrs_policy_stop_primary(struct ptlrpc_nrs *nrs) tmp->pol_state = NRS_POL_STATE_STOPPING; if (tmp->pol_ref == 0) - nrs_policy_stop0(tmp); + __nrs_policy_stop(tmp); } /** @@ -300,7 +300,7 @@ static void nrs_policy_put_locked(struct ptlrpc_nrs_policy *policy) policy->pol_ref--; if (unlikely(policy->pol_ref == 0 && policy->pol_state == NRS_POL_STATE_STOPPING)) - nrs_policy_stop0(policy); + __nrs_policy_stop(policy); } static void nrs_policy_put(struct ptlrpc_nrs_policy *policy) @@ -888,8 +888,8 @@ static int nrs_register_policies_locked(struct ptlrpc_nrs *nrs) * * \pre mutex_is_locked(&nrs_core.nrs_mutex) */ -static int nrs_svcpt_setup_locked0(struct ptlrpc_nrs *nrs, - struct ptlrpc_service_part *svcpt) +static int __nrs_svcpt_setup_locked(struct ptlrpc_nrs *nrs, + struct ptlrpc_service_part *svcpt) { enum ptlrpc_nrs_queue_type queue; @@ -931,7 +931,7 @@ static int nrs_svcpt_setup_locked(struct ptlrpc_service_part *svcpt) * Initialize the regular NRS head. */ nrs = nrs_svcpt2nrs(svcpt, false); - rc = nrs_svcpt_setup_locked0(nrs, svcpt); + rc = __nrs_svcpt_setup_locked(nrs, svcpt); if (rc < 0) goto out; @@ -951,7 +951,7 @@ static int nrs_svcpt_setup_locked(struct ptlrpc_service_part *svcpt) } nrs = nrs_svcpt2nrs(svcpt, true); - rc = nrs_svcpt_setup_locked0(nrs, svcpt); + rc = __nrs_svcpt_setup_locked(nrs, svcpt); out: return rc; @@ -1444,8 +1444,8 @@ static void nrs_request_removed(struct ptlrpc_nrs_policy *policy) * \retval NULL the head has no requests to serve */ struct ptlrpc_request * -ptlrpc_nrs_req_get_nolock0(struct ptlrpc_service_part *svcpt, bool hp, - bool peek, bool force) +__ptlrpc_nrs_req_get_nolock(struct ptlrpc_service_part *svcpt, bool hp, + bool peek, bool force) { struct ptlrpc_nrs *nrs = nrs_svcpt2nrs(svcpt, hp); struct ptlrpc_nrs_policy *policy; diff --git a/drivers/staging/lustre/lustre/ptlrpc/nrs_fifo.c b/drivers/staging/lustre/lustre/ptlrpc/nrs_fifo.c index ff630d94dd26..7fe8aeeff428 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/nrs_fifo.c +++ b/drivers/staging/lustre/lustre/ptlrpc/nrs_fifo.c @@ -96,7 +96,7 @@ static int nrs_fifo_start(struct ptlrpc_nrs_policy *policy) * * \param[in] policy The policy to stop * - * \see nrs_policy_stop0() + * \see __nrs_policy_stop() */ static void nrs_fifo_stop(struct ptlrpc_nrs_policy *policy) { diff --git a/drivers/staging/lustre/lustre/ptlrpc/ptlrpc_internal.h b/drivers/staging/lustre/lustre/ptlrpc/ptlrpc_internal.h index 177010cf7148..da42b99fc36f 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/ptlrpc_internal.h +++ b/drivers/staging/lustre/lustre/ptlrpc/ptlrpc_internal.h @@ -133,14 +133,14 @@ void ptlrpc_nrs_req_add(struct ptlrpc_service_part *svcpt, struct ptlrpc_request *req, bool hp); struct ptlrpc_request * -ptlrpc_nrs_req_get_nolock0(struct ptlrpc_service_part *svcpt, bool hp, - bool peek, bool force); +__ptlrpc_nrs_req_get_nolock(struct ptlrpc_service_part *svcpt, bool hp, + bool peek, bool force); static inline struct ptlrpc_request * ptlrpc_nrs_req_get_nolock(struct ptlrpc_service_part *svcpt, bool hp, bool force) { - return ptlrpc_nrs_req_get_nolock0(svcpt, hp, false, force); + return __ptlrpc_nrs_req_get_nolock(svcpt, hp, false, force); } bool ptlrpc_nrs_req_pending_nolock(struct ptlrpc_service_part *svcpt, bool hp); From neilb at suse.com Fri Jan 11 00:27:38 2019 From: neilb at suse.com (NeilBrown) Date: Fri, 11 Jan 2019 11:27:38 +1100 Subject: [lustre-devel] [PATCH 23/29] lustre: osc_cache: remove 'transient' arg from osc_enter_cache_try In-Reply-To: <87E1C21A-052C-46A7-81AA-2183EB3BB178@whamcloud.com> References: <154701488711.26726.17363928508883972338.stgit@noble> <154701504254.26726.7702205638412400024.stgit@noble> <87E1C21A-052C-46A7-81AA-2183EB3BB178@whamcloud.com> Message-ID: <87ftu0ghs5.fsf@notabene.neil.brown.name> On Thu, Jan 10 2019, Andreas Dilger wrote: > On Jan 8, 2019, at 23:24, NeilBrown wrote: >> >> This arg is always '0', so remove it. >> >> Signed-off-by: NeilBrown > > Out of curiosity, how would you find something like this? Just > through code reading, or do you have some sort of static analysis > tool that shows this is dead code? > > Digging into this a bit more, it looks like this is the only place > that increments cl_dirty_transit and sets OBD_BRW_NOCACHE, which > means the corresponding code in osc_release_write_grant() that checks > OBD_BRW_NOCACHE and decrements cl_dirty_transit is also dead, which > is good otherwise there would have been some kind of accounting leak. > > That further implies that cl_dirty_transit is unused and can be removed, > along with obd_dirty_transit_pages. The OBD_BRW_NOCACHE flag is part > of the wire protocol, but it looks like this was never actually sent on > the wire, just an internal housekeeping flag, so it should be marked like: > > /* #define OBD_BRW_NOCACHE 0x400 internal use only 2.2.57-2.12 */ > > The follow-on cleanup could be part of this patch or a separate one. > > Reviewed-by: Andreas Dilger Below is the revised version of this patch. Thanks, NeilBrown From: NeilBrown Subject: [PATCH] lustre: osc_cache: remove 'transient' arg from osc_enter_cache_try This arg is always '0', so remove it. Consequently, OBD_BRW_NOCACHE is never set, and cl_dirty_transit and obd_dirty_transit_pages are never non-zero. So they can be removed as well. Reviewed-by: Andreas Dilger Signed-off-by: NeilBrown --- .../lustre/include/uapi/linux/lustre/lustre_idl.h | 2 +- drivers/staging/lustre/lustre/include/obd.h | 1 - drivers/staging/lustre/lustre/include/obd_support.h | 1 - drivers/staging/lustre/lustre/obdclass/class_obd.c | 3 --- drivers/staging/lustre/lustre/osc/osc_cache.c | 16 +++------------- drivers/staging/lustre/lustre/osc/osc_request.c | 14 ++++++-------- drivers/staging/lustre/lustre/ptlrpc/wiretest.c | 2 -- 7 files changed, 10 insertions(+), 29 deletions(-) diff --git a/drivers/staging/lustre/include/uapi/linux/lustre/lustre_idl.h b/drivers/staging/lustre/include/uapi/linux/lustre/lustre_idl.h index a8de36c8fbe4..bffe62e87e00 100644 --- a/drivers/staging/lustre/include/uapi/linux/lustre/lustre_idl.h +++ b/drivers/staging/lustre/include/uapi/linux/lustre/lustre_idl.h @@ -1182,7 +1182,7 @@ struct hsm_state_set { #define OBD_BRW_CHECK 0x10 #define OBD_BRW_FROM_GRANT 0x20 /* the osc manages this under llite */ #define OBD_BRW_GRANTED 0x40 /* the ost manages this */ -#define OBD_BRW_NOCACHE 0x80 /* this page is a part of non-cached IO */ +/* #define OBD_BRW_NOCACHE 0x80 internal use only 2.2.57-2.12 */ #define OBD_BRW_NOQUOTA 0x100 #define OBD_BRW_SRVLOCK 0x200 /* Client holds no lock over this page */ #define OBD_BRW_ASYNC 0x400 /* Server may delay commit to disk */ diff --git a/drivers/staging/lustre/lustre/include/obd.h b/drivers/staging/lustre/lustre/include/obd.h index 0d8b9fe4bcec..4b43707f3d36 100644 --- a/drivers/staging/lustre/lustre/include/obd.h +++ b/drivers/staging/lustre/lustre/include/obd.h @@ -193,7 +193,6 @@ struct client_obd { /* the grant values are protected by loi_list_lock below */ unsigned long cl_dirty_pages; /* all _dirty_ in pages */ unsigned long cl_dirty_max_pages; /* allowed w/o rpc */ - unsigned long cl_dirty_transit; /* dirty synchronous */ unsigned long cl_avail_grant; /* bytes of credit for ost */ unsigned long cl_lost_grant; /* lost credits (trunc) */ /* grant consumed for dirty pages */ diff --git a/drivers/staging/lustre/lustre/include/obd_support.h b/drivers/staging/lustre/lustre/include/obd_support.h index 79875fad3f18..93a374514a77 100644 --- a/drivers/staging/lustre/lustre/include/obd_support.h +++ b/drivers/staging/lustre/lustre/include/obd_support.h @@ -55,7 +55,6 @@ extern int at_early_margin; extern int at_extra; extern unsigned long obd_max_dirty_pages; extern atomic_long_t obd_dirty_pages; -extern atomic_long_t obd_dirty_transit_pages; extern char obd_jobid_var[]; /* Some hash init argument constants */ diff --git a/drivers/staging/lustre/lustre/obdclass/class_obd.c b/drivers/staging/lustre/lustre/obdclass/class_obd.c index 5b0b2f64a4a3..e563ebb5b328 100644 --- a/drivers/staging/lustre/lustre/obdclass/class_obd.c +++ b/drivers/staging/lustre/lustre/obdclass/class_obd.c @@ -77,9 +77,6 @@ EXPORT_SYMBOL(at_early_margin); int at_extra = 30; EXPORT_SYMBOL(at_extra); -atomic_long_t obd_dirty_transit_pages; -EXPORT_SYMBOL(obd_dirty_transit_pages); - char obd_jobid_var[JOBSTATS_JOBID_VAR_MAX_LEN + 1] = JOBSTATS_DISABLE; char obd_jobid_node[LUSTRE_JOBID_SIZE + 1]; diff --git a/drivers/staging/lustre/lustre/osc/osc_cache.c b/drivers/staging/lustre/lustre/osc/osc_cache.c index 8f5c567b4e15..53f067d4e09b 100644 --- a/drivers/staging/lustre/lustre/osc/osc_cache.c +++ b/drivers/staging/lustre/lustre/osc/osc_cache.c @@ -1424,11 +1424,6 @@ static void osc_release_write_grant(struct client_obd *cli, pga->flag &= ~OBD_BRW_FROM_GRANT; atomic_long_dec(&obd_dirty_pages); cli->cl_dirty_pages--; - if (pga->flag & OBD_BRW_NOCACHE) { - pga->flag &= ~OBD_BRW_NOCACHE; - atomic_long_dec(&obd_dirty_transit_pages); - cli->cl_dirty_transit--; - } } /** @@ -1535,7 +1530,7 @@ static void osc_exit_cache(struct client_obd *cli, struct osc_async_page *oap) */ static bool osc_enter_cache_try(struct client_obd *cli, struct osc_async_page *oap, - int bytes, int transient) + int bytes) { OSC_DUMP_GRANT(D_CACHE, cli, "need:%d\n", bytes); @@ -1545,11 +1540,6 @@ static bool osc_enter_cache_try(struct client_obd *cli, if (cli->cl_dirty_pages < cli->cl_dirty_max_pages && atomic_long_read(&obd_dirty_pages) + 1 <= obd_max_dirty_pages) { osc_consume_write_grant(cli, &oap->oap_brw_page); - if (transient) { - cli->cl_dirty_transit++; - atomic_long_inc(&obd_dirty_transit_pages); - oap->oap_brw_flags |= OBD_BRW_NOCACHE; - } return true; } else { __osc_unreserve_grant(cli, bytes, bytes); @@ -1618,7 +1608,7 @@ static int osc_enter_cache(const struct lu_env *env, struct client_obd *cli, remain = wait_event_idle_exclusive_timeout_cmd( cli->cl_cache_waiters, (entered = osc_enter_cache_try( - cli, oap, bytes, 0)) || + cli, oap, bytes)) || (cli->cl_dirty_pages == 0 && cli->cl_w_in_flight == 0), timeout, @@ -2396,7 +2386,7 @@ int osc_queue_async_io(const struct lu_env *env, struct cl_io *io, /* it doesn't need any grant to dirty this page */ spin_lock(&cli->cl_loi_list_lock); - if (!osc_enter_cache_try(cli, oap, grants, 0)) { + if (!osc_enter_cache_try(cli, oap, grants)) { grants = 0; need_release = 1; } diff --git a/drivers/staging/lustre/lustre/osc/osc_request.c b/drivers/staging/lustre/lustre/osc/osc_request.c index b28fbacbcfbf..e18d592bf42a 100644 --- a/drivers/staging/lustre/lustre/osc/osc_request.c +++ b/drivers/staging/lustre/lustre/osc/osc_request.c @@ -678,22 +678,20 @@ static void osc_announce_cached(struct client_obd *cli, struct obdo *oa, oa->o_dirty = cli->cl_dirty_grant; else oa->o_dirty = cli->cl_dirty_pages << PAGE_SHIFT; - if (unlikely(cli->cl_dirty_pages - cli->cl_dirty_transit > + if (unlikely(cli->cl_dirty_pages > cli->cl_dirty_max_pages)) { - CERROR("dirty %lu - %lu > dirty_max %lu\n", - cli->cl_dirty_pages, cli->cl_dirty_transit, + CERROR("dirty %lu > dirty_max %lu\n", + cli->cl_dirty_pages, cli->cl_dirty_max_pages); oa->o_undirty = 0; - } else if (unlikely(atomic_long_read(&obd_dirty_pages) - - atomic_long_read(&obd_dirty_transit_pages) > + } else if (unlikely(atomic_long_read(&obd_dirty_pages) > (long)(obd_max_dirty_pages + 1))) { /* The atomic_read() allowing the atomic_inc() are * not covered by a lock thus they may safely race and trip * this CERROR() unless we add in a small fudge factor (+1). */ - CERROR("%s: dirty %ld + %ld > system dirty_max %ld\n", + CERROR("%s: dirty %ld > system dirty_max %ld\n", cli_name(cli), atomic_long_read(&obd_dirty_pages), - atomic_long_read(&obd_dirty_transit_pages), obd_max_dirty_pages); oa->o_undirty = 0; } else if (unlikely(cli->cl_dirty_max_pages - cli->cl_dirty_pages > @@ -1047,7 +1045,7 @@ static int check_write_rcs(struct ptlrpc_request *req, static inline int can_merge_pages(struct brw_page *p1, struct brw_page *p2) { if (p1->flag != p2->flag) { - unsigned int mask = ~(OBD_BRW_FROM_GRANT | OBD_BRW_NOCACHE | + unsigned int mask = ~(OBD_BRW_FROM_GRANT | OBD_BRW_SYNC | OBD_BRW_ASYNC | OBD_BRW_NOQUOTA | OBD_BRW_SOFT_SYNC); diff --git a/drivers/staging/lustre/lustre/ptlrpc/wiretest.c b/drivers/staging/lustre/lustre/ptlrpc/wiretest.c index 639db24b4f63..c2f49a3e0454 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/wiretest.c +++ b/drivers/staging/lustre/lustre/ptlrpc/wiretest.c @@ -1823,8 +1823,6 @@ void lustre_assert_wire_constants(void) OBD_BRW_FROM_GRANT); LASSERTF(OBD_BRW_GRANTED == 0x40, "found 0x%.8x\n", OBD_BRW_GRANTED); - LASSERTF(OBD_BRW_NOCACHE == 0x80, "found 0x%.8x\n", - OBD_BRW_NOCACHE); LASSERTF(OBD_BRW_NOQUOTA == 0x100, "found 0x%.8x\n", OBD_BRW_NOQUOTA); LASSERTF(OBD_BRW_SRVLOCK == 0x200, "found 0x%.8x\n", -- 2.14.0.rc0.dirty -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 832 bytes Desc: not available URL: From neilb at suse.com Fri Jan 11 00:48:56 2019 From: neilb at suse.com (NeilBrown) Date: Fri, 11 Jan 2019 11:48:56 +1100 Subject: [lustre-devel] [PATCH 27/29] lustre: osc_cache: white-space and other checkpatch fixes. In-Reply-To: <058406C4-B01E-4DD5-8EBB-3014A23CA963@whamcloud.com> References: <154701488711.26726.17363928508883972338.stgit@noble> <154701504274.26726.6932313520085605572.stgit@noble> <058406C4-B01E-4DD5-8EBB-3014A23CA963@whamcloud.com> Message-ID: <87d0p4ggsn.fsf@notabene.neil.brown.name> On Thu, Jan 10 2019, Andreas Dilger wrote: > On Jan 8, 2019, at 23:24, NeilBrown wrote: >> >> Assorted minor checkpatch issues fixed. >> >> Signed-off-by: NeilBrown >> --- >> drivers/staging/lustre/lustre/osc/osc_cache.c | 25 +++++++++++++------------ >> 1 file changed, 13 insertions(+), 12 deletions(-) >> >> diff --git a/drivers/staging/lustre/lustre/osc/osc_cache.c b/drivers/staging/lustre/lustre/osc/osc_cache.c >> index e01f3815978c..019854b78277 100644 >> --- a/drivers/staging/lustre/lustre/osc/osc_cache.c >> +++ b/drivers/staging/lustre/lustre/osc/osc_cache.c >> @@ -962,7 +962,6 @@ static int osc_extent_wait(const struct lu_env *env, struct osc_extent *ext, >> >> wait_event_idle(ext->oe_waitq, >> smp_load_acquire(&ext->oe_state) == state); >> - >> } >> return ext->oe_rc < 0 ? ext->oe_rc : 0; >> } > > Typically we prefer a blank line before return. Otherwise fine. Interesting ... I had a look through osc_cache.c and I can find some evidence of this preference, but also many cases of the opposite. While I do see the value in a lot of places, this is one place where I I'm not so sure. Specifically, if the line before "return" is a lone "}", it seems (visually) close enough to a blank line, that adding another line looks wasteful. After some debate I have added blank lines there, but not when the 'return' is followed by an 'LASSERT' or other debugging code. Here is the new version. Thanks, NeilBrown From: NeilBrown Subject: [PATCH] lustre: osc_cache: white-space and other checkpatch fixes. Assorted minor checkpatch issues fixed. Also add some blank links to help 'return' lines to stand out. Reviewed-by: Andreas Dilger Signed-off-by: NeilBrown --- drivers/staging/lustre/lustre/osc/osc_cache.c | 61 +++++++++++++++++++++------ 1 file changed, 49 insertions(+), 12 deletions(-) diff --git a/drivers/staging/lustre/lustre/osc/osc_cache.c b/drivers/staging/lustre/lustre/osc/osc_cache.c index d89edad9fbc5..902e5fd3f501 100644 --- a/drivers/staging/lustre/lustre/osc/osc_cache.c +++ b/drivers/staging/lustre/lustre/osc/osc_cache.c @@ -91,6 +91,7 @@ static inline char *ext_flags(struct osc_extent *ext, char *flags) if (ext->oe_fsync_wait) *buf++ = 'Y'; *buf = 0; + return flags; } @@ -101,7 +102,7 @@ static inline char list_empty_marker(struct list_head *list) #define EXTSTR "[%lu -> %lu/%lu]" #define EXTPARA(ext) (ext)->oe_start, (ext)->oe_end, (ext)->oe_max_end -static const char *oes_strings[] = { +static const char * const oes_strings[] = { "inv", "active", "cache", "locking", "lockdone", "rpc", "trunc", NULL }; #define OSC_EXTENT_DUMP(lvl, extent, fmt, ...) do { \ @@ -337,6 +338,7 @@ static int osc_extent_is_overlapped(struct osc_object *obj, if (overlapped(tmp, ext)) return 1; } + return 0; } @@ -404,6 +406,7 @@ static struct osc_extent *osc_extent_get(struct osc_extent *ext) { LASSERT(kref_read(&ext->oe_refc) >= 0); kref_get(&ext->oe_refc); + return ext; } @@ -454,6 +457,7 @@ static struct osc_extent *osc_extent_search(struct osc_object *obj, return tmp; } } + return p; } @@ -469,6 +473,7 @@ static struct osc_extent *osc_extent_lookup(struct osc_object *obj, ext = osc_extent_search(obj, index); if (ext && ext->oe_start <= index && index <= ext->oe_end) return osc_extent_get(ext); + return NULL; } @@ -524,6 +529,7 @@ static struct osc_extent *osc_extent_hold(struct osc_extent *ext) } refcount_inc(&ext->oe_users); list_del_init(&ext->oe_link); + return osc_extent_get(ext); } @@ -668,7 +674,7 @@ static struct osc_extent *osc_extent_find(const struct lu_env *env, unsigned int *grants) { struct client_obd *cli = osc_cli(obj); - struct osc_lock *olck; + struct osc_lock *olck; struct cl_lock_descr *descr; struct osc_extent *cur; struct osc_extent *ext; @@ -705,6 +711,7 @@ static struct osc_extent *osc_extent_find(const struct lu_env *env, if ((max_pages & ~chunk_mask) != 0) { CERROR("max_pages: %#x chunkbits: %u chunk_mask: %#lx\n", max_pages, cli->cl_chunkbits, chunk_mask); + return ERR_PTR(-EINVAL); } max_end = index - (index % max_pages) + max_pages - 1; @@ -858,6 +865,7 @@ static struct osc_extent *osc_extent_find(const struct lu_env *env, out: osc_extent_put(env, cur); + return found; } @@ -919,6 +927,7 @@ int osc_extent_finish(const struct lu_env *env, struct osc_extent *ext, osc_extent_remove(ext); /* put the refcount for RPC */ osc_extent_put(env, ext); + return 0; } @@ -962,8 +971,8 @@ static int osc_extent_wait(const struct lu_env *env, struct osc_extent *ext, wait_event_idle(ext->oe_waitq, smp_load_acquire(&ext->oe_state) == state); - } + return ext->oe_rc < 0 ? ext->oe_rc : 0; } @@ -1020,7 +1029,8 @@ static int osc_extent_truncate(struct osc_extent *ext, pgoff_t trunc_index, if (index < trunc_index || (index == trunc_index && partial)) { /* accounting how many pages remaining in the chunk - * so that we can calculate grants correctly. */ + * so that we can calculate grants correctly. + */ if (index >> ppc_bits == trunc_chunk) ++pages_in_chunk; continue; @@ -1087,6 +1097,7 @@ static int osc_extent_truncate(struct osc_extent *ext, pgoff_t trunc_index, out: cl_io_fini(env, io); cl_env_put(env, &refcheck); + return rc; } @@ -1141,7 +1152,8 @@ static int osc_extent_make_ready(const struct lu_env *env, * the size of file. */ if (!(last->oap_async_flags & ASYNC_COUNT_STABLE)) { - int last_oap_count = osc_refresh_count(env, last, OBD_BRW_WRITE); + int last_oap_count = osc_refresh_count(env, last, + OBD_BRW_WRITE); LASSERT(last_oap_count > 0); LASSERT(last->oap_page_off + last_oap_count <= PAGE_SIZE); @@ -1233,6 +1245,7 @@ static int osc_extent_expand(struct osc_extent *ext, pgoff_t index, out: osc_object_unlock(obj); + return rc; } @@ -1299,6 +1312,7 @@ static int osc_make_ready(const struct lu_env *env, struct osc_async_page *oap, result = cl_page_make_ready(env, page, CRT_WRITE); if (result == 0) opg->ops_submit_time = jiffies; + return result; } @@ -1322,6 +1336,7 @@ static int osc_refresh_count(const struct lu_env *env, cl_object_attr_unlock(obj); if (result < 0) return result; + kms = attr->cat_kms; if (cl_offset(obj, index) >= kms) /* catch race with truncate */ @@ -1337,7 +1352,7 @@ static int osc_completion(const struct lu_env *env, struct osc_async_page *oap, int cmd, int rc) { struct osc_page *opg = oap2osc_page(oap); - struct cl_page *page = oap2cl_page(oap); + struct cl_page *page = oap2cl_page(oap); enum cl_req_type crt; int srvlock; @@ -1441,6 +1456,7 @@ static int osc_reserve_grant(struct client_obd *cli, unsigned int bytes) cli->cl_reserved_grant += bytes; rc = 0; } + return rc; } @@ -1641,6 +1657,7 @@ static int osc_enter_cache(const struct lu_env *env, struct client_obd *cli, } out: spin_unlock(&cli->cl_loi_list_lock); + return rc; } @@ -1731,7 +1748,8 @@ static void osc_update_pending(struct osc_object *obj, int cmd, int delta) OSC_IO_DEBUG(obj, "update pending cmd %d delta %d.\n", cmd, delta); } -static void on_list(struct list_head *item, struct list_head *list, int should_be_on) +static void on_list(struct list_head *item, struct list_head *list, + int should_be_on) { if (list_empty(item) && should_be_on) list_add_tail(item, list); @@ -1790,6 +1808,7 @@ static void osc_process_ar(struct osc_async_rc *ar, __u64 xid, ar->ar_force_sync = 1; ar->ar_min_xid = ptlrpc_sample_next_xid(); + return; } @@ -1893,7 +1912,8 @@ static int try_to_add_extent_for_io(struct client_obd *cli, oap_pending_item); EASSERT(tmp->oe_owner == current, tmp); if (oap2cl_page(oap)->cp_type != oap2cl_page(oap2)->cp_type) { - CDEBUG(D_CACHE, "Do not permit different type of IO in one RPC\n"); + CDEBUG(D_CACHE, + "Do not permit different type of IO in one RPC\n"); return 0; } @@ -1911,6 +1931,7 @@ static int try_to_add_extent_for_io(struct client_obd *cli, data->erd_page_count += ext->oe_nr_pages; list_move_tail(&ext->oe_link, data->erd_rpc_list); ext->oe_owner = current; + return 1; } @@ -2012,6 +2033,7 @@ static unsigned int get_write_extents(struct osc_object *obj, if (!try_to_add_extent_for_io(cli, ext, &data)) return data.erd_page_count; } + return data.erd_page_count; } @@ -2035,6 +2057,7 @@ osc_send_write_rpc(const struct lu_env *env, struct client_obd *cli, if (list_empty(&rpclist)) { osc_object_unlock(osc); + return 0; } @@ -2109,6 +2132,7 @@ osc_send_read_rpc(const struct lu_env *env, struct client_obd *cli, osc_object_lock(osc); if (!osc_makes_rpc(cli, osc, OBD_BRW_READ)) { osc_object_unlock(osc); + return rc; } @@ -2125,11 +2149,10 @@ osc_send_read_rpc(const struct lu_env *env, struct client_obd *cli, osc_object_unlock(osc); if (!list_empty(&rpclist)) { - rc = osc_build_rpc(env, cli, &rpclist, OBD_BRW_READ); LASSERT(list_empty(&rpclist)); - } + return rc; } @@ -2150,6 +2173,7 @@ static struct osc_object *osc_next_obj(struct client_obd *cli) */ if (!list_empty(&cli->cl_loi_hp_ready_list)) return list_to_obj(&cli->cl_loi_hp_ready_list, hp_ready_item); + if (!list_empty(&cli->cl_loi_ready_list)) return list_to_obj(&cli->cl_loi_ready_list, ready_item); @@ -2168,9 +2192,11 @@ static struct osc_object *osc_next_obj(struct client_obd *cli) if (!cli->cl_import || cli->cl_import->imp_invalid) { if (!list_empty(&cli->cl_loi_write_list)) return list_to_obj(&cli->cl_loi_write_list, write_item); + if (!list_empty(&cli->cl_loi_read_list)) return list_to_obj(&cli->cl_loi_read_list, read_item); } + return NULL; } @@ -2254,6 +2280,7 @@ static int __osc_io_unplug(const struct lu_env *env, struct client_obd *cli, LASSERT(cli->cl_writeback_work); rc = ptlrpcd_queue_work(cli->cl_writeback_work); } + return rc; } @@ -2295,6 +2322,7 @@ int osc_prep_async_page(struct osc_object *osc, struct osc_page *ops, spin_lock_init(&oap->oap_lock); CDEBUG(D_INFO, "oap %p page %p obj off %llu\n", oap, page, oap->oap_obj_off); + return 0; } @@ -2464,6 +2492,7 @@ int osc_queue_async_io(const struct lu_env *env, struct cl_io *io, list_add_tail(&oap->oap_pending_item, &ext->oe_pages); osc_object_unlock(osc); } + return rc; } @@ -2499,6 +2528,7 @@ int osc_teardown_async_page(const struct lu_env *env, if (ext) osc_extent_put(env, ext); } + return rc; } @@ -2582,6 +2612,7 @@ int osc_flush_async_page(const struct lu_env *env, struct cl_io *io, osc_extent_put(env, ext); if (unplug) osc_io_unplug_async(env, osc_cli(obj), obj); + return rc; } @@ -2620,6 +2651,7 @@ int osc_queue_sync_pages(const struct lu_env *env, struct osc_object *obj, list_del_init(&oap->oap_pending_item); osc_ap_completion(env, cli, oap, 0, -ENOMEM); } + return -ENOMEM; } @@ -2649,6 +2681,7 @@ int osc_queue_sync_pages(const struct lu_env *env, struct osc_object *obj, osc_object_unlock(obj); osc_io_unplug_async(env, cli, obj); + return 0; } @@ -2777,6 +2810,7 @@ int osc_cache_truncate_start(const struct lu_env *env, struct osc_object *obj, waiting = NULL; goto again; } + return result; } @@ -3070,6 +3104,7 @@ bool osc_page_gang_lookup(const struct lu_env *env, struct cl_io *io, } if (tree_lock) spin_unlock(&osc->oo_tree_lock); + return res; } @@ -3077,7 +3112,7 @@ bool osc_page_gang_lookup(const struct lu_env *env, struct cl_io *io, * Check if page @page is covered by an extra lock or discard it. */ static bool check_and_discard_cb(const struct lu_env *env, struct cl_io *io, - struct osc_page *ops, void *cbdata) + struct osc_page *ops, void *cbdata) { struct osc_thread_info *info = osc_env_info(env); struct osc_object *osc = cbdata; @@ -3112,11 +3147,12 @@ static bool check_and_discard_cb(const struct lu_env *env, struct cl_io *io, } info->oti_next_index = index + 1; + return true; } static bool discard_cb(const struct lu_env *env, struct cl_io *io, - struct osc_page *ops, void *cbdata) + struct osc_page *ops, void *cbdata) { struct osc_thread_info *info = osc_env_info(env); struct cl_page *page = ops->ops_cl.cpl_page; @@ -3170,6 +3206,7 @@ int osc_lock_discard_pages(const struct lu_env *env, struct osc_object *osc, info->oti_next_index, end, cb, osc); out: cl_io_fini(env, io); + return result; } -- 2.14.0.rc0.dirty -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 832 bytes Desc: not available URL: From neilb at suse.com Fri Jan 11 01:11:24 2019 From: neilb at suse.com (NeilBrown) Date: Fri, 11 Jan 2019 12:11:24 +1100 Subject: [lustre-devel] [PATCH 26/29] lustre: osc_cache: simplify osc_page_gang_lookup() In-Reply-To: References: <154701488711.26726.17363928508883972338.stgit@noble> <154701504269.26726.8061168646539306509.stgit@noble> Message-ID: <87a7k8gfr7.fsf@notabene.neil.brown.name> On Thu, Jan 10 2019, Andreas Dilger wrote: > On Jan 8, 2019, at 23:24, NeilBrown wrote: >> >> osc_page_gang_lookup() has 4 values that it can receive from a >> callback, and that it can return to the caller: >> CLP_GANG_OKAY, >> CLP_GANG_RESCHED, >> CLP_GANG_AGAIN, >> CLP_GANG_ABORT >> >> "AGAIN" is never used. >> "RESCHED" is not needed as a cond_resched() can safely be called at >> the point this is returned, rather than returning it. >> That leaves "OKAY" and "ABORT" which can simply by "true" and "false" >> boolean values. >> >> Internalizing the RESCHED case means the callers don't need to loop >> themselves. This simplify calling patterns. >> >> Signed-off-by: NeilBrown >> --- >> drivers/staging/lustre/lustre/include/cl_object.h | 7 ---- >> drivers/staging/lustre/lustre/osc/osc_cache.c | 40 ++++++++------------ >> .../staging/lustre/lustre/osc/osc_cl_internal.h | 10 +++-- >> drivers/staging/lustre/lustre/osc/osc_io.c | 4 +- >> drivers/staging/lustre/lustre/osc/osc_lock.c | 27 ++++++-------- >> 5 files changed, 33 insertions(+), 55 deletions(-) >> >> diff --git a/drivers/staging/lustre/lustre/osc/osc_cache.c b/drivers/staging/lustre/lustre/osc/osc_cache.c >> index 79bcaa212339..e01f3815978c 100644 >> --- a/drivers/staging/lustre/lustre/osc/osc_cache.c >> +++ b/drivers/staging/lustre/lustre/osc/osc_cache.c >> @@ -3069,10 +3065,10 @@ int osc_page_gang_lookup(const struct lu_env *env, struct cl_io *io, >> if (nr < OTI_PVEC_SIZE || end_of_region) >> break; >> >> - if (res == CLP_GANG_OKAY && need_resched()) >> - res = CLP_GANG_RESCHED; >> - if (res != CLP_GANG_OKAY) >> + if (!res) >> break; >> + if (need_resched()) >> + cond_resched(); >> >> spin_lock(&osc->oo_tree_lock); >> tree_lock = true; > > The one thing I notice here is that if the CLP_GANG_RESCHED is not > returned to the caller, it doesn't have the chance to finish the > work before it is rescheduled: > > do { > res = osc_page_gang_lookup(env, io, osc, > info->oti_next_index, end, cb, osc); > if (info->oti_next_index > end) > break; > > if (res == CLP_GANG_RESCHED) > cond_resched(); > } while (res != CLP_GANG_OKAY); > > That means if the thread did a lot of work in osc_page_gang_lookup() > but is otherwise finished, it will block at the internal cond_resched() > rather than detecting it is finishing and returning to the caller without > any reschedule at all. > > However, looking into the osc_page_gang_lookup() code more closely, I > see "end_of_region" would already be set in this case (it is just at > the start of the context in the above patch hunk) so CLP_GANG_RESCHED > should never be set in that case. So it looks OK. Oh good :-) Thanks. I love when a review includes what you saw as well as the "Reviewed-by". > > Reviewed-by: Andreas Dilger > >> diff --git a/drivers/staging/lustre/lustre/osc/osc_lock.c b/drivers/staging/lustre/lustre/osc/osc_lock.c >> index 4cc813d192d9..1eab61d720e2 100644 >> --- a/drivers/staging/lustre/lustre/osc/osc_lock.c >> +++ b/drivers/staging/lustre/lustre/osc/osc_lock.c >> @@ -630,18 +630,18 @@ static int osc_ldlm_glimpse_ast(struct ldlm_lock *dlmlock, void *data) >> return result; >> } >> >> -static int weigh_cb(const struct lu_env *env, struct cl_io *io, >> - struct osc_page *ops, void *cbdata) >> +static bool weigh_cb(const struct lu_env *env, struct cl_io *io, >> + struct osc_page *ops, void *cbdata) >> { >> struct cl_page *page = ops->ops_cl.cpl_page; >> >> if (cl_page_is_vmlocked(env, page) || >> PageDirty(page->cp_vmpage) || PageWriteback(page->cp_vmpage) >> ) > > This is a bit oddly formatted. I see in our tree it looks like: > > if (cl_page_is_vmlocked(env, page) || PageDirty(page->cp_vmpage) || > PageWriteback(page->cp_vmpage)) > > which is more normal. It has only been this way in OpenSFS since July this year. Commit b44b1ff8c7fc ("LU-10961 ldlm: don't cancel DoM locks before replay") made the change without any comment. I guess we aren't up to that 2.11 yet :-) > >> @@ -660,19 +660,14 @@ static unsigned long osc_lock_weight(const struct lu_env *env, >> return result; >> >> page_index = cl_index(obj, extent->start); >> + >> + result = osc_page_gang_lookup(env, io, oscobj, >> + page_index, >> + cl_index(obj, extent->end), >> + weigh_cb, (void *)&page_index); >> cl_io_fini(env, io); >> >> - return result == CLP_GANG_ABORT ? 1 : 0; >> + return result ? 1 : 0; >> } > > Per your commit comment above: > >> That leaves "OKAY" and "ABORT" which can simply by "true" and "false" >> boolean values. > > So if "ABORT" is now "false", this should be: > > return !result; > > otherwise your return code logic is backward? Good catch, thanks. That isn't the only problem there. "result" - which I change to a bool - also holds the return value for cl_io_init(). I'm not sur what sort of value that is, but I don't think I should be changing the type. So I changed 'result' back to an int and handled failure differently. I also removed the 'res' variable from osc_Lock_discard_pages(), as it is now unused. New version below. Thanks, NeilBrown From: NeilBrown Subject: [PATCH] lustre: osc_cache: simplify osc_page_gang_lookup() osc_page_gang_lookup() has 4 values that it can receive from a callback, and that it can return to the caller: CLP_GANG_OKAY, CLP_GANG_RESCHED, CLP_GANG_AGAIN, CLP_GANG_ABORT "AGAIN" is never used. "RESCHED" is not needed as a cond_resched() can safely be called at the point this is returned, rather than returning it. That leaves "OKAY" and "ABORT" which can simply by "true" and "false" boolean values. Internalizing the RESCHED case means the callers don't need to loop themselves. This simplify calling patterns. Reviewed-by: Andreas Dilger Signed-off-by: NeilBrown --- drivers/staging/lustre/lustre/include/cl_object.h | 7 ---- drivers/staging/lustre/lustre/osc/osc_cache.c | 39 ++++++++-------------- .../staging/lustre/lustre/osc/osc_cl_internal.h | 10 +++--- drivers/staging/lustre/lustre/osc/osc_io.c | 4 +-- drivers/staging/lustre/lustre/osc/osc_lock.c | 26 ++++++--------- 5 files changed, 32 insertions(+), 54 deletions(-) diff --git a/drivers/staging/lustre/lustre/include/cl_object.h b/drivers/staging/lustre/lustre/include/cl_object.h index 603281567219..41b32b7db515 100644 --- a/drivers/staging/lustre/lustre/include/cl_object.h +++ b/drivers/staging/lustre/lustre/include/cl_object.h @@ -2084,14 +2084,7 @@ static inline int cl_object_refc(struct cl_object *clob) /** \defgroup cl_page cl_page * @{ */ -enum { - CLP_GANG_OKAY = 0, - CLP_GANG_RESCHED, - CLP_GANG_AGAIN, - CLP_GANG_ABORT -}; -/* callback of cl_page_gang_lookup() */ struct cl_page *cl_page_find(const struct lu_env *env, struct cl_object *obj, pgoff_t idx, struct page *vmpage, enum cl_page_type type); diff --git a/drivers/staging/lustre/lustre/osc/osc_cache.c b/drivers/staging/lustre/lustre/osc/osc_cache.c index 29fe8ef11af1..de3250a2d1ec 100644 --- a/drivers/staging/lustre/lustre/osc/osc_cache.c +++ b/drivers/staging/lustre/lustre/osc/osc_cache.c @@ -2989,18 +2989,14 @@ int osc_cache_writeback_range(const struct lu_env *env, struct osc_object *obj, /** * Returns a list of pages by a given [start, end] of \a obj. * - * \param resched If not NULL, then we give up before hogging CPU for too - * long and set *resched = 1, in that case caller should implement a retry - * logic. - * * Gang tree lookup (radix_tree_gang_lookup()) optimization is absolutely * crucial in the face of [offset, EOF] locks. * * Return at least one page in @queue unless there is no covered page. */ -int osc_page_gang_lookup(const struct lu_env *env, struct cl_io *io, - struct osc_object *osc, pgoff_t start, pgoff_t end, - osc_page_gang_cbt cb, void *cbdata) +bool osc_page_gang_lookup(const struct lu_env *env, struct cl_io *io, + struct osc_object *osc, pgoff_t start, pgoff_t end, + osc_page_gang_cbt cb, void *cbdata) { struct osc_page *ops; void **pvec; @@ -3008,7 +3004,7 @@ int osc_page_gang_lookup(const struct lu_env *env, struct cl_io *io, unsigned int nr; unsigned int i; unsigned int j; - int res = CLP_GANG_OKAY; + bool res = true; bool tree_lock = true; idx = start; @@ -3054,7 +3050,7 @@ int osc_page_gang_lookup(const struct lu_env *env, struct cl_io *io, for (i = 0; i < j; ++i) { ops = pvec[i]; - if (res == CLP_GANG_OKAY) + if (res) res = (*cb)(env, io, ops, cbdata); page = ops->ops_cl.cpl_page; @@ -3064,10 +3060,10 @@ int osc_page_gang_lookup(const struct lu_env *env, struct cl_io *io, if (nr < OTI_PVEC_SIZE || end_of_region) break; - if (res == CLP_GANG_OKAY && need_resched()) - res = CLP_GANG_RESCHED; - if (res != CLP_GANG_OKAY) + if (!res) break; + if (need_resched()) + cond_resched(); spin_lock(&osc->oo_tree_lock); tree_lock = true; @@ -3080,7 +3076,7 @@ int osc_page_gang_lookup(const struct lu_env *env, struct cl_io *io, /** * Check if page @page is covered by an extra lock or discard it. */ -static int check_and_discard_cb(const struct lu_env *env, struct cl_io *io, +static bool check_and_discard_cb(const struct lu_env *env, struct cl_io *io, struct osc_page *ops, void *cbdata) { struct osc_thread_info *info = osc_env_info(env); @@ -3116,10 +3112,10 @@ static int check_and_discard_cb(const struct lu_env *env, struct cl_io *io, } info->oti_next_index = index + 1; - return CLP_GANG_OKAY; + return true; } -static int discard_cb(const struct lu_env *env, struct cl_io *io, +static bool discard_cb(const struct lu_env *env, struct cl_io *io, struct osc_page *ops, void *cbdata) { struct osc_thread_info *info = osc_env_info(env); @@ -3140,7 +3136,7 @@ static int discard_cb(const struct lu_env *env, struct cl_io *io, LASSERT(page->cp_state == CPS_FREEING); } - return CLP_GANG_OKAY; + return true; } /** @@ -3157,7 +3153,6 @@ int osc_lock_discard_pages(const struct lu_env *env, struct osc_object *osc, struct osc_thread_info *info = osc_env_info(env); struct cl_io *io = &info->oti_io; osc_page_gang_cbt cb; - int res; int result; io->ci_obj = cl_object_top(osc2cl(osc)); @@ -3169,15 +3164,9 @@ int osc_lock_discard_pages(const struct lu_env *env, struct osc_object *osc, cb = discard ? discard_cb : check_and_discard_cb; info->oti_fn_index = start; info->oti_next_index = start; - do { - res = osc_page_gang_lookup(env, io, osc, - info->oti_next_index, end, cb, osc); - if (info->oti_next_index > end) - break; - if (res == CLP_GANG_RESCHED) - cond_resched(); - } while (res != CLP_GANG_OKAY); + osc_page_gang_lookup(env, io, osc, + info->oti_next_index, end, cb, osc); out: cl_io_fini(env, io); return result; diff --git a/drivers/staging/lustre/lustre/osc/osc_cl_internal.h b/drivers/staging/lustre/lustre/osc/osc_cl_internal.h index 3af096e0dbdd..c0f58f41513f 100644 --- a/drivers/staging/lustre/lustre/osc/osc_cl_internal.h +++ b/drivers/staging/lustre/lustre/osc/osc_cl_internal.h @@ -660,11 +660,11 @@ void osc_extent_release(const struct lu_env *env, struct osc_extent *ext); int osc_lock_discard_pages(const struct lu_env *env, struct osc_object *osc, pgoff_t start, pgoff_t end, bool discard_pages); -typedef int (*osc_page_gang_cbt)(const struct lu_env *, struct cl_io *, - struct osc_page *, void *); -int osc_page_gang_lookup(const struct lu_env *env, struct cl_io *io, - struct osc_object *osc, pgoff_t start, pgoff_t end, - osc_page_gang_cbt cb, void *cbdata); +typedef bool (*osc_page_gang_cbt)(const struct lu_env *, struct cl_io *, + struct osc_page *, void *); +bool osc_page_gang_lookup(const struct lu_env *env, struct cl_io *io, + struct osc_object *osc, pgoff_t start, pgoff_t end, + osc_page_gang_cbt cb, void *cbdata); /* @} osc */ #endif /* OSC_CL_INTERNAL_H */ diff --git a/drivers/staging/lustre/lustre/osc/osc_io.c b/drivers/staging/lustre/lustre/osc/osc_io.c index 8cd0813fb4bf..0a7bfe2d4059 100644 --- a/drivers/staging/lustre/lustre/osc/osc_io.c +++ b/drivers/staging/lustre/lustre/osc/osc_io.c @@ -449,7 +449,7 @@ static int osc_async_upcall(void *a, int rc) /** * Checks that there are no pages being written in the extent being truncated. */ -static int trunc_check_cb(const struct lu_env *env, struct cl_io *io, +static bool trunc_check_cb(const struct lu_env *env, struct cl_io *io, struct osc_page *ops, void *cbdata) { struct cl_page *page = ops->ops_cl.cpl_page; @@ -466,7 +466,7 @@ static int trunc_check_cb(const struct lu_env *env, struct cl_io *io, CDEBUG(D_CACHE, "page %p index %lu locked for %d.\n", ops, osc_index(ops), oap->oap_cmd & OBD_BRW_RWMASK); - return CLP_GANG_OKAY; + return true; } static void osc_trunc_check(const struct lu_env *env, struct cl_io *io, diff --git a/drivers/staging/lustre/lustre/osc/osc_lock.c b/drivers/staging/lustre/lustre/osc/osc_lock.c index 01b6bf7df3b7..1781243f1c66 100644 --- a/drivers/staging/lustre/lustre/osc/osc_lock.c +++ b/drivers/staging/lustre/lustre/osc/osc_lock.c @@ -630,18 +630,18 @@ static int osc_ldlm_glimpse_ast(struct ldlm_lock *dlmlock, void *data) return result; } -static int weigh_cb(const struct lu_env *env, struct cl_io *io, - struct osc_page *ops, void *cbdata) +static bool weigh_cb(const struct lu_env *env, struct cl_io *io, + struct osc_page *ops, void *cbdata) { struct cl_page *page = ops->ops_cl.cpl_page; if (cl_page_is_vmlocked(env, page) || PageDirty(page->cp_vmpage) || PageWriteback(page->cp_vmpage) ) - return CLP_GANG_ABORT; + return false; *(pgoff_t *)cbdata = osc_index(ops) + 1; - return CLP_GANG_OKAY; + return true; } static unsigned long osc_lock_weight(const struct lu_env *env, @@ -660,19 +660,15 @@ static unsigned long osc_lock_weight(const struct lu_env *env, return result; page_index = cl_index(obj, extent->start); - do { - result = osc_page_gang_lookup(env, io, oscobj, - page_index, - cl_index(obj, extent->end), - weigh_cb, (void *)&page_index); - if (result == CLP_GANG_ABORT) - break; - if (result == CLP_GANG_RESCHED) - cond_resched(); - } while (result != CLP_GANG_OKAY); + + if (!osc_page_gang_lookup(env, io, oscobj, + page_index, + cl_index(obj, extent->end), + weigh_cb, (void *)&page_index)) + result = 1; cl_io_fini(env, io); - return result == CLP_GANG_ABORT ? 1 : 0; + return result; } /** -- 2.14.0.rc0.dirty -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 832 bytes Desc: not available URL: From adilger at whamcloud.com Fri Jan 11 03:54:23 2019 From: adilger at whamcloud.com (Andreas Dilger) Date: Fri, 11 Jan 2019 03:54:23 +0000 Subject: [lustre-devel] [PATCH 26/29] lustre: osc_cache: simplify osc_page_gang_lookup() In-Reply-To: <87a7k8gfr7.fsf@notabene.neil.brown.name> References: <154701488711.26726.17363928508883972338.stgit@noble> <154701504269.26726.8061168646539306509.stgit@noble> <87a7k8gfr7.fsf@notabene.neil.brown.name> Message-ID: <5E69C433-834D-48CF-BAE3-0F9D8F314D38@whamcloud.com> On Jan 10, 2019, at 18:11, NeilBrown wrote: > : >> >> However, looking into the osc_page_gang_lookup() code more closely, I >> see "end_of_region" would already be set in this case (it is just at >> the start of the context in the above patch hunk) so CLP_GANG_RESCHED >> should never be set in that case. So it looks OK. > > Oh good :-) > Thanks. > I love when a review includes what you saw as well as the "Reviewed-by". Sometimes (IMHO) it points out that code "reads" in a misleading manner, looking like it does one thing, but actually doing something else. This is mostly only obvious if you don't already know what the code is doing, otherwise your own mental picture of the functionality guides you along. I'm not really working on the CLIO code as it was developed for a project that wanted to provide WinNT and MacOS code, and replaced the Lustre VFS IO interface that I'd "grown up with". >>> +static bool weigh_cb(const struct lu_env *env, struct cl_io *io, >>> + struct osc_page *ops, void *cbdata) >>> { >>> struct cl_page *page = ops->ops_cl.cpl_page; >>> >>> if (cl_page_is_vmlocked(env, page) || >>> PageDirty(page->cp_vmpage) || PageWriteback(page->cp_vmpage) >>> ) >> >> This is a bit oddly formatted. I see in our tree it looks like: >> >> if (cl_page_is_vmlocked(env, page) || PageDirty(page->cp_vmpage) || >> PageWriteback(page->cp_vmpage)) >> >> which is more normal. > > It has only been this way in OpenSFS since July this year. I didn't know that when I was looking at the patch, just that the above was looking strange with the lone closing parenthesis on the line. > Commit b44b1ff8c7fc ("LU-10961 ldlm: don't cancel DoM locks before replay") > made the change without any comment. I guess we aren't up to that 2.11 > yet :-) Sure, but I figured if you are changing the formatting anyway you may as well make it consistent. Cheers, Andreas --- Andreas Dilger Principal Lustre Architect Whamcloud From adilger at whamcloud.com Sun Jan 13 20:40:26 2019 From: adilger at whamcloud.com (Andreas Dilger) Date: Sun, 13 Jan 2019 20:40:26 +0000 Subject: [lustre-devel] [PATCH 1/4] lustre: osc: change some foo0() to __foo() In-Reply-To: <154716484583.28978.14863799416083470252.stgit@noble> References: <154716475327.28978.3817067697027604609.stgit@noble> <154716484583.28978.14863799416083470252.stgit@noble> Message-ID: <31E3F1E2-37ED-4BCA-85ED-D210DC1BAF21@whamcloud.com> On Jan 10, 2019, at 16:00, NeilBrown wrote: > > It is standard practice in Linux, when naming a > helper-function which is not meant to be called directly, > to use a name starting __. > e.g. foo() and foo_too() might call __foo(), which is otherwise > not directly called. > Lustre has a similar convention, but instead uses names like foo0(). > > This patch convert > osc_extent_tree_dump0 -> __osc_extent_tree_dump > osc_extent_sanity_check0 -> __osc_extent_sanity_check > osc_io_unplug0 -> __osc_io_unplug > osc_dlm_blocking_ast0 -> __osc_dlm_blocking_ast > > Suggested-by: Andreas Dilger > Signed-off-by: NeilBrown Reviewed-by: Andreas Dilger > --- > drivers/staging/lustre/lustre/osc/osc_cache.c | 44 +++++++++++++------------ > drivers/staging/lustre/lustre/osc/osc_lock.c | 8 ++--- > 2 files changed, 26 insertions(+), 26 deletions(-) > > diff --git a/drivers/staging/lustre/lustre/osc/osc_cache.c b/drivers/staging/lustre/lustre/osc/osc_cache.c > index 1ce9f673f1bf..57046d355eda 100644 > --- a/drivers/staging/lustre/lustre/osc/osc_cache.c > +++ b/drivers/staging/lustre/lustre/osc/osc_cache.c > @@ -57,10 +57,10 @@ static int osc_io_unplug_async(const struct lu_env *env, > static void osc_free_grant(struct client_obd *cli, unsigned int nr_pages, > unsigned int lost_grant, unsigned int dirty_grant); > > -static void osc_extent_tree_dump0(int level, struct osc_object *obj, > - const char *func, int line); > +static void __osc_extent_tree_dump(int level, struct osc_object *obj, > + const char *func, int line); > #define osc_extent_tree_dump(lvl, obj) \ > - osc_extent_tree_dump0(lvl, obj, __func__, __LINE__) > + __osc_extent_tree_dump(lvl, obj, __func__, __LINE__) > > static void osc_unreserve_grant(struct client_obd *cli, unsigned int reserved, > unsigned int unused); > @@ -173,8 +173,8 @@ static inline struct osc_extent *first_extent(struct osc_object *obj) > } > > /* object must be locked by caller. */ > -static int osc_extent_sanity_check0(struct osc_extent *ext, > - const char *func, const int line) > +static int __osc_extent_sanity_check(struct osc_extent *ext, > + const char *func, const int line) > { > struct osc_object *obj = ext->oe_obj; > struct osc_async_page *oap; > @@ -302,13 +302,13 @@ static int osc_extent_sanity_check0(struct osc_extent *ext, > return rc; > } > > -#define sanity_check_nolock(ext) \ > - osc_extent_sanity_check0(ext, __func__, __LINE__) > +#define osc_extent_sanity_check_nolock(ext) \ > + __osc_extent_sanity_check(ext, __func__, __LINE__) > > -#define sanity_check(ext) ({ \ > +#define osc_extent_sanity_check(ext) ({ \ > int __res; \ > osc_object_lock((ext)->oe_obj); \ > - __res = sanity_check_nolock(ext); \ > + __res = osc_extent_sanity_check_nolock(ext); \ > osc_object_unlock((ext)->oe_obj); \ > __res; \ > }) > @@ -342,7 +342,7 @@ static void osc_extent_state_set(struct osc_extent *ext, int state) > LASSERT(state >= OES_INV && state < OES_STATE_MAX); > > /* Never try to sanity check a state changing extent :-) */ > - /* LASSERT(sanity_check_nolock(ext) == 0); */ > + /* LASSERT(osc_extent_sanity_check_nolock(ext) == 0); */ > > /* TODO: validate the state machine */ > ext->oe_state = state; > @@ -600,7 +600,7 @@ void osc_extent_release(const struct lu_env *env, struct osc_extent *ext) > struct client_obd *cli = osc_cli(obj); > > LASSERT(atomic_read(&ext->oe_users) > 0); > - LASSERT(sanity_check(ext) == 0); > + LASSERT(osc_extent_sanity_check(ext) == 0); > LASSERT(ext->oe_grants > 0); > > if (atomic_dec_and_lock(&ext->oe_users, &obj->oo_lock)) { > @@ -729,7 +729,7 @@ static struct osc_extent *osc_extent_find(const struct lu_env *env, > pgoff_t ext_chk_start = ext->oe_start >> ppc_bits; > pgoff_t ext_chk_end = ext->oe_end >> ppc_bits; > > - LASSERT(sanity_check_nolock(ext) == 0); > + LASSERT(osc_extent_sanity_check_nolock(ext) == 0); > if (chunk > ext_chk_end + 1) > break; > > @@ -969,7 +969,7 @@ static int osc_extent_wait(const struct lu_env *env, struct osc_extent *ext, > int rc = 0; > > osc_object_lock(obj); > - LASSERT(sanity_check_nolock(ext) == 0); > + LASSERT(osc_extent_sanity_check_nolock(ext) == 0); > /* `Kick' this extent only if the caller is waiting for it to be > * written out. > */ > @@ -1025,7 +1025,7 @@ static int osc_extent_truncate(struct osc_extent *ext, pgoff_t trunc_index, > int rc = 0; > u16 refcheck; > > - LASSERT(sanity_check(ext) == 0); > + LASSERT(osc_extent_sanity_check(ext) == 0); > EASSERT(ext->oe_state == OES_TRUNC, ext); > EASSERT(!ext->oe_urgent, ext); > > @@ -1141,7 +1141,7 @@ static int osc_extent_make_ready(const struct lu_env *env, > int rc; > > /* we're going to grab page lock, so object lock must not be taken. */ > - LASSERT(sanity_check(ext) == 0); > + LASSERT(osc_extent_sanity_check(ext) == 0); > /* in locking state, any process should not touch this extent. */ > EASSERT(ext->oe_state == OES_LOCKING, ext); > EASSERT(ext->oe_owner, ext); > @@ -1229,7 +1229,7 @@ static int osc_extent_expand(struct osc_extent *ext, pgoff_t index, > > LASSERT(ext->oe_max_end >= index && ext->oe_start <= index); > osc_object_lock(obj); > - LASSERT(sanity_check_nolock(ext) == 0); > + LASSERT(osc_extent_sanity_check_nolock(ext) == 0); > end_chunk = ext->oe_end >> ppc_bits; > if (chunk > end_chunk + 1) { > rc = -ERANGE; > @@ -1273,8 +1273,8 @@ static int osc_extent_expand(struct osc_extent *ext, pgoff_t index, > return rc; > } > > -static void osc_extent_tree_dump0(int level, struct osc_object *obj, > - const char *func, int line) > +static void __osc_extent_tree_dump(int level, struct osc_object *obj, > + const char *func, int line) > { > struct osc_extent *ext; > int cnt; > @@ -2355,8 +2355,8 @@ static void osc_check_rpcs(const struct lu_env *env, struct client_obd *cli) > } > } > > -static int osc_io_unplug0(const struct lu_env *env, struct client_obd *cli, > - struct osc_object *osc, int async) > +static int __osc_io_unplug(const struct lu_env *env, struct client_obd *cli, > + struct osc_object *osc, int async) > { > int rc = 0; > > @@ -2378,13 +2378,13 @@ static int osc_io_unplug0(const struct lu_env *env, struct client_obd *cli, > static int osc_io_unplug_async(const struct lu_env *env, > struct client_obd *cli, struct osc_object *osc) > { > - return osc_io_unplug0(env, cli, osc, 1); > + return __osc_io_unplug(env, cli, osc, 1); > } > > void osc_io_unplug(const struct lu_env *env, struct client_obd *cli, > struct osc_object *osc) > { > - (void)osc_io_unplug0(env, cli, osc, 0); > + (void)__osc_io_unplug(env, cli, osc, 0); > } > > int osc_prep_async_page(struct osc_object *osc, struct osc_page *ops, > diff --git a/drivers/staging/lustre/lustre/osc/osc_lock.c b/drivers/staging/lustre/lustre/osc/osc_lock.c > index 824c655b4ce0..01b6bf7df3b7 100644 > --- a/drivers/staging/lustre/lustre/osc/osc_lock.c > +++ b/drivers/staging/lustre/lustre/osc/osc_lock.c > @@ -413,9 +413,9 @@ static int osc_lock_flush(struct osc_object *obj, pgoff_t start, pgoff_t end, > * Helper for osc_dlm_blocking_ast() handling discrepancies between cl_lock > * and ldlm_lock caches. > */ > -static int osc_dlm_blocking_ast0(const struct lu_env *env, > - struct ldlm_lock *dlmlock, > - void *data, int flag) > +static int __osc_dlm_blocking_ast(const struct lu_env *env, > + struct ldlm_lock *dlmlock, > + void *data, int flag) > { > enum cl_lock_mode mode = CLM_READ; > struct cl_object *obj = NULL; > @@ -556,7 +556,7 @@ static int osc_ldlm_blocking_ast(struct ldlm_lock *dlmlock, > break; > } > > - result = osc_dlm_blocking_ast0(env, dlmlock, data, flag); > + result = __osc_dlm_blocking_ast(env, dlmlock, data, flag); > cl_env_put(env, &refcheck); > break; > } > > Cheers, Andreas --- Andreas Dilger CTO Whamcloud From adilger at whamcloud.com Sun Jan 13 20:41:30 2019 From: adilger at whamcloud.com (Andreas Dilger) Date: Sun, 13 Jan 2019 20:41:30 +0000 Subject: [lustre-devel] [PATCH 2/4] lustre: llite: change some foo0() to __foo() In-Reply-To: <154716484597.28978.7362652816645934722.stgit@noble> References: <154716475327.28978.3817067697027604609.stgit@noble> <154716484597.28978.7362652816645934722.stgit@noble> Message-ID: On Jan 10, 2019, at 16:00, NeilBrown wrote: > > Change: > cl_glimpse_size0 -> __cl_glimpse_size > ll_page_mkwrite0 -> __ll_page_mkwrite > ll_fault0 -> __ll_fault > vvp_object_init0 -> __vvp_object_init > > This is more consistent with Linux naming style. > > Signed-off-by: NeilBrown Reviewed-by: Andreas Dilger > --- > drivers/staging/lustre/lustre/llite/glimpse.c | 2 +- > .../staging/lustre/lustre/llite/llite_internal.h | 6 +++--- > drivers/staging/lustre/lustre/llite/llite_mmap.c | 11 +++++------ > drivers/staging/lustre/lustre/llite/vvp_object.c | 8 ++++---- > 4 files changed, 13 insertions(+), 14 deletions(-) > > diff --git a/drivers/staging/lustre/lustre/llite/glimpse.c b/drivers/staging/lustre/lustre/llite/glimpse.c > index ce0d51767da3..d8712a392e58 100644 > --- a/drivers/staging/lustre/lustre/llite/glimpse.c > +++ b/drivers/staging/lustre/lustre/llite/glimpse.c > @@ -163,7 +163,7 @@ static int cl_io_get(struct inode *inode, struct lu_env **envout, > return result; > } > > -int cl_glimpse_size0(struct inode *inode, int agl) > +int __cl_glimpse_size(struct inode *inode, int agl) > { > /* > * We don't need ast_flags argument to cl_glimpse_size(), because > diff --git a/drivers/staging/lustre/lustre/llite/llite_internal.h b/drivers/staging/lustre/lustre/llite/llite_internal.h > index b2a1f54ab228..c680a49d900c 100644 > --- a/drivers/staging/lustre/lustre/llite/llite_internal.h > +++ b/drivers/staging/lustre/lustre/llite/llite_internal.h > @@ -1161,18 +1161,18 @@ void ll_deauthorize_statahead(struct inode *dir, void *key); > > blkcnt_t dirty_cnt(struct inode *inode); > > -int cl_glimpse_size0(struct inode *inode, int agl); > +int __cl_glimpse_size(struct inode *inode, int agl); > int cl_glimpse_lock(const struct lu_env *env, struct cl_io *io, > struct inode *inode, struct cl_object *clob, int agl); > > static inline int cl_glimpse_size(struct inode *inode) > { > - return cl_glimpse_size0(inode, 0); > + return __cl_glimpse_size(inode, 0); > } > > static inline int cl_agl(struct inode *inode) > { > - return cl_glimpse_size0(inode, 1); > + return __cl_glimpse_size(inode, 1); > } > > static inline int ll_glimpse_size(struct inode *inode) > diff --git a/drivers/staging/lustre/lustre/llite/llite_mmap.c b/drivers/staging/lustre/lustre/llite/llite_mmap.c > index 023d62e53051..33e23ee4aff4 100644 > --- a/drivers/staging/lustre/lustre/llite/llite_mmap.c > +++ b/drivers/staging/lustre/lustre/llite/llite_mmap.c > @@ -143,9 +143,8 @@ ll_fault_io_init(struct lu_env *env, struct vm_area_struct *vma, > return io; > } > > -/* Sharing code of page_mkwrite method for rhel5 and rhel6 */ > -static int ll_page_mkwrite0(struct vm_area_struct *vma, struct page *vmpage, > - bool *retry) > +static int __ll_page_mkwrite(struct vm_area_struct *vma, struct page *vmpage, > + bool *retry) > { > struct lu_env *env; > struct cl_io *io; > @@ -262,7 +261,7 @@ static inline vm_fault_t to_fault_error(int result) > * \retval VM_FAULT_ERROR on general error > * \retval NOPAGE_OOM not have memory for allocate new page > */ > -static vm_fault_t ll_fault0(struct vm_area_struct *vma, struct vm_fault *vmf) > +static vm_fault_t __ll_fault(struct vm_area_struct *vma, struct vm_fault *vmf) > { > struct lu_env *env; > struct cl_io *io; > @@ -365,7 +364,7 @@ static vm_fault_t ll_fault(struct vm_fault *vmf) > LPROC_LL_FAULT, 1); > > restart: > - result = ll_fault0(vmf->vma, vmf); > + result = __ll_fault(vmf->vma, vmf); > if (!(result & (VM_FAULT_RETRY | VM_FAULT_ERROR | VM_FAULT_LOCKED))) { > struct page *vmpage = vmf->page; > > @@ -406,7 +405,7 @@ static vm_fault_t ll_page_mkwrite(struct vm_fault *vmf) > file_update_time(vma->vm_file); > do { > retry = false; > - err = ll_page_mkwrite0(vma, vmf->page, &retry); > + err = __ll_page_mkwrite(vma, vmf->page, &retry); > > if (!printed && ++count > 16) { > const struct dentry *de = vma->vm_file->f_path.dentry; > diff --git a/drivers/staging/lustre/lustre/llite/vvp_object.c b/drivers/staging/lustre/lustre/llite/vvp_object.c > index e1000f6b7f22..86e077bd516b 100644 > --- a/drivers/staging/lustre/lustre/llite/vvp_object.c > +++ b/drivers/staging/lustre/lustre/llite/vvp_object.c > @@ -220,9 +220,9 @@ static const struct cl_object_operations vvp_ops = { > .coo_req_attr_set = vvp_req_attr_set > }; > > -static int vvp_object_init0(const struct lu_env *env, > - struct vvp_object *vob, > - const struct cl_object_conf *conf) > +static int __vvp_object_init(const struct lu_env *env, > + struct vvp_object *vob, > + const struct cl_object_conf *conf) > { > vob->vob_inode = conf->coc_inode; > atomic_set(&vob->vob_transient_pages, 0); > @@ -246,7 +246,7 @@ static int vvp_object_init(const struct lu_env *env, struct lu_object *obj, > > cconf = lu2cl_conf(conf); > lu_object_add(obj, below); > - result = vvp_object_init0(env, vob, cconf); > + result = __vvp_object_init(env, vob, cconf); > } else { > result = -ENOMEM; > } > > Cheers, Andreas --- Andreas Dilger Principal Lustre Architect Whamcloud From adilger at whamcloud.com Sun Jan 13 20:42:04 2019 From: adilger at whamcloud.com (Andreas Dilger) Date: Sun, 13 Jan 2019 20:42:04 +0000 Subject: [lustre-devel] [PATCH 3/4] lustre: obdclass: change some foo0() to __foo() In-Reply-To: <154716484605.28978.3593304564414994720.stgit@noble> References: <154716475327.28978.3817067697027604609.stgit@noble> <154716484605.28978.3593304564414994720.stgit@noble> Message-ID: On Jan 10, 2019, at 16:00, NeilBrown wrote: > > Change: > cl_io_init0 -> __cl_io_init > cl_lock_trace0 -> __cl_lock_trace > cl_page_delete0 -> __cl_page_delete > cl_page_state_set0 -> __cl_page_state_set > cl_page_own0 -> __cl_page_own > cl_page_disown0 -> __cl_page_disown > cl_page_delete0 -> __cl_page_delete > cl_echo_enqueue0 -> __cl_echo_enqueue > cl_echo_cancel0 -> __cl_echo_cancel > > This is more consistent with Linux naming style. > > Signed-off-by: NeilBrown Reviewed-by: Andreas Dilger > --- > drivers/staging/lustre/lustre/include/cl_object.h | 6 ++- > drivers/staging/lustre/lustre/obdclass/cl_io.c | 14 ++++---- > drivers/staging/lustre/lustre/obdclass/cl_lock.c | 8 ++-- > drivers/staging/lustre/lustre/obdclass/cl_page.c | 36 ++++++++++---------- > .../staging/lustre/lustre/obdecho/echo_client.c | 20 ++++++----- > 5 files changed, 42 insertions(+), 42 deletions(-) > > diff --git a/drivers/staging/lustre/lustre/include/cl_object.h b/drivers/staging/lustre/lustre/include/cl_object.h > index 4f0e8e271452..d0e61e503f9d 100644 > --- a/drivers/staging/lustre/lustre/include/cl_object.h > +++ b/drivers/staging/lustre/lustre/include/cl_object.h > @@ -803,7 +803,7 @@ struct cl_page_operations { > /** > * cl_page<->struct page methods. Only one layer in the stack has to > * implement these. Current code assumes that this functionality is > - * provided by the topmost layer, see cl_page_disown0() as an example. > + * provided by the topmost layer, see __cl_page_disown() as an example. > */ > > /** > @@ -2144,8 +2144,8 @@ void cl_page_unassume(const struct lu_env *env, > struct cl_io *io, struct cl_page *pg); > void cl_page_disown(const struct lu_env *env, > struct cl_io *io, struct cl_page *page); > -void cl_page_disown0(const struct lu_env *env, > - struct cl_io *io, struct cl_page *pg); > +void __cl_page_disown(const struct lu_env *env, > + struct cl_io *io, struct cl_page *pg); > int cl_page_is_owned(const struct cl_page *pg, const struct cl_io *io); > > /** @} ownership */ > diff --git a/drivers/staging/lustre/lustre/obdclass/cl_io.c b/drivers/staging/lustre/lustre/obdclass/cl_io.c > index 0da731cfeb30..84c7710f80d7 100644 > --- a/drivers/staging/lustre/lustre/obdclass/cl_io.c > +++ b/drivers/staging/lustre/lustre/obdclass/cl_io.c > @@ -131,8 +131,8 @@ void cl_io_fini(const struct lu_env *env, struct cl_io *io) > } > EXPORT_SYMBOL(cl_io_fini); > > -static int cl_io_init0(const struct lu_env *env, struct cl_io *io, > - enum cl_io_type iot, struct cl_object *obj) > +static int __cl_io_init(const struct lu_env *env, struct cl_io *io, > + enum cl_io_type iot, struct cl_object *obj) > { > struct cl_object *scan; > int result; > @@ -169,7 +169,7 @@ int cl_io_sub_init(const struct lu_env *env, struct cl_io *io, > { > LASSERT(obj != cl_object_top(obj)); > > - return cl_io_init0(env, io, iot, obj); > + return __cl_io_init(env, io, iot, obj); > } > EXPORT_SYMBOL(cl_io_sub_init); > > @@ -188,7 +188,7 @@ int cl_io_init(const struct lu_env *env, struct cl_io *io, > { > LASSERT(obj == cl_object_top(obj)); > > - return cl_io_init0(env, io, iot, obj); > + return __cl_io_init(env, io, iot, obj); > } > EXPORT_SYMBOL(cl_io_init); > > @@ -897,14 +897,14 @@ void cl_page_list_disown(const struct lu_env *env, > list_del_init(&page->cp_batch); > --plist->pl_nr; > /* > - * cl_page_disown0 rather than usual cl_page_disown() is used, > + * __cl_page_disown rather than usual cl_page_disown() is used, > * because pages are possibly in CPS_FREEING state already due > * to the call to cl_page_list_discard(). > */ > /* > - * XXX cl_page_disown0() will fail if page is not locked. > + * XXX __cl_page_disown() will fail if page is not locked. > */ > - cl_page_disown0(env, io, page); > + __cl_page_disown(env, io, page); > lu_ref_del_at(&page->cp_reference, &page->cp_queue_ref, "queue", > plist); > cl_page_put(env, page); > diff --git a/drivers/staging/lustre/lustre/obdclass/cl_lock.c b/drivers/staging/lustre/lustre/obdclass/cl_lock.c > index 9ca29a26a38b..23c1609415a3 100644 > --- a/drivers/staging/lustre/lustre/obdclass/cl_lock.c > +++ b/drivers/staging/lustre/lustre/obdclass/cl_lock.c > @@ -45,9 +45,9 @@ > #include > #include "cl_internal.h" > > -static void cl_lock_trace0(int level, const struct lu_env *env, > - const char *prefix, const struct cl_lock *lock, > - const char *func, const int line) > +static void __cl_lock_trace(int level, const struct lu_env *env, > + const char *prefix, const struct cl_lock *lock, > + const char *func, const int line) > { > struct cl_object_header *h = cl_object_header(lock->cll_descr.cld_obj); > > @@ -55,7 +55,7 @@ static void cl_lock_trace0(int level, const struct lu_env *env, > prefix, lock, env, h->coh_nesting, func, line); > } > #define cl_lock_trace(level, env, prefix, lock) \ > - cl_lock_trace0(level, env, prefix, lock, __func__, __LINE__) > + __cl_lock_trace(level, env, prefix, lock, __func__, __LINE__) > > /** > * Adds lock slice to the compound lock. > diff --git a/drivers/staging/lustre/lustre/obdclass/cl_page.c b/drivers/staging/lustre/lustre/obdclass/cl_page.c > index 00df94b87606..5794b1cbfb54 100644 > --- a/drivers/staging/lustre/lustre/obdclass/cl_page.c > +++ b/drivers/staging/lustre/lustre/obdclass/cl_page.c > @@ -45,7 +45,7 @@ > #include > #include "cl_internal.h" > > -static void cl_page_delete0(const struct lu_env *env, struct cl_page *pg); > +static void __cl_page_delete(const struct lu_env *env, struct cl_page *pg); > > # define PASSERT(env, page, expr) \ > do { \ > @@ -156,7 +156,7 @@ struct cl_page *cl_page_alloc(const struct lu_env *env, > result = o->co_ops->coo_page_init(env, o, page, > ind); > if (result != 0) { > - cl_page_delete0(env, page); > + __cl_page_delete(env, page); > cl_page_free(env, page); > page = ERR_PTR(result); > break; > @@ -228,8 +228,8 @@ static inline int cl_page_invariant(const struct cl_page *pg) > return cl_page_in_use_noref(pg); > } > > -static void cl_page_state_set0(const struct lu_env *env, > - struct cl_page *page, enum cl_page_state state) > +static void __cl_page_state_set(const struct lu_env *env, > + struct cl_page *page, enum cl_page_state state) > { > enum cl_page_state old; > > @@ -286,7 +286,7 @@ static void cl_page_state_set0(const struct lu_env *env, > static void cl_page_state_set(const struct lu_env *env, > struct cl_page *page, enum cl_page_state state) > { > - cl_page_state_set0(env, page, state); > + __cl_page_state_set(env, page, state); > } > > /** > @@ -377,7 +377,7 @@ static void cl_page_owner_set(struct cl_page *page) > page->cp_owner->ci_owned_nr++; > } > > -void cl_page_disown0(const struct lu_env *env, > +void __cl_page_disown(const struct lu_env *env, > struct cl_io *io, struct cl_page *pg) > { > const struct cl_page_slice *slice; > @@ -433,8 +433,8 @@ EXPORT_SYMBOL(cl_page_is_owned); > * \see cl_page_own_try() > * \see cl_page_own > */ > -static int cl_page_own0(const struct lu_env *env, struct cl_io *io, > - struct cl_page *pg, int nonblock) > +static int __cl_page_own(const struct lu_env *env, struct cl_io *io, > + struct cl_page *pg, int nonblock) > { > const struct cl_page_slice *slice; > int result = 0; > @@ -465,7 +465,7 @@ static int cl_page_own0(const struct lu_env *env, struct cl_io *io, > if (pg->cp_state != CPS_FREEING) { > cl_page_state_set(env, pg, CPS_OWNED); > } else { > - cl_page_disown0(env, io, pg); > + __cl_page_disown(env, io, pg); > result = -ENOENT; > } > } > @@ -477,23 +477,23 @@ static int cl_page_own0(const struct lu_env *env, struct cl_io *io, > /** > * Own a page, might be blocked. > * > - * \see cl_page_own0() > + * \see __cl_page_own() > */ > int cl_page_own(const struct lu_env *env, struct cl_io *io, struct cl_page *pg) > { > - return cl_page_own0(env, io, pg, 0); > + return __cl_page_own(env, io, pg, 0); > } > EXPORT_SYMBOL(cl_page_own); > > /** > * Nonblock version of cl_page_own(). > * > - * \see cl_page_own0() > + * \see __cl_page_own() > */ > int cl_page_own_try(const struct lu_env *env, struct cl_io *io, > struct cl_page *pg) > { > - return cl_page_own0(env, io, pg, 1); > + return __cl_page_own(env, io, pg, 1); > } > EXPORT_SYMBOL(cl_page_own_try); > > @@ -576,7 +576,7 @@ void cl_page_disown(const struct lu_env *env, > pg->cp_state == CPS_FREEING); > > io = cl_io_top(io); > - cl_page_disown0(env, io, pg); > + __cl_page_disown(env, io, pg); > } > EXPORT_SYMBOL(cl_page_disown); > > @@ -607,10 +607,10 @@ EXPORT_SYMBOL(cl_page_discard); > > /** > * Version of cl_page_delete() that can be called for not fully constructed > - * pages, e.g,. in a error handling cl_page_find()->cl_page_delete0() > + * pages, e.g,. in a error handling cl_page_find()->__cl_page_delete() > * path. Doesn't check page invariant. > */ > -static void cl_page_delete0(const struct lu_env *env, struct cl_page *pg) > +static void __cl_page_delete(const struct lu_env *env, struct cl_page *pg) > { > const struct cl_page_slice *slice; > > @@ -620,7 +620,7 @@ static void cl_page_delete0(const struct lu_env *env, struct cl_page *pg) > * Sever all ways to obtain new pointers to @pg. > */ > cl_page_owner_clear(pg); > - cl_page_state_set0(env, pg, CPS_FREEING); > + __cl_page_state_set(env, pg, CPS_FREEING); > > list_for_each_entry_reverse(slice, &pg->cp_layers, cpl_linkage) { > if (slice->cpl_ops->cpo_delete) > @@ -655,7 +655,7 @@ static void cl_page_delete0(const struct lu_env *env, struct cl_page *pg) > void cl_page_delete(const struct lu_env *env, struct cl_page *pg) > { > PINVRNT(env, pg, cl_page_invariant(pg)); > - cl_page_delete0(env, pg); > + __cl_page_delete(env, pg); > } > EXPORT_SYMBOL(cl_page_delete); > > diff --git a/drivers/staging/lustre/lustre/obdecho/echo_client.c b/drivers/staging/lustre/lustre/obdecho/echo_client.c > index 887df7ce6b5c..39b7ab1447a4 100644 > --- a/drivers/staging/lustre/lustre/obdecho/echo_client.c > +++ b/drivers/staging/lustre/lustre/obdecho/echo_client.c > @@ -910,9 +910,9 @@ static int cl_echo_object_put(struct echo_object *eco) > return 0; > } > > -static int cl_echo_enqueue0(struct lu_env *env, struct echo_object *eco, > - u64 start, u64 end, int mode, > - __u64 *cookie, __u32 enqflags) > +static int __cl_echo_enqueue(struct lu_env *env, struct echo_object *eco, > + u64 start, u64 end, int mode, > + __u64 *cookie, __u32 enqflags) > { > struct cl_io *io; > struct cl_lock *lck; > @@ -953,8 +953,8 @@ static int cl_echo_enqueue0(struct lu_env *env, struct echo_object *eco, > return rc; > } > > -static int cl_echo_cancel0(struct lu_env *env, struct echo_device *ed, > - __u64 cookie) > +static int __cl_echo_cancel(struct lu_env *env, struct echo_device *ed, > + __u64 cookie) > { > struct echo_client_obd *ec = ed->ed_ec; > struct echo_lock *ecl = NULL; > @@ -1028,10 +1028,10 @@ static int cl_echo_object_brw(struct echo_object *eco, int rw, u64 offset, > goto out; > LASSERT(rc == 0); > > - rc = cl_echo_enqueue0(env, eco, offset, > - offset + npages * PAGE_SIZE - 1, > - rw == READ ? LCK_PR : LCK_PW, &lh.cookie, > - CEF_NEVER); > + rc = __cl_echo_enqueue(env, eco, offset, > + offset + npages * PAGE_SIZE - 1, > + rw == READ ? LCK_PR : LCK_PW, &lh.cookie, > + CEF_NEVER); > if (rc < 0) > goto error_lock; > > @@ -1079,7 +1079,7 @@ static int cl_echo_object_brw(struct echo_object *eco, int rw, u64 offset, > async ? "async" : "sync", rc); > } > > - cl_echo_cancel0(env, ed, lh.cookie); > + __cl_echo_cancel(env, ed, lh.cookie); > error_lock: > cl_2queue_discard(env, io, queue); > cl_2queue_disown(env, io, queue); > > Cheers, Andreas --- Andreas Dilger CTO Whamcloud From adilger at whamcloud.com Sun Jan 13 20:42:38 2019 From: adilger at whamcloud.com (Andreas Dilger) Date: Sun, 13 Jan 2019 20:42:38 +0000 Subject: [lustre-devel] [PATCH 4/4] lustre: ptlrpc: change some foo0() to __foo() In-Reply-To: <154716484609.28978.296505839179223953.stgit@noble> References: <154716475327.28978.3817067697027604609.stgit@noble> <154716484609.28978.296505839179223953.stgit@noble> Message-ID: <1948C079-1DBA-4563-82A4-2D8F3B1A95C8@whamcloud.com> On Jan 10, 2019, at 16:00, NeilBrown wrote: > > Change: > nrs_policy_stop0 -> __nrs_policy_stop > nrs_svcpt_setup_locked0 -> __nrs_svcpt_setup_locked > ptlrpc_nrs_req_get_nolock0 -> __ptlrpc_nrs_req_get_nolock > > This is more consistent with Linux naming style. > > Signed-off-by: NeilBrown Reviewed-by: Andreas Dilger > --- > drivers/staging/lustre/lustre/ptlrpc/nrs.c | 20 ++++++++++---------- > drivers/staging/lustre/lustre/ptlrpc/nrs_fifo.c | 2 +- > .../staging/lustre/lustre/ptlrpc/ptlrpc_internal.h | 6 +++--- > 3 files changed, 14 insertions(+), 14 deletions(-) > > diff --git a/drivers/staging/lustre/lustre/ptlrpc/nrs.c b/drivers/staging/lustre/lustre/ptlrpc/nrs.c > index e09b86529c5d..248ba045fb79 100644 > --- a/drivers/staging/lustre/lustre/ptlrpc/nrs.c > +++ b/drivers/staging/lustre/lustre/ptlrpc/nrs.c > @@ -82,7 +82,7 @@ static int nrs_policy_ctl_locked(struct ptlrpc_nrs_policy *policy, > -ENOSYS; > } > > -static void nrs_policy_stop0(struct ptlrpc_nrs_policy *policy) > +static void __nrs_policy_stop(struct ptlrpc_nrs_policy *policy) > { > if (policy->pol_desc->pd_ops->op_policy_stop) > policy->pol_desc->pd_ops->op_policy_stop(policy); > @@ -126,7 +126,7 @@ static int nrs_policy_stop_locked(struct ptlrpc_nrs_policy *policy) > > /* I have the only refcount */ > if (policy->pol_ref == 1) > - nrs_policy_stop0(policy); > + __nrs_policy_stop(policy); > > return 0; > } > @@ -151,7 +151,7 @@ static void nrs_policy_stop_primary(struct ptlrpc_nrs *nrs) > tmp->pol_state = NRS_POL_STATE_STOPPING; > > if (tmp->pol_ref == 0) > - nrs_policy_stop0(tmp); > + __nrs_policy_stop(tmp); > } > > /** > @@ -300,7 +300,7 @@ static void nrs_policy_put_locked(struct ptlrpc_nrs_policy *policy) > policy->pol_ref--; > if (unlikely(policy->pol_ref == 0 && > policy->pol_state == NRS_POL_STATE_STOPPING)) > - nrs_policy_stop0(policy); > + __nrs_policy_stop(policy); > } > > static void nrs_policy_put(struct ptlrpc_nrs_policy *policy) > @@ -888,8 +888,8 @@ static int nrs_register_policies_locked(struct ptlrpc_nrs *nrs) > * > * \pre mutex_is_locked(&nrs_core.nrs_mutex) > */ > -static int nrs_svcpt_setup_locked0(struct ptlrpc_nrs *nrs, > - struct ptlrpc_service_part *svcpt) > +static int __nrs_svcpt_setup_locked(struct ptlrpc_nrs *nrs, > + struct ptlrpc_service_part *svcpt) > { > enum ptlrpc_nrs_queue_type queue; > > @@ -931,7 +931,7 @@ static int nrs_svcpt_setup_locked(struct ptlrpc_service_part *svcpt) > * Initialize the regular NRS head. > */ > nrs = nrs_svcpt2nrs(svcpt, false); > - rc = nrs_svcpt_setup_locked0(nrs, svcpt); > + rc = __nrs_svcpt_setup_locked(nrs, svcpt); > if (rc < 0) > goto out; > > @@ -951,7 +951,7 @@ static int nrs_svcpt_setup_locked(struct ptlrpc_service_part *svcpt) > } > > nrs = nrs_svcpt2nrs(svcpt, true); > - rc = nrs_svcpt_setup_locked0(nrs, svcpt); > + rc = __nrs_svcpt_setup_locked(nrs, svcpt); > > out: > return rc; > @@ -1444,8 +1444,8 @@ static void nrs_request_removed(struct ptlrpc_nrs_policy *policy) > * \retval NULL the head has no requests to serve > */ > struct ptlrpc_request * > -ptlrpc_nrs_req_get_nolock0(struct ptlrpc_service_part *svcpt, bool hp, > - bool peek, bool force) > +__ptlrpc_nrs_req_get_nolock(struct ptlrpc_service_part *svcpt, bool hp, > + bool peek, bool force) > { > struct ptlrpc_nrs *nrs = nrs_svcpt2nrs(svcpt, hp); > struct ptlrpc_nrs_policy *policy; > diff --git a/drivers/staging/lustre/lustre/ptlrpc/nrs_fifo.c b/drivers/staging/lustre/lustre/ptlrpc/nrs_fifo.c > index ff630d94dd26..7fe8aeeff428 100644 > --- a/drivers/staging/lustre/lustre/ptlrpc/nrs_fifo.c > +++ b/drivers/staging/lustre/lustre/ptlrpc/nrs_fifo.c > @@ -96,7 +96,7 @@ static int nrs_fifo_start(struct ptlrpc_nrs_policy *policy) > * > * \param[in] policy The policy to stop > * > - * \see nrs_policy_stop0() > + * \see __nrs_policy_stop() > */ > static void nrs_fifo_stop(struct ptlrpc_nrs_policy *policy) > { > diff --git a/drivers/staging/lustre/lustre/ptlrpc/ptlrpc_internal.h b/drivers/staging/lustre/lustre/ptlrpc/ptlrpc_internal.h > index 177010cf7148..da42b99fc36f 100644 > --- a/drivers/staging/lustre/lustre/ptlrpc/ptlrpc_internal.h > +++ b/drivers/staging/lustre/lustre/ptlrpc/ptlrpc_internal.h > @@ -133,14 +133,14 @@ void ptlrpc_nrs_req_add(struct ptlrpc_service_part *svcpt, > struct ptlrpc_request *req, bool hp); > > struct ptlrpc_request * > -ptlrpc_nrs_req_get_nolock0(struct ptlrpc_service_part *svcpt, bool hp, > - bool peek, bool force); > +__ptlrpc_nrs_req_get_nolock(struct ptlrpc_service_part *svcpt, bool hp, > + bool peek, bool force); > > static inline struct ptlrpc_request * > ptlrpc_nrs_req_get_nolock(struct ptlrpc_service_part *svcpt, bool hp, > bool force) > { > - return ptlrpc_nrs_req_get_nolock0(svcpt, hp, false, force); > + return __ptlrpc_nrs_req_get_nolock(svcpt, hp, false, force); > } > > bool ptlrpc_nrs_req_pending_nolock(struct ptlrpc_service_part *svcpt, bool hp); > > Cheers, Andreas --- Andreas Dilger Principal Lustre Architect Whamcloud From nangelinas at cray.com Mon Jan 14 11:27:37 2019 From: nangelinas at cray.com (Nikitas Angelinas) Date: Mon, 14 Jan 2019 11:27:37 +0000 Subject: [lustre-devel] [PATCH 4/4] lustre: ptlrpc: change some foo0() to __foo() In-Reply-To: <154716484609.28978.296505839179223953.stgit@noble> References: <154716475327.28978.3817067697027604609.stgit@noble> <154716484609.28978.296505839179223953.stgit@noble> Message-ID: <98B8BD52-731B-4D5C-8D71-09FCA3BC34F5@cray.com> On 1/10/19, 4:01 PM, "NeilBrown" wrote: Change: nrs_policy_stop0 -> __nrs_policy_stop nrs_svcpt_setup_locked0 -> __nrs_svcpt_setup_locked ptlrpc_nrs_req_get_nolock0 -> __ptlrpc_nrs_req_get_nolock This is more consistent with Linux naming style. Signed-off-by: NeilBrown --- drivers/staging/lustre/lustre/ptlrpc/nrs.c | 20 ++++++++++---------- drivers/staging/lustre/lustre/ptlrpc/nrs_fifo.c | 2 +- .../staging/lustre/lustre/ptlrpc/ptlrpc_internal.h | 6 +++--- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/drivers/staging/lustre/lustre/ptlrpc/nrs.c b/drivers/staging/lustre/lustre/ptlrpc/nrs.c index e09b86529c5d..248ba045fb79 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/nrs.c +++ b/drivers/staging/lustre/lustre/ptlrpc/nrs.c @@ -82,7 +82,7 @@ static int nrs_policy_ctl_locked(struct ptlrpc_nrs_policy *policy, -ENOSYS; } -static void nrs_policy_stop0(struct ptlrpc_nrs_policy *policy) +static void __nrs_policy_stop(struct ptlrpc_nrs_policy *policy) { if (policy->pol_desc->pd_ops->op_policy_stop) policy->pol_desc->pd_ops->op_policy_stop(policy); @@ -126,7 +126,7 @@ static int nrs_policy_stop_locked(struct ptlrpc_nrs_policy *policy) /* I have the only refcount */ if (policy->pol_ref == 1) - nrs_policy_stop0(policy); + __nrs_policy_stop(policy); return 0; } @@ -151,7 +151,7 @@ static void nrs_policy_stop_primary(struct ptlrpc_nrs *nrs) tmp->pol_state = NRS_POL_STATE_STOPPING; if (tmp->pol_ref == 0) - nrs_policy_stop0(tmp); + __nrs_policy_stop(tmp); } /** @@ -300,7 +300,7 @@ static void nrs_policy_put_locked(struct ptlrpc_nrs_policy *policy) policy->pol_ref--; if (unlikely(policy->pol_ref == 0 && policy->pol_state == NRS_POL_STATE_STOPPING)) - nrs_policy_stop0(policy); + __nrs_policy_stop(policy); } "nrs_policy_stop0()" also appears in a comment in drivers/staging/lustre/lustre/include/lustre_nrs.h, if you would like to change that as well? Other than that, please feel free to add: Reviewed-by: Nikitas Angelinas static void nrs_policy_put(struct ptlrpc_nrs_policy *policy) @@ -888,8 +888,8 @@ static int nrs_register_policies_locked(struct ptlrpc_nrs *nrs) * * \pre mutex_is_locked(&nrs_core.nrs_mutex) */ -static int nrs_svcpt_setup_locked0(struct ptlrpc_nrs *nrs, - struct ptlrpc_service_part *svcpt) +static int __nrs_svcpt_setup_locked(struct ptlrpc_nrs *nrs, + struct ptlrpc_service_part *svcpt) { enum ptlrpc_nrs_queue_type queue; @@ -931,7 +931,7 @@ static int nrs_svcpt_setup_locked(struct ptlrpc_service_part *svcpt) * Initialize the regular NRS head. */ nrs = nrs_svcpt2nrs(svcpt, false); - rc = nrs_svcpt_setup_locked0(nrs, svcpt); + rc = __nrs_svcpt_setup_locked(nrs, svcpt); if (rc < 0) goto out; @@ -951,7 +951,7 @@ static int nrs_svcpt_setup_locked(struct ptlrpc_service_part *svcpt) } nrs = nrs_svcpt2nrs(svcpt, true); - rc = nrs_svcpt_setup_locked0(nrs, svcpt); + rc = __nrs_svcpt_setup_locked(nrs, svcpt); out: return rc; @@ -1444,8 +1444,8 @@ static void nrs_request_removed(struct ptlrpc_nrs_policy *policy) * \retval NULL the head has no requests to serve */ struct ptlrpc_request * -ptlrpc_nrs_req_get_nolock0(struct ptlrpc_service_part *svcpt, bool hp, - bool peek, bool force) +__ptlrpc_nrs_req_get_nolock(struct ptlrpc_service_part *svcpt, bool hp, + bool peek, bool force) { struct ptlrpc_nrs *nrs = nrs_svcpt2nrs(svcpt, hp); struct ptlrpc_nrs_policy *policy; diff --git a/drivers/staging/lustre/lustre/ptlrpc/nrs_fifo.c b/drivers/staging/lustre/lustre/ptlrpc/nrs_fifo.c index ff630d94dd26..7fe8aeeff428 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/nrs_fifo.c +++ b/drivers/staging/lustre/lustre/ptlrpc/nrs_fifo.c @@ -96,7 +96,7 @@ static int nrs_fifo_start(struct ptlrpc_nrs_policy *policy) * * \param[in] policy The policy to stop * - * \see nrs_policy_stop0() + * \see __nrs_policy_stop() */ static void nrs_fifo_stop(struct ptlrpc_nrs_policy *policy) { diff --git a/drivers/staging/lustre/lustre/ptlrpc/ptlrpc_internal.h b/drivers/staging/lustre/lustre/ptlrpc/ptlrpc_internal.h index 177010cf7148..da42b99fc36f 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/ptlrpc_internal.h +++ b/drivers/staging/lustre/lustre/ptlrpc/ptlrpc_internal.h @@ -133,14 +133,14 @@ void ptlrpc_nrs_req_add(struct ptlrpc_service_part *svcpt, struct ptlrpc_request *req, bool hp); struct ptlrpc_request * -ptlrpc_nrs_req_get_nolock0(struct ptlrpc_service_part *svcpt, bool hp, - bool peek, bool force); +__ptlrpc_nrs_req_get_nolock(struct ptlrpc_service_part *svcpt, bool hp, + bool peek, bool force); static inline struct ptlrpc_request * ptlrpc_nrs_req_get_nolock(struct ptlrpc_service_part *svcpt, bool hp, bool force) { - return ptlrpc_nrs_req_get_nolock0(svcpt, hp, false, force); + return __ptlrpc_nrs_req_get_nolock(svcpt, hp, false, force); } bool ptlrpc_nrs_req_pending_nolock(struct ptlrpc_service_part *svcpt, bool hp); Cheers, Nikitas From charlie at whamcloud.com Tue Jan 22 20:50:53 2019 From: charlie at whamcloud.com (Charlie Olmstead) Date: Tue, 22 Jan 2019 20:50:53 +0000 Subject: [lustre-devel] Test session changes for review patches Message-ID: <96E7DD45-067F-4FD0-A8FE-DC1AB5D9062A@ddn.com> FYI: The following changes will be made to review patch testing on 01/22/2019 at 22:00 MST: * review-dne-zfs-part-3 will be changed to an enforcing session * review-zfs will no longer run conf-sanity since review-dne-zfs-part-3 already does No actions are needed by patch owners. Let me know if you have any questions. Charlie Olmstead -------------- next part -------------- An HTML attachment was scrubbed... URL: From degremoa at amazon.com Fri Jan 25 13:26:57 2019 From: degremoa at amazon.com (Degremont, Aurelien) Date: Fri, 25 Jan 2019 13:26:57 +0000 Subject: [lustre-devel] LibCFS and LNET module versions Message-ID: <41616FC6-B2B4-4B72-B7D6-69D1B5713653@amazon.com> Hello, All Lustre modules uses the Lustre version as their module version except for lnet and libcfs modules. Is there a specific reason to that? These version are hardcoded and never change. Tools like dkms could think some libcfs modules are the same because the version is the same but actually it changed a lot. Until we decide to properly manage a real version for these modules, could it be possible to also use Lustre version for them? Aurélien -------------- next part -------------- An HTML attachment was scrubbed... URL: From lochoa at whamcloud.com Tue Jan 29 21:12:07 2019 From: lochoa at whamcloud.com (Leonel Ochoa) Date: Tue, 29 Jan 2019 21:12:07 +0000 Subject: [lustre-devel] Maloo Unscheduled Maintenance Message-ID: <57473651-AA57-4469-B2DD-2D07D0B2A885@ddn.com> NOTICE TO ALL MALOO USERS The Maloo web server has been down since yesterday 1/28 due to unscheduled maintenance, at present we expect the downtime to last all of today 1/29 and possibly tomorrow 1/30 as well. Once service has been restored we’ll post a notification to this mailing list. Gerrit can still receive patches and Autotest will continue to run test sessions while Maloo remains offline, once the server is back up all pending results and gerrit +/- notifications (from Maloo) will be sent for all completed tests. Thank you for your patience. Lee Ochoa lochoa at whamcloud.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From neilb at suse.com Wed Jan 30 02:55:08 2019 From: neilb at suse.com (NeilBrown) Date: Wed, 30 Jan 2019 13:55:08 +1100 Subject: [lustre-devel] [PATCH 4/4] lustre: ptlrpc: change some foo0() to __foo() In-Reply-To: <98B8BD52-731B-4D5C-8D71-09FCA3BC34F5@cray.com> References: <154716475327.28978.3817067697027604609.stgit@noble> <154716484609.28978.296505839179223953.stgit@noble> <98B8BD52-731B-4D5C-8D71-09FCA3BC34F5@cray.com> Message-ID: <87tvhqlur7.fsf@notabene.neil.brown.name> On Mon, Jan 14 2019, Nikitas Angelinas wrote: > On 1/10/19, 4:01 PM, "NeilBrown" wrote: > > Change: > nrs_policy_stop0 -> __nrs_policy_stop > nrs_svcpt_setup_locked0 -> __nrs_svcpt_setup_locked > ptlrpc_nrs_req_get_nolock0 -> __ptlrpc_nrs_req_get_nolock > > This is more consistent with Linux naming style. > > Signed-off-by: NeilBrown > --- > drivers/staging/lustre/lustre/ptlrpc/nrs.c | 20 ++++++++++---------- > drivers/staging/lustre/lustre/ptlrpc/nrs_fifo.c | 2 +- > .../staging/lustre/lustre/ptlrpc/ptlrpc_internal.h | 6 +++--- > 3 files changed, 14 insertions(+), 14 deletions(-) > > diff --git a/drivers/staging/lustre/lustre/ptlrpc/nrs.c b/drivers/staging/lustre/lustre/ptlrpc/nrs.c > index e09b86529c5d..248ba045fb79 100644 > --- a/drivers/staging/lustre/lustre/ptlrpc/nrs.c > +++ b/drivers/staging/lustre/lustre/ptlrpc/nrs.c > @@ -82,7 +82,7 @@ static int nrs_policy_ctl_locked(struct ptlrpc_nrs_policy *policy, > -ENOSYS; > } > > -static void nrs_policy_stop0(struct ptlrpc_nrs_policy *policy) > +static void __nrs_policy_stop(struct ptlrpc_nrs_policy *policy) > { > if (policy->pol_desc->pd_ops->op_policy_stop) > policy->pol_desc->pd_ops->op_policy_stop(policy); > @@ -126,7 +126,7 @@ static int nrs_policy_stop_locked(struct ptlrpc_nrs_policy *policy) > > /* I have the only refcount */ > if (policy->pol_ref == 1) > - nrs_policy_stop0(policy); > + __nrs_policy_stop(policy); > > return 0; > } > @@ -151,7 +151,7 @@ static void nrs_policy_stop_primary(struct ptlrpc_nrs *nrs) > tmp->pol_state = NRS_POL_STATE_STOPPING; > > if (tmp->pol_ref == 0) > - nrs_policy_stop0(tmp); > + __nrs_policy_stop(tmp); > } > > /** > @@ -300,7 +300,7 @@ static void nrs_policy_put_locked(struct ptlrpc_nrs_policy *policy) > policy->pol_ref--; > if (unlikely(policy->pol_ref == 0 && > policy->pol_state == NRS_POL_STATE_STOPPING)) > - nrs_policy_stop0(policy); > + __nrs_policy_stop(policy); > } > "nrs_policy_stop0()" also appears in a comment in drivers/staging/lustre/lustre/include/lustre_nrs.h, if you would like to change that as well? Other than that, please feel free to add: > > Reviewed-by: Nikitas Angelinas Thanks! I've fixed that missing change, and added your Reviewed-by. NeilBrown -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 832 bytes Desc: not available URL: From neilb at suse.com Wed Jan 30 03:02:18 2019 From: neilb at suse.com (NeilBrown) Date: Wed, 30 Jan 2019 14:02:18 +1100 Subject: [lustre-devel] [PATCH 26/29] lustre: osc_cache: simplify osc_page_gang_lookup() In-Reply-To: <5E69C433-834D-48CF-BAE3-0F9D8F314D38@whamcloud.com> References: <154701488711.26726.17363928508883972338.stgit@noble> <154701504269.26726.8061168646539306509.stgit@noble> <87a7k8gfr7.fsf@notabene.neil.brown.name> <5E69C433-834D-48CF-BAE3-0F9D8F314D38@whamcloud.com> Message-ID: <87r2culuf9.fsf@notabene.neil.brown.name> On Fri, Jan 11 2019, Andreas Dilger wrote: > On Jan 10, 2019, at 18:11, NeilBrown wrote: >> : >>> >>> However, looking into the osc_page_gang_lookup() code more closely, I >>> see "end_of_region" would already be set in this case (it is just at >>> the start of the context in the above patch hunk) so CLP_GANG_RESCHED >>> should never be set in that case. So it looks OK. >> >> Oh good :-) >> Thanks. >> I love when a review includes what you saw as well as the "Reviewed-by". > > Sometimes (IMHO) it points out that code "reads" in a misleading manner, > looking like it does one thing, but actually doing something else. This > is mostly only obvious if you don't already know what the code is doing, > otherwise your own mental picture of the functionality guides you along. > I'm not really working on the CLIO code as it was developed for a project > that wanted to provide WinNT and MacOS code, and replaced the Lustre VFS > IO interface that I'd "grown up with". > >>>> +static bool weigh_cb(const struct lu_env *env, struct cl_io *io, >>>> + struct osc_page *ops, void *cbdata) >>>> { >>>> struct cl_page *page = ops->ops_cl.cpl_page; >>>> >>>> if (cl_page_is_vmlocked(env, page) || >>>> PageDirty(page->cp_vmpage) || PageWriteback(page->cp_vmpage) >>>> ) >>> >>> This is a bit oddly formatted. I see in our tree it looks like: >>> >>> if (cl_page_is_vmlocked(env, page) || PageDirty(page->cp_vmpage) || >>> PageWriteback(page->cp_vmpage)) >>> >>> which is more normal. >> >> It has only been this way in OpenSFS since July this year. > > I didn't know that when I was looking at the patch, just that the above > was looking strange with the lone closing parenthesis on the line. > >> Commit b44b1ff8c7fc ("LU-10961 ldlm: don't cancel DoM locks before replay") >> made the change without any comment. I guess we aren't up to that 2.11 >> yet :-) > > Sure, but I figured if you are changing the formatting anyway you may as > well make it consistent. If I was, I probably would. But I didn't. i.e. this patch didn't change if (cl_page_is_vmlocked(env, page) || PageDirty(page->cp_vmpage) || PageWriteback(page->cp_vmpage) ) so there is no case to be made that it should change it in a better way. This patch changes the type of value returned by a callback, and makes related changes that are a direct consequence of that. It should do nothing else. Making unrelated changes in the same patch just makes the patch harder to review. So I'll leave this code as it is for now. Thanks, NeilBrown > > Cheers, Andreas > --- > Andreas Dilger > Principal Lustre Architect > Whamcloud -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 832 bytes Desc: not available URL: From degremoa at amazon.com Wed Jan 30 14:53:12 2019 From: degremoa at amazon.com (Degremont, Aurelien) Date: Wed, 30 Jan 2019 14:53:12 +0000 Subject: [lustre-devel] Run acceptance tests on client side only Message-ID: <9E0B8A72-3AFF-4141-8E94-28AF402B0CC9@amazon.com> Hello I’m trying to run test suites without having access to servers. A lot of tests in acc-sm assume that servers are reachable. Is there way to automatically skip these tests? Does somebody has a smart way to run acc-sm? Thanks Aurélien -------------- next part -------------- An HTML attachment was scrubbed... URL: From pfarrell at whamcloud.com Wed Jan 30 19:01:50 2019 From: pfarrell at whamcloud.com (Patrick Farrell) Date: Wed, 30 Jan 2019 19:01:50 +0000 Subject: [lustre-devel] Run acceptance tests on client side only In-Reply-To: <9E0B8A72-3AFF-4141-8E94-28AF402B0CC9@amazon.com> References: <9E0B8A72-3AFF-4141-8E94-28AF402B0CC9@amazon.com> Message-ID: Aurelien, We played with this idea some when I was at Cray, and I believe we decided it wasn't worth it. Many, many tests - maybe a majority - depend on running commands on the server. Many are intentionally destructive in various ways, and since we don't test them with other data on the file system, some of them are probably *accidentally* destructive as well. My conclusion then was that the test framework tests (acceptance small included) are not designed to be run A) without server access, or B ) on any kind of production file system. It would be possible to create a curated client only & non-destructive list, but it would be a lot of work, and it would miss large areas of the test framework. (Many tests which are primarily client require some manipulation of the server (settings, cache dropping, fail loc...) to work.) - Patrick ________________________________ From: lustre-devel on behalf of Degremont, Aurelien Sent: Wednesday, January 30, 2019 8:53:12 AM To: lustre-devel at lists.lustre.org Subject: [lustre-devel] Run acceptance tests on client side only Hello I’m trying to run test suites without having access to servers. A lot of tests in acc-sm assume that servers are reachable. Is there way to automatically skip these tests? Does somebody has a smart way to run acc-sm? Thanks Aurélien -------------- next part -------------- An HTML attachment was scrubbed... URL: From lochoa at whamcloud.com Thu Jan 31 04:49:36 2019 From: lochoa at whamcloud.com (Leonel Ochoa) Date: Thu, 31 Jan 2019 04:49:36 +0000 Subject: [lustre-devel] Maloo Unscheduled Maintenance In-Reply-To: <57473651-AA57-4469-B2DD-2D07D0B2A885@ddn.com> References: <57473651-AA57-4469-B2DD-2D07D0B2A885@ddn.com> Message-ID: UPDATE: Maloo is back up…but not fully restored yet. For the time being you’ll notice the following things: 1. Test queue pages DO show accurate state of ongoing tests in Autotest 2. The main test session page is missing results from 1/19 – 1/30, these results will start getting ingested from oldest to newest, please be patient and all results will eventually show up 3. For test sessions EARLIER than 1/19, sub test and test log pages are missing and will slowly populate, also from oldest to newest, also please be patient I’ll be sending periodic updates as we fill in the missing data Lee Ochoa lochoa at whamcloud.com From: Leonel Ochoa Date: Tuesday, January 29, 2019 at 14:12 To: "lustre-devel at lists.lustre.org" Subject: Maloo Unscheduled Maintenance NOTICE TO ALL MALOO USERS The Maloo web server has been down since yesterday 1/28 due to unscheduled maintenance, at present we expect the downtime to last all of today 1/29 and possibly tomorrow 1/30 as well. Once service has been restored we’ll post a notification to this mailing list. Gerrit can still receive patches and Autotest will continue to run test sessions while Maloo remains offline, once the server is back up all pending results and gerrit +/- notifications (from Maloo) will be sent for all completed tests. Thank you for your patience. Lee Ochoa lochoa at whamcloud.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From jsimmons at infradead.org Thu Jan 31 17:19:04 2019 From: jsimmons at infradead.org (James Simmons) Date: Thu, 31 Jan 2019 12:19:04 -0500 Subject: [lustre-devel] [PATCH 00/26] lustre: cleanups with no code changes Message-ID: <1548955170-13456-1-git-send-email-jsimmons@infradead.org> To prepare for lustre to leave staging the code needs to be cleaned up to make it easier for others to examine our code. This patch series does no real code changes but does the following: 1) Replace all the UAPI types in the kernel only code. Once these patches are applied only the UAPI headers will have UAPI types. 2) The lustre code has massive amounts of white spacing. Remove the white spacing for variable declarations. Removing the white spacing in data structures and align the fields to make it easier to read. In a few patches remove access blank lines. James Simmons (26): lnet: use kernel types for lnet core kernel code lnet: use kernel types for lnet klnd kernel code lnet: use kernel types for lnet selftest kernel code ptlrpc: use kernel types for kernel code lustre: use kernel types for lustre internal headers ldlm: use kernel types for kernel code obdclass: use kernel types for kernel code lustre: convert remaining code to kernel types lustre: cleanup white spaces in fid and fld layer ldlm: cleanup white spaces llite: cleanup white spaces lmv: cleanup white spaces lov: cleanup white spaces mdc: cleanup white spaces mgc: cleanup white spaces obdclass: cleanup white spaces obdecho: cleanup white spaces osc: cleanup white spaces ptlrpc: cleanup white spaces lustre: first batch to cleanup white spaces in internal headers lustre: second batch to cleanup white spaces in internal headers lustre: last batch to cleanup white spaces in internal headers libcfs: cleanup white spaces lnet: cleanup white spaces socklnd: cleanup white spaces o2iblnd: cleanup white spaces .../lustre/include/linux/libcfs/libcfs_debug.h | 74 +- .../lustre/include/linux/libcfs/libcfs_fail.h | 8 +- .../lustre/include/linux/libcfs/libcfs_private.h | 56 +- .../lustre/include/linux/libcfs/libcfs_string.h | 10 +- drivers/staging/lustre/include/linux/lnet/api.h | 40 +- .../staging/lustre/include/linux/lnet/lib-lnet.h | 69 +- .../staging/lustre/include/linux/lnet/lib-types.h | 234 +++---- .../staging/lustre/include/linux/lnet/socklnd.h | 20 +- .../staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c | 107 +-- .../staging/lustre/lnet/klnds/o2iblnd/o2iblnd.h | 642 +++++++++--------- .../staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c | 121 ++-- .../lustre/lnet/klnds/o2iblnd/o2iblnd_modparams.c | 22 +- .../staging/lustre/lnet/klnds/socklnd/socklnd.c | 125 ++-- .../staging/lustre/lnet/klnds/socklnd/socklnd.h | 566 ++++++++-------- .../staging/lustre/lnet/klnds/socklnd/socklnd_cb.c | 56 +- .../lustre/lnet/klnds/socklnd/socklnd_lib.c | 20 +- .../lustre/lnet/klnds/socklnd/socklnd_modparams.c | 54 +- .../lustre/lnet/klnds/socklnd/socklnd_proto.c | 99 ++- drivers/staging/lustre/lnet/libcfs/debug.c | 22 +- drivers/staging/lustre/lnet/libcfs/libcfs_cpu.c | 8 +- drivers/staging/lustre/lnet/libcfs/libcfs_string.c | 4 +- .../lustre/lnet/libcfs/linux-crypto-adler.c | 2 +- drivers/staging/lustre/lnet/libcfs/linux-crypto.c | 1 - drivers/staging/lustre/lnet/libcfs/module.c | 128 ++-- drivers/staging/lustre/lnet/libcfs/tracefile.c | 5 +- drivers/staging/lustre/lnet/libcfs/tracefile.h | 12 +- drivers/staging/lustre/lnet/lnet/acceptor.c | 30 +- drivers/staging/lustre/lnet/lnet/api-ni.c | 115 ++-- drivers/staging/lustre/lnet/lnet/config.c | 86 ++- drivers/staging/lustre/lnet/lnet/lib-eq.c | 2 +- drivers/staging/lustre/lnet/lnet/lib-me.c | 4 +- drivers/staging/lustre/lnet/lnet/lib-move.c | 112 ++-- drivers/staging/lustre/lnet/lnet/lib-msg.c | 72 +- drivers/staging/lustre/lnet/lnet/lib-ptl.c | 36 +- drivers/staging/lustre/lnet/lnet/lib-socket.c | 21 +- drivers/staging/lustre/lnet/lnet/module.c | 3 +- drivers/staging/lustre/lnet/lnet/net_fault.c | 1 - drivers/staging/lustre/lnet/lnet/nidstrings.c | 126 ++-- drivers/staging/lustre/lnet/lnet/peer.c | 57 +- drivers/staging/lustre/lnet/lnet/router.c | 42 +- drivers/staging/lustre/lnet/lnet/router_proc.c | 65 +- drivers/staging/lustre/lnet/selftest/brw_test.c | 20 +- drivers/staging/lustre/lnet/selftest/console.h | 2 +- drivers/staging/lustre/lnet/selftest/rpc.c | 22 +- drivers/staging/lustre/lnet/selftest/rpc.h | 132 ++-- drivers/staging/lustre/lustre/fid/fid_lib.c | 2 +- drivers/staging/lustre/lustre/fid/fid_request.c | 12 +- drivers/staging/lustre/lustre/fid/lproc_fid.c | 4 +- drivers/staging/lustre/lustre/fld/fld_cache.c | 18 +- drivers/staging/lustre/lustre/fld/fld_internal.h | 36 +- drivers/staging/lustre/lustre/fld/fld_request.c | 14 +- drivers/staging/lustre/lustre/include/cl_object.h | 340 +++++----- .../staging/lustre/lustre/include/lprocfs_status.h | 95 +-- drivers/staging/lustre/lustre/include/lu_object.h | 354 +++++----- .../staging/lustre/lustre/include/lustre_debug.h | 4 +- .../staging/lustre/lustre/include/lustre_disk.h | 48 +- drivers/staging/lustre/lustre/include/lustre_dlm.h | 298 ++++----- .../lustre/lustre/include/lustre_dlm_flags.h | 326 ++++----- .../staging/lustre/lustre/include/lustre_export.h | 82 +-- drivers/staging/lustre/lustre/include/lustre_fid.h | 44 +- drivers/staging/lustre/lustre/include/lustre_fld.h | 18 +- drivers/staging/lustre/lustre/include/lustre_ha.h | 2 +- .../staging/lustre/lustre/include/lustre_handles.h | 6 +- .../staging/lustre/lustre/include/lustre_import.h | 225 +++---- .../staging/lustre/lustre/include/lustre_intent.h | 24 +- drivers/staging/lustre/lustre/include/lustre_lib.h | 2 - drivers/staging/lustre/lustre/include/lustre_lmv.h | 26 +- drivers/staging/lustre/lustre/include/lustre_log.h | 44 +- drivers/staging/lustre/lustre/include/lustre_mdc.h | 4 +- drivers/staging/lustre/lustre/include/lustre_mds.h | 4 +- drivers/staging/lustre/lustre/include/lustre_net.h | 502 +++++++------- .../lustre/lustre/include/lustre_nrs_fifo.h | 6 +- .../lustre/lustre/include/lustre_req_layout.h | 10 +- drivers/staging/lustre/lustre/include/lustre_sec.h | 338 +++++----- .../staging/lustre/lustre/include/lustre_swab.h | 6 +- drivers/staging/lustre/lustre/include/obd.h | 539 +++++++-------- drivers/staging/lustre/lustre/include/obd_cksum.h | 4 +- drivers/staging/lustre/lustre/include/obd_class.h | 110 +-- .../staging/lustre/lustre/include/obd_support.h | 744 ++++++++++----------- drivers/staging/lustre/lustre/include/seq_range.h | 2 +- drivers/staging/lustre/lustre/ldlm/ldlm_extent.c | 8 +- drivers/staging/lustre/lustre/ldlm/ldlm_flock.c | 6 +- drivers/staging/lustre/lustre/ldlm/ldlm_internal.h | 12 +- drivers/staging/lustre/lustre/ldlm/ldlm_lib.c | 22 +- drivers/staging/lustre/lustre/ldlm/ldlm_lock.c | 50 +- drivers/staging/lustre/lustre/ldlm/ldlm_lockd.c | 28 +- drivers/staging/lustre/lustre/ldlm/ldlm_pool.c | 27 +- drivers/staging/lustre/lustre/ldlm/ldlm_request.c | 60 +- drivers/staging/lustre/lustre/ldlm/ldlm_resource.c | 90 +-- drivers/staging/lustre/lustre/llite/dir.c | 132 ++-- drivers/staging/lustre/lustre/llite/file.c | 220 +++--- drivers/staging/lustre/lustre/llite/glimpse.c | 18 +- drivers/staging/lustre/lustre/llite/lcommon_cl.c | 24 +- drivers/staging/lustre/lustre/llite/lcommon_misc.c | 4 +- .../staging/lustre/lustre/llite/llite_internal.h | 74 +- drivers/staging/lustre/lustre/llite/llite_lib.c | 64 +- drivers/staging/lustre/lustre/llite/llite_mmap.c | 54 +- drivers/staging/lustre/lustre/llite/llite_nfs.c | 54 +- drivers/staging/lustre/lustre/llite/lproc_llite.c | 82 +-- drivers/staging/lustre/lustre/llite/namei.c | 65 +- drivers/staging/lustre/lustre/llite/range_lock.c | 4 +- drivers/staging/lustre/lustre/llite/range_lock.h | 10 +- drivers/staging/lustre/lustre/llite/rw.c | 12 +- drivers/staging/lustre/lustre/llite/rw26.c | 57 +- drivers/staging/lustre/lustre/llite/statahead.c | 149 +++-- drivers/staging/lustre/lustre/llite/super25.c | 16 +- drivers/staging/lustre/lustre/llite/vvp_dev.c | 104 +-- drivers/staging/lustre/lustre/llite/vvp_internal.h | 58 +- drivers/staging/lustre/lustre/llite/vvp_io.c | 181 +++-- drivers/staging/lustre/lustre/llite/vvp_object.c | 30 +- drivers/staging/lustre/lustre/llite/vvp_page.c | 88 +-- drivers/staging/lustre/lustre/llite/xattr.c | 48 +- drivers/staging/lustre/lustre/llite/xattr_cache.c | 6 +- drivers/staging/lustre/lustre/lmv/lmv_intent.c | 46 +- drivers/staging/lustre/lustre/lmv/lmv_internal.h | 2 +- drivers/staging/lustre/lustre/lmv/lmv_obd.c | 382 +++++------ drivers/staging/lustre/lustre/lmv/lproc_lmv.c | 24 +- .../staging/lustre/lustre/lov/lov_cl_internal.h | 50 +- drivers/staging/lustre/lustre/lov/lov_dev.c | 72 +- drivers/staging/lustre/lustre/lov/lov_internal.h | 76 +-- drivers/staging/lustre/lustre/lov/lov_io.c | 136 ++-- drivers/staging/lustre/lustre/lov/lov_lock.c | 34 +- drivers/staging/lustre/lustre/lov/lov_merge.c | 8 +- drivers/staging/lustre/lustre/lov/lov_obd.c | 63 +- drivers/staging/lustre/lustre/lov/lov_object.c | 154 ++--- drivers/staging/lustre/lustre/lov/lov_offset.c | 6 +- drivers/staging/lustre/lustre/lov/lov_pack.c | 6 +- drivers/staging/lustre/lustre/lov/lov_page.c | 18 +- drivers/staging/lustre/lustre/lov/lov_pool.c | 24 +- drivers/staging/lustre/lustre/lov/lov_request.c | 16 +- drivers/staging/lustre/lustre/lov/lovsub_dev.c | 32 +- drivers/staging/lustre/lustre/lov/lovsub_lock.c | 4 +- drivers/staging/lustre/lustre/lov/lovsub_object.c | 29 +- drivers/staging/lustre/lustre/lov/lovsub_page.c | 2 +- drivers/staging/lustre/lustre/lov/lproc_lov.c | 18 +- drivers/staging/lustre/lustre/mdc/mdc_internal.h | 24 +- drivers/staging/lustre/lustre/mdc/mdc_lib.c | 146 ++-- drivers/staging/lustre/lustre/mdc/mdc_locks.c | 96 +-- drivers/staging/lustre/lustre/mdc/mdc_reint.c | 8 +- drivers/staging/lustre/lustre/mdc/mdc_request.c | 266 ++++---- drivers/staging/lustre/lustre/mgc/mgc_request.c | 101 +-- .../staging/lustre/lustre/obdclass/cl_internal.h | 2 +- drivers/staging/lustre/lustre/obdclass/cl_io.c | 30 +- drivers/staging/lustre/lustre/obdclass/cl_lock.c | 4 +- drivers/staging/lustre/lustre/obdclass/cl_object.c | 42 +- drivers/staging/lustre/lustre/obdclass/cl_page.c | 62 +- drivers/staging/lustre/lustre/obdclass/class_obd.c | 20 +- drivers/staging/lustre/lustre/obdclass/debug.c | 16 +- drivers/staging/lustre/lustre/obdclass/genops.c | 26 +- .../staging/lustre/lustre/obdclass/kernelcomm.c | 8 +- drivers/staging/lustre/lustre/obdclass/linkea.c | 6 +- drivers/staging/lustre/lustre/obdclass/llog.c | 40 +- drivers/staging/lustre/lustre/obdclass/llog_cat.c | 6 +- .../staging/lustre/lustre/obdclass/llog_internal.h | 24 +- drivers/staging/lustre/lustre/obdclass/llog_swab.c | 18 +- .../lustre/lustre/obdclass/lprocfs_counters.c | 18 +- .../lustre/lustre/obdclass/lprocfs_status.c | 184 ++--- drivers/staging/lustre/lustre/obdclass/lu_object.c | 120 ++-- .../lustre/lustre/obdclass/lustre_handles.c | 6 +- .../staging/lustre/lustre/obdclass/lustre_peer.c | 12 +- .../staging/lustre/lustre/obdclass/obd_config.c | 39 +- drivers/staging/lustre/lustre/obdclass/obd_mount.c | 23 +- .../staging/lustre/lustre/obdecho/echo_client.c | 284 ++++---- .../staging/lustre/lustre/obdecho/echo_internal.h | 4 +- drivers/staging/lustre/lustre/osc/lproc_osc.c | 8 +- drivers/staging/lustre/lustre/osc/osc_cache.c | 71 +- .../staging/lustre/lustre/osc/osc_cl_internal.h | 6 +- drivers/staging/lustre/lustre/osc/osc_dev.c | 42 +- drivers/staging/lustre/lustre/osc/osc_internal.h | 6 +- drivers/staging/lustre/lustre/osc/osc_io.c | 42 +- drivers/staging/lustre/lustre/osc/osc_lock.c | 42 +- drivers/staging/lustre/lustre/osc/osc_object.c | 30 +- drivers/staging/lustre/lustre/osc/osc_page.c | 8 +- drivers/staging/lustre/lustre/osc/osc_request.c | 48 +- drivers/staging/lustre/lustre/ptlrpc/client.c | 77 +-- drivers/staging/lustre/lustre/ptlrpc/events.c | 10 +- drivers/staging/lustre/lustre/ptlrpc/import.c | 14 +- drivers/staging/lustre/lustre/ptlrpc/layout.c | 21 +- drivers/staging/lustre/lustre/ptlrpc/llog_client.c | 2 +- .../staging/lustre/lustre/ptlrpc/lproc_ptlrpc.c | 304 ++++----- drivers/staging/lustre/lustre/ptlrpc/niobuf.c | 11 +- drivers/staging/lustre/lustre/ptlrpc/nrs.c | 1 - .../staging/lustre/lustre/ptlrpc/pack_generic.c | 112 ++-- .../staging/lustre/lustre/ptlrpc/ptlrpc_internal.h | 18 +- drivers/staging/lustre/lustre/ptlrpc/ptlrpcd.c | 22 +- drivers/staging/lustre/lustre/ptlrpc/recover.c | 3 +- drivers/staging/lustre/lustre/ptlrpc/sec.c | 22 +- drivers/staging/lustre/lustre/ptlrpc/sec_bulk.c | 80 +-- drivers/staging/lustre/lustre/ptlrpc/sec_config.c | 22 +- drivers/staging/lustre/lustre/ptlrpc/sec_null.c | 40 +- drivers/staging/lustre/lustre/ptlrpc/sec_plain.c | 94 +-- drivers/staging/lustre/lustre/ptlrpc/service.c | 36 +- 192 files changed, 6805 insertions(+), 6827 deletions(-) -- 1.8.3.1 From jsimmons at infradead.org Thu Jan 31 17:19:05 2019 From: jsimmons at infradead.org (James Simmons) Date: Thu, 31 Jan 2019 12:19:05 -0500 Subject: [lustre-devel] [PATCH 01/26] lnet: use kernel types for lnet core kernel code In-Reply-To: <1548955170-13456-1-git-send-email-jsimmons@infradead.org> References: <1548955170-13456-1-git-send-email-jsimmons@infradead.org> Message-ID: <1548955170-13456-2-git-send-email-jsimmons@infradead.org> LNet stack was originally both a user land and kernel implementation. The source contains many types of the form __u32 but since this is mostly kernel code change the types to kernel internal types. Signed-off-by: James Simmons --- drivers/staging/lustre/include/linux/lnet/api.h | 16 ++-- .../staging/lustre/include/linux/lnet/lib-lnet.h | 66 ++++++++-------- .../staging/lustre/include/linux/lnet/lib-types.h | 50 ++++++------ .../staging/lustre/include/linux/lnet/socklnd.h | 20 ++--- drivers/staging/lustre/lnet/lnet/acceptor.c | 14 ++-- drivers/staging/lustre/lnet/lnet/api-ni.c | 26 +++---- drivers/staging/lustre/lnet/lnet/config.c | 48 ++++++------ drivers/staging/lustre/lnet/lnet/lib-me.c | 4 +- drivers/staging/lustre/lnet/lnet/lib-move.c | 28 +++---- drivers/staging/lustre/lnet/lnet/lib-ptl.c | 14 ++-- drivers/staging/lustre/lnet/lnet/lib-socket.c | 10 +-- drivers/staging/lustre/lnet/lnet/nidstrings.c | 88 +++++++++++----------- drivers/staging/lustre/lnet/lnet/peer.c | 20 ++--- drivers/staging/lustre/lnet/lnet/router.c | 16 ++-- drivers/staging/lustre/lnet/lnet/router_proc.c | 4 +- 15 files changed, 212 insertions(+), 212 deletions(-) diff --git a/drivers/staging/lustre/include/linux/lnet/api.h b/drivers/staging/lustre/include/linux/lnet/api.h index 70c9919..7c30475 100644 --- a/drivers/staging/lustre/include/linux/lnet/api.h +++ b/drivers/staging/lustre/include/linux/lnet/api.h @@ -76,7 +76,7 @@ * @{ */ int LNetGetId(unsigned int index, struct lnet_process_id *id); -int LNetDist(lnet_nid_t nid, lnet_nid_t *srcnid, __u32 *order); +int LNetDist(lnet_nid_t nid, lnet_nid_t *srcnid, u32 *order); lnet_nid_t LNetPrimaryNID(lnet_nid_t nid); /** @} lnet_addr */ @@ -96,16 +96,16 @@ */ int LNetMEAttach(unsigned int portal, struct lnet_process_id match_id_in, - __u64 match_bits_in, - __u64 ignore_bits_in, + u64 match_bits_in, + u64 ignore_bits_in, enum lnet_unlink unlink_in, enum lnet_ins_pos pos_in, struct lnet_handle_me *handle_out); int LNetMEInsert(struct lnet_handle_me current_in, struct lnet_process_id match_id_in, - __u64 match_bits_in, - __u64 ignore_bits_in, + u64 match_bits_in, + u64 ignore_bits_in, enum lnet_unlink unlink_in, enum lnet_ins_pos position_in, struct lnet_handle_me *handle_out); @@ -186,15 +186,15 @@ int LNetPut(lnet_nid_t self, enum lnet_ack_req ack_req_in, struct lnet_process_id target_in, unsigned int portal_in, - __u64 match_bits_in, + u64 match_bits_in, unsigned int offset_in, - __u64 hdr_data_in); + u64 hdr_data_in); int LNetGet(lnet_nid_t self, struct lnet_handle_md md_in, struct lnet_process_id target_in, unsigned int portal_in, - __u64 match_bits_in, + u64 match_bits_in, unsigned int offset_in); /** @} lnet_data */ diff --git a/drivers/staging/lustre/include/linux/lnet/lib-lnet.h b/drivers/staging/lustre/include/linux/lnet/lib-lnet.h index fcfd844..5c3f5e3 100644 --- a/drivers/staging/lustre/include/linux/lnet/lib-lnet.h +++ b/drivers/staging/lustre/include/linux/lnet/lib-lnet.h @@ -127,7 +127,7 @@ static inline int lnet_md_unlinkable(struct lnet_libmd *md) #define lnet_cpt_current() cfs_cpt_current(the_lnet.ln_cpt_table, 1) static inline int -lnet_cpt_of_cookie(__u64 cookie) +lnet_cpt_of_cookie(u64 cookie) { unsigned int cpt = (cookie >> LNET_COOKIE_TYPE_BITS) & LNET_CPT_MASK; @@ -217,7 +217,7 @@ static inline int lnet_md_unlinkable(struct lnet_libmd *md) } struct lnet_libhandle *lnet_res_lh_lookup(struct lnet_res_container *rec, - __u64 cookie); + u64 cookie); void lnet_res_lh_initialize(struct lnet_res_container *rec, struct lnet_libhandle *lh); static inline void @@ -404,13 +404,13 @@ void lnet_res_lh_initialize(struct lnet_res_container *rec, void lnet_net_free(struct lnet_net *net); struct lnet_net * -lnet_net_alloc(__u32 net_type, struct list_head *netlist); +lnet_net_alloc(u32 net_type, struct list_head *netlist); struct lnet_ni * lnet_ni_alloc(struct lnet_net *net, struct cfs_expr_list *el, char *iface); struct lnet_ni * -lnet_ni_alloc_w_cpt_array(struct lnet_net *net, __u32 *cpts, __u32 ncpts, +lnet_ni_alloc_w_cpt_array(struct lnet_net *net, u32 *cpts, u32 ncpts, char *iface); static inline int @@ -420,7 +420,7 @@ struct lnet_ni * } static inline struct list_head * -lnet_net2rnethash(__u32 net) +lnet_net2rnethash(u32 net) { return &the_lnet.ln_remote_nets_hash[(LNET_NETNUM(net) + LNET_NETTYP(net)) & @@ -435,8 +435,8 @@ struct lnet_ni * int lnet_cpt_of_nid(lnet_nid_t nid, struct lnet_ni *ni); struct lnet_ni *lnet_nid2ni_locked(lnet_nid_t nid, int cpt); struct lnet_ni *lnet_nid2ni_addref(lnet_nid_t nid); -struct lnet_ni *lnet_net2ni_locked(__u32 net, int cpt); -struct lnet_ni *lnet_net2ni_addref(__u32 net); +struct lnet_ni *lnet_net2ni_locked(u32 net, int cpt); +struct lnet_ni *lnet_net2ni_addref(u32 net); bool lnet_is_ni_healthy_locked(struct lnet_ni *ni); struct lnet_net *lnet_get_net_locked(u32 net_id); @@ -451,18 +451,18 @@ int lnet_notify(struct lnet_ni *ni, lnet_nid_t peer, int alive, time64_t when); void lnet_notify_locked(struct lnet_peer_ni *lp, int notifylnd, int alive, time64_t when); -int lnet_add_route(__u32 net, __u32 hops, lnet_nid_t gateway_nid, +int lnet_add_route(u32 net, u32 hops, lnet_nid_t gateway_nid, unsigned int priority); int lnet_check_routes(void); -int lnet_del_route(__u32 net, lnet_nid_t gw_nid); +int lnet_del_route(u32 net, lnet_nid_t gw_nid); void lnet_destroy_routes(void); -int lnet_get_route(int idx, __u32 *net, __u32 *hops, - lnet_nid_t *gateway, __u32 *alive, __u32 *priority); +int lnet_get_route(int idx, u32 *net, u32 *hops, + lnet_nid_t *gateway, u32 *alive, u32 *priority); int lnet_get_rtr_pool_cfg(int idx, struct lnet_ioctl_pool_cfg *pool_cfg); struct lnet_ni *lnet_get_next_ni_locked(struct lnet_net *mynet, struct lnet_ni *prev); struct lnet_ni *lnet_get_ni_idx_locked(int idx); -int lnet_get_peer_list(__u32 *countp, __u32 *sizep, +int lnet_get_peer_list(u32 *countp, u32 *sizep, struct lnet_process_id __user *ids); void lnet_router_debugfs_init(void); @@ -473,16 +473,16 @@ int lnet_get_peer_list(__u32 *countp, __u32 *sizep, int lnet_rtrpools_enable(void); void lnet_rtrpools_disable(void); void lnet_rtrpools_free(int keep_pools); -struct lnet_remotenet *lnet_find_rnet_locked(__u32 net); +struct lnet_remotenet *lnet_find_rnet_locked(u32 net); int lnet_dyn_add_net(struct lnet_ioctl_config_data *conf); -int lnet_dyn_del_net(__u32 net); +int lnet_dyn_del_net(u32 net); int lnet_dyn_add_ni(struct lnet_ioctl_config_ni *conf); int lnet_dyn_del_ni(struct lnet_ioctl_config_ni *conf); int lnet_clear_lazy_portal(struct lnet_ni *ni, int portal, char *reason); -struct lnet_net *lnet_get_net_locked(__u32 net_id); +struct lnet_net *lnet_get_net_locked(u32 net_id); int lnet_islocalnid(lnet_nid_t nid); -int lnet_islocalnet(__u32 net); +int lnet_islocalnet(u32 net); void lnet_msg_attach_md(struct lnet_msg *msg, struct lnet_libmd *md, unsigned int offset, unsigned int mlen); @@ -536,10 +536,10 @@ void lnet_prep_send(struct lnet_msg *msg, int type, /* match-table functions */ struct list_head *lnet_mt_match_head(struct lnet_match_table *mtable, - struct lnet_process_id id, __u64 mbits); + struct lnet_process_id id, u64 mbits); struct lnet_match_table *lnet_mt_of_attach(unsigned int index, struct lnet_process_id id, - __u64 mbits, __u64 ignore_bits, + u64 mbits, u64 ignore_bits, enum lnet_ins_pos pos); int lnet_mt_match_md(struct lnet_match_table *mtable, struct lnet_match_info *info, struct lnet_msg *msg); @@ -575,7 +575,7 @@ void lnet_set_reply_msg_len(struct lnet_ni *ni, struct lnet_msg *msg, void lnet_finalize(struct lnet_msg *msg, int rc); void lnet_drop_message(struct lnet_ni *ni, int cpt, void *private, - unsigned int nob, __u32 msg_type); + unsigned int nob, u32 msg_type); void lnet_drop_delayed_msg_list(struct list_head *head, char *reason); void lnet_recv_delayed_msg_list(struct list_head *head); @@ -637,9 +637,9 @@ void lnet_copy_kiov2iter(struct iov_iter *to, void lnet_unregister_lnd(struct lnet_lnd *lnd); int lnet_connect(struct socket **sockp, lnet_nid_t peer_nid, - __u32 local_ip, __u32 peer_ip, int peer_port); + u32 local_ip, u32 peer_ip, int peer_port); void lnet_connect_console_error(int rc, lnet_nid_t peer_nid, - __u32 peer_ip, int port); + u32 peer_ip, int port); int lnet_count_acceptor_nets(void); int lnet_acceptor_timeout(void); int lnet_acceptor_port(void); @@ -652,15 +652,15 @@ void lnet_connect_console_error(int rc, lnet_nid_t peer_nid, int lnet_sock_setbuf(struct socket *socket, int txbufsize, int rxbufsize); int lnet_sock_getbuf(struct socket *socket, int *txbufsize, int *rxbufsize); -int lnet_sock_getaddr(struct socket *socket, bool remote, __u32 *ip, int *port); +int lnet_sock_getaddr(struct socket *socket, bool remote, u32 *ip, int *port); int lnet_sock_write(struct socket *sock, void *buffer, int nob, int timeout); int lnet_sock_read(struct socket *sock, void *buffer, int nob, int timeout); -int lnet_sock_listen(struct socket **sockp, __u32 ip, int port, int backlog); +int lnet_sock_listen(struct socket **sockp, u32 ip, int port, int backlog); int lnet_sock_accept(struct socket **newsockp, struct socket *sock); int lnet_sock_connect(struct socket **sockp, int *fatal, - __u32 local_ip, int local_port, - __u32 peer_ip, int peer_port); + u32 local_ip, int local_port, + u32 peer_ip, int peer_port); void libcfs_sock_release(struct socket *sock); int lnet_peers_start_down(void); @@ -668,7 +668,7 @@ int lnet_sock_connect(struct socket **sockp, int *fatal, int lnet_router_checker_start(void); void lnet_router_checker_stop(void); -void lnet_router_ni_update_locked(struct lnet_peer_ni *gw, __u32 net); +void lnet_router_ni_update_locked(struct lnet_peer_ni *gw, u32 net); void lnet_swap_pinginfo(struct lnet_ping_buffer *pbuf); int lnet_ping_info_validate(struct lnet_ping_info *pinfo); @@ -703,7 +703,7 @@ static inline int lnet_push_target_resize_needed(void) int lnet_parse_routes(char *route_str, int *im_a_router); int lnet_parse_networks(struct list_head *nilist, char *networks, bool use_tcp_bonding); -bool lnet_net_unique(__u32 net_id, struct list_head *nilist, +bool lnet_net_unique(u32 net_id, struct list_head *nilist, struct lnet_net **net); bool lnet_ni_unique_net(struct list_head *nilist, char *iface); void lnet_incr_dlc_seq(void); @@ -734,12 +734,12 @@ struct lnet_peer_net *lnet_peer_get_net_locked(struct lnet_peer *peer, int lnet_add_peer_ni(lnet_nid_t key_nid, lnet_nid_t nid, bool mr); int lnet_del_peer_ni(lnet_nid_t key_nid, lnet_nid_t nid); int lnet_get_peer_info(struct lnet_ioctl_peer_cfg *cfg, void __user *bulk); -int lnet_get_peer_ni_info(__u32 peer_index, __u64 *nid, +int lnet_get_peer_ni_info(u32 peer_index, u64 *nid, char alivness[LNET_MAX_STR_LEN], - __u32 *cpt_iter, __u32 *refcount, - __u32 *ni_peer_tx_credits, __u32 *peer_tx_credits, - __u32 *peer_rtr_credits, __u32 *peer_min_rtr_credtis, - __u32 *peer_tx_qnob); + u32 *cpt_iter, u32 *refcount, + u32 *ni_peer_tx_credits, u32 *peer_tx_credits, + u32 *peer_rtr_credits, u32 *peer_min_rtr_credtis, + u32 *peer_tx_qnob); static inline bool lnet_is_peer_ni_healthy_locked(struct lnet_peer_ni *lpni) @@ -827,7 +827,7 @@ void lnet_incr_stats(struct lnet_element_stats *stats, enum lnet_msg_type msg_type, enum lnet_stats_type stats_type); -__u32 lnet_sum_stats(struct lnet_element_stats *stats, +u32 lnet_sum_stats(struct lnet_element_stats *stats, enum lnet_stats_type stats_type); void lnet_usr_translate_stats(struct lnet_ioctl_element_msg_stats *msg_stats, diff --git a/drivers/staging/lustre/include/linux/lnet/lib-types.h b/drivers/staging/lustre/include/linux/lnet/lib-types.h index 3a54e06..0646f07 100644 --- a/drivers/staging/lustre/include/linux/lnet/lib-types.h +++ b/drivers/staging/lustre/include/linux/lnet/lib-types.h @@ -64,7 +64,7 @@ struct lnet_msg { lnet_nid_t msg_initiator; /* where is it from, it's only for building event */ lnet_nid_t msg_from; - __u32 msg_type; + u32 msg_type; /* * hold parameters in case message is with held due @@ -123,7 +123,7 @@ struct lnet_msg { struct lnet_libhandle { struct list_head lh_hash_chain; - __u64 lh_cookie; + u64 lh_cookie; }; #define lh_entry(ptr, type, member) \ @@ -146,8 +146,8 @@ struct lnet_me { struct lnet_process_id me_match_id; unsigned int me_portal; unsigned int me_pos; /* hash offset in mt_hash */ - __u64 me_match_bits; - __u64 me_ignore_bits; + u64 me_match_bits; + u64 me_ignore_bits; enum lnet_unlink me_unlink; struct lnet_libmd *me_md; }; @@ -199,7 +199,7 @@ struct lnet_lnd { int lnd_refcount; /* # active instances */ /* fields initialised by the LND */ - __u32 lnd_type; + u32 lnd_type; int (*lnd_startup)(struct lnet_ni *ni); void (*lnd_shutdown)(struct lnet_ni *ni); @@ -306,13 +306,13 @@ struct lnet_net { * (net_type << 16) | net_num. * net_type can be one of the enumerated types defined in * lnet/include/lnet/nidstr.h */ - __u32 net_id; + u32 net_id; /* total number of CPTs in the array */ - __u32 net_ncpts; + u32 net_ncpts; /* cumulative CPTs of all NIs in this net */ - __u32 *net_cpts; + u32 *net_cpts; /* network tunables */ struct lnet_ioctl_config_lnd_cmn_tunables net_tunables; @@ -343,7 +343,7 @@ struct lnet_ni { int ni_ncpts; /* bond NI on some CPTs */ - __u32 *ni_cpts; + u32 *ni_cpts; /* interface's NID */ lnet_nid_t ni_nid; @@ -497,7 +497,7 @@ struct lnet_peer_ni { /* sequence number used to round robin over peer nis within a net */ u32 lpni_seq; /* sequence number used to round robin over gateways */ - __u32 lpni_gw_seq; + u32 lpni_gw_seq; /* health flag */ bool lpni_healthy; /* returned RC ping features. Protected with lpni_lock */ @@ -559,13 +559,13 @@ struct lnet_peer { int lp_data_nnis; /* NI config sequence number of peer */ - __u32 lp_peer_seqno; + u32 lp_peer_seqno; /* Local NI config sequence number acked by peer */ - __u32 lp_node_seqno; + u32 lp_node_seqno; /* Local NI config sequence number sent to peer */ - __u32 lp_node_seqno_sent; + u32 lp_node_seqno_sent; /* Ping error encountered during discovery. */ int lp_ping_error; @@ -645,7 +645,7 @@ struct lnet_peer_net { struct lnet_peer *lpn_peer; /* Net ID */ - __u32 lpn_net_id; + u32 lpn_net_id; /* reference count */ atomic_t lpn_refcount; @@ -706,13 +706,13 @@ struct lnet_route { /* router node */ struct lnet_peer_ni *lr_gateway; /* remote network number */ - __u32 lr_net; + u32 lr_net; /* sequence for round-robin */ int lr_seq; /* number of down NIs */ unsigned int lr_downis; /* how far I am */ - __u32 lr_hops; + u32 lr_hops; /* route priority */ unsigned int lr_priority; }; @@ -727,7 +727,7 @@ struct lnet_remotenet { /* routes to me */ struct list_head lrn_routes; /* my net number */ - __u32 lrn_net; + u32 lrn_net; }; /** lnet message has credit and can be submitted to lnd for send/receive */ @@ -788,7 +788,7 @@ enum lnet_match_flags { /* parameter for matching operations (GET, PUT) */ struct lnet_match_info { - __u64 mi_mbits; + u64 mi_mbits; struct lnet_process_id mi_id; unsigned int mi_cpt; unsigned int mi_opc; @@ -807,8 +807,8 @@ struct lnet_match_info { */ #define LNET_MT_HASH_IGNORE LNET_MT_HASH_SIZE /* - * __u64 has 2^6 bits, so need 2^(LNET_MT_HASH_BITS - LNET_MT_BITS_U64) which - * is 4 __u64s as bit-map, and add an extra __u64 (only use one bit) for the + * u64 has 2^6 bits, so need 2^(LNET_MT_HASH_BITS - LNET_MT_BITS_U64) which + * is 4 u64s as bit-map, and add an extra u64 (only use one bit) for the * ME-list with ignore-bits, which is mtable::mt_hash[LNET_MT_HASH_IGNORE] */ #define LNET_MT_BITS_U64 6 /* 2^6 bits */ @@ -826,7 +826,7 @@ struct lnet_match_table { */ unsigned int mt_enabled; /* bitmap to flag whether MEs on mt_hash are exhausted or not */ - __u64 mt_exhausted[LNET_MT_EXHAUSTED_BMAP]; + u64 mt_exhausted[LNET_MT_EXHAUSTED_BMAP]; struct list_head *mt_mhash; /* matching hash */ }; @@ -866,7 +866,7 @@ struct lnet_portal { /* resource container (ME, MD, EQ) */ struct lnet_res_container { unsigned int rec_type; /* container type */ - __u64 rec_lh_cookie; /* cookie generator */ + u64 rec_lh_cookie; /* cookie generator */ struct list_head rec_active; /* active resource list */ struct list_head *rec_lh_hash; /* handle hash */ }; @@ -949,11 +949,11 @@ struct lnet { /* remote networks with routes to them */ struct list_head *ln_remote_nets_hash; /* validity stamp */ - __u64 ln_remote_nets_version; + u64 ln_remote_nets_version; /* list of all known routers */ struct list_head ln_routers; /* validity stamp */ - __u64 ln_routers_version; + u64 ln_routers_version; /* percpt router buffer pools */ struct lnet_rtrbufpool **ln_rtrpools; @@ -1019,7 +1019,7 @@ struct lnet { int ln_routing; /* am I a router? */ lnet_pid_t ln_pid; /* requested pid */ /* uniquely identifies this ni in this epoch */ - __u64 ln_interface_cookie; + u64 ln_interface_cookie; /* registered LNDs */ struct list_head ln_lnds; diff --git a/drivers/staging/lustre/include/linux/lnet/socklnd.h b/drivers/staging/lustre/include/linux/lnet/socklnd.h index 9f69257..20fa221d 100644 --- a/drivers/staging/lustre/include/linux/lnet/socklnd.h +++ b/drivers/staging/lustre/include/linux/lnet/socklnd.h @@ -39,17 +39,17 @@ #include struct ksock_hello_msg { - __u32 kshm_magic; /* magic number of socklnd message */ - __u32 kshm_version; /* version of socklnd message */ + u32 kshm_magic; /* magic number of socklnd message */ + u32 kshm_version; /* version of socklnd message */ lnet_nid_t kshm_src_nid; /* sender's nid */ lnet_nid_t kshm_dst_nid; /* destination nid */ lnet_pid_t kshm_src_pid; /* sender's pid */ lnet_pid_t kshm_dst_pid; /* destination pid */ - __u64 kshm_src_incarnation; /* sender's incarnation */ - __u64 kshm_dst_incarnation; /* destination's incarnation */ - __u32 kshm_ctype; /* connection type */ - __u32 kshm_nips; /* # IP addrs */ - __u32 kshm_ips[0]; /* IP addrs */ + u64 kshm_src_incarnation; /* sender's incarnation */ + u64 kshm_dst_incarnation; /* destination's incarnation */ + u32 kshm_ctype; /* connection type */ + u32 kshm_nips; /* # IP addrs */ + u32 kshm_ips[0]; /* IP addrs */ } __packed; struct ksock_lnet_msg { @@ -64,9 +64,9 @@ struct ksock_lnet_msg { } __packed; struct ksock_msg { - __u32 ksm_type; /* type of socklnd message */ - __u32 ksm_csum; /* checksum if != 0 */ - __u64 ksm_zc_cookies[2]; /* Zero-Copy request/ACK cookie */ + u32 ksm_type; /* type of socklnd message */ + u32 ksm_csum; /* checksum if != 0 */ + u64 ksm_zc_cookies[2]; /* Zero-Copy request/ACK cookie */ union { struct ksock_lnet_msg lnetmsg; /* lnet message, it's empty if * it's NOOP diff --git a/drivers/staging/lustre/lnet/lnet/acceptor.c b/drivers/staging/lustre/lnet/lnet/acceptor.c index 150fcd6..aa28a9f 100644 --- a/drivers/staging/lustre/lnet/lnet/acceptor.c +++ b/drivers/staging/lustre/lnet/lnet/acceptor.c @@ -56,7 +56,7 @@ EXPORT_SYMBOL(lnet_acceptor_port); static inline int -lnet_accept_magic(__u32 magic, __u32 constant) +lnet_accept_magic(u32 magic, u32 constant) { return (magic == constant || magic == __swab32(constant)); @@ -96,7 +96,7 @@ void lnet_connect_console_error(int rc, lnet_nid_t peer_nid, - __u32 peer_ip, int peer_port) + u32 peer_ip, int peer_port) { switch (rc) { /* "normal" errors */ @@ -142,7 +142,7 @@ int lnet_connect(struct socket **sockp, lnet_nid_t peer_nid, - __u32 local_ip, __u32 peer_ip, int peer_port) + u32 local_ip, u32 peer_ip, int peer_port) { struct lnet_acceptor_connreq cr; struct socket *sock; @@ -205,10 +205,10 @@ EXPORT_SYMBOL(lnet_connect); static int -lnet_accept(struct socket *sock, __u32 magic) +lnet_accept(struct socket *sock, u32 magic) { struct lnet_acceptor_connreq cr; - __u32 peer_ip; + u32 peer_ip; int peer_port; int rc; int flip; @@ -328,8 +328,8 @@ { struct socket *newsock; int rc; - __u32 magic; - __u32 peer_ip; + u32 magic; + u32 peer_ip; int peer_port; int secure = (int)((long)arg); diff --git a/drivers/staging/lustre/lnet/lnet/api-ni.c b/drivers/staging/lustre/lnet/lnet/api-ni.c index 6d52824..be77e10 100644 --- a/drivers/staging/lustre/lnet/lnet/api-ni.c +++ b/drivers/staging/lustre/lnet/lnet/api-ni.c @@ -104,7 +104,7 @@ struct lnet the_lnet = { static int lnet_ping(struct lnet_process_id id, signed long timeout, struct lnet_process_id __user *ids, int n_ids); -static int lnet_discover(struct lnet_process_id id, __u32 force, +static int lnet_discover(struct lnet_process_id id, u32 force, struct lnet_process_id __user *ids, int n_ids); static int @@ -420,7 +420,7 @@ static void lnet_assert_wire_constants(void) } static struct lnet_lnd * -lnet_find_lnd_by_type(__u32 type) +lnet_find_lnd_by_type(u32 type) { struct lnet_lnd *lnd; @@ -632,7 +632,7 @@ static void lnet_assert_wire_constants(void) } struct lnet_libhandle * -lnet_res_lh_lookup(struct lnet_res_container *rec, __u64 cookie) +lnet_res_lh_lookup(struct lnet_res_container *rec, u64 cookie) { /* ALWAYS called with lnet_res_lock held */ struct list_head *head; @@ -803,7 +803,7 @@ struct lnet_libhandle * } struct lnet_ni * -lnet_net2ni_locked(__u32 net_id, int cpt) +lnet_net2ni_locked(u32 net_id, int cpt) { struct lnet_ni *ni; struct lnet_net *net; @@ -822,7 +822,7 @@ struct lnet_ni * } struct lnet_ni * -lnet_net2ni_addref(__u32 net) +lnet_net2ni_addref(u32 net) { struct lnet_ni *ni; @@ -837,7 +837,7 @@ struct lnet_ni * EXPORT_SYMBOL(lnet_net2ni_addref); struct lnet_net * -lnet_get_net_locked(__u32 net_id) +lnet_get_net_locked(u32 net_id) { struct lnet_net *net; @@ -852,7 +852,7 @@ struct lnet_net * unsigned int lnet_nid_cpt_hash(lnet_nid_t nid, unsigned int number) { - __u64 key = nid; + u64 key = nid; unsigned int val; LASSERT(number >= 1 && number <= LNET_CPT_NUMBER); @@ -920,7 +920,7 @@ struct lnet_net * EXPORT_SYMBOL(lnet_cpt_of_nid); int -lnet_islocalnet(__u32 net_id) +lnet_islocalnet(u32 net_id) { struct lnet_net *net; int cpt; @@ -2234,7 +2234,7 @@ void lnet_lib_exit(void) lnet_fill_ni_info(struct lnet_ni *ni, struct lnet_ioctl_config_ni *cfg_ni, struct lnet_ioctl_config_lnd_tunables *tun, struct lnet_ioctl_element_stats *stats, - __u32 tun_size) + u32 tun_size) { size_t min_size = 0; int i; @@ -2471,7 +2471,7 @@ struct lnet_ni * lnet_get_ni_config(struct lnet_ioctl_config_ni *cfg_ni, struct lnet_ioctl_config_lnd_tunables *tun, struct lnet_ioctl_element_stats *stats, - __u32 tun_size) + u32 tun_size) { struct lnet_ni *ni; int cpt; @@ -2848,7 +2848,7 @@ int lnet_dyn_del_ni(struct lnet_ioctl_config_ni *conf) } int -lnet_dyn_del_net(__u32 net_id) +lnet_dyn_del_net(u32 net_id) { struct lnet_net *net; struct lnet_ping_buffer *pbuf; @@ -2980,7 +2980,7 @@ u32 lnet_get_dlc_seq_locked(void) struct lnet_ioctl_config_ni *cfg_ni; struct lnet_ioctl_config_lnd_tunables *tun = NULL; struct lnet_ioctl_element_stats *stats; - __u32 tun_size; + u32 tun_size; cfg_ni = arg; @@ -3522,7 +3522,7 @@ static int lnet_ping(struct lnet_process_id id, signed long timeout, } static int -lnet_discover(struct lnet_process_id id, __u32 force, +lnet_discover(struct lnet_process_id id, u32 force, struct lnet_process_id __user *ids, int n_ids) { diff --git a/drivers/staging/lustre/lnet/lnet/config.c b/drivers/staging/lustre/lnet/lnet/config.c index 087d9a8..16c42bf 100644 --- a/drivers/staging/lustre/lnet/lnet/config.c +++ b/drivers/staging/lustre/lnet/lnet/config.c @@ -82,7 +82,7 @@ struct lnet_text_buf { /* tmp struct for parsing routes */ } bool -lnet_net_unique(__u32 net_id, struct list_head *netlist, +lnet_net_unique(u32 net_id, struct list_head *netlist, struct lnet_net **net) { struct lnet_net *net_l; @@ -136,7 +136,7 @@ struct lnet_text_buf { /* tmp struct for parsing routes */ } static bool -in_array(__u32 *array, __u32 size, __u32 value) +in_array(u32 *array, u32 size, u32 value) { int i; @@ -149,9 +149,9 @@ struct lnet_text_buf { /* tmp struct for parsing routes */ } static int -lnet_net_append_cpts(__u32 *cpts, __u32 ncpts, struct lnet_net *net) +lnet_net_append_cpts(u32 *cpts, u32 ncpts, struct lnet_net *net) { - __u32 *added_cpts = NULL; + u32 *added_cpts = NULL; int i, j = 0, rc = 0; /* @@ -193,8 +193,8 @@ struct lnet_text_buf { /* tmp struct for parsing routes */ /* append the new cpts if any to the list of cpts in the net */ if (j > 0) { - __u32 *array = NULL, *loc; - __u32 total_entries = j + net->net_ncpts; + u32 *array = NULL, *loc; + u32 total_entries = j + net->net_ncpts; array = kmalloc_array(total_entries, sizeof(*net->net_cpts), GFP_KERNEL); @@ -220,7 +220,7 @@ struct lnet_text_buf { /* tmp struct for parsing routes */ } static void -lnet_net_remove_cpts(__u32 *cpts, __u32 ncpts, struct lnet_net *net) +lnet_net_remove_cpts(u32 *cpts, u32 ncpts, struct lnet_net *net) { struct lnet_ni *ni; int rc; @@ -344,7 +344,7 @@ struct lnet_text_buf { /* tmp struct for parsing routes */ } struct lnet_net * -lnet_net_alloc(__u32 net_id, struct list_head *net_list) +lnet_net_alloc(u32 net_id, struct list_head *net_list) { struct lnet_net *net; @@ -525,7 +525,7 @@ struct lnet_ni * } struct lnet_ni * -lnet_ni_alloc_w_cpt_array(struct lnet_net *net, __u32 *cpts, __u32 ncpts, +lnet_ni_alloc_w_cpt_array(struct lnet_net *net, u32 *cpts, u32 ncpts, char *iface) { struct lnet_ni *ni; @@ -573,7 +573,7 @@ struct lnet_ni * char *str; struct lnet_net *net; struct lnet_ni *ni = NULL; - __u32 net_id; + u32 net_id; int nnets = 0; if (!networks) { @@ -1098,7 +1098,7 @@ struct lnet_ni * struct list_head gateways; struct list_head *tmp1; struct list_head *tmp2; - __u32 net; + u32 net; lnet_nid_t nid; struct lnet_text_buf *ltb; struct lnet_text_buf *ltb1, *ltb2; @@ -1107,7 +1107,7 @@ struct lnet_ni * char *token = str; int ntokens = 0; int myrc = -1; - __u32 hops; + u32 hops; int got_hops = 0; unsigned int priority = 0; @@ -1276,7 +1276,7 @@ struct lnet_ni * } static int -lnet_match_network_token(char *token, int len, __u32 *ipaddrs, int nip) +lnet_match_network_token(char *token, int len, u32 *ipaddrs, int nip) { LIST_HEAD(list); int rc; @@ -1295,7 +1295,7 @@ struct lnet_ni * } static int -lnet_match_network_tokens(char *net_entry, __u32 *ipaddrs, int nip) +lnet_match_network_tokens(char *net_entry, u32 *ipaddrs, int nip) { static char tokens[LNET_SINGLE_TEXTBUF_NOB]; @@ -1352,11 +1352,11 @@ struct lnet_ni * return 1; } -static __u32 +static u32 lnet_netspec2net(char *netspec) { char *bracket = strchr(netspec, '('); - __u32 net; + u32 net; if (bracket) *bracket = 0; @@ -1379,7 +1379,7 @@ struct lnet_ni * struct lnet_text_buf *tb2; char *sep; char *bracket; - __u32 net; + u32 net; LASSERT(!list_empty(nets)); LASSERT(nets->next == nets->prev); /* single entry */ @@ -1447,7 +1447,7 @@ struct lnet_ni * } static int -lnet_match_networks(char **networksp, char *ip2nets, __u32 *ipaddrs, int nip) +lnet_match_networks(char **networksp, char *ip2nets, u32 *ipaddrs, int nip) { static char networks[LNET_SINGLE_TEXTBUF_NOB]; static char source[LNET_SINGLE_TEXTBUF_NOB]; @@ -1459,8 +1459,8 @@ struct lnet_ni * struct list_head *t2; struct lnet_text_buf *tb; struct lnet_text_buf *tb2; - __u32 net1; - __u32 net2; + u32 net1; + u32 net2; int len; int count; int dup; @@ -1563,10 +1563,10 @@ struct lnet_ni * } static int -lnet_ipaddr_enumerate(__u32 **ipaddrsp) +lnet_ipaddr_enumerate(u32 **ipaddrsp) { struct net_device *dev; - __u32 *ipaddrs; + u32 *ipaddrs; int nalloc = 64; int nip; @@ -1594,7 +1594,7 @@ struct lnet_ni * } if (nip >= nalloc) { - __u32 *ipaddrs2; + u32 *ipaddrs2; nalloc += nalloc; ipaddrs2 = krealloc(ipaddrs, nalloc * sizeof(*ipaddrs2), GFP_KERNEL); @@ -1622,7 +1622,7 @@ struct lnet_ni * int lnet_parse_ip2nets(char **networksp, char *ip2nets) { - __u32 *ipaddrs = NULL; + u32 *ipaddrs = NULL; int nip = lnet_ipaddr_enumerate(&ipaddrs); int rc; diff --git a/drivers/staging/lustre/lnet/lnet/lib-me.c b/drivers/staging/lustre/lnet/lnet/lib-me.c index 672e37b..4a5ffb1 100644 --- a/drivers/staging/lustre/lnet/lnet/lib-me.c +++ b/drivers/staging/lustre/lnet/lnet/lib-me.c @@ -72,7 +72,7 @@ int LNetMEAttach(unsigned int portal, struct lnet_process_id match_id, - __u64 match_bits, __u64 ignore_bits, + u64 match_bits, u64 ignore_bits, enum lnet_unlink unlink, enum lnet_ins_pos pos, struct lnet_handle_me *handle) { @@ -143,7 +143,7 @@ int LNetMEInsert(struct lnet_handle_me current_meh, struct lnet_process_id match_id, - __u64 match_bits, __u64 ignore_bits, + u64 match_bits, u64 ignore_bits, enum lnet_unlink unlink, enum lnet_ins_pos pos, struct lnet_handle_me *handle) { diff --git a/drivers/staging/lustre/lnet/lnet/lib-move.c b/drivers/staging/lustre/lnet/lnet/lib-move.c index eaa1dfa..639f67ed 100644 --- a/drivers/staging/lustre/lnet/lnet/lib-move.c +++ b/drivers/staging/lustre/lnet/lnet/lib-move.c @@ -94,7 +94,7 @@ void lnet_incr_stats(struct lnet_element_stats *stats, } } -__u32 lnet_sum_stats(struct lnet_element_stats *stats, +u32 lnet_sum_stats(struct lnet_element_stats *stats, enum lnet_stats_type stats_type) { struct lnet_comm_count *counts = get_stats_counts(stats, stats_type); @@ -1845,7 +1845,7 @@ void lnet_usr_translate_stats(struct lnet_ioctl_element_msg_stats *msg_stats, */ cpt2 = lnet_cpt_of_nid_locked(best_lpni->lpni_nid, best_ni); if (cpt != cpt2) { - __u32 seq = lnet_get_dlc_seq_locked(); + u32 seq = lnet_get_dlc_seq_locked(); lnet_net_unlock(cpt); cpt = cpt2; lnet_net_lock(cpt); @@ -1962,7 +1962,7 @@ void lnet_usr_translate_stats(struct lnet_ioctl_element_msg_stats *msg_stats, void lnet_drop_message(struct lnet_ni *ni, int cpt, void *private, unsigned int nob, - __u32 msg_type) + u32 msg_type) { lnet_net_lock(cpt); lnet_incr_stats(&ni->ni_stats, msg_type, LNET_STATS_TYPE_DROP); @@ -2383,8 +2383,8 @@ void lnet_usr_translate_stats(struct lnet_ioctl_element_msg_stats *msg_stats, lnet_nid_t dest_nid; lnet_nid_t src_nid; struct lnet_peer_ni *lpni; - __u32 payload_length; - __u32 type; + u32 payload_length; + u32 type; LASSERT(!in_interrupt()); @@ -2418,7 +2418,7 @@ void lnet_usr_translate_stats(struct lnet_ioctl_element_msg_stats *msg_stats, case LNET_MSG_PUT: case LNET_MSG_REPLY: if (payload_length > - (__u32)(for_me ? LNET_MAX_PAYLOAD : LNET_MTU)) { + (u32)(for_me ? LNET_MAX_PAYLOAD : LNET_MTU)) { CERROR("%s, src %s: bad %s payload %d (%d max expected)\n", libcfs_nid2str(from_nid), libcfs_nid2str(src_nid), @@ -2741,8 +2741,8 @@ void lnet_usr_translate_stats(struct lnet_ioctl_element_msg_stats *msg_stats, int LNetPut(lnet_nid_t self, struct lnet_handle_md mdh, enum lnet_ack_req ack, struct lnet_process_id target, unsigned int portal, - __u64 match_bits, unsigned int offset, - __u64 hdr_data) + u64 match_bits, unsigned int offset, + u64 hdr_data) { struct lnet_msg *msg; struct lnet_libmd *md; @@ -2948,7 +2948,7 @@ struct lnet_msg * int LNetGet(lnet_nid_t self, struct lnet_handle_md mdh, struct lnet_process_id target, unsigned int portal, - __u64 match_bits, unsigned int offset) + u64 match_bits, unsigned int offset) { struct lnet_msg *msg; struct lnet_libmd *md; @@ -3037,14 +3037,14 @@ struct lnet_msg * * \retval -EHOSTUNREACH If \a dstnid is not reachable. */ int -LNetDist(lnet_nid_t dstnid, lnet_nid_t *srcnidp, __u32 *orderp) +LNetDist(lnet_nid_t dstnid, lnet_nid_t *srcnidp, u32 *orderp) { struct lnet_ni *ni = NULL; struct lnet_remotenet *rnet; - __u32 dstnet = LNET_NIDNET(dstnid); + u32 dstnet = LNET_NIDNET(dstnid); int hops; int cpt; - __u32 order = 2; + u32 order = 2; struct list_head *rn_list; /* @@ -3098,8 +3098,8 @@ struct lnet_msg * if (rnet->lrn_net == dstnet) { struct lnet_route *route; struct lnet_route *shortest = NULL; - __u32 shortest_hops = LNET_UNDEFINED_HOPS; - __u32 route_hops; + u32 shortest_hops = LNET_UNDEFINED_HOPS; + u32 route_hops; LASSERT(!list_empty(&rnet->lrn_routes)); diff --git a/drivers/staging/lustre/lnet/lnet/lib-ptl.c b/drivers/staging/lustre/lnet/lnet/lib-ptl.c index 6fa5bbf..fa391ee 100644 --- a/drivers/staging/lustre/lnet/lnet/lib-ptl.c +++ b/drivers/staging/lustre/lnet/lnet/lib-ptl.c @@ -41,7 +41,7 @@ static int lnet_ptl_match_type(unsigned int index, struct lnet_process_id match_id, - __u64 mbits, __u64 ignore_bits) + u64 mbits, u64 ignore_bits) { struct lnet_portal *ptl = the_lnet.ln_portals[index]; int unique; @@ -213,7 +213,7 @@ } static struct lnet_match_table * -lnet_match2mt(struct lnet_portal *ptl, struct lnet_process_id id, __u64 mbits) +lnet_match2mt(struct lnet_portal *ptl, struct lnet_process_id id, u64 mbits) { if (LNET_CPT_NUMBER == 1) return ptl->ptl_mtables[0]; /* the only one */ @@ -225,7 +225,7 @@ struct lnet_match_table * lnet_mt_of_attach(unsigned int index, struct lnet_process_id id, - __u64 mbits, __u64 ignore_bits, enum lnet_ins_pos pos) + u64 mbits, u64 ignore_bits, enum lnet_ins_pos pos) { struct lnet_portal *ptl; struct lnet_match_table *mtable; @@ -316,7 +316,7 @@ struct lnet_match_table * static int lnet_mt_test_exhausted(struct lnet_match_table *mtable, int pos) { - __u64 *bmap; + u64 *bmap; int i; if (!lnet_ptl_is_wildcard(the_lnet.ln_portals[mtable->mt_portal])) @@ -324,7 +324,7 @@ struct lnet_match_table * if (pos < 0) { /* check all bits */ for (i = 0; i < LNET_MT_EXHAUSTED_BMAP; i++) { - if (mtable->mt_exhausted[i] != (__u64)(-1)) + if (mtable->mt_exhausted[i] != (u64)(-1)) return 0; } return 1; @@ -341,7 +341,7 @@ struct lnet_match_table * static void lnet_mt_set_exhausted(struct lnet_match_table *mtable, int pos, int exhausted) { - __u64 *bmap; + u64 *bmap; LASSERT(lnet_ptl_is_wildcard(the_lnet.ln_portals[mtable->mt_portal])); LASSERT(pos <= LNET_MT_HASH_IGNORE); @@ -358,7 +358,7 @@ struct lnet_match_table * struct list_head * lnet_mt_match_head(struct lnet_match_table *mtable, - struct lnet_process_id id, __u64 mbits) + struct lnet_process_id id, u64 mbits) { struct lnet_portal *ptl = the_lnet.ln_portals[mtable->mt_portal]; unsigned long hash = mbits; diff --git a/drivers/staging/lustre/lnet/lnet/lib-socket.c b/drivers/staging/lustre/lnet/lnet/lib-socket.c index 62a742e..cff3d1e 100644 --- a/drivers/staging/lustre/lnet/lnet/lib-socket.c +++ b/drivers/staging/lustre/lnet/lnet/lib-socket.c @@ -146,7 +146,7 @@ EXPORT_SYMBOL(lnet_sock_read); static int -lnet_sock_create(struct socket **sockp, int *fatal, __u32 local_ip, +lnet_sock_create(struct socket **sockp, int *fatal, u32 local_ip, int local_port) { struct sockaddr_in locaddr; @@ -233,7 +233,7 @@ EXPORT_SYMBOL(lnet_sock_setbuf); int -lnet_sock_getaddr(struct socket *sock, bool remote, __u32 *ip, int *port) +lnet_sock_getaddr(struct socket *sock, bool remote, u32 *ip, int *port) { struct sockaddr_in sin; int rc; @@ -272,7 +272,7 @@ EXPORT_SYMBOL(lnet_sock_getbuf); int -lnet_sock_listen(struct socket **sockp, __u32 local_ip, int local_port, +lnet_sock_listen(struct socket **sockp, u32 local_ip, int local_port, int backlog) { int fatal; @@ -337,8 +337,8 @@ } int -lnet_sock_connect(struct socket **sockp, int *fatal, __u32 local_ip, - int local_port, __u32 peer_ip, int peer_port) +lnet_sock_connect(struct socket **sockp, int *fatal, u32 local_ip, + int local_port, u32 peer_ip, int peer_port) { struct sockaddr_in srvaddr; int rc; diff --git a/drivers/staging/lustre/lnet/lnet/nidstrings.c b/drivers/staging/lustre/lnet/lnet/nidstrings.c index 43d957f..0f2b75e 100644 --- a/drivers/staging/lustre/lnet/lnet/nidstrings.c +++ b/drivers/staging/lustre/lnet/lnet/nidstrings.c @@ -465,12 +465,12 @@ int cfs_print_nidlist(char *buffer, int count, struct list_head *nidlist) * \param min_nid * \param max_nid */ -static void cfs_ip_ar_min_max(struct addrrange *ar, __u32 *min_nid, - __u32 *max_nid) +static void cfs_ip_ar_min_max(struct addrrange *ar, u32 *min_nid, + u32 *max_nid) { struct cfs_expr_list *el; struct cfs_range_expr *re; - __u32 tmp_ip_addr = 0; + u32 tmp_ip_addr = 0; unsigned int min_ip[4] = {0}; unsigned int max_ip[4] = {0}; int re_count = 0; @@ -504,8 +504,8 @@ static void cfs_ip_ar_min_max(struct addrrange *ar, __u32 *min_nid, * \param min_nid * \param max_nid */ -static void cfs_num_ar_min_max(struct addrrange *ar, __u32 *min_nid, - __u32 *max_nid) +static void cfs_num_ar_min_max(struct addrrange *ar, u32 *min_nid, + u32 *max_nid) { struct cfs_expr_list *el; struct cfs_range_expr *re; @@ -581,9 +581,9 @@ static bool cfs_num_is_contiguous(struct list_head *nidlist) struct cfs_expr_list *el; struct cfs_range_expr *re; int last_hi = 0; - __u32 last_end_nid = 0; - __u32 current_start_nid = 0; - __u32 current_end_nid = 0; + u32 last_end_nid = 0; + u32 current_start_nid = 0; + u32 current_end_nid = 0; list_for_each_entry(nr, nidlist, nr_link) { list_for_each_entry(ar, &nr->nr_addrranges, ar_link) { @@ -629,9 +629,9 @@ static bool cfs_ip_is_contiguous(struct list_head *nidlist) int expr_count; int last_hi = 255; int last_diff = 0; - __u32 last_end_nid = 0; - __u32 current_start_nid = 0; - __u32 current_end_nid = 0; + u32 last_end_nid = 0; + u32 current_start_nid = 0; + u32 current_end_nid = 0; list_for_each_entry(nr, nidlist, nr_link) { list_for_each_entry(ar, &nr->nr_addrranges, ar_link) { @@ -678,8 +678,8 @@ void cfs_nidrange_find_min_max(struct list_head *nidlist, char *min_nid, struct nidrange *nr; struct netstrfns *nf = NULL; int netnum = -1; - __u32 min_addr; - __u32 max_addr; + u32 min_addr; + u32 max_addr; char *lndname = NULL; char min_addr_str[IPSTRING_LENGTH]; char max_addr_str[IPSTRING_LENGTH]; @@ -709,8 +709,8 @@ void cfs_nidrange_find_min_max(struct list_head *nidlist, char *min_nid, * \param *min_nid * \param *max_nid */ -static void cfs_num_min_max(struct list_head *nidlist, __u32 *min_nid, - __u32 *max_nid) +static void cfs_num_min_max(struct list_head *nidlist, u32 *min_nid, + u32 *max_nid) { struct nidrange *nr; struct addrrange *ar; @@ -741,15 +741,15 @@ static void cfs_num_min_max(struct list_head *nidlist, __u32 *min_nid, * \param *min_nid * \param *max_nid */ -static void cfs_ip_min_max(struct list_head *nidlist, __u32 *min_nid, - __u32 *max_nid) +static void cfs_ip_min_max(struct list_head *nidlist, u32 *min_nid, + u32 *max_nid) { struct nidrange *nr; struct addrrange *ar; - __u32 tmp_min_ip_addr = 0; - __u32 tmp_max_ip_addr = 0; - __u32 min_ip_addr = 0; - __u32 max_ip_addr = 0; + u32 tmp_min_ip_addr = 0; + u32 tmp_max_ip_addr = 0; + u32 min_ip_addr = 0; + u32 max_ip_addr = 0; list_for_each_entry(nr, nidlist, nr_link) { list_for_each_entry(ar, &nr->nr_addrranges, ar_link) { @@ -769,14 +769,14 @@ static void cfs_ip_min_max(struct list_head *nidlist, __u32 *min_nid, } static int -libcfs_lo_str2addr(const char *str, int nob, __u32 *addr) +libcfs_lo_str2addr(const char *str, int nob, u32 *addr) { *addr = 0; return 1; } static void -libcfs_ip_addr2str(__u32 addr, char *str, size_t size) +libcfs_ip_addr2str(u32 addr, char *str, size_t size) { snprintf(str, size, "%u.%u.%u.%u", (addr >> 24) & 0xff, (addr >> 16) & 0xff, @@ -792,7 +792,7 @@ static void cfs_ip_min_max(struct list_head *nidlist, __u32 *min_nid, * fine too :) */ static int -libcfs_ip_str2addr(const char *str, int nob, __u32 *addr) +libcfs_ip_str2addr(const char *str, int nob, u32 *addr) { unsigned int a; unsigned int b; @@ -873,7 +873,7 @@ static void cfs_ip_min_max(struct list_head *nidlist, __u32 *min_nid, * \retval 0 otherwise */ int -cfs_ip_addr_match(__u32 addr, struct list_head *list) +cfs_ip_addr_match(u32 addr, struct list_head *list) { struct cfs_expr_list *el; int i = 0; @@ -889,13 +889,13 @@ static void cfs_ip_min_max(struct list_head *nidlist, __u32 *min_nid, } static void -libcfs_decnum_addr2str(__u32 addr, char *str, size_t size) +libcfs_decnum_addr2str(u32 addr, char *str, size_t size) { snprintf(str, size, "%u", addr); } static int -libcfs_num_str2addr(const char *str, int nob, __u32 *addr) +libcfs_num_str2addr(const char *str, int nob, u32 *addr) { int n; @@ -955,7 +955,7 @@ static void cfs_ip_min_max(struct list_head *nidlist, __u32 *min_nid, * \retval 0 otherwise */ static int -libcfs_num_match(__u32 addr, struct list_head *numaddr) +libcfs_num_match(u32 addr, struct list_head *numaddr) { struct cfs_expr_list *el; @@ -1021,7 +1021,7 @@ static void cfs_ip_min_max(struct list_head *nidlist, __u32 *min_nid, static const size_t libcfs_nnetstrfns = ARRAY_SIZE(libcfs_netstrfns); static struct netstrfns * -libcfs_lnd2netstrfns(__u32 lnd) +libcfs_lnd2netstrfns(u32 lnd) { int i; @@ -1059,14 +1059,14 @@ static void cfs_ip_min_max(struct list_head *nidlist, __u32 *min_nid, } int -libcfs_isknown_lnd(__u32 lnd) +libcfs_isknown_lnd(u32 lnd) { return !!libcfs_lnd2netstrfns(lnd); } EXPORT_SYMBOL(libcfs_isknown_lnd); char * -libcfs_lnd2modname(__u32 lnd) +libcfs_lnd2modname(u32 lnd) { struct netstrfns *nf = libcfs_lnd2netstrfns(lnd); @@ -1087,7 +1087,7 @@ static void cfs_ip_min_max(struct list_head *nidlist, __u32 *min_nid, EXPORT_SYMBOL(libcfs_str2lnd); char * -libcfs_lnd2str_r(__u32 lnd, char *buf, size_t buf_size) +libcfs_lnd2str_r(u32 lnd, char *buf, size_t buf_size) { struct netstrfns *nf; @@ -1102,10 +1102,10 @@ static void cfs_ip_min_max(struct list_head *nidlist, __u32 *min_nid, EXPORT_SYMBOL(libcfs_lnd2str_r); char * -libcfs_net2str_r(__u32 net, char *buf, size_t buf_size) +libcfs_net2str_r(u32 net, char *buf, size_t buf_size) { - __u32 nnum = LNET_NETNUM(net); - __u32 lnd = LNET_NETTYP(net); + u32 nnum = LNET_NETNUM(net); + u32 lnd = LNET_NETTYP(net); struct netstrfns *nf; nf = libcfs_lnd2netstrfns(lnd); @@ -1123,10 +1123,10 @@ static void cfs_ip_min_max(struct list_head *nidlist, __u32 *min_nid, char * libcfs_nid2str_r(lnet_nid_t nid, char *buf, size_t buf_size) { - __u32 addr = LNET_NIDADDR(nid); - __u32 net = LNET_NIDNET(nid); - __u32 nnum = LNET_NETNUM(net); - __u32 lnd = LNET_NETTYP(net); + u32 addr = LNET_NIDADDR(nid); + u32 net = LNET_NIDNET(nid); + u32 nnum = LNET_NETNUM(net); + u32 lnd = LNET_NETTYP(net); struct netstrfns *nf; if (nid == LNET_NID_ANY) { @@ -1156,7 +1156,7 @@ static void cfs_ip_min_max(struct list_head *nidlist, __u32 *min_nid, EXPORT_SYMBOL(libcfs_nid2str_r); static struct netstrfns * -libcfs_str2net_internal(const char *str, __u32 *net) +libcfs_str2net_internal(const char *str, u32 *net) { struct netstrfns *nf = NULL; int nob; @@ -1191,10 +1191,10 @@ static void cfs_ip_min_max(struct list_head *nidlist, __u32 *min_nid, return nf; } -__u32 +u32 libcfs_str2net(const char *str) { - __u32 net; + u32 net; if (libcfs_str2net_internal(str, &net)) return net; @@ -1208,8 +1208,8 @@ static void cfs_ip_min_max(struct list_head *nidlist, __u32 *min_nid, { const char *sep = strchr(str, '@'); struct netstrfns *nf; - __u32 net; - __u32 addr; + u32 net; + u32 addr; if (sep) { nf = libcfs_str2net_internal(sep + 1, &net); diff --git a/drivers/staging/lustre/lnet/lnet/peer.c b/drivers/staging/lustre/lnet/lnet/peer.c index db36b5c..d807dd4 100644 --- a/drivers/staging/lustre/lnet/lnet/peer.c +++ b/drivers/staging/lustre/lnet/lnet/peer.c @@ -697,17 +697,17 @@ struct lnet_peer_ni * /* Call with the ln_api_mutex held */ int -lnet_get_peer_list(__u32 *countp, __u32 *sizep, +lnet_get_peer_list(u32 *countp, u32 *sizep, struct lnet_process_id __user *ids) { struct lnet_process_id id; struct lnet_peer_table *ptable; struct lnet_peer *lp; - __u32 count = 0; - __u32 size = 0; + u32 count = 0; + u32 size = 0; int lncpt; int cpt; - __u32 i; + u32 i; int rc; rc = -ESHUTDOWN; @@ -3234,12 +3234,12 @@ void lnet_peer_discovery_stop(void) /* Gathering information for userspace. */ int -lnet_get_peer_ni_info(__u32 peer_index, __u64 *nid, +lnet_get_peer_ni_info(u32 peer_index, u64 *nid, char aliveness[LNET_MAX_STR_LEN], - __u32 *cpt_iter, __u32 *refcount, - __u32 *ni_peer_tx_credits, __u32 *peer_tx_credits, - __u32 *peer_rtr_credits, __u32 *peer_min_rtr_credits, - __u32 *peer_tx_qnob) + u32 *cpt_iter, u32 *refcount, + u32 *ni_peer_tx_credits, u32 *peer_tx_credits, + u32 *peer_rtr_credits, u32 *peer_min_rtr_credits, + u32 *peer_tx_qnob) { struct lnet_peer_table *peer_table; struct lnet_peer_ni *lp; @@ -3305,7 +3305,7 @@ int lnet_get_peer_info(struct lnet_ioctl_peer_cfg *cfg, void __user *bulk) struct lnet_peer_ni *lpni; struct lnet_peer *lp; lnet_nid_t nid; - __u32 size; + u32 size; int rc; lp = lnet_find_peer(cfg->prcfg_prim_nid); diff --git a/drivers/staging/lustre/lnet/lnet/router.c b/drivers/staging/lustre/lnet/lnet/router.c index 86cce27..22c88ec 100644 --- a/drivers/staging/lustre/lnet/lnet/router.c +++ b/drivers/staging/lustre/lnet/lnet/router.c @@ -247,7 +247,7 @@ } struct lnet_remotenet * -lnet_find_rnet_locked(__u32 net) +lnet_find_rnet_locked(u32 net) { struct lnet_remotenet *rnet; struct list_head *rn_list; @@ -273,7 +273,7 @@ static void lnet_shuffle_seed(void) /* Nodes with small feet have little entropy * the NID for this node gives the most entropy in the low bits */ while ((ni = lnet_get_next_ni_locked(NULL, ni))) { - __u32 lnd_type, seed; + u32 lnd_type, seed; lnd_type = LNET_NETTYP(LNET_NIDNET(ni->ni_nid)); if (lnd_type != LOLND) { seed = (LNET_NIDADDR(ni->ni_nid) | lnd_type); @@ -313,7 +313,7 @@ static void lnet_shuffle_seed(void) } int -lnet_add_route(__u32 net, __u32 hops, lnet_nid_t gateway, +lnet_add_route(u32 net, u32 hops, lnet_nid_t gateway, unsigned int priority) { struct lnet_remotenet *rnet; @@ -479,7 +479,7 @@ static void lnet_shuffle_seed(void) } int -lnet_del_route(__u32 net, lnet_nid_t gw_nid) +lnet_del_route(u32 net, lnet_nid_t gw_nid) { struct lnet_peer_ni *gateway; struct lnet_remotenet *rnet; @@ -585,8 +585,8 @@ int lnet_get_rtr_pool_cfg(int idx, struct lnet_ioctl_pool_cfg *pool_cfg) } int -lnet_get_route(int idx, __u32 *net, __u32 *hops, - lnet_nid_t *gateway, __u32 *alive, __u32 *priority) +lnet_get_route(int idx, u32 *net, u32 *hops, + lnet_nid_t *gateway, u32 *alive, u32 *priority) { struct lnet_remotenet *rnet; struct lnet_route *route; @@ -836,7 +836,7 @@ int lnet_get_rtr_pool_cfg(int idx, struct lnet_ioctl_pool_cfg *pool_cfg) } void -lnet_router_ni_update_locked(struct lnet_peer_ni *gw, __u32 net) +lnet_router_ni_update_locked(struct lnet_peer_ni *gw, u32 net) { struct lnet_route *rte; @@ -1274,7 +1274,7 @@ int lnet_get_rtr_pool_cfg(int idx, struct lnet_ioctl_pool_cfg *pool_cfg) struct lnet_peer_ni *rtr; while (the_lnet.ln_rc_state == LNET_RC_STATE_RUNNING) { - __u64 version; + u64 version; int cpt; int cpt2; diff --git a/drivers/staging/lustre/lnet/lnet/router_proc.c b/drivers/staging/lustre/lnet/lnet/router_proc.c index 236b5a1..e8cc70f 100644 --- a/drivers/staging/lustre/lnet/lnet/router_proc.c +++ b/drivers/staging/lustre/lnet/lnet/router_proc.c @@ -211,8 +211,8 @@ static int proc_lnet_routes(struct ctl_table *table, int write, } if (route) { - __u32 net = rnet->lrn_net; - __u32 hops = route->lr_hops; + u32 net = rnet->lrn_net; + u32 hops = route->lr_hops; unsigned int priority = route->lr_priority; lnet_nid_t nid = route->lr_gateway->lpni_nid; int alive = lnet_is_route_alive(route); -- 1.8.3.1 From jsimmons at infradead.org Thu Jan 31 17:19:08 2019 From: jsimmons at infradead.org (James Simmons) Date: Thu, 31 Jan 2019 12:19:08 -0500 Subject: [lustre-devel] [PATCH 04/26] ptlrpc: use kernel types for kernel code In-Reply-To: <1548955170-13456-1-git-send-email-jsimmons@infradead.org> References: <1548955170-13456-1-git-send-email-jsimmons@infradead.org> Message-ID: <1548955170-13456-5-git-send-email-jsimmons@infradead.org> Lustre ptlrpc code was originally both a user land and kernel implementation. The source contains many types of the form __u32 but since this is mostly kernel code change the types to kernel internal types. Signed-off-by: James Simmons --- drivers/staging/lustre/lustre/ptlrpc/client.c | 32 +++--- drivers/staging/lustre/lustre/ptlrpc/events.c | 10 +- drivers/staging/lustre/lustre/ptlrpc/import.c | 14 +-- drivers/staging/lustre/lustre/ptlrpc/layout.c | 18 ++-- drivers/staging/lustre/lustre/ptlrpc/llog_client.c | 2 +- .../staging/lustre/lustre/ptlrpc/lproc_ptlrpc.c | 30 +++--- drivers/staging/lustre/lustre/ptlrpc/niobuf.c | 4 +- .../staging/lustre/lustre/ptlrpc/pack_generic.c | 112 ++++++++++----------- .../staging/lustre/lustre/ptlrpc/ptlrpc_internal.h | 4 +- drivers/staging/lustre/lustre/ptlrpc/ptlrpcd.c | 2 +- drivers/staging/lustre/lustre/ptlrpc/recover.c | 2 +- drivers/staging/lustre/lustre/ptlrpc/sec.c | 20 ++-- drivers/staging/lustre/lustre/ptlrpc/sec_bulk.c | 6 +- drivers/staging/lustre/lustre/ptlrpc/sec_null.c | 6 +- drivers/staging/lustre/lustre/ptlrpc/sec_plain.c | 26 ++--- drivers/staging/lustre/lustre/ptlrpc/service.c | 16 +-- 16 files changed, 152 insertions(+), 152 deletions(-) diff --git a/drivers/staging/lustre/lustre/ptlrpc/client.c b/drivers/staging/lustre/lustre/ptlrpc/client.c index 110bb5d..f4b3875 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/client.c +++ b/drivers/staging/lustre/lustre/ptlrpc/client.c @@ -286,7 +286,7 @@ void ptlrpc_free_bulk(struct ptlrpc_bulk_desc *desc) */ void ptlrpc_at_set_req_timeout(struct ptlrpc_request *req) { - __u32 serv_est; + u32 serv_est; int idx; struct imp_at *at; @@ -690,12 +690,12 @@ static inline void ptlrpc_assign_next_xid(struct ptlrpc_request *req) } int ptlrpc_request_bufs_pack(struct ptlrpc_request *request, - __u32 version, int opcode, char **bufs, + u32 version, int opcode, char **bufs, struct ptlrpc_cli_ctx *ctx) { int count; struct obd_import *imp; - __u32 *lengths; + u32 *lengths; int rc; count = req_capsule_filled_sizes(&request->rq_pill, RCL_CLIENT); @@ -785,7 +785,7 @@ int ptlrpc_request_bufs_pack(struct ptlrpc_request *request, * steps if necessary. */ int ptlrpc_request_pack(struct ptlrpc_request *request, - __u32 version, int opcode) + u32 version, int opcode) { int rc; @@ -917,7 +917,7 @@ void ptlrpc_request_free(struct ptlrpc_request *request) */ struct ptlrpc_request *ptlrpc_request_alloc_pack(struct obd_import *imp, const struct req_format *format, - __u32 version, int opcode) + u32 version, int opcode) { struct ptlrpc_request *req = ptlrpc_request_alloc(imp, format); int rc; @@ -1186,7 +1186,7 @@ static int ptlrpc_import_delay_req(struct obd_import *imp, */ static bool ptlrpc_console_allow(struct ptlrpc_request *req) { - __u32 opc; + u32 opc; LASSERT(req->rq_reqmsg); opc = lustre_msg_get_opc(req->rq_reqmsg); @@ -1226,7 +1226,7 @@ static int ptlrpc_check_status(struct ptlrpc_request *req) if (lustre_msg_get_type(req->rq_repmsg) == PTL_RPC_MSG_ERR) { struct obd_import *imp = req->rq_import; lnet_nid_t nid = imp->imp_connection->c_peer.nid; - __u32 opc = lustre_msg_get_opc(req->rq_reqmsg); + u32 opc = lustre_msg_get_opc(req->rq_reqmsg); /* -EAGAIN is normal when using POSIX flocks */ if (ptlrpc_console_allow(req) && @@ -1256,7 +1256,7 @@ static void ptlrpc_save_versions(struct ptlrpc_request *req) { struct lustre_msg *repmsg = req->rq_repmsg; struct lustre_msg *reqmsg = req->rq_reqmsg; - __u64 *versions = lustre_msg_get_versions(repmsg); + u64 *versions = lustre_msg_get_versions(repmsg); if (lustre_msg_get_flags(req->rq_reqmsg) & MSG_REPLAY) return; @@ -1267,7 +1267,7 @@ static void ptlrpc_save_versions(struct ptlrpc_request *req) versions[0], versions[1]); } -__u64 ptlrpc_known_replied_xid(struct obd_import *imp) +u64 ptlrpc_known_replied_xid(struct obd_import *imp) { struct ptlrpc_request *req; @@ -2471,7 +2471,7 @@ void ptlrpc_req_finished(struct ptlrpc_request *request) /** * Returns xid of a \a request */ -__u64 ptlrpc_req_xid(struct ptlrpc_request *request) +u64 ptlrpc_req_xid(struct ptlrpc_request *request) { return request->rq_xid; } @@ -3025,7 +3025,7 @@ void ptlrpc_abort_set(struct ptlrpc_request_set *set) } } -static __u64 ptlrpc_last_xid; +static u64 ptlrpc_last_xid; static spinlock_t ptlrpc_last_xid_lock; /** @@ -3054,7 +3054,7 @@ void ptlrpc_init_xid(void) ptlrpc_last_xid >>= 2; ptlrpc_last_xid |= (1ULL << 61); } else { - ptlrpc_last_xid = (__u64)now << 20; + ptlrpc_last_xid = (u64)now << 20; } /* Always need to be aligned to a power-of-two for multi-bulk BRW */ @@ -3074,9 +3074,9 @@ void ptlrpc_init_xid(void) * This is assumed to be true due to the initial ptlrpc_last_xid * value also being initialized to a power-of-two value. LU-1431 */ -__u64 ptlrpc_next_xid(void) +u64 ptlrpc_next_xid(void) { - __u64 next; + u64 next; spin_lock(&ptlrpc_last_xid_lock); next = ptlrpc_last_xid + PTLRPC_BULK_OPS_COUNT; @@ -3155,11 +3155,11 @@ void ptlrpc_set_bulk_mbits(struct ptlrpc_request *req) * Get a glimpse at what next xid value might have been. * Returns possible next xid. */ -__u64 ptlrpc_sample_next_xid(void) +u64 ptlrpc_sample_next_xid(void) { #if BITS_PER_LONG == 32 /* need to avoid possible word tearing on 32-bit systems */ - __u64 next; + u64 next; spin_lock(&ptlrpc_last_xid_lock); next = ptlrpc_last_xid + PTLRPC_BULK_OPS_COUNT; diff --git a/drivers/staging/lustre/lustre/ptlrpc/events.c b/drivers/staging/lustre/lustre/ptlrpc/events.c index ab6dd74..0c16a2c 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/events.c +++ b/drivers/staging/lustre/lustre/ptlrpc/events.c @@ -253,9 +253,9 @@ void client_bulk_callback(struct lnet_event *ev) static void ptlrpc_req_add_history(struct ptlrpc_service_part *svcpt, struct ptlrpc_request *req) { - __u64 sec = req->rq_arrival_time.tv_sec; - __u32 usec = req->rq_arrival_time.tv_nsec / NSEC_PER_USEC / 16; /* usec / 16 */ - __u64 new_seq; + u64 sec = req->rq_arrival_time.tv_sec; + u32 usec = req->rq_arrival_time.tv_nsec / NSEC_PER_USEC / 16; /* usec / 16 */ + u64 new_seq; /* set sequence ID for request and add it to history list, * it must be called with hold svcpt::scp_lock @@ -453,11 +453,11 @@ int ptlrpc_uuid_to_peer(struct obd_uuid *uuid, struct lnet_process_id *peer, lnet_nid_t *self) { int best_dist = 0; - __u32 best_order = 0; + u32 best_order = 0; int count = 0; int rc = -ENOENT; int dist; - __u32 order; + u32 order; lnet_nid_t dst_nid; lnet_nid_t src_nid; diff --git a/drivers/staging/lustre/lustre/ptlrpc/import.c b/drivers/staging/lustre/lustre/ptlrpc/import.c index 480c860d..56a0b76 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/import.c +++ b/drivers/staging/lustre/lustre/ptlrpc/import.c @@ -51,7 +51,7 @@ #include "ptlrpc_internal.h" struct ptlrpc_connect_async_args { - __u64 pcaa_peer_committed; + u64 pcaa_peer_committed; int pcaa_initial_connect; }; @@ -154,7 +154,7 @@ static void deuuidify(char *uuid, const char *prefix, char **uuid_start, * (increasing the import->conn_cnt) the older failure should * not also cause a reconnection. If zero it forces a reconnect. */ -int ptlrpc_set_import_discon(struct obd_import *imp, __u32 conn_cnt) +int ptlrpc_set_import_discon(struct obd_import *imp, u32 conn_cnt) { int rc = 0; @@ -399,7 +399,7 @@ void ptlrpc_pinger_force(struct obd_import *imp) } EXPORT_SYMBOL(ptlrpc_pinger_force); -void ptlrpc_fail_import(struct obd_import *imp, __u32 conn_cnt) +void ptlrpc_fail_import(struct obd_import *imp, u32 conn_cnt) { LASSERT(!imp->imp_dlm_fake); @@ -547,7 +547,7 @@ static int import_select_connection(struct obd_import *imp) /* * must be called under imp_lock */ -static int ptlrpc_first_transno(struct obd_import *imp, __u64 *transno) +static int ptlrpc_first_transno(struct obd_import *imp, u64 *transno) { struct ptlrpc_request *req; @@ -589,7 +589,7 @@ int ptlrpc_connect_import(struct obd_import *imp) struct obd_device *obd = imp->imp_obd; int initial_connect = 0; int set_transno = 0; - __u64 committed_before_reconnect = 0; + u64 committed_before_reconnect = 0; struct ptlrpc_request *request; char *bufs[] = { NULL, obd2cli_tgt(imp->imp_obd), @@ -686,7 +686,7 @@ int ptlrpc_connect_import(struct obd_import *imp) /* Allow a slightly larger reply for future growth compatibility */ req_capsule_set_size(&request->rq_pill, &RMF_CONNECT_DATA, RCL_SERVER, sizeof(struct obd_connect_data) + - 16 * sizeof(__u64)); + 16 * sizeof(u64)); ptlrpc_request_set_replen(request); request->rq_interpret_reply = ptlrpc_connect_interpret; @@ -936,7 +936,7 @@ static int ptlrpc_connect_interpret(const struct lu_env *env, struct ptlrpc_connect_async_args *aa = data; struct obd_import *imp = request->rq_import; struct lustre_handle old_hdl; - __u64 old_connect_flags; + u64 old_connect_flags; int msg_flags; struct obd_connect_data *ocd; struct obd_export *exp; diff --git a/drivers/staging/lustre/lustre/ptlrpc/layout.c b/drivers/staging/lustre/lustre/ptlrpc/layout.c index a155200..2848f2f 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/layout.c +++ b/drivers/staging/lustre/lustre/ptlrpc/layout.c @@ -768,7 +768,7 @@ }; struct req_msg_field { - const __u32 rmf_flags; + const u32 rmf_flags; const char *rmf_name; /** * Field length. (-1) means "variable length". If the @@ -842,7 +842,7 @@ struct req_msg_field RMF_MGS_CONFIG_RES = struct req_msg_field RMF_U32 = DEFINE_MSGF("generic u32", 0, - sizeof(__u32), lustre_swab_generic_32s, NULL); + sizeof(u32), lustre_swab_generic_32s, NULL); EXPORT_SYMBOL(RMF_U32); struct req_msg_field RMF_SETINFO_VAL = @@ -855,7 +855,7 @@ struct req_msg_field RMF_GETINFO_KEY = struct req_msg_field RMF_GETINFO_VALLEN = DEFINE_MSGF("getinfo_vallen", 0, - sizeof(__u32), lustre_swab_generic_32s, NULL); + sizeof(u32), lustre_swab_generic_32s, NULL); EXPORT_SYMBOL(RMF_GETINFO_VALLEN); struct req_msg_field RMF_GETINFO_VAL = @@ -864,7 +864,7 @@ struct req_msg_field RMF_GETINFO_VAL = struct req_msg_field RMF_SEQ_OPC = DEFINE_MSGF("seq_query_opc", 0, - sizeof(__u32), lustre_swab_generic_32s, NULL); + sizeof(u32), lustre_swab_generic_32s, NULL); EXPORT_SYMBOL(RMF_SEQ_OPC); struct req_msg_field RMF_SEQ_RANGE = @@ -875,7 +875,7 @@ struct req_msg_field RMF_SEQ_RANGE = struct req_msg_field RMF_FLD_OPC = DEFINE_MSGF("fld_query_opc", 0, - sizeof(__u32), lustre_swab_generic_32s, NULL); + sizeof(u32), lustre_swab_generic_32s, NULL); EXPORT_SYMBOL(RMF_FLD_OPC); struct req_msg_field RMF_FLD_MDFLD = @@ -1069,12 +1069,12 @@ struct req_msg_field RMF_NIOBUF_REMOTE = EXPORT_SYMBOL(RMF_NIOBUF_REMOTE); struct req_msg_field RMF_RCS = - DEFINE_MSGF("niobuf_remote", RMF_F_STRUCT_ARRAY, sizeof(__u32), + DEFINE_MSGF("niobuf_remote", RMF_F_STRUCT_ARRAY, sizeof(u32), lustre_swab_generic_32s, dump_rcs); EXPORT_SYMBOL(RMF_RCS); struct req_msg_field RMF_EAVALS_LENS = - DEFINE_MSGF("eavals_lens", RMF_F_STRUCT_ARRAY, sizeof(__u32), + DEFINE_MSGF("eavals_lens", RMF_F_STRUCT_ARRAY, sizeof(u32), lustre_swab_generic_32s, NULL); EXPORT_SYMBOL(RMF_EAVALS_LENS); @@ -1130,7 +1130,7 @@ struct req_msg_field RMF_MDS_HSM_USER_ITEM = struct req_msg_field RMF_MDS_HSM_ARCHIVE = DEFINE_MSGF("hsm_archive", 0, - sizeof(__u32), lustre_swab_generic_32s, NULL); + sizeof(u32), lustre_swab_generic_32s, NULL); EXPORT_SYMBOL(RMF_MDS_HSM_ARCHIVE); struct req_msg_field RMF_MDS_HSM_REQUEST = @@ -2129,7 +2129,7 @@ u32 req_capsule_msg_size(struct req_capsule *pill, enum req_location loc) * This function should not be used for formats which contain variable size * fields. */ -u32 req_capsule_fmt_size(__u32 magic, const struct req_format *fmt, +u32 req_capsule_fmt_size(u32 magic, const struct req_format *fmt, enum req_location loc) { size_t i = 0; diff --git a/drivers/staging/lustre/lustre/ptlrpc/llog_client.c b/drivers/staging/lustre/lustre/ptlrpc/llog_client.c index 6ddd93c..8ca6959 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/llog_client.c +++ b/drivers/staging/lustre/lustre/ptlrpc/llog_client.c @@ -142,7 +142,7 @@ static int llog_client_open(const struct lu_env *env, static int llog_client_next_block(const struct lu_env *env, struct llog_handle *loghandle, int *cur_idx, int next_idx, - __u64 *cur_offset, void *buf, int len) + u64 *cur_offset, void *buf, int len) { struct obd_import *imp; struct ptlrpc_request *req = NULL; diff --git a/drivers/staging/lustre/lustre/ptlrpc/lproc_ptlrpc.c b/drivers/staging/lustre/lustre/ptlrpc/lproc_ptlrpc.c index cce86c4..92e3e0f 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/lproc_ptlrpc.c +++ b/drivers/staging/lustre/lustre/ptlrpc/lproc_ptlrpc.c @@ -42,7 +42,7 @@ #include "ptlrpc_internal.h" static struct ll_rpc_opcode { - __u32 opcode; + u32 opcode; const char *opname; } ll_rpc_opcode_table[LUSTRE_MAX_OPCODES] = { { OST_REPLY, "ost_reply" }, @@ -134,7 +134,7 @@ }; static struct ll_eopcode { - __u32 opcode; + u32 opcode; const char *opname; } ll_eopcode_table[EXTRA_LAST_OPC] = { { LDLM_GLIMPSE_ENQUEUE, "ldlm_glimpse_enqueue" }, @@ -153,7 +153,7 @@ { BRW_WRITE_BYTES, "write_bytes" }, }; -const char *ll_opcode2str(__u32 opcode) +const char *ll_opcode2str(u32 opcode) { /* When one of the assertions below fail, chances are that: * 1) A new opcode was added in include/lustre/lustre_idl.h, @@ -162,7 +162,7 @@ const char *ll_opcode2str(__u32 opcode) * and the opcode_offset() function in * ptlrpc_internal.h needs to be modified. */ - __u32 offset = opcode_offset(opcode); + u32 offset = opcode_offset(opcode); LASSERTF(offset < LUSTRE_MAX_OPCODES, "offset %u >= LUSTRE_MAX_OPCODES %u\n", @@ -173,7 +173,7 @@ const char *ll_opcode2str(__u32 opcode) return ll_rpc_opcode_table[offset].opname; } -static const char *ll_eopcode2str(__u32 opcode) +static const char *ll_eopcode2str(u32 opcode) { LASSERT(ll_eopcode_table[opcode].opcode == opcode); return ll_eopcode_table[opcode].opname; @@ -231,7 +231,7 @@ static const char *ll_eopcode2str(__u32 opcode) ll_eopcode2str(i), units); } for (i = 0; i < LUSTRE_MAX_OPCODES; i++) { - __u32 opcode = ll_rpc_opcode_table[i].opcode; + u32 opcode = ll_rpc_opcode_table[i].opcode; lprocfs_counter_init(svc_stats, EXTRA_MAX_OPCODES + i, svc_counter_config, @@ -709,14 +709,14 @@ static ssize_t ptlrpc_lprocfs_nrs_seq_write(struct file *file, struct ptlrpc_srh_iterator { int srhi_idx; - __u64 srhi_seq; + u64 srhi_seq; struct ptlrpc_request *srhi_req; }; static int ptlrpc_lprocfs_svc_req_history_seek(struct ptlrpc_service_part *svcpt, struct ptlrpc_srh_iterator *srhi, - __u64 seq) + u64 seq) { struct list_head *e; struct ptlrpc_request *req; @@ -772,7 +772,7 @@ struct ptlrpc_srh_iterator { /* convert seq_file pos to cpt */ #define PTLRPC_REQ_POS2CPT(svc, pos) \ ((svc)->srv_cpt_bits == 0 ? 0 : \ - (__u64)(pos) >> (64 - (svc)->srv_cpt_bits)) + (u64)(pos) >> (64 - (svc)->srv_cpt_bits)) /* make up seq_file pos from cpt */ #define PTLRPC_REQ_CPT2POS(svc, cpt) \ @@ -788,8 +788,8 @@ struct ptlrpc_srh_iterator { /* convert position to sequence */ #define PTLRPC_REQ_POS2SEQ(svc, pos) \ ((svc)->srv_cpt_bits == 0 ? (pos) : \ - ((__u64)(pos) << (svc)->srv_cpt_bits) | \ - ((__u64)(pos) >> (64 - (svc)->srv_cpt_bits))) + ((u64)(pos) << (svc)->srv_cpt_bits) | \ + ((u64)(pos) >> (64 - (svc)->srv_cpt_bits))) static void * ptlrpc_lprocfs_svc_req_history_start(struct seq_file *s, loff_t *pos) @@ -801,7 +801,7 @@ struct ptlrpc_srh_iterator { int rc; int i; - if (sizeof(loff_t) != sizeof(__u64)) { /* can't support */ + if (sizeof(loff_t) != sizeof(u64)) { /* can't support */ CWARN("Failed to read request history because size of loff_t %d can't match size of u64\n", (int)sizeof(loff_t)); return NULL; @@ -852,7 +852,7 @@ struct ptlrpc_srh_iterator { struct ptlrpc_service *svc = s->private; struct ptlrpc_srh_iterator *srhi = iter; struct ptlrpc_service_part *svcpt; - __u64 seq; + u64 seq; int rc; int i; @@ -1120,7 +1120,7 @@ void ptlrpc_lprocfs_register_obd(struct obd_device *obddev) void ptlrpc_lprocfs_rpc_sent(struct ptlrpc_request *req, long amount) { struct lprocfs_stats *svc_stats; - __u32 op = lustre_msg_get_opc(req->rq_reqmsg); + u32 op = lustre_msg_get_opc(req->rq_reqmsg); int opc = opcode_offset(op); svc_stats = req->rq_import->imp_obd->obd_svc_stats; @@ -1243,7 +1243,7 @@ int lprocfs_wr_import(struct file *file, const char __user *buffer, uuid = kbuf + prefix_len; ptr = strstr(uuid, "::"); if (ptr) { - __u32 inst; + u32 inst; char *endptr; *ptr = 0; diff --git a/drivers/staging/lustre/lustre/ptlrpc/niobuf.c b/drivers/staging/lustre/lustre/ptlrpc/niobuf.c index 7e7db24..d3044a7 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/niobuf.c +++ b/drivers/staging/lustre/lustre/ptlrpc/niobuf.c @@ -48,7 +48,7 @@ static int ptl_send_buf(struct lnet_handle_md *mdh, void *base, int len, enum lnet_ack_req ack, struct ptlrpc_cb_id *cbid, lnet_nid_t self, struct lnet_process_id peer_id, - int portal, __u64 xid, unsigned int offset, + int portal, u64 xid, unsigned int offset, struct lnet_handle_md *bulk_cookie) { int rc; @@ -530,7 +530,7 @@ int ptl_send_rpc(struct ptlrpc_request *request, int noreply) * from the resend for reply timeout. */ if (request->rq_nr_resend && list_empty(&request->rq_unreplied_list)) { - __u64 min_xid = 0; + u64 min_xid = 0; /* * resend for EINPROGRESS, allocate new xid to avoid reply * reconstruction diff --git a/drivers/staging/lustre/lustre/ptlrpc/pack_generic.c b/drivers/staging/lustre/lustre/ptlrpc/pack_generic.c index 5fadd5e..1fadba2 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/pack_generic.c +++ b/drivers/staging/lustre/lustre/ptlrpc/pack_generic.c @@ -58,7 +58,7 @@ static inline u32 lustre_msg_hdr_size_v2(u32 count) lm_buflens[count])); } -u32 lustre_msg_hdr_size(__u32 magic, u32 count) +u32 lustre_msg_hdr_size(u32 magic, u32 count) { switch (magic) { case LUSTRE_MSG_MAGIC_V2: @@ -102,7 +102,7 @@ u32 lustre_msg_early_size(void) * XXX Remove this whenever we drop interoperability with such * client. */ - __u32 pblen = sizeof(struct ptlrpc_body_v2); + u32 pblen = sizeof(struct ptlrpc_body_v2); size = lustre_msg_size(LUSTRE_MSG_MAGIC_V2, 1, &pblen); } @@ -110,7 +110,7 @@ u32 lustre_msg_early_size(void) } EXPORT_SYMBOL(lustre_msg_early_size); -u32 lustre_msg_size_v2(int count, __u32 *lengths) +u32 lustre_msg_size_v2(int count, u32 *lengths) { u32 size; int i; @@ -130,9 +130,9 @@ u32 lustre_msg_size_v2(int count, __u32 *lengths) * target then the first buffer will be stripped because the ptlrpc * data is part of the lustre_msg_v1 header. b=14043 */ -u32 lustre_msg_size(__u32 magic, int count, __u32 *lens) +u32 lustre_msg_size(u32 magic, int count, u32 *lens) { - __u32 size[] = { sizeof(struct ptlrpc_body) }; + u32 size[] = { sizeof(struct ptlrpc_body) }; if (!lens) { LASSERT(count == 1); @@ -165,7 +165,7 @@ u32 lustre_packed_msg_size(struct lustre_msg *msg) } } -void lustre_init_msg_v2(struct lustre_msg_v2 *msg, int count, __u32 *lens, +void lustre_init_msg_v2(struct lustre_msg_v2 *msg, int count, u32 *lens, char **bufs) { char *ptr; @@ -193,7 +193,7 @@ void lustre_init_msg_v2(struct lustre_msg_v2 *msg, int count, __u32 *lens, EXPORT_SYMBOL(lustre_init_msg_v2); static int lustre_pack_request_v2(struct ptlrpc_request *req, - int count, __u32 *lens, char **bufs) + int count, u32 *lens, char **bufs) { int reqlen, rc; @@ -210,10 +210,10 @@ static int lustre_pack_request_v2(struct ptlrpc_request *req, return 0; } -int lustre_pack_request(struct ptlrpc_request *req, __u32 magic, int count, - __u32 *lens, char **bufs) +int lustre_pack_request(struct ptlrpc_request *req, u32 magic, int count, + u32 *lens, char **bufs) { - __u32 size[] = { sizeof(struct ptlrpc_body) }; + u32 size[] = { sizeof(struct ptlrpc_body) }; if (!lens) { LASSERT(count == 1); @@ -297,7 +297,7 @@ void lustre_put_emerg_rs(struct ptlrpc_reply_state *rs) } int lustre_pack_reply_v2(struct ptlrpc_request *req, int count, - __u32 *lens, char **bufs, int flags) + u32 *lens, char **bufs, int flags) { struct ptlrpc_reply_state *rs; int msg_len, rc; @@ -338,11 +338,11 @@ int lustre_pack_reply_v2(struct ptlrpc_request *req, int count, } EXPORT_SYMBOL(lustre_pack_reply_v2); -int lustre_pack_reply_flags(struct ptlrpc_request *req, int count, __u32 *lens, +int lustre_pack_reply_flags(struct ptlrpc_request *req, int count, u32 *lens, char **bufs, int flags) { int rc = 0; - __u32 size[] = { sizeof(struct ptlrpc_body) }; + u32 size[] = { sizeof(struct ptlrpc_body) }; if (!lens) { LASSERT(count == 1); @@ -367,7 +367,7 @@ int lustre_pack_reply_flags(struct ptlrpc_request *req, int count, __u32 *lens, return rc; } -int lustre_pack_reply(struct ptlrpc_request *req, int count, __u32 *lens, +int lustre_pack_reply(struct ptlrpc_request *req, int count, u32 *lens, char **bufs) { return lustre_pack_reply_flags(req, count, lens, bufs, 0); @@ -749,7 +749,7 @@ static inline struct ptlrpc_body *lustre_msg_ptlrpc_body(struct lustre_msg *msg) sizeof(struct ptlrpc_body_v2)); } -__u32 lustre_msghdr_get_flags(struct lustre_msg *msg) +u32 lustre_msghdr_get_flags(struct lustre_msg *msg) { switch (msg->lm_magic) { case LUSTRE_MSG_MAGIC_V2: @@ -762,7 +762,7 @@ __u32 lustre_msghdr_get_flags(struct lustre_msg *msg) } EXPORT_SYMBOL(lustre_msghdr_get_flags); -void lustre_msghdr_set_flags(struct lustre_msg *msg, __u32 flags) +void lustre_msghdr_set_flags(struct lustre_msg *msg, u32 flags) { switch (msg->lm_magic) { case LUSTRE_MSG_MAGIC_V2: @@ -773,7 +773,7 @@ void lustre_msghdr_set_flags(struct lustre_msg *msg, __u32 flags) } } -__u32 lustre_msg_get_flags(struct lustre_msg *msg) +u32 lustre_msg_get_flags(struct lustre_msg *msg) { switch (msg->lm_magic) { case LUSTRE_MSG_MAGIC_V2: { @@ -841,7 +841,7 @@ void lustre_msg_clear_flags(struct lustre_msg *msg, u32 flags) } EXPORT_SYMBOL(lustre_msg_clear_flags); -__u32 lustre_msg_get_op_flags(struct lustre_msg *msg) +u32 lustre_msg_get_op_flags(struct lustre_msg *msg) { switch (msg->lm_magic) { case LUSTRE_MSG_MAGIC_V2: { @@ -892,7 +892,7 @@ struct lustre_handle *lustre_msg_get_handle(struct lustre_msg *msg) } } -__u32 lustre_msg_get_type(struct lustre_msg *msg) +u32 lustre_msg_get_type(struct lustre_msg *msg) { switch (msg->lm_magic) { case LUSTRE_MSG_MAGIC_V2: { @@ -926,7 +926,7 @@ void lustre_msg_add_version(struct lustre_msg *msg, u32 version) } } -__u32 lustre_msg_get_opc(struct lustre_msg *msg) +u32 lustre_msg_get_opc(struct lustre_msg *msg) { switch (msg->lm_magic) { case LUSTRE_MSG_MAGIC_V2: { @@ -946,7 +946,7 @@ __u32 lustre_msg_get_opc(struct lustre_msg *msg) } EXPORT_SYMBOL(lustre_msg_get_opc); -__u16 lustre_msg_get_tag(struct lustre_msg *msg) +u16 lustre_msg_get_tag(struct lustre_msg *msg) { switch (msg->lm_magic) { case LUSTRE_MSG_MAGIC_V2: { @@ -965,7 +965,7 @@ __u16 lustre_msg_get_tag(struct lustre_msg *msg) } EXPORT_SYMBOL(lustre_msg_get_tag); -__u64 lustre_msg_get_last_committed(struct lustre_msg *msg) +u64 lustre_msg_get_last_committed(struct lustre_msg *msg) { switch (msg->lm_magic) { case LUSTRE_MSG_MAGIC_V2: { @@ -984,7 +984,7 @@ __u64 lustre_msg_get_last_committed(struct lustre_msg *msg) } EXPORT_SYMBOL(lustre_msg_get_last_committed); -__u64 *lustre_msg_get_versions(struct lustre_msg *msg) +u64 *lustre_msg_get_versions(struct lustre_msg *msg) { switch (msg->lm_magic) { case LUSTRE_MSG_MAGIC_V2: { @@ -1003,7 +1003,7 @@ __u64 *lustre_msg_get_versions(struct lustre_msg *msg) } EXPORT_SYMBOL(lustre_msg_get_versions); -__u64 lustre_msg_get_transno(struct lustre_msg *msg) +u64 lustre_msg_get_transno(struct lustre_msg *msg) { switch (msg->lm_magic) { case LUSTRE_MSG_MAGIC_V2: { @@ -1043,7 +1043,7 @@ int lustre_msg_get_status(struct lustre_msg *msg) } EXPORT_SYMBOL(lustre_msg_get_status); -__u64 lustre_msg_get_slv(struct lustre_msg *msg) +u64 lustre_msg_get_slv(struct lustre_msg *msg) { switch (msg->lm_magic) { case LUSTRE_MSG_MAGIC_V2: { @@ -1061,7 +1061,7 @@ __u64 lustre_msg_get_slv(struct lustre_msg *msg) } } -void lustre_msg_set_slv(struct lustre_msg *msg, __u64 slv) +void lustre_msg_set_slv(struct lustre_msg *msg, u64 slv) { switch (msg->lm_magic) { case LUSTRE_MSG_MAGIC_V2: { @@ -1080,7 +1080,7 @@ void lustre_msg_set_slv(struct lustre_msg *msg, __u64 slv) } } -__u32 lustre_msg_get_limit(struct lustre_msg *msg) +u32 lustre_msg_get_limit(struct lustre_msg *msg) { switch (msg->lm_magic) { case LUSTRE_MSG_MAGIC_V2: { @@ -1098,7 +1098,7 @@ __u32 lustre_msg_get_limit(struct lustre_msg *msg) } } -void lustre_msg_set_limit(struct lustre_msg *msg, __u64 limit) +void lustre_msg_set_limit(struct lustre_msg *msg, u64 limit) { switch (msg->lm_magic) { case LUSTRE_MSG_MAGIC_V2: { @@ -1117,7 +1117,7 @@ void lustre_msg_set_limit(struct lustre_msg *msg, __u64 limit) } } -__u32 lustre_msg_get_conn_cnt(struct lustre_msg *msg) +u32 lustre_msg_get_conn_cnt(struct lustre_msg *msg) { switch (msg->lm_magic) { case LUSTRE_MSG_MAGIC_V2: { @@ -1136,7 +1136,7 @@ __u32 lustre_msg_get_conn_cnt(struct lustre_msg *msg) } EXPORT_SYMBOL(lustre_msg_get_conn_cnt); -__u32 lustre_msg_get_magic(struct lustre_msg *msg) +u32 lustre_msg_get_magic(struct lustre_msg *msg) { switch (msg->lm_magic) { case LUSTRE_MSG_MAGIC_V2: @@ -1147,7 +1147,7 @@ __u32 lustre_msg_get_magic(struct lustre_msg *msg) } } -__u32 lustre_msg_get_timeout(struct lustre_msg *msg) +u32 lustre_msg_get_timeout(struct lustre_msg *msg) { switch (msg->lm_magic) { case LUSTRE_MSG_MAGIC_V2: { @@ -1165,7 +1165,7 @@ __u32 lustre_msg_get_timeout(struct lustre_msg *msg) } } -__u32 lustre_msg_get_service_time(struct lustre_msg *msg) +u32 lustre_msg_get_service_time(struct lustre_msg *msg) { switch (msg->lm_magic) { case LUSTRE_MSG_MAGIC_V2: { @@ -1183,7 +1183,7 @@ __u32 lustre_msg_get_service_time(struct lustre_msg *msg) } } -__u32 lustre_msg_get_cksum(struct lustre_msg *msg) +u32 lustre_msg_get_cksum(struct lustre_msg *msg) { switch (msg->lm_magic) { case LUSTRE_MSG_MAGIC_V2: @@ -1194,12 +1194,12 @@ __u32 lustre_msg_get_cksum(struct lustre_msg *msg) } } -__u32 lustre_msg_calc_cksum(struct lustre_msg *msg) +u32 lustre_msg_calc_cksum(struct lustre_msg *msg) { switch (msg->lm_magic) { case LUSTRE_MSG_MAGIC_V2: { struct ptlrpc_body *pb = lustre_msg_ptlrpc_body(msg); - __u32 crc; + u32 crc; unsigned int hsize = 4; cfs_crypto_hash_digest(CFS_HASH_ALG_CRC32, (unsigned char *)pb, @@ -1229,7 +1229,7 @@ void lustre_msg_set_handle(struct lustre_msg *msg, struct lustre_handle *handle) } } -void lustre_msg_set_type(struct lustre_msg *msg, __u32 type) +void lustre_msg_set_type(struct lustre_msg *msg, u32 type) { switch (msg->lm_magic) { case LUSTRE_MSG_MAGIC_V2: { @@ -1244,7 +1244,7 @@ void lustre_msg_set_type(struct lustre_msg *msg, __u32 type) } } -void lustre_msg_set_opc(struct lustre_msg *msg, __u32 opc) +void lustre_msg_set_opc(struct lustre_msg *msg, u32 opc) { switch (msg->lm_magic) { case LUSTRE_MSG_MAGIC_V2: { @@ -1274,7 +1274,7 @@ void lustre_msg_set_last_xid(struct lustre_msg *msg, u64 last_xid) } } -void lustre_msg_set_tag(struct lustre_msg *msg, __u16 tag) +void lustre_msg_set_tag(struct lustre_msg *msg, u16 tag) { switch (msg->lm_magic) { case LUSTRE_MSG_MAGIC_V2: { @@ -1290,7 +1290,7 @@ void lustre_msg_set_tag(struct lustre_msg *msg, __u16 tag) } EXPORT_SYMBOL(lustre_msg_set_tag); -void lustre_msg_set_versions(struct lustre_msg *msg, __u64 *versions) +void lustre_msg_set_versions(struct lustre_msg *msg, u64 *versions) { switch (msg->lm_magic) { case LUSTRE_MSG_MAGIC_V2: { @@ -1309,7 +1309,7 @@ void lustre_msg_set_versions(struct lustre_msg *msg, __u64 *versions) } EXPORT_SYMBOL(lustre_msg_set_versions); -void lustre_msg_set_transno(struct lustre_msg *msg, __u64 transno) +void lustre_msg_set_transno(struct lustre_msg *msg, u64 transno) { switch (msg->lm_magic) { case LUSTRE_MSG_MAGIC_V2: { @@ -1325,7 +1325,7 @@ void lustre_msg_set_transno(struct lustre_msg *msg, __u64 transno) } EXPORT_SYMBOL(lustre_msg_set_transno); -void lustre_msg_set_status(struct lustre_msg *msg, __u32 status) +void lustre_msg_set_status(struct lustre_msg *msg, u32 status) { switch (msg->lm_magic) { case LUSTRE_MSG_MAGIC_V2: { @@ -1341,7 +1341,7 @@ void lustre_msg_set_status(struct lustre_msg *msg, __u32 status) } EXPORT_SYMBOL(lustre_msg_set_status); -void lustre_msg_set_conn_cnt(struct lustre_msg *msg, __u32 conn_cnt) +void lustre_msg_set_conn_cnt(struct lustre_msg *msg, u32 conn_cnt) { switch (msg->lm_magic) { case LUSTRE_MSG_MAGIC_V2: { @@ -1356,7 +1356,7 @@ void lustre_msg_set_conn_cnt(struct lustre_msg *msg, __u32 conn_cnt) } } -void lustre_msg_set_timeout(struct lustre_msg *msg, __u32 timeout) +void lustre_msg_set_timeout(struct lustre_msg *msg, u32 timeout) { switch (msg->lm_magic) { case LUSTRE_MSG_MAGIC_V2: { @@ -1371,7 +1371,7 @@ void lustre_msg_set_timeout(struct lustre_msg *msg, __u32 timeout) } } -void lustre_msg_set_service_time(struct lustre_msg *msg, __u32 service_time) +void lustre_msg_set_service_time(struct lustre_msg *msg, u32 service_time) { switch (msg->lm_magic) { case LUSTRE_MSG_MAGIC_V2: { @@ -1390,7 +1390,7 @@ void lustre_msg_set_jobid(struct lustre_msg *msg, char *jobid) { switch (msg->lm_magic) { case LUSTRE_MSG_MAGIC_V2: { - __u32 opc = lustre_msg_get_opc(msg); + u32 opc = lustre_msg_get_opc(msg); struct ptlrpc_body *pb; /* Don't set jobid for ldlm ast RPCs, they've been shrunk. @@ -1416,7 +1416,7 @@ void lustre_msg_set_jobid(struct lustre_msg *msg, char *jobid) } EXPORT_SYMBOL(lustre_msg_set_jobid); -void lustre_msg_set_cksum(struct lustre_msg *msg, __u32 cksum) +void lustre_msg_set_cksum(struct lustre_msg *msg, u32 cksum) { switch (msg->lm_magic) { case LUSTRE_MSG_MAGIC_V2: @@ -1427,7 +1427,7 @@ void lustre_msg_set_cksum(struct lustre_msg *msg, __u32 cksum) } } -void lustre_msg_set_mbits(struct lustre_msg *msg, __u64 mbits) +void lustre_msg_set_mbits(struct lustre_msg *msg, u64 mbits) { switch (msg->lm_magic) { case LUSTRE_MSG_MAGIC_V2: { @@ -1677,7 +1677,7 @@ void lustre_swab_ost_last_id(u64 *id) __swab64s(id); } -void lustre_swab_generic_32s(__u32 *val) +void lustre_swab_generic_32s(u32 *val) { __swab32s(val); } @@ -1784,14 +1784,14 @@ void lustre_swab_mgs_target_info(struct mgs_target_info *mti) __swab32s(&mti->mti_flags); __swab32s(&mti->mti_instance); __swab32s(&mti->mti_nid_count); - BUILD_BUG_ON(sizeof(lnet_nid_t) != sizeof(__u64)); + BUILD_BUG_ON(sizeof(lnet_nid_t) != sizeof(u64)); for (i = 0; i < MTI_NIDS_MAX; i++) __swab64s(&mti->mti_nids[i]); } void lustre_swab_mgs_nidtbl_entry(struct mgs_nidtbl_entry *entry) { - __u8 i; + u8 i; __swab64s(&entry->mne_version); __swab32s(&entry->mne_instance); @@ -1800,13 +1800,13 @@ void lustre_swab_mgs_nidtbl_entry(struct mgs_nidtbl_entry *entry) /* mne_nid_(count|type) must be one byte size because we're gonna * access it w/o swapping. */ - BUILD_BUG_ON(sizeof(entry->mne_nid_count) != sizeof(__u8)); - BUILD_BUG_ON(sizeof(entry->mne_nid_type) != sizeof(__u8)); + BUILD_BUG_ON(sizeof(entry->mne_nid_count) != sizeof(u8)); + BUILD_BUG_ON(sizeof(entry->mne_nid_type) != sizeof(u8)); /* remove this assertion if ipv6 is supported. */ LASSERT(entry->mne_nid_type == 0); for (i = 0; i < entry->mne_nid_count; i++) { - BUILD_BUG_ON(sizeof(lnet_nid_t) != sizeof(__u64)); + BUILD_BUG_ON(sizeof(lnet_nid_t) != sizeof(u64)); __swab64s(&entry->u.nids[i]); } } @@ -1877,7 +1877,7 @@ static void lustre_swab_fiemap_extent(struct fiemap_extent *fm_extent) void lustre_swab_fiemap(struct fiemap *fiemap) { - __u32 i; + u32 i; __swab64s(&fiemap->fm_start); __swab64s(&fiemap->fm_length); @@ -2171,7 +2171,7 @@ void dump_rniobuf(struct niobuf_remote *nb) static void dump_obdo(struct obdo *oa) { - __u32 valid = oa->o_valid; + u32 valid = oa->o_valid; CDEBUG(D_RPCTRACE, "obdo: o_valid = %08x\n", valid); if (valid & OBD_MD_FLID) @@ -2234,7 +2234,7 @@ void dump_ost_body(struct ost_body *ob) dump_obdo(&ob->oa); } -void dump_rcs(__u32 *rc) +void dump_rcs(u32 *rc) { CDEBUG(D_RPCTRACE, "rmf_rcs: %d\n", *rc); } diff --git a/drivers/staging/lustre/lustre/ptlrpc/ptlrpc_internal.h b/drivers/staging/lustre/lustre/ptlrpc/ptlrpc_internal.h index da42b99..10c2520 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/ptlrpc_internal.h +++ b/drivers/staging/lustre/lustre/ptlrpc/ptlrpc_internal.h @@ -73,7 +73,7 @@ void ptlrpc_set_add_new_req(struct ptlrpcd_ctl *pc, void ptlrpc_resend_req(struct ptlrpc_request *request); void ptlrpc_set_bulk_mbits(struct ptlrpc_request *req); void ptlrpc_assign_next_xid_nolock(struct ptlrpc_request *req); -__u64 ptlrpc_known_replied_xid(struct obd_import *imp); +u64 ptlrpc_known_replied_xid(struct obd_import *imp); void ptlrpc_add_unreplied(struct ptlrpc_request *req); /* events.c */ @@ -83,7 +83,7 @@ void ptlrpc_set_add_new_req(struct ptlrpcd_ctl *pc, void ptlrpc_request_handle_notconn(struct ptlrpc_request *req); void lustre_assert_wire_constants(void); int ptlrpc_import_in_recovery(struct obd_import *imp); -int ptlrpc_set_import_discon(struct obd_import *imp, __u32 conn_cnt); +int ptlrpc_set_import_discon(struct obd_import *imp, u32 conn_cnt); int ptlrpc_replay_next(struct obd_import *imp, int *inflight); void ptlrpc_initiate_recovery(struct obd_import *imp); diff --git a/drivers/staging/lustre/lustre/ptlrpc/ptlrpcd.c b/drivers/staging/lustre/lustre/ptlrpc/ptlrpcd.c index 4bd0d9d..e39c38a 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/ptlrpcd.c +++ b/drivers/staging/lustre/lustre/ptlrpc/ptlrpcd.c @@ -672,7 +672,7 @@ static int ptlrpcd_init(void) int j; int rc = 0; struct cfs_cpt_table *cptable; - __u32 *cpts = NULL; + u32 *cpts = NULL; int ncpts; int cpt; struct ptlrpcd *pd; diff --git a/drivers/staging/lustre/lustre/ptlrpc/recover.c b/drivers/staging/lustre/lustre/ptlrpc/recover.c index 9d369f8..ed769a4 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/recover.c +++ b/drivers/staging/lustre/lustre/ptlrpc/recover.c @@ -67,7 +67,7 @@ int ptlrpc_replay_next(struct obd_import *imp, int *inflight) { int rc = 0; struct ptlrpc_request *req = NULL, *pos; - __u64 last_transno; + u64 last_transno; *inflight = 0; diff --git a/drivers/staging/lustre/lustre/ptlrpc/sec.c b/drivers/staging/lustre/lustre/ptlrpc/sec.c index 53f4d4f..165082a 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/sec.c +++ b/drivers/staging/lustre/lustre/ptlrpc/sec.c @@ -64,7 +64,7 @@ int sptlrpc_register_policy(struct ptlrpc_sec_policy *policy) { - __u16 number = policy->sp_policy; + u16 number = policy->sp_policy; LASSERT(policy->sp_name); LASSERT(policy->sp_cops); @@ -88,7 +88,7 @@ int sptlrpc_register_policy(struct ptlrpc_sec_policy *policy) int sptlrpc_unregister_policy(struct ptlrpc_sec_policy *policy) { - __u16 number = policy->sp_policy; + u16 number = policy->sp_policy; LASSERT(number < SPTLRPC_POLICY_MAX); @@ -109,13 +109,13 @@ int sptlrpc_unregister_policy(struct ptlrpc_sec_policy *policy) EXPORT_SYMBOL(sptlrpc_unregister_policy); static -struct ptlrpc_sec_policy *sptlrpc_wireflavor2policy(__u32 flavor) +struct ptlrpc_sec_policy *sptlrpc_wireflavor2policy(u32 flavor) { static DEFINE_MUTEX(load_mutex); static atomic_t loaded = ATOMIC_INIT(0); struct ptlrpc_sec_policy *policy; - __u16 number = SPTLRPC_FLVR_POLICY(flavor); - __u16 flag = 0; + u16 number = SPTLRPC_FLVR_POLICY(flavor); + u16 flag = 0; if (number >= SPTLRPC_POLICY_MAX) return NULL; @@ -150,7 +150,7 @@ struct ptlrpc_sec_policy *sptlrpc_wireflavor2policy(__u32 flavor) return policy; } -__u32 sptlrpc_name2flavor_base(const char *name) +u32 sptlrpc_name2flavor_base(const char *name) { if (!strcmp(name, "null")) return SPTLRPC_FLVR_NULL; @@ -169,9 +169,9 @@ __u32 sptlrpc_name2flavor_base(const char *name) } EXPORT_SYMBOL(sptlrpc_name2flavor_base); -const char *sptlrpc_flavor2name_base(__u32 flvr) +const char *sptlrpc_flavor2name_base(u32 flvr) { - __u32 base = SPTLRPC_FLVR_BASE(flvr); + u32 base = SPTLRPC_FLVR_BASE(flvr); if (base == SPTLRPC_FLVR_BASE(SPTLRPC_FLVR_NULL)) return "null"; @@ -226,7 +226,7 @@ char *sptlrpc_flavor2name(struct sptlrpc_flavor *sf, char *buf, int bufsize) } EXPORT_SYMBOL(sptlrpc_flavor2name); -static char *sptlrpc_secflags2str(__u32 flags, char *buf, int bufsize) +static char *sptlrpc_secflags2str(u32 flags, char *buf, int bufsize) { buf[0] = '\0'; @@ -2280,7 +2280,7 @@ int sptlrpc_unpack_user_desc(struct lustre_msg *msg, int offset, int swabbed) return -EINVAL; } - if (sizeof(*pud) + pud->pud_ngroups * sizeof(__u32) > + if (sizeof(*pud) + pud->pud_ngroups * sizeof(u32) > msg->lm_buflens[offset]) { CERROR("%u groups are claimed but bufsize only %u\n", pud->pud_ngroups, msg->lm_buflens[offset]); diff --git a/drivers/staging/lustre/lustre/ptlrpc/sec_bulk.c b/drivers/staging/lustre/lustre/ptlrpc/sec_bulk.c index dbd6c74..93dcb6d 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/sec_bulk.c +++ b/drivers/staging/lustre/lustre/ptlrpc/sec_bulk.c @@ -485,12 +485,12 @@ void sptlrpc_enc_pool_fini(void) [BULK_HASH_ALG_SHA512] = CFS_HASH_ALG_SHA512, }; -const char *sptlrpc_get_hash_name(__u8 hash_alg) +const char *sptlrpc_get_hash_name(u8 hash_alg) { return cfs_crypto_hash_name(cfs_hash_alg_id[hash_alg]); } -__u8 sptlrpc_get_hash_alg(const char *algname) +u8 sptlrpc_get_hash_alg(const char *algname) { return cfs_crypto_hash_alg(algname); } @@ -532,7 +532,7 @@ int bulk_sec_desc_unpack(struct lustre_msg *msg, int offset, int swabbed) } EXPORT_SYMBOL(bulk_sec_desc_unpack); -int sptlrpc_get_bulk_checksum(struct ptlrpc_bulk_desc *desc, __u8 alg, +int sptlrpc_get_bulk_checksum(struct ptlrpc_bulk_desc *desc, u8 alg, void *buf, int buflen) { struct ahash_request *hdesc; diff --git a/drivers/staging/lustre/lustre/ptlrpc/sec_null.c b/drivers/staging/lustre/lustre/ptlrpc/sec_null.c index ecc387d..6933a53 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/sec_null.c +++ b/drivers/staging/lustre/lustre/ptlrpc/sec_null.c @@ -57,7 +57,7 @@ static inline void null_encode_sec_part(struct lustre_msg *msg, enum lustre_sec_part sp) { - msg->lm_secflvr |= (((__u32)sp) & 0xFF) << 24; + msg->lm_secflvr |= (((u32)sp) & 0xFF) << 24; } static inline @@ -91,7 +91,7 @@ int null_ctx_sign(struct ptlrpc_cli_ctx *ctx, struct ptlrpc_request *req) static int null_ctx_verify(struct ptlrpc_cli_ctx *ctx, struct ptlrpc_request *req) { - __u32 cksums, cksumc; + u32 cksums, cksumc; LASSERT(req->rq_repdata); @@ -361,7 +361,7 @@ int null_authorize(struct ptlrpc_request *req) else req->rq_reply_off = 0; } else { - __u32 cksum; + u32 cksum; cksum = lustre_msg_calc_cksum(rs->rs_repbuf); lustre_msg_set_cksum(rs->rs_repbuf, cksum); diff --git a/drivers/staging/lustre/lustre/ptlrpc/sec_plain.c b/drivers/staging/lustre/lustre/ptlrpc/sec_plain.c index ead1df7..0a31ff4 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/sec_plain.c +++ b/drivers/staging/lustre/lustre/ptlrpc/sec_plain.c @@ -76,15 +76,15 @@ static inline struct plain_sec *sec2plsec(struct ptlrpc_sec *sec) #define PLAIN_FL_BULK (0x02) struct plain_header { - __u8 ph_ver; /* 0 */ - __u8 ph_flags; - __u8 ph_sp; /* source */ - __u8 ph_bulk_hash_alg; /* complete flavor desc */ - __u8 ph_pad[4]; + u8 ph_ver; /* 0 */ + u8 ph_flags; + u8 ph_sp; /* source */ + u8 ph_bulk_hash_alg; /* complete flavor desc */ + u8 ph_pad[4]; }; struct plain_bulk_token { - __u8 pbt_hash[8]; + u8 pbt_hash[8]; }; #define PLAIN_BSD_SIZE \ @@ -118,7 +118,7 @@ static int plain_unpack_bsd(struct lustre_msg *msg, int swabbed) } static int plain_generate_bulk_csum(struct ptlrpc_bulk_desc *desc, - __u8 hash_alg, + u8 hash_alg, struct plain_bulk_token *token) { if (hash_alg == BULK_HASH_ALG_NULL) @@ -130,7 +130,7 @@ static int plain_generate_bulk_csum(struct ptlrpc_bulk_desc *desc, } static int plain_verify_bulk_csum(struct ptlrpc_bulk_desc *desc, - __u8 hash_alg, + u8 hash_alg, struct plain_bulk_token *tokenr) { struct plain_bulk_token tokenv; @@ -216,7 +216,7 @@ int plain_ctx_verify(struct ptlrpc_cli_ctx *ctx, struct ptlrpc_request *req) { struct lustre_msg *msg = req->rq_repdata; struct plain_header *phdr; - __u32 cksum; + u32 cksum; int swabbed; if (msg->lm_bufcount != PLAIN_PACK_SEGMENTS) { @@ -543,7 +543,7 @@ int plain_alloc_reqbuf(struct ptlrpc_sec *sec, struct ptlrpc_request *req, int msgsize) { - __u32 buflens[PLAIN_PACK_SEGMENTS] = { 0, }; + u32 buflens[PLAIN_PACK_SEGMENTS] = { 0, }; int alloc_len; buflens[PLAIN_PACK_HDR_OFF] = sizeof(struct plain_header); @@ -603,7 +603,7 @@ int plain_alloc_repbuf(struct ptlrpc_sec *sec, struct ptlrpc_request *req, int msgsize) { - __u32 buflens[PLAIN_PACK_SEGMENTS] = { 0, }; + u32 buflens[PLAIN_PACK_SEGMENTS] = { 0, }; int alloc_len; buflens[PLAIN_PACK_HDR_OFF] = sizeof(struct plain_header); @@ -790,7 +790,7 @@ int plain_accept(struct ptlrpc_request *req) int plain_alloc_rs(struct ptlrpc_request *req, int msgsize) { struct ptlrpc_reply_state *rs; - __u32 buflens[PLAIN_PACK_SEGMENTS] = { 0, }; + u32 buflens[PLAIN_PACK_SEGMENTS] = { 0, }; int rs_size = sizeof(*rs); LASSERT(msgsize % 8 == 0); @@ -1001,7 +1001,7 @@ int plain_svc_wrap_bulk(struct ptlrpc_request *req, int sptlrpc_plain_init(void) { - __u32 buflens[PLAIN_PACK_SEGMENTS] = { 0, }; + u32 buflens[PLAIN_PACK_SEGMENTS] = { 0, }; int rc; buflens[PLAIN_PACK_MSG_OFF] = lustre_msg_early_size(); diff --git a/drivers/staging/lustre/lustre/ptlrpc/service.c b/drivers/staging/lustre/lustre/ptlrpc/service.c index 6a5a9c5..1030f65 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/service.c +++ b/drivers/staging/lustre/lustre/ptlrpc/service.c @@ -507,7 +507,7 @@ static void ptlrpc_at_timer(struct timer_list *t) INIT_LIST_HEAD(&array->paa_reqs_array[index]); array->paa_reqs_count = - kzalloc_node(sizeof(__u32) * size, GFP_NOFS, + kzalloc_node(sizeof(u32) * size, GFP_NOFS, cfs_cpt_spread_node(svc->srv_cptable, cpt)); if (!array->paa_reqs_count) goto free_reqs_array; @@ -555,7 +555,7 @@ struct ptlrpc_service * struct ptlrpc_service *service; struct ptlrpc_service_part *svcpt; struct cfs_cpt_table *cptable; - __u32 *cpts = NULL; + u32 *cpts = NULL; int ncpts; int cpt; int rc; @@ -925,7 +925,7 @@ static int ptlrpc_check_req(struct ptlrpc_request *req) static void ptlrpc_at_set_timer(struct ptlrpc_service_part *svcpt) { struct ptlrpc_at_array *array = &svcpt->scp_at_array; - __s32 next; + s32 next; if (array->paa_count == 0) { del_timer(&svcpt->scp_at_timer); @@ -933,7 +933,7 @@ static void ptlrpc_at_set_timer(struct ptlrpc_service_part *svcpt) } /* Set timer for closest deadline */ - next = (__s32)(array->paa_deadline - ktime_get_real_seconds() - + next = (s32)(array->paa_deadline - ktime_get_real_seconds() - at_early_margin); if (next <= 0) { ptlrpc_at_timer(&svcpt->scp_at_timer); @@ -950,7 +950,7 @@ static int ptlrpc_at_add_timed(struct ptlrpc_request *req) struct ptlrpc_service_part *svcpt = req->rq_rqbd->rqbd_svcpt; struct ptlrpc_at_array *array = &svcpt->scp_at_array; struct ptlrpc_request *rq = NULL; - __u32 index; + u32 index; if (AT_OFF) return 0; @@ -1158,7 +1158,7 @@ static void ptlrpc_at_check_timed(struct ptlrpc_service_part *svcpt) struct ptlrpc_at_array *array = &svcpt->scp_at_array; struct ptlrpc_request *rq, *n; struct list_head work_list; - __u32 index, count; + u32 index, count; time64_t deadline; time64_t now = ktime_get_real_seconds(); long delay; @@ -1478,7 +1478,7 @@ static bool ptlrpc_server_normal_pending(struct ptlrpc_service_part *svcpt, { struct ptlrpc_service *svc = svcpt->scp_service; struct ptlrpc_request *req; - __u32 deadline; + u32 deadline; int rc; spin_lock(&svcpt->scp_lock); @@ -1757,7 +1757,7 @@ static bool ptlrpc_server_normal_pending(struct ptlrpc_service_part *svcpt, (request->rq_repmsg ? lustre_msg_get_status(request->rq_repmsg) : -999)); if (likely(svc->srv_stats && request->rq_reqmsg)) { - __u32 op = lustre_msg_get_opc(request->rq_reqmsg); + u32 op = lustre_msg_get_opc(request->rq_reqmsg); int opc = opcode_offset(op); if (opc > 0 && !(op == LDLM_ENQUEUE || op == MDS_REINT)) { -- 1.8.3.1 From jsimmons at infradead.org Thu Jan 31 17:19:06 2019 From: jsimmons at infradead.org (James Simmons) Date: Thu, 31 Jan 2019 12:19:06 -0500 Subject: [lustre-devel] [PATCH 02/26] lnet: use kernel types for lnet klnd kernel code In-Reply-To: <1548955170-13456-1-git-send-email-jsimmons@infradead.org> References: <1548955170-13456-1-git-send-email-jsimmons@infradead.org> Message-ID: <1548955170-13456-3-git-send-email-jsimmons@infradead.org> LNet klnd drivers was originally both a user land and kernel implementation. The source contains many types of the form __u32 but since this is mostly kernel code change the types to kernel internal types. Signed-off-by: James Simmons --- .../staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c | 30 ++--- .../staging/lustre/lnet/klnds/o2iblnd/o2iblnd.h | 126 ++++++++++----------- .../staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c | 22 ++-- .../staging/lustre/lnet/klnds/socklnd/socklnd.c | 54 ++++----- .../staging/lustre/lnet/klnds/socklnd/socklnd.h | 44 +++---- .../staging/lustre/lnet/klnds/socklnd/socklnd_cb.c | 8 +- .../lustre/lnet/klnds/socklnd/socklnd_lib.c | 4 +- .../lustre/lnet/klnds/socklnd/socklnd_proto.c | 24 ++-- 8 files changed, 156 insertions(+), 156 deletions(-) diff --git a/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c b/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c index bd7ff7d..1a6bc45 100644 --- a/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c +++ b/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c @@ -44,10 +44,10 @@ struct kib_data kiblnd_data; -static __u32 kiblnd_cksum(void *ptr, int nob) +static u32 kiblnd_cksum(void *ptr, int nob) { char *c = ptr; - __u32 sum = 0; + u32 sum = 0; while (nob-- > 0) sum = ((sum << 1) | (sum >> 31)) + *c++; @@ -175,7 +175,7 @@ static int kiblnd_unpack_rd(struct kib_msg *msg, int flip) } void kiblnd_pack_msg(struct lnet_ni *ni, struct kib_msg *msg, int version, - int credits, lnet_nid_t dstnid, __u64 dststamp) + int credits, lnet_nid_t dstnid, u64 dststamp) { struct kib_net *net = ni->ni_data; @@ -203,8 +203,8 @@ void kiblnd_pack_msg(struct lnet_ni *ni, struct kib_msg *msg, int version, int kiblnd_unpack_msg(struct kib_msg *msg, int nob) { const int hdr_size = offsetof(struct kib_msg, ibm_u); - __u32 msg_cksum; - __u16 version; + u32 msg_cksum; + u16 version; int msg_nob; int flip; @@ -994,7 +994,7 @@ int kiblnd_close_peer_conns_locked(struct kib_peer_ni *peer_ni, int why) } int kiblnd_close_stale_conns_locked(struct kib_peer_ni *peer_ni, - int version, __u64 incarnation) + int version, u64 incarnation) { struct kib_conn *conn; struct list_head *ctmp; @@ -1240,7 +1240,7 @@ void kiblnd_map_rx_descs(struct kib_conn *conn) CDEBUG(D_NET, "rx %d: %p %#llx(%#llx)\n", i, rx->rx_msg, rx->rx_msgaddr, - (__u64)(page_to_phys(pg) + pg_off)); + (u64)(page_to_phys(pg) + pg_off)); pg_off += IBLND_MSG_SIZE; LASSERT(pg_off <= PAGE_SIZE); @@ -1610,7 +1610,7 @@ static int kiblnd_fmr_pool_is_idle(struct kib_fmr_pool *fpo, time64_t now) static int kiblnd_map_tx_pages(struct kib_tx *tx, struct kib_rdma_desc *rd) { - __u64 *pages = tx->tx_pages; + u64 *pages = tx->tx_pages; struct kib_hca_dev *hdev; int npages; int size; @@ -1685,15 +1685,15 @@ void kiblnd_fmr_pool_unmap(struct kib_fmr *fmr, int status) } int kiblnd_fmr_pool_map(struct kib_fmr_poolset *fps, struct kib_tx *tx, - struct kib_rdma_desc *rd, __u32 nob, __u64 iov, + struct kib_rdma_desc *rd, u32 nob, u64 iov, struct kib_fmr *fmr) { - __u64 *pages = tx->tx_pages; + u64 *pages = tx->tx_pages; bool is_rx = (rd != tx->tx_rd); bool tx_pages_mapped = false; struct kib_fmr_pool *fpo; int npages = 0; - __u64 version; + u64 version; int rc; again: @@ -1740,7 +1740,7 @@ int kiblnd_fmr_pool_map(struct kib_fmr_poolset *fps, struct kib_tx *tx, mr = frd->frd_mr; if (!frd->frd_valid) { - __u32 key = is_rx ? mr->rkey : mr->lkey; + u32 key = is_rx ? mr->rkey : mr->lkey; struct ib_send_wr *inv_wr; inv_wr = &frd->frd_inv_wr; @@ -2204,7 +2204,7 @@ static void kiblnd_net_fini_pools(struct kib_net *net) } static int kiblnd_net_init_pools(struct kib_net *net, struct lnet_ni *ni, - __u32 *cpts, int ncpts) + u32 *cpts, int ncpts) { struct lnet_ioctl_config_o2iblnd_tunables *tunables; int cpt; @@ -2303,7 +2303,7 @@ static int kiblnd_hdev_get_attr(struct kib_hca_dev *hdev) */ hdev->ibh_page_shift = PAGE_SHIFT; hdev->ibh_page_size = 1 << PAGE_SHIFT; - hdev->ibh_page_mask = ~((__u64)hdev->ibh_page_size - 1); + hdev->ibh_page_mask = ~((u64)hdev->ibh_page_size - 1); if (hdev->ibh_ibdev->ops.alloc_fmr && hdev->ibh_ibdev->ops.dealloc_fmr && @@ -2878,7 +2878,7 @@ static int kiblnd_start_schedulers(struct kib_sched_info *sched) return rc; } -static int kiblnd_dev_start_threads(struct kib_dev *dev, int newdev, __u32 *cpts, +static int kiblnd_dev_start_threads(struct kib_dev *dev, int newdev, u32 *cpts, int ncpts) { int cpt; diff --git a/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.h b/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.h index 2ddd83b..423bae7 100644 --- a/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.h +++ b/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.h @@ -157,7 +157,7 @@ enum kib_dev_caps { struct kib_dev { struct list_head ibd_list; /* chain on kib_devs */ struct list_head ibd_fail_list; /* chain on kib_failed_devs */ - __u32 ibd_ifip; /* IPoIB interface IP */ + u32 ibd_ifip; /* IPoIB interface IP */ /* IPoIB interface name */ char ibd_ifname[KIB_IFNAME_SIZE]; @@ -177,9 +177,9 @@ struct kib_hca_dev { struct ib_device *ibh_ibdev; /* IB device */ int ibh_page_shift; /* page shift of current HCA */ int ibh_page_size; /* page size of current HCA */ - __u64 ibh_page_mask; /* page mask of current HCA */ + u64 ibh_page_mask; /* page mask of current HCA */ int ibh_mr_shift; /* bits shift of max MR size */ - __u64 ibh_mr_size; /* size of MR */ + u64 ibh_mr_size; /* size of MR */ struct ib_pd *ibh_pd; /* PD */ struct kib_dev *ibh_dev; /* owner */ atomic_t ibh_ref; /* refcount */ @@ -238,7 +238,7 @@ struct kib_pool { struct kib_tx_poolset { struct kib_poolset tps_poolset; /* pool-set */ - __u64 tps_next_tx_cookie; /* cookie of TX */ + u64 tps_next_tx_cookie; /* cookie of TX */ }; struct kib_tx_pool { @@ -253,7 +253,7 @@ struct kib_fmr_poolset { struct kib_net *fps_net; /* IB network */ struct list_head fps_pool_list; /* FMR pool list */ struct list_head fps_failed_pool_list;/* FMR pool list */ - __u64 fps_version; /* validity stamp */ + u64 fps_version; /* validity stamp */ int fps_cpt; /* CPT id */ int fps_pool_size; int fps_flush_trigger; @@ -299,7 +299,7 @@ struct kib_fmr { struct kib_net { struct list_head ibn_list; /* chain on struct kib_dev::ibd_nets */ - __u64 ibn_incarnation;/* my epoch */ + u64 ibn_incarnation;/* my epoch */ int ibn_init; /* initialisation state */ int ibn_shutdown; /* shutting down? */ @@ -365,9 +365,9 @@ struct kib_data { */ struct kib_connparams { - __u16 ibcp_queue_depth; - __u16 ibcp_max_frags; - __u32 ibcp_max_msg_size; + u16 ibcp_queue_depth; + u16 ibcp_max_frags; + u32 ibcp_max_msg_size; } __packed; struct kib_immediate_msg { @@ -376,51 +376,51 @@ struct kib_immediate_msg { } __packed; struct kib_rdma_frag { - __u32 rf_nob; /* # bytes this frag */ - __u64 rf_addr; /* CAVEAT EMPTOR: misaligned!! */ + u32 rf_nob; /* # bytes this frag */ + u64 rf_addr; /* CAVEAT EMPTOR: misaligned!! */ } __packed; struct kib_rdma_desc { - __u32 rd_key; /* local/remote key */ - __u32 rd_nfrags; /* # fragments */ + u32 rd_key; /* local/remote key */ + u32 rd_nfrags; /* # fragments */ struct kib_rdma_frag rd_frags[0]; /* buffer frags */ } __packed; struct kib_putreq_msg { struct lnet_hdr ibprm_hdr; /* portals header */ - __u64 ibprm_cookie; /* opaque completion cookie */ + u64 ibprm_cookie; /* opaque completion cookie */ } __packed; struct kib_putack_msg { - __u64 ibpam_src_cookie; /* reflected completion cookie */ - __u64 ibpam_dst_cookie; /* opaque completion cookie */ + u64 ibpam_src_cookie; /* reflected completion cookie */ + u64 ibpam_dst_cookie; /* opaque completion cookie */ struct kib_rdma_desc ibpam_rd; /* sender's sink buffer */ } __packed; struct kib_get_msg { struct lnet_hdr ibgm_hdr; /* portals header */ - __u64 ibgm_cookie; /* opaque completion cookie */ + u64 ibgm_cookie; /* opaque completion cookie */ struct kib_rdma_desc ibgm_rd; /* rdma descriptor */ } __packed; struct kib_completion_msg { - __u64 ibcm_cookie; /* opaque completion cookie */ - __s32 ibcm_status; /* < 0 failure: >= 0 length */ + u64 ibcm_cookie; /* opaque completion cookie */ + s32 ibcm_status; /* < 0 failure: >= 0 length */ } __packed; struct kib_msg { /* First 2 fields fixed FOR ALL TIME */ - __u32 ibm_magic; /* I'm an ibnal message */ - __u16 ibm_version; /* this is my version number */ - - __u8 ibm_type; /* msg type */ - __u8 ibm_credits; /* returned credits */ - __u32 ibm_nob; /* # bytes in whole message */ - __u32 ibm_cksum; /* checksum (0 == no checksum) */ - __u64 ibm_srcnid; /* sender's NID */ - __u64 ibm_srcstamp; /* sender's incarnation */ - __u64 ibm_dstnid; /* destination's NID */ - __u64 ibm_dststamp; /* destination's incarnation */ + u32 ibm_magic; /* I'm an ibnal message */ + u16 ibm_version; /* this is my version number */ + + u8 ibm_type; /* msg type */ + u8 ibm_credits; /* returned credits */ + u32 ibm_nob; /* # bytes in whole message */ + u32 ibm_cksum; /* checksum (0 == no checksum) */ + u64 ibm_srcnid; /* sender's NID */ + u64 ibm_srcstamp; /* sender's incarnation */ + u64 ibm_dstnid; /* destination's NID */ + u64 ibm_dststamp; /* destination's incarnation */ union { struct kib_connparams connparams; @@ -450,11 +450,11 @@ struct kib_msg { #define IBLND_MSG_GET_DONE 0xd7 /* completion (src->sink: all OK) */ struct kib_rej { - __u32 ibr_magic; /* sender's magic */ - __u16 ibr_version; /* sender's version */ - __u8 ibr_why; /* reject reason */ - __u8 ibr_padding; /* padding */ - __u64 ibr_incarnation; /* incarnation of peer_ni */ + u32 ibr_magic; /* sender's magic */ + u16 ibr_version; /* sender's version */ + u8 ibr_why; /* reject reason */ + u8 ibr_padding; /* padding */ + u64 ibr_incarnation; /* incarnation of peer_ni */ struct kib_connparams ibr_cp; /* connection parameters */ } __packed; @@ -478,7 +478,7 @@ struct kib_rx { /* receive message */ int rx_nob; /* # bytes received (-1 while posted) */ enum ib_wc_status rx_status; /* completion status */ struct kib_msg *rx_msg; /* message buffer (host vaddr) */ - __u64 rx_msgaddr; /* message buffer (I/O addr) */ + u64 rx_msgaddr; /* message buffer (I/O addr) */ DEFINE_DMA_UNMAP_ADDR(rx_msgunmap); /* for dma_unmap_single() */ struct ib_recv_wr rx_wrq; /* receive work item... */ struct ib_sge rx_sge; /* ...and its memory */ @@ -498,10 +498,10 @@ struct kib_tx { /* transmit message */ short tx_waiting; /* waiting for peer_ni */ int tx_status; /* LNET completion status */ ktime_t tx_deadline; /* completion deadline */ - __u64 tx_cookie; /* completion cookie */ + u64 tx_cookie; /* completion cookie */ struct lnet_msg *tx_lntmsg[2]; /* lnet msgs to finalize on completion */ struct kib_msg *tx_msg; /* message buffer (host vaddr) */ - __u64 tx_msgaddr; /* message buffer (I/O addr) */ + u64 tx_msgaddr; /* message buffer (I/O addr) */ DEFINE_DMA_UNMAP_ADDR(tx_msgunmap); /* for dma_unmap_single() */ /** sge for tx_msgaddr */ struct ib_sge tx_msgsge; @@ -513,7 +513,7 @@ struct kib_tx { /* transmit message */ struct kib_rdma_desc *tx_rd; /* rdma descriptor */ int tx_nfrags; /* # entries in... */ struct scatterlist *tx_frags; /* dma_map_sg descriptor */ - __u64 *tx_pages; /* rdma phys page addrs */ + u64 *tx_pages; /* rdma phys page addrs */ /* gaps in fragments */ bool tx_gaps; struct kib_fmr tx_fmr; /* FMR */ @@ -530,10 +530,10 @@ struct kib_conn { struct kib_hca_dev *ibc_hdev; /* HCA bound on */ struct list_head ibc_list; /* stash on peer_ni's conn list */ struct list_head ibc_sched_list; /* schedule for attention */ - __u16 ibc_version; /* version of connection */ + u16 ibc_version; /* version of connection */ /* reconnect later */ - __u16 ibc_reconnect:1; - __u64 ibc_incarnation; /* which instance of the peer_ni */ + u16 ibc_reconnect:1; + u64 ibc_incarnation; /* which instance of the peer_ni */ atomic_t ibc_refcount; /* # users */ int ibc_state; /* what's happening */ int ibc_nsends_posted; /* # uncompleted sends */ @@ -543,9 +543,9 @@ struct kib_conn { int ibc_reserved_credits; /* # ACK/DONE msg credits */ int ibc_comms_error; /* set on comms error */ /* connections queue depth */ - __u16 ibc_queue_depth; + u16 ibc_queue_depth; /* connections max frags */ - __u16 ibc_max_frags; + u16 ibc_max_frags; unsigned int ibc_nrx:16; /* receive buffers owned */ unsigned int ibc_scheduled:1; /* scheduled for attention */ unsigned int ibc_ready:1; /* CQ callback fired */ @@ -586,13 +586,13 @@ struct kib_peer_ni { struct kib_conn *ibp_next_conn; /* next connection to send on for * round robin */ struct list_head ibp_tx_queue; /* msgs waiting for a conn */ - __u64 ibp_incarnation; /* incarnation of peer_ni */ + u64 ibp_incarnation; /* incarnation of peer_ni */ /* when (in seconds) I was last alive */ time64_t ibp_last_alive; /* # users */ atomic_t ibp_refcount; /* version of peer_ni */ - __u16 ibp_version; + u16 ibp_version; /* current passive connection attempts */ unsigned short ibp_accepting; /* current active connection attempts */ @@ -606,9 +606,9 @@ struct kib_peer_ni { /* errno on closing this peer_ni */ int ibp_error; /* max map_on_demand */ - __u16 ibp_max_frags; + u16 ibp_max_frags; /* max_peer_credits */ - __u16 ibp_queue_depth; + u16 ibp_queue_depth; }; extern struct kib_data kiblnd_data; @@ -819,24 +819,24 @@ struct kib_peer_ni { #define IBLND_WID_MR 4 #define IBLND_WID_MASK 7UL -static inline __u64 +static inline u64 kiblnd_ptr2wreqid(void *ptr, int type) { unsigned long lptr = (unsigned long)ptr; LASSERT(!(lptr & IBLND_WID_MASK)); LASSERT(!(type & ~IBLND_WID_MASK)); - return (__u64)(lptr | type); + return (u64)(lptr | type); } static inline void * -kiblnd_wreqid2ptr(__u64 wreqid) +kiblnd_wreqid2ptr(u64 wreqid) { return (void *)(((unsigned long)wreqid) & ~IBLND_WID_MASK); } static inline int -kiblnd_wreqid2type(__u64 wreqid) +kiblnd_wreqid2type(u64 wreqid) { return wreqid & IBLND_WID_MASK; } @@ -867,26 +867,26 @@ struct kib_peer_ni { return size; } -static inline __u64 +static inline u64 kiblnd_rd_frag_addr(struct kib_rdma_desc *rd, int index) { return rd->rd_frags[index].rf_addr; } -static inline __u32 +static inline u32 kiblnd_rd_frag_size(struct kib_rdma_desc *rd, int index) { return rd->rd_frags[index].rf_nob; } -static inline __u32 +static inline u32 kiblnd_rd_frag_key(struct kib_rdma_desc *rd, int index) { return rd->rd_key; } static inline int -kiblnd_rd_consume_frag(struct kib_rdma_desc *rd, int index, __u32 nob) +kiblnd_rd_consume_frag(struct kib_rdma_desc *rd, int index, u32 nob) { if (nob < rd->rd_frags[index].rf_nob) { rd->rd_frags[index].rf_addr += nob; @@ -909,13 +909,13 @@ struct kib_peer_ni { offsetof(struct kib_putack_msg, ibpam_rd.rd_frags[n]); } -static inline __u64 +static inline u64 kiblnd_dma_mapping_error(struct ib_device *dev, u64 dma_addr) { return ib_dma_mapping_error(dev, dma_addr); } -static inline __u64 kiblnd_dma_map_single(struct ib_device *dev, +static inline u64 kiblnd_dma_map_single(struct ib_device *dev, void *msg, size_t size, enum dma_data_direction direction) { @@ -923,7 +923,7 @@ static inline __u64 kiblnd_dma_map_single(struct ib_device *dev, } static inline void kiblnd_dma_unmap_single(struct ib_device *dev, - __u64 addr, size_t size, + u64 addr, size_t size, enum dma_data_direction direction) { ib_dma_unmap_single(dev, addr, size, direction); @@ -946,7 +946,7 @@ static inline void kiblnd_dma_unmap_sg(struct ib_device *dev, ib_dma_unmap_sg(dev, sg, nents, direction); } -static inline __u64 kiblnd_sg_dma_address(struct ib_device *dev, +static inline u64 kiblnd_sg_dma_address(struct ib_device *dev, struct scatterlist *sg) { return ib_sg_dma_address(dev, sg); @@ -971,7 +971,7 @@ static inline unsigned int kiblnd_sg_dma_len(struct ib_device *dev, struct list_head *kiblnd_pool_alloc_node(struct kib_poolset *ps); int kiblnd_fmr_pool_map(struct kib_fmr_poolset *fps, struct kib_tx *tx, - struct kib_rdma_desc *rd, __u32 nob, __u64 iov, + struct kib_rdma_desc *rd, u32 nob, u64 iov, struct kib_fmr *fmr); void kiblnd_fmr_pool_unmap(struct kib_fmr *fmr, int status); @@ -998,7 +998,7 @@ int kiblnd_create_peer(struct lnet_ni *ni, struct kib_peer_ni **peerp, void kiblnd_unlink_peer_locked(struct kib_peer_ni *peer_ni); struct kib_peer_ni *kiblnd_find_peer_locked(struct lnet_ni *ni, lnet_nid_t nid); int kiblnd_close_stale_conns_locked(struct kib_peer_ni *peer_ni, - int version, __u64 incarnation); + int version, u64 incarnation); int kiblnd_close_peer_conns_locked(struct kib_peer_ni *peer_ni, int why); struct kib_conn *kiblnd_create_conn(struct kib_peer_ni *peer_ni, @@ -1016,7 +1016,7 @@ struct kib_conn *kiblnd_create_conn(struct kib_peer_ni *peer_ni, void kiblnd_cq_completion(struct ib_cq *cq, void *arg); void kiblnd_pack_msg(struct lnet_ni *ni, struct kib_msg *msg, int version, - int credits, lnet_nid_t dstnid, __u64 dststamp); + int credits, lnet_nid_t dstnid, u64 dststamp); int kiblnd_unpack_msg(struct kib_msg *msg, int nob); int kiblnd_post_rx(struct kib_rx *rx, int credit); diff --git a/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c b/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c index 57fe037..48f2814 100644 --- a/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c +++ b/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c @@ -47,7 +47,7 @@ static void kiblnd_init_tx_msg(struct lnet_ni *ni, struct kib_tx *tx, int type, int body_nob); static int kiblnd_init_rdma(struct kib_conn *conn, struct kib_tx *tx, int type, int resid, struct kib_rdma_desc *dstrd, - __u64 dstcookie); + u64 dstcookie); static void kiblnd_queue_tx_locked(struct kib_tx *tx, struct kib_conn *conn); static void kiblnd_queue_tx(struct kib_tx *tx, struct kib_conn *conn); static void kiblnd_unmap_tx(struct kib_tx *tx); @@ -223,7 +223,7 @@ static int kiblnd_init_rdma(struct kib_conn *conn, struct kib_tx *tx, int type, } static struct kib_tx * -kiblnd_find_waiting_tx_locked(struct kib_conn *conn, int txtype, __u64 cookie) +kiblnd_find_waiting_tx_locked(struct kib_conn *conn, int txtype, u64 cookie) { struct kib_tx *tx; @@ -246,7 +246,7 @@ static int kiblnd_init_rdma(struct kib_conn *conn, struct kib_tx *tx, int type, } static void -kiblnd_handle_completion(struct kib_conn *conn, int txtype, int status, __u64 cookie) +kiblnd_handle_completion(struct kib_conn *conn, int txtype, int status, u64 cookie) { struct kib_tx *tx; struct lnet_ni *ni = conn->ibc_peer->ibp_ni; @@ -284,7 +284,7 @@ static int kiblnd_init_rdma(struct kib_conn *conn, struct kib_tx *tx, int type, } static void -kiblnd_send_completion(struct kib_conn *conn, int type, int status, __u64 cookie) +kiblnd_send_completion(struct kib_conn *conn, int type, int status, u64 cookie) { struct lnet_ni *ni = conn->ibc_peer->ibp_ni; struct kib_tx *tx = kiblnd_get_idle_tx(ni, conn->ibc_peer->ibp_nid); @@ -536,7 +536,7 @@ static int kiblnd_init_rdma(struct kib_conn *conn, struct kib_tx *tx, int type, } static int -kiblnd_fmr_map_tx(struct kib_net *net, struct kib_tx *tx, struct kib_rdma_desc *rd, __u32 nob) +kiblnd_fmr_map_tx(struct kib_net *net, struct kib_tx *tx, struct kib_rdma_desc *rd, u32 nob) { struct kib_hca_dev *hdev; struct kib_fmr_poolset *fps; @@ -637,7 +637,7 @@ static int kiblnd_map_tx(struct lnet_ni *ni, struct kib_tx *tx, { struct kib_net *net = ni->ni_data; struct kib_hca_dev *hdev = net->ibn_dev->ibd_hdev; - __u32 nob; + u32 nob; int i; /* @@ -1086,7 +1086,7 @@ static int kiblnd_map_tx(struct lnet_ni *ni, struct kib_tx *tx, static int kiblnd_init_rdma(struct kib_conn *conn, struct kib_tx *tx, int type, - int resid, struct kib_rdma_desc *dstrd, __u64 dstcookie) + int resid, struct kib_rdma_desc *dstrd, u64 dstcookie) { struct kib_msg *ibmsg = tx->tx_msg; struct kib_rdma_desc *srcrd = tx->tx_rd; @@ -2296,7 +2296,7 @@ static int kiblnd_resolve_addr(struct rdma_cm_id *cmid, peer_addr = (struct sockaddr_in *)&cmid->route.addr.dst_addr; if (*kiblnd_tunables.kib_require_priv_port && ntohs(peer_addr->sin_port) >= PROT_SOCK) { - __u32 ip = ntohl(peer_addr->sin_addr.s_addr); + u32 ip = ntohl(peer_addr->sin_addr.s_addr); CERROR("peer_ni's port (%pI4h:%hu) is not privileged\n", &ip, ntohs(peer_addr->sin_port)); @@ -2589,7 +2589,7 @@ static int kiblnd_resolve_addr(struct rdma_cm_id *cmid, static void kiblnd_check_reconnect(struct kib_conn *conn, int version, - __u64 incarnation, int why, struct kib_connparams *cp) + u64 incarnation, int why, struct kib_connparams *cp) { rwlock_t *glock = &kiblnd_data.kib_global_lock; struct kib_peer_ni *peer_ni = conn->ibc_peer; @@ -2734,7 +2734,7 @@ static int kiblnd_resolve_addr(struct rdma_cm_id *cmid, struct kib_rej *rej = priv; struct kib_connparams *cp = NULL; int flip = 0; - __u64 incarnation = -1; + u64 incarnation = -1; /* NB. default incarnation is -1 because: * a) V1 will ignore dst incarnation in connreq. @@ -2947,7 +2947,7 @@ static int kiblnd_resolve_addr(struct rdma_cm_id *cmid, struct kib_msg *msg; struct rdma_conn_param cp; int version; - __u64 incarnation; + u64 incarnation; unsigned long flags; int rc; diff --git a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c index ff8d732..f048f0a 100644 --- a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c +++ b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c @@ -46,7 +46,7 @@ struct ksock_nal_data ksocknal_data; static struct ksock_interface * -ksocknal_ip2iface(struct lnet_ni *ni, __u32 ip) +ksocknal_ip2iface(struct lnet_ni *ni, u32 ip) { struct ksock_net *net = ni->ni_data; int i; @@ -64,7 +64,7 @@ } static struct ksock_route * -ksocknal_create_route(__u32 ipaddr, int port) +ksocknal_create_route(u32 ipaddr, int port) { struct ksock_route *route; @@ -217,7 +217,7 @@ struct ksock_peer * ksocknal_unlink_peer_locked(struct ksock_peer *peer_ni) { int i; - __u32 ip; + u32 ip; struct ksock_interface *iface; for (i = 0; i < peer_ni->ksnp_n_passive_ips; i++) { @@ -247,7 +247,7 @@ struct ksock_peer * static int ksocknal_get_peer_info(struct lnet_ni *ni, int index, - struct lnet_process_id *id, __u32 *myip, __u32 *peer_ip, + struct lnet_process_id *id, u32 *myip, u32 *peer_ip, int *port, int *conn_count, int *share_count) { struct ksock_peer *peer_ni; @@ -440,7 +440,7 @@ struct ksock_peer * } int -ksocknal_add_peer(struct lnet_ni *ni, struct lnet_process_id id, __u32 ipaddr, +ksocknal_add_peer(struct lnet_ni *ni, struct lnet_process_id id, u32 ipaddr, int port) { struct ksock_peer *peer_ni; @@ -497,7 +497,7 @@ struct ksock_peer * } static void -ksocknal_del_peer_locked(struct ksock_peer *peer_ni, __u32 ip) +ksocknal_del_peer_locked(struct ksock_peer *peer_ni, u32 ip) { struct ksock_conn *conn; struct ksock_route *route; @@ -553,7 +553,7 @@ struct ksock_peer * } static int -ksocknal_del_peer(struct lnet_ni *ni, struct lnet_process_id id, __u32 ip) +ksocknal_del_peer(struct lnet_ni *ni, struct lnet_process_id id, u32 ip) { LIST_HEAD(zombies); struct ksock_peer *pnxt; @@ -680,7 +680,7 @@ struct ksock_peer * } static int -ksocknal_local_ipvec(struct lnet_ni *ni, __u32 *ipaddrs) +ksocknal_local_ipvec(struct lnet_ni *ni, u32 *ipaddrs) { struct ksock_net *net = ni->ni_data; int i; @@ -710,7 +710,7 @@ struct ksock_peer * } static int -ksocknal_match_peerip(struct ksock_interface *iface, __u32 *ips, int nips) +ksocknal_match_peerip(struct ksock_interface *iface, u32 *ips, int nips) { int best_netmatch = 0; int best_xor = 0; @@ -742,7 +742,7 @@ struct ksock_peer * } static int -ksocknal_select_ips(struct ksock_peer *peer_ni, __u32 *peerips, int n_peerips) +ksocknal_select_ips(struct ksock_peer *peer_ni, u32 *peerips, int n_peerips) { rwlock_t *global_lock = &ksocknal_data.ksnd_global_lock; struct ksock_net *net = peer_ni->ksnp_ni->ni_data; @@ -752,8 +752,8 @@ struct ksock_peer * int i; int j; int k; - __u32 ip; - __u32 xor; + u32 ip; + u32 xor; int this_netmatch; int best_netmatch; int best_npeers; @@ -858,7 +858,7 @@ struct ksock_peer * static void ksocknal_create_routes(struct ksock_peer *peer_ni, int port, - __u32 *peer_ipaddrs, int npeer_ipaddrs) + u32 *peer_ipaddrs, int npeer_ipaddrs) { struct ksock_route *newroute = NULL; rwlock_t *global_lock = &ksocknal_data.ksnd_global_lock; @@ -968,7 +968,7 @@ struct ksock_peer * { struct ksock_connreq *cr; int rc; - __u32 peer_ip; + u32 peer_ip; int peer_port; rc = lnet_sock_getaddr(sock, 1, &peer_ip, &peer_port); @@ -995,7 +995,7 @@ struct ksock_peer * } static int -ksocknal_connecting(struct ksock_peer *peer_ni, __u32 ipaddr) +ksocknal_connecting(struct ksock_peer *peer_ni, u32 ipaddr) { struct ksock_route *route; @@ -1013,7 +1013,7 @@ struct ksock_peer * rwlock_t *global_lock = &ksocknal_data.ksnd_global_lock; LIST_HEAD(zombies); struct lnet_process_id peerid; - __u64 incarnation; + u64 incarnation; struct ksock_conn *conn; struct ksock_conn *conn2; struct ksock_peer *peer_ni = NULL; @@ -1714,7 +1714,7 @@ struct ksock_peer * int ksocknal_close_peer_conns_locked(struct ksock_peer *peer_ni, - __u32 ipaddr, int why) + u32 ipaddr, int why) { struct ksock_conn *conn; struct list_head *ctmp; @@ -1737,7 +1737,7 @@ struct ksock_peer * ksocknal_close_conn_and_siblings(struct ksock_conn *conn, int why) { struct ksock_peer *peer_ni = conn->ksnc_peer; - __u32 ipaddr = conn->ksnc_ipaddr; + u32 ipaddr = conn->ksnc_ipaddr; int count; write_lock_bh(&ksocknal_data.ksnd_global_lock); @@ -1750,7 +1750,7 @@ struct ksock_peer * } int -ksocknal_close_matching_conns(struct lnet_process_id id, __u32 ipaddr) +ksocknal_close_matching_conns(struct lnet_process_id id, u32 ipaddr) { struct ksock_peer *peer_ni; struct ksock_peer *pnxt; @@ -1964,7 +1964,7 @@ static int ksocknal_push(struct lnet_ni *ni, struct lnet_process_id id) } static int -ksocknal_add_interface(struct lnet_ni *ni, __u32 ipaddress, __u32 netmask) +ksocknal_add_interface(struct lnet_ni *ni, u32 ipaddress, u32 netmask) { struct ksock_net *net = ni->ni_data; struct ksock_interface *iface; @@ -2027,7 +2027,7 @@ static int ksocknal_push(struct lnet_ni *ni, struct lnet_process_id id) } static void -ksocknal_peer_del_interface_locked(struct ksock_peer *peer_ni, __u32 ipaddr) +ksocknal_peer_del_interface_locked(struct ksock_peer *peer_ni, u32 ipaddr) { struct list_head *tmp; struct list_head *nxt; @@ -2068,13 +2068,13 @@ static int ksocknal_push(struct lnet_ni *ni, struct lnet_process_id id) } static int -ksocknal_del_interface(struct lnet_ni *ni, __u32 ipaddress) +ksocknal_del_interface(struct lnet_ni *ni, u32 ipaddress) { struct ksock_net *net = ni->ni_data; int rc = -ENOENT; struct ksock_peer *nxt; struct ksock_peer *peer_ni; - __u32 this_ip; + u32 this_ip; int i; int j; @@ -2126,7 +2126,7 @@ static int ksocknal_push(struct lnet_ni *ni, struct lnet_process_id id) read_lock(&ksocknal_data.ksnd_global_lock); - if (data->ioc_count >= (__u32)net->ksnn_ninterfaces) { + if (data->ioc_count >= (u32)net->ksnn_ninterfaces) { rc = -ENOENT; } else { rc = 0; @@ -2152,8 +2152,8 @@ static int ksocknal_push(struct lnet_ni *ni, struct lnet_process_id id) data->ioc_u32[0]); /* IP address */ case IOC_LIBCFS_GET_PEER: { - __u32 myip = 0; - __u32 ip = 0; + u32 myip = 0; + u32 ip = 0; int port = 0; int conn_count = 0; int share_count = 0; @@ -2742,7 +2742,7 @@ static int ksocknal_push(struct lnet_ni *ni, struct lnet_process_id id) } static int -ksocknal_net_start_threads(struct ksock_net *net, __u32 *cpts, int ncpts) +ksocknal_net_start_threads(struct ksock_net *net, u32 *cpts, int ncpts) { int newif = ksocknal_search_new_ipif(net); int rc; diff --git a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.h b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.h index 297d1e5..a390381 100644 --- a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.h +++ b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.h @@ -101,8 +101,8 @@ struct ksock_sched_info { #define KSOCK_THREAD_SID(id) ((id) & ((1UL << KSOCK_CPT_SHIFT) - 1)) struct ksock_interface { /* in-use interface */ - __u32 ksni_ipaddr; /* interface's IP address */ - __u32 ksni_netmask; /* interface's network mask */ + u32 ksni_ipaddr; /* interface's IP address */ + u32 ksni_netmask; /* interface's network mask */ int ksni_nroutes; /* # routes using (active) */ int ksni_npeers; /* # peers using (passive) */ char ksni_name[IFNAMSIZ]; /* interface name */ @@ -167,7 +167,7 @@ struct ksock_tunables { }; struct ksock_net { - __u64 ksnn_incarnation; /* my epoch */ + u64 ksnn_incarnation; /* my epoch */ spinlock_t ksnn_lock; /* serialise */ struct list_head ksnn_list; /* chain on global list */ int ksnn_npeers; /* # peers */ @@ -326,8 +326,8 @@ struct ksock_conn { atomic_t ksnc_sock_refcount;/* sock refcount */ struct ksock_sched *ksnc_scheduler; /* who schedules this connection */ - __u32 ksnc_myipaddr; /* my IP */ - __u32 ksnc_ipaddr; /* peer_ni's IP */ + u32 ksnc_myipaddr; /* my IP */ + u32 ksnc_ipaddr; /* peer_ni's IP */ int ksnc_port; /* peer_ni's port */ signed int ksnc_type:3; /* type of connection, should be * signed value @@ -344,14 +344,14 @@ struct ksock_conn { time64_t ksnc_rx_deadline; /* when (in secs) receive times * out */ - __u8 ksnc_rx_started; /* started receiving a message */ - __u8 ksnc_rx_ready; /* data ready to read */ - __u8 ksnc_rx_scheduled; /* being progressed */ - __u8 ksnc_rx_state; /* what is being read */ + u8 ksnc_rx_started; /* started receiving a message */ + u8 ksnc_rx_ready; /* data ready to read */ + u8 ksnc_rx_scheduled; /* being progressed */ + u8 ksnc_rx_state; /* what is being read */ int ksnc_rx_nob_left; /* # bytes to next hdr/body */ struct iov_iter ksnc_rx_to; /* copy destination */ struct kvec ksnc_rx_iov_space[LNET_MAX_IOV]; /* space for frag descriptors */ - __u32 ksnc_rx_csum; /* partial checksum for incoming + u32 ksnc_rx_csum; /* partial checksum for incoming * data */ void *ksnc_cookie; /* rx lnet_finalize passthru arg @@ -391,8 +391,8 @@ struct ksock_route { * can happen next */ time64_t ksnr_retry_interval; /* how long between retries */ - __u32 ksnr_myipaddr; /* my IP */ - __u32 ksnr_ipaddr; /* IP address to connect to */ + u32 ksnr_myipaddr; /* my IP */ + u32 ksnr_ipaddr; /* IP address to connect to */ int ksnr_port; /* port to connect to */ unsigned int ksnr_scheduled:1; /* scheduled for attention */ unsigned int ksnr_connecting:1; /* connection establishment in @@ -422,8 +422,8 @@ struct ksock_peer { int ksnp_accepting; /* # passive connections pending */ int ksnp_error; /* errno on closing last conn */ - __u64 ksnp_zc_next_cookie; /* ZC completion cookie */ - __u64 ksnp_incarnation; /* latest known peer_ni + u64 ksnp_zc_next_cookie; /* ZC completion cookie */ + u64 ksnp_incarnation; /* latest known peer_ni * incarnation */ struct ksock_proto *ksnp_proto; /* latest known peer_ni @@ -479,13 +479,13 @@ struct ksock_proto { struct ksock_tx *(*pro_queue_tx_msg)(struct ksock_conn *, struct ksock_tx *); /* queue ZC ack on the connection */ - int (*pro_queue_tx_zcack)(struct ksock_conn *, struct ksock_tx *, __u64); + int (*pro_queue_tx_zcack)(struct ksock_conn *, struct ksock_tx *, u64); /* handle ZC request */ - int (*pro_handle_zcreq)(struct ksock_conn *, __u64, int); + int (*pro_handle_zcreq)(struct ksock_conn *, u64, int); /* handle ZC ACK */ - int (*pro_handle_zcack)(struct ksock_conn *, __u64, __u64); + int (*pro_handle_zcack)(struct ksock_conn *, u64, u64); /* * msg type matches the connection type: @@ -634,7 +634,7 @@ int ksocknal_recv(struct lnet_ni *ni, void *private, struct lnet_msg *lntmsg, int delayed, struct iov_iter *to, unsigned int rlen); int ksocknal_accept(struct lnet_ni *ni, struct socket *sock); -int ksocknal_add_peer(struct lnet_ni *ni, struct lnet_process_id id, __u32 ip, +int ksocknal_add_peer(struct lnet_ni *ni, struct lnet_process_id id, u32 ip, int port); struct ksock_peer *ksocknal_find_peer_locked(struct lnet_ni *ni, struct lnet_process_id id); @@ -647,9 +647,9 @@ int ksocknal_create_conn(struct lnet_ni *ni, struct ksock_route *route, void ksocknal_terminate_conn(struct ksock_conn *conn); void ksocknal_destroy_conn(struct ksock_conn *conn); int ksocknal_close_peer_conns_locked(struct ksock_peer *peer_ni, - __u32 ipaddr, int why); + u32 ipaddr, int why); int ksocknal_close_conn_and_siblings(struct ksock_conn *conn, int why); -int ksocknal_close_matching_conns(struct lnet_process_id id, __u32 ipaddr); +int ksocknal_close_matching_conns(struct lnet_process_id id, u32 ipaddr); struct ksock_conn *ksocknal_find_conn_locked(struct ksock_peer *peer_ni, struct ksock_tx *tx, int nonblk); @@ -657,7 +657,7 @@ int ksocknal_launch_packet(struct lnet_ni *ni, struct ksock_tx *tx, struct lnet_process_id id); struct ksock_tx *ksocknal_alloc_tx(int type, int size); void ksocknal_free_tx(struct ksock_tx *tx); -struct ksock_tx *ksocknal_alloc_tx_noop(__u64 cookie, int nonblk); +struct ksock_tx *ksocknal_alloc_tx_noop(u64 cookie, int nonblk); void ksocknal_next_tx_carrier(struct ksock_conn *conn); void ksocknal_queue_tx_locked(struct ksock_tx *tx, struct ksock_conn *conn); void ksocknal_txlist_done(struct lnet_ni *ni, struct list_head *txlist, int error); @@ -679,7 +679,7 @@ int ksocknal_send_hello(struct lnet_ni *ni, struct ksock_conn *conn, int ksocknal_recv_hello(struct lnet_ni *ni, struct ksock_conn *conn, struct ksock_hello_msg *hello, struct lnet_process_id *id, - __u64 *incarnation); + u64 *incarnation); void ksocknal_read_callback(struct ksock_conn *conn); void ksocknal_write_callback(struct ksock_conn *conn); diff --git a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_cb.c b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_cb.c index 4abf0eb..dd4fb69 100644 --- a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_cb.c +++ b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_cb.c @@ -64,7 +64,7 @@ struct ksock_tx * } struct ksock_tx * -ksocknal_alloc_tx_noop(__u64 cookie, int nonblk) +ksocknal_alloc_tx_noop(u64 cookie, int nonblk) { struct ksock_tx *tx; @@ -1126,7 +1126,7 @@ struct ksock_route * } if (conn->ksnc_msg.ksm_zc_cookies[1]) { - __u64 cookie = 0; + u64 cookie = 0; LASSERT(conn->ksnc_proto != &ksocknal_protocol_v1x); @@ -1533,7 +1533,7 @@ void ksocknal_write_callback(struct ksock_conn *conn) static struct ksock_proto * ksocknal_parse_proto_version(struct ksock_hello_msg *hello) { - __u32 version = 0; + u32 version = 0; if (hello->kshm_magic == LNET_PROTO_MAGIC) version = hello->kshm_version; @@ -1614,7 +1614,7 @@ void ksocknal_write_callback(struct ksock_conn *conn) ksocknal_recv_hello(struct lnet_ni *ni, struct ksock_conn *conn, struct ksock_hello_msg *hello, struct lnet_process_id *peerid, - __u64 *incarnation) + u64 *incarnation) { /* Return < 0 fatal error * 0 success diff --git a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_lib.c b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_lib.c index 686c2d3..565c50c 100644 --- a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_lib.c +++ b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_lib.c @@ -175,7 +175,7 @@ static int lustre_csum(struct kvec *v, void *context) ksocknal_lib_recv(struct ksock_conn *conn) { struct msghdr msg = { .msg_iter = conn->ksnc_rx_to }; - __u32 saved_csum; + u32 saved_csum; int rc; rc = sock_recvmsg(conn->ksnc_sock, &msg, MSG_DONTWAIT); @@ -203,7 +203,7 @@ static int lustre_csum(struct kvec *v, void *context) ksocknal_lib_csum_tx(struct ksock_tx *tx) { int i; - __u32 csum; + u32 csum; void *base; LASSERT(tx->tx_iov[0].iov_base == &tx->tx_msg); diff --git a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_proto.c b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_proto.c index 54ec5d0..91bed59 100644 --- a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_proto.c +++ b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_proto.c @@ -68,7 +68,7 @@ static int ksocknal_queue_tx_zcack_v2(struct ksock_conn *conn, - struct ksock_tx *tx_ack, __u64 cookie) + struct ksock_tx *tx_ack, u64 cookie) { struct ksock_tx *tx = conn->ksnc_tx_carrier; @@ -151,7 +151,7 @@ static int ksocknal_queue_tx_zcack_v3(struct ksock_conn *conn, - struct ksock_tx *tx_ack, __u64 cookie) + struct ksock_tx *tx_ack, u64 cookie) { struct ksock_tx *tx; @@ -220,7 +220,7 @@ /* takes two or more cookies already */ if (tx->tx_msg.ksm_zc_cookies[0] > tx->tx_msg.ksm_zc_cookies[1]) { - __u64 tmp = 0; + u64 tmp = 0; /* two separated cookies: (a+2, a) or (a+1, a) */ LASSERT(tx->tx_msg.ksm_zc_cookies[0] - @@ -365,7 +365,7 @@ /* (Sink) handle incoming ZC request from sender */ static int -ksocknal_handle_zcreq(struct ksock_conn *c, __u64 cookie, int remote) +ksocknal_handle_zcreq(struct ksock_conn *c, u64 cookie, int remote) { struct ksock_peer *peer_ni = c->ksnc_peer; struct ksock_conn *conn; @@ -409,7 +409,7 @@ /* (Sender) handle ZC_ACK from sink */ static int -ksocknal_handle_zcack(struct ksock_conn *conn, __u64 cookie1, __u64 cookie2) +ksocknal_handle_zcack(struct ksock_conn *conn, u64 cookie1, u64 cookie2) { struct ksock_peer *peer_ni = conn->ksnc_peer; struct ksock_tx *tx; @@ -432,7 +432,7 @@ list_for_each_entry_safe(tx, tmp, &peer_ni->ksnp_zc_req_list, tx_zc_list) { - __u64 c = tx->tx_msg.ksm_zc_cookies[0]; + u64 c = tx->tx_msg.ksm_zc_cookies[0]; if (c == cookie1 || c == cookie2 || (cookie1 < c && c < cookie2)) { @@ -500,7 +500,7 @@ hdr->src_nid = cpu_to_le64(hello->kshm_src_nid); hdr->src_pid = cpu_to_le32(hello->kshm_src_pid); hdr->type = cpu_to_le32(LNET_MSG_HELLO); - hdr->payload_length = cpu_to_le32(hello->kshm_nips * sizeof(__u32)); + hdr->payload_length = cpu_to_le32(hello->kshm_nips * sizeof(u32)); hdr->msg.hello.type = cpu_to_le32(hello->kshm_ctype); hdr->msg.hello.incarnation = cpu_to_le64(hello->kshm_src_incarnation); @@ -518,7 +518,7 @@ hello->kshm_ips[i] = __cpu_to_le32(hello->kshm_ips[i]); rc = lnet_sock_write(sock, hello->kshm_ips, - hello->kshm_nips * sizeof(__u32), + hello->kshm_nips * sizeof(u32), lnet_acceptor_timeout()); if (rc) { CNETERR("Error %d sending HELLO payload (%d) to %pI4h/%d\n", @@ -562,7 +562,7 @@ return 0; rc = lnet_sock_write(sock, hello->kshm_ips, - hello->kshm_nips * sizeof(__u32), + hello->kshm_nips * sizeof(u32), lnet_acceptor_timeout()); if (rc) { CNETERR("Error %d sending HELLO payload (%d) to %pI4h/%d\n", @@ -612,7 +612,7 @@ hello->kshm_src_incarnation = le64_to_cpu(hdr->msg.hello.incarnation); hello->kshm_ctype = le32_to_cpu(hdr->msg.hello.type); hello->kshm_nips = le32_to_cpu(hdr->payload_length) / - sizeof(__u32); + sizeof(u32); if (hello->kshm_nips > LNET_INTERFACES_NUM) { CERROR("Bad nips %d from ip %pI4h\n", @@ -625,7 +625,7 @@ goto out; rc = lnet_sock_read(sock, hello->kshm_ips, - hello->kshm_nips * sizeof(__u32), timeout); + hello->kshm_nips * sizeof(u32), timeout); if (rc) { CERROR("Error %d reading IPs from ip %pI4h\n", rc, &conn->ksnc_ipaddr); @@ -694,7 +694,7 @@ return 0; rc = lnet_sock_read(sock, hello->kshm_ips, - hello->kshm_nips * sizeof(__u32), timeout); + hello->kshm_nips * sizeof(u32), timeout); if (rc) { CERROR("Error %d reading IPs from ip %pI4h\n", rc, &conn->ksnc_ipaddr); -- 1.8.3.1 From jsimmons at infradead.org Thu Jan 31 17:19:09 2019 From: jsimmons at infradead.org (James Simmons) Date: Thu, 31 Jan 2019 12:19:09 -0500 Subject: [lustre-devel] [PATCH 05/26] lustre: use kernel types for lustre internal headers In-Reply-To: <1548955170-13456-1-git-send-email-jsimmons@infradead.org> References: <1548955170-13456-1-git-send-email-jsimmons@infradead.org> Message-ID: <1548955170-13456-6-git-send-email-jsimmons@infradead.org> Lustre internal header was originally both a user land and kernel implementation. The source contains many types of the form __u32 but since this is mostly kernel code change the types to kernel internal types. Signed-off-by: James Simmons --- drivers/staging/lustre/lustre/include/cl_object.h | 10 +- .../staging/lustre/lustre/include/lprocfs_status.h | 28 ++-- drivers/staging/lustre/lustre/include/lu_object.h | 46 +++---- .../staging/lustre/lustre/include/lustre_debug.h | 4 +- .../staging/lustre/lustre/include/lustre_disk.h | 6 +- drivers/staging/lustre/lustre/include/lustre_dlm.h | 66 +++++----- .../staging/lustre/lustre/include/lustre_export.h | 14 +- drivers/staging/lustre/lustre/include/lustre_fid.h | 34 ++--- drivers/staging/lustre/lustre/include/lustre_fld.h | 6 +- drivers/staging/lustre/lustre/include/lustre_ha.h | 2 +- .../staging/lustre/lustre/include/lustre_handles.h | 4 +- .../staging/lustre/lustre/include/lustre_import.h | 28 ++-- .../staging/lustre/lustre/include/lustre_intent.h | 8 +- drivers/staging/lustre/lustre/include/lustre_lmv.h | 26 ++-- drivers/staging/lustre/lustre/include/lustre_log.h | 8 +- drivers/staging/lustre/lustre/include/lustre_mdc.h | 2 +- drivers/staging/lustre/lustre/include/lustre_net.h | 144 ++++++++++----------- .../lustre/lustre/include/lustre_nrs_fifo.h | 4 +- .../lustre/lustre/include/lustre_req_layout.h | 4 +- drivers/staging/lustre/lustre/include/lustre_sec.h | 92 ++++++------- .../staging/lustre/lustre/include/lustre_swab.h | 6 +- drivers/staging/lustre/lustre/include/obd.h | 84 ++++++------ drivers/staging/lustre/lustre/include/obd_class.h | 28 ++-- 23 files changed, 327 insertions(+), 327 deletions(-) diff --git a/drivers/staging/lustre/lustre/include/cl_object.h b/drivers/staging/lustre/lustre/include/cl_object.h index 41b32b7..3109c04 100644 --- a/drivers/staging/lustre/lustre/include/cl_object.h +++ b/drivers/staging/lustre/lustre/include/cl_object.h @@ -153,7 +153,7 @@ struct cl_attr { * * \todo XXX An interface for block size is needed. */ - __u64 cat_blocks; + u64 cat_blocks; /** * User identifier for quota purposes. */ @@ -164,7 +164,7 @@ struct cl_attr { gid_t cat_gid; /* nlink of the directory */ - __u64 cat_nlink; + u64 cat_nlink; /* Project identifier for quota purpose. */ u32 cat_projid; @@ -1151,14 +1151,14 @@ struct cl_lock_descr { /** Index of the last page (inclusive) protected by this lock. */ pgoff_t cld_end; /** Group ID, for group lock */ - __u64 cld_gid; + u64 cld_gid; /** Lock mode. */ enum cl_lock_mode cld_mode; /** * flags to enqueue lock. A combination of bit-flags from * enum cl_enq_flags. */ - __u32 cld_enq_flags; + u32 cld_enq_flags; }; #define DDESCR "%s(%d):[%lu, %lu]:%x" @@ -2438,7 +2438,7 @@ void cl_sync_io_note(const struct lu_env *env, struct cl_sync_io *anchor, */ struct lu_env *cl_env_get(u16 *refcheck); -struct lu_env *cl_env_alloc(u16 *refcheck, __u32 tags); +struct lu_env *cl_env_alloc(u16 *refcheck, u32 tags); void cl_env_put(struct lu_env *env, u16 *refcheck); unsigned int cl_env_cache_purge(unsigned int nr); struct lu_env *cl_env_percpu_get(void); diff --git a/drivers/staging/lustre/lustre/include/lprocfs_status.h b/drivers/staging/lustre/lustre/include/lprocfs_status.h index c22ae3d..7649040 100644 --- a/drivers/staging/lustre/lustre/include/lprocfs_status.h +++ b/drivers/staging/lustre/lustre/include/lprocfs_status.h @@ -136,7 +136,7 @@ enum { LPROCFS_TYPE_CYCLE = 0x0800, }; -#define LC_MIN_INIT ((~(__u64)0) >> 1) +#define LC_MIN_INIT ((~(u64)0) >> 1) struct lprocfs_counter_header { unsigned int lc_config; @@ -145,17 +145,17 @@ struct lprocfs_counter_header { }; struct lprocfs_counter { - __s64 lc_count; - __s64 lc_min; - __s64 lc_max; - __s64 lc_sumsquare; + s64 lc_count; + s64 lc_min; + s64 lc_max; + s64 lc_sumsquare; /* * Every counter has lc_array_sum[0], while lc_array_sum[1] is only * for irq context counter, i.e. stats with * LPROCFS_STATS_FLAG_IRQ_SAFE flag, its counter need * lc_array_sum[1] */ - __s64 lc_array_sum[1]; + s64 lc_array_sum[1]; }; #define lc_sum lc_array_sum[0] @@ -163,7 +163,7 @@ struct lprocfs_counter { struct lprocfs_percpu { #ifndef __GNUC__ - __s64 pad; + s64 pad; #endif struct lprocfs_counter lp_cntr[0]; }; @@ -210,7 +210,7 @@ struct lprocfs_stats { #define OPC_RANGE(seg) (seg ## _LAST_OPC - seg ## _FIRST_OPC) /* Pack all opcodes down into a single monotonically increasing index */ -static inline int opcode_offset(__u32 opc) +static inline int opcode_offset(u32 opc) { if (opc < OST_LAST_OPC) { /* OST opcode */ @@ -394,7 +394,7 @@ void lprocfs_stats_unlock(struct lprocfs_stats *stats, /* irq safe stats need lc_array_sum[1] */ if ((stats->ls_flags & LPROCFS_STATS_FLAG_IRQ_SAFE) != 0) - percpusize += stats->ls_num * sizeof(__s64); + percpusize += stats->ls_num * sizeof(s64); if ((stats->ls_flags & LPROCFS_STATS_FLAG_NOPERCPU) == 0) percpusize = L1_CACHE_ALIGN(percpusize); @@ -411,7 +411,7 @@ void lprocfs_stats_unlock(struct lprocfs_stats *stats, cntr = &stats->ls_percpu[cpuid]->lp_cntr[index]; if ((stats->ls_flags & LPROCFS_STATS_FLAG_IRQ_SAFE) != 0) - cntr = (void *)cntr + index * sizeof(__s64); + cntr = (void *)cntr + index * sizeof(s64); return cntr; } @@ -431,11 +431,11 @@ void lprocfs_stats_unlock(struct lprocfs_stats *stats, #define lprocfs_counter_decr(stats, idx) \ lprocfs_counter_sub(stats, idx, 1) -__s64 lprocfs_read_helper(struct lprocfs_counter *lc, +s64 lprocfs_read_helper(struct lprocfs_counter *lc, struct lprocfs_counter_header *header, enum lprocfs_stats_flags flags, enum lprocfs_fields_flags field); -__u64 lprocfs_stats_collector(struct lprocfs_stats *stats, int idx, +u64 lprocfs_stats_collector(struct lprocfs_stats *stats, int idx, enum lprocfs_fields_flags field); extern struct lprocfs_stats * @@ -485,10 +485,10 @@ int lprocfs_wr_pinger_recov(struct file *file, const char __user *buffer, int lprocfs_write_helper(const char __user *buffer, unsigned long count, int *val); int lprocfs_write_u64_helper(const char __user *buffer, - unsigned long count, __u64 *val); + unsigned long count, u64 *val); int lprocfs_write_frac_u64_helper(const char __user *buffer, unsigned long count, - __u64 *val, int mult); + u64 *val, int mult); char *lprocfs_find_named_value(const char *buffer, const char *name, size_t *count); void lprocfs_oh_tally(struct obd_histogram *oh, unsigned int value); diff --git a/drivers/staging/lustre/lustre/include/lu_object.h b/drivers/staging/lustre/lustre/include/lu_object.h index 47f8021..3e663a9 100644 --- a/drivers/staging/lustre/lustre/include/lu_object.h +++ b/drivers/staging/lustre/lustre/include/lu_object.h @@ -309,7 +309,7 @@ struct lu_device_type { /** * Tag bits. Taken from enum lu_device_tag. Never modified once set. */ - __u32 ldt_tags; + u32 ldt_tags; /** * Name of this class. Unique system-wide. Never modified once set. */ @@ -325,7 +325,7 @@ struct lu_device_type { /** * \todo XXX: temporary: context tags used by obd_*() calls. */ - __u32 ldt_ctx_tags; + u32 ldt_ctx_tags; /** * Number of existing device type instances. */ @@ -392,7 +392,7 @@ static inline int lu_device_is_md(const struct lu_device *d) */ struct lu_attr { /** size in bytes */ - __u64 la_size; + u64 la_size; /** modification time in seconds since Epoch */ s64 la_mtime; /** access time in seconds since Epoch */ @@ -400,29 +400,29 @@ struct lu_attr { /** change time in seconds since Epoch */ s64 la_ctime; /** 512-byte blocks allocated to object */ - __u64 la_blocks; + u64 la_blocks; /** permission bits and file type */ - __u32 la_mode; + u32 la_mode; /** owner id */ - __u32 la_uid; + u32 la_uid; /** group id */ - __u32 la_gid; + u32 la_gid; /** object flags */ - __u32 la_flags; + u32 la_flags; /** number of persistent references to this object */ - __u32 la_nlink; + u32 la_nlink; /** blk bits of the object*/ - __u32 la_blkbits; + u32 la_blkbits; /** blk size of the object*/ - __u32 la_blksize; + u32 la_blksize; /** real device */ - __u32 la_rdev; + u32 la_rdev; /** * valid bits * * \see enum la_valid */ - __u64 la_valid; + u64 la_valid; }; /** Bit-mask of valid attributes */ @@ -522,7 +522,7 @@ struct lu_object_header { * Common object attributes, cached for efficiency. From enum * lu_object_header_attr. */ - __u32 loh_attr; + u32 loh_attr; /** * Linkage into per-site hash table. Protected by lu_site::ls_guard. */ @@ -812,7 +812,7 @@ static inline int lu_object_assert_not_exists(const struct lu_object *o) /** * Attr of this object. */ -static inline __u32 lu_object_attr(const struct lu_object *o) +static inline u32 lu_object_attr(const struct lu_object *o) { LASSERT(lu_object_exists(o) != 0); return o->lo_header->loh_attr; @@ -849,13 +849,13 @@ static inline void lu_object_ref_del_at(struct lu_object *o, /** input params, should be filled out by mdt */ struct lu_rdpg { /** hash */ - __u64 rp_hash; + u64 rp_hash; /** count in bytes */ unsigned int rp_count; /** number of pages */ unsigned int rp_npages; /** requested attr */ - __u32 rp_attrs; + u32 rp_attrs; /** pointers to pages */ struct page **rp_pages; }; @@ -912,7 +912,7 @@ struct lu_context { * of tags has non-empty intersection with one for key. Tags are taken * from enum lu_context_tag. */ - __u32 lc_tags; + u32 lc_tags; enum lu_context_state lc_state; /** * Pointer to the home service thread. NULL for other execution @@ -1049,7 +1049,7 @@ struct lu_context_key { /** * Set of tags for which values of this key are to be instantiated. */ - __u32 lct_tags; + u32 lct_tags; /** * Value constructor. This is called when new value is created for a * context. Returns pointer to new value of error pointer. @@ -1194,7 +1194,7 @@ void *lu_context_key_get(const struct lu_context *ctx, LU_TYPE_START(mod, __VA_ARGS__); \ LU_TYPE_STOP(mod, __VA_ARGS__) -int lu_context_init(struct lu_context *ctx, __u32 tags); +int lu_context_init(struct lu_context *ctx, u32 tags); void lu_context_fini(struct lu_context *ctx); void lu_context_enter(struct lu_context *ctx); void lu_context_exit(struct lu_context *ctx); @@ -1224,7 +1224,7 @@ struct lu_env { struct lu_context *le_ses; }; -int lu_env_init(struct lu_env *env, __u32 tags); +int lu_env_init(struct lu_env *env, u32 tags); void lu_env_fini(struct lu_env *env); int lu_env_refill(struct lu_env *env); @@ -1293,8 +1293,8 @@ struct lu_kmem_descr { int lu_kmem_init(struct lu_kmem_descr *caches); void lu_kmem_fini(struct lu_kmem_descr *caches); -extern __u32 lu_context_tags_default; -extern __u32 lu_session_tags_default; +extern u32 lu_context_tags_default; +extern u32 lu_session_tags_default; /** @} lu */ #endif /* __LUSTRE_LU_OBJECT_H */ diff --git a/drivers/staging/lustre/lustre/include/lustre_debug.h b/drivers/staging/lustre/lustre/include/lustre_debug.h index 721a81f..b9414fc 100644 --- a/drivers/staging/lustre/lustre/include/lustre_debug.h +++ b/drivers/staging/lustre/lustre/include/lustre_debug.h @@ -44,8 +44,8 @@ /* lib/debug.c */ int dump_req(struct ptlrpc_request *req); -int block_debug_setup(void *addr, int len, __u64 off, __u64 id); -int block_debug_check(char *who, void *addr, int len, __u64 off, __u64 id); +int block_debug_setup(void *addr, int len, u64 off, u64 id); +int block_debug_check(char *who, void *addr, int len, u64 off, u64 id); /** @} debug */ diff --git a/drivers/staging/lustre/lustre/include/lustre_disk.h b/drivers/staging/lustre/lustre/include/lustre_disk.h index 7b6421d..091a09f 100644 --- a/drivers/staging/lustre/lustre/include/lustre_disk.h +++ b/drivers/staging/lustre/lustre/include/lustre_disk.h @@ -70,8 +70,8 @@ /* gleaned from the mount command - no persistent info here */ struct lustre_mount_data { - __u32 lmd_magic; - __u32 lmd_flags; /* lustre mount flags */ + u32 lmd_magic; + u32 lmd_flags; /* lustre mount flags */ int lmd_mgs_failnodes; /* mgs failover node count */ int lmd_exclude_count; int lmd_recovery_time_soft; @@ -84,7 +84,7 @@ struct lustre_mount_data { * _device_ mount options) */ char *lmd_params; /* lustre params */ - __u32 *lmd_exclude; /* array of OSTs to ignore */ + u32 *lmd_exclude; /* array of OSTs to ignore */ char *lmd_mgs; /* MGS nid */ char *lmd_osd_type; /* OSD type */ char *lmd_nidnet; /* network to restrict this client to */ diff --git a/drivers/staging/lustre/lustre/include/lustre_dlm.h b/drivers/staging/lustre/lustre/include/lustre_dlm.h index e2bbcaa..7c12087 100644 --- a/drivers/staging/lustre/lustre/include/lustre_dlm.h +++ b/drivers/staging/lustre/lustre/include/lustre_dlm.h @@ -243,9 +243,9 @@ struct ldlm_pool { /** Cancel rate per T. */ atomic_t pl_cancel_rate; /** Server lock volume (SLV). Protected by pl_lock. */ - __u64 pl_server_lock_volume; + u64 pl_server_lock_volume; /** Current biggest client lock volume. Protected by pl_lock. */ - __u64 pl_client_lock_volume; + u64 pl_client_lock_volume; /** Lock volume factor. SLV on client is calculated as following: * server_slv * lock_volume_factor. */ @@ -377,10 +377,10 @@ struct ldlm_namespace { * Namespace connect flags supported by server (may be changed via * sysfs, LRU resize may be disabled/enabled). */ - __u64 ns_connect_flags; + u64 ns_connect_flags; /** Client side original connect flags supported by server. */ - __u64 ns_orig_connect_flags; + u64 ns_orig_connect_flags; /* namespace debugfs dir entry */ struct dentry *ns_debugfs_entry; @@ -494,7 +494,7 @@ typedef int (*ldlm_blocking_callback)(struct ldlm_lock *lock, struct ldlm_lock_desc *new, void *data, int flag); /** Type for completion callback function of a lock. */ -typedef int (*ldlm_completion_callback)(struct ldlm_lock *lock, __u64 flags, +typedef int (*ldlm_completion_callback)(struct ldlm_lock *lock, u64 flags, void *data); /** Type for glimpse callback function of a lock. */ typedef int (*ldlm_glimpse_callback)(struct ldlm_lock *lock, void *data); @@ -503,7 +503,7 @@ typedef int (*ldlm_completion_callback)(struct ldlm_lock *lock, __u64 flags, struct ldlm_glimpse_work { struct ldlm_lock *gl_lock; /* lock to glimpse */ struct list_head gl_list; /* linkage to other gl work structs */ - __u32 gl_flags;/* see LDLM_GL_WORK_* below */ + u32 gl_flags;/* see LDLM_GL_WORK_* below */ union ldlm_gl_desc *gl_desc; /* glimpse descriptor to be packed in * glimpse callback request */ @@ -538,12 +538,12 @@ enum ldlm_cancel_flags { }; struct ldlm_flock { - __u64 start; - __u64 end; - __u64 owner; - __u64 blocking_owner; + u64 start; + u64 end; + u64 owner; + u64 blocking_owner; struct obd_export *blocking_export; - __u32 pid; + u32 pid; }; union ldlm_policy_data { @@ -566,7 +566,7 @@ enum lvb_type { /** * LDLM_GID_ANY is used to match any group id in ldlm_lock_match(). */ -#define LDLM_GID_ANY ((__u64)-1) +#define LDLM_GID_ANY ((u64)-1) /** * LDLM lock structure @@ -621,7 +621,7 @@ struct ldlm_lock { * Interval-tree node for ldlm_extent. */ struct rb_node l_rb; - __u64 __subtree_last; + u64 __subtree_last; /** * Requested mode. @@ -681,14 +681,14 @@ struct ldlm_lock { * Lock state flags. Protected by lr_lock. * \see lustre_dlm_flags.h where the bits are defined. */ - __u64 l_flags; + u64 l_flags; /** * Lock r/w usage counters. * Protected by lr_lock. */ - __u32 l_readers; - __u32 l_writers; + u32 l_readers; + u32 l_writers; /** * If the lock is granted, a process sleeps on this waitq to learn when * it's no longer in use. If the lock is not granted, a process sleeps @@ -720,7 +720,7 @@ struct ldlm_lock { /** * Temporary storage for a LVB received during an enqueue operation. */ - __u32 l_lvb_len; + u32 l_lvb_len; void *l_lvb_data; /** Private storage for lock user. Opaque to LDLM. */ @@ -735,7 +735,7 @@ struct ldlm_lock { * Used by Commit on Share (COS) code. Currently only used for * inodebits locks on MDS. */ - __u64 l_client_cookie; + u64 l_client_cookie; /** * List item for locks waiting for cancellation from clients. @@ -756,7 +756,7 @@ struct ldlm_lock { unsigned long l_callback_timeout; /** Local PID of process which created this lock. */ - __u32 l_pid; + u32 l_pid; /** * Number of times blocking AST was sent for this lock. @@ -1007,7 +1007,7 @@ void _ldlm_lock_debug(struct ldlm_lock *lock, } \ } while (0) -typedef int (*ldlm_processing_policy)(struct ldlm_lock *lock, __u64 *flags, +typedef int (*ldlm_processing_policy)(struct ldlm_lock *lock, u64 *flags, int first_enq, enum ldlm_error *err, struct list_head *work_list); @@ -1034,10 +1034,10 @@ int ldlm_resource_iterate(struct ldlm_namespace *, const struct ldlm_res_id *, int ldlm_replay_locks(struct obd_import *imp); /* ldlm_flock.c */ -int ldlm_flock_completion_ast(struct ldlm_lock *lock, __u64 flags, void *data); +int ldlm_flock_completion_ast(struct ldlm_lock *lock, u64 flags, void *data); /* ldlm_extent.c */ -__u64 ldlm_extent_shift_kms(struct ldlm_lock *lock, __u64 old_kms); +u64 ldlm_extent_shift_kms(struct ldlm_lock *lock, u64 old_kms); struct ldlm_callback_suite { ldlm_completion_callback lcs_completion; @@ -1053,7 +1053,7 @@ struct ldlm_callback_suite { /* ldlm_lock.c */ void ldlm_lock2handle(const struct ldlm_lock *lock, struct lustre_handle *lockh); -struct ldlm_lock *__ldlm_handle2lock(const struct lustre_handle *, __u64 flags); +struct ldlm_lock *__ldlm_handle2lock(const struct lustre_handle *, u64 flags); void ldlm_cancel_callback(struct ldlm_lock *); int ldlm_lock_remove_from_lru(struct ldlm_lock *); int ldlm_lock_set_data(const struct lustre_handle *lockh, void *data); @@ -1070,7 +1070,7 @@ static inline struct ldlm_lock *ldlm_handle2lock(const struct lustre_handle *h) lu_ref_del(&lock->l_reference, "handle", current) static inline struct ldlm_lock * -ldlm_handle2lock_long(const struct lustre_handle *h, __u64 flags) +ldlm_handle2lock_long(const struct lustre_handle *h, u64 flags) { struct ldlm_lock *lock; @@ -1154,13 +1154,13 @@ void ldlm_lock_decref_and_cancel(const struct lustre_handle *lockh, void ldlm_lock_fail_match_locked(struct ldlm_lock *lock); void ldlm_lock_allow_match(struct ldlm_lock *lock); void ldlm_lock_allow_match_locked(struct ldlm_lock *lock); -enum ldlm_mode ldlm_lock_match(struct ldlm_namespace *ns, __u64 flags, +enum ldlm_mode ldlm_lock_match(struct ldlm_namespace *ns, u64 flags, const struct ldlm_res_id *, enum ldlm_type type, union ldlm_policy_data *, enum ldlm_mode mode, struct lustre_handle *, int unref); enum ldlm_mode ldlm_revalidate_lock_handle(const struct lustre_handle *lockh, - __u64 *bits); + u64 *bits); void ldlm_lock_cancel(struct ldlm_lock *lock); void ldlm_lock_dump_handle(int level, const struct lustre_handle *); void ldlm_unlink_lock_skiplist(struct ldlm_lock *req); @@ -1170,7 +1170,7 @@ struct ldlm_namespace * ldlm_namespace_new(struct obd_device *obd, char *name, enum ldlm_side client, enum ldlm_appetite apt, enum ldlm_ns_type ns_type); -int ldlm_namespace_cleanup(struct ldlm_namespace *ns, __u64 flags); +int ldlm_namespace_cleanup(struct ldlm_namespace *ns, u64 flags); void ldlm_namespace_free_prior(struct ldlm_namespace *ns, struct obd_import *imp, int force); @@ -1213,7 +1213,7 @@ int ldlm_lock_change_resource(struct ldlm_namespace *, struct ldlm_lock *, * processing. * @{ */ -int ldlm_completion_ast(struct ldlm_lock *lock, __u64 flags, void *data); +int ldlm_completion_ast(struct ldlm_lock *lock, u64 flags, void *data); /** @} ldlm_local_ast */ /** \defgroup ldlm_cli_api API to operate on locks from actual LDLM users. @@ -1224,8 +1224,8 @@ int ldlm_lock_change_resource(struct ldlm_namespace *, struct ldlm_lock *, int ldlm_cli_enqueue(struct obd_export *exp, struct ptlrpc_request **reqp, struct ldlm_enqueue_info *einfo, const struct ldlm_res_id *res_id, - union ldlm_policy_data const *policy, __u64 *flags, - void *lvb, __u32 lvb_len, enum lvb_type lvb_type, + union ldlm_policy_data const *policy, u64 *flags, + void *lvb, u32 lvb_len, enum lvb_type lvb_type, struct lustre_handle *lockh, int async); int ldlm_prep_enqueue_req(struct obd_export *exp, struct ptlrpc_request *req, @@ -1237,9 +1237,9 @@ int ldlm_prep_elc_req(struct obd_export *exp, struct list_head *cancels, int count); int ldlm_cli_enqueue_fini(struct obd_export *exp, struct ptlrpc_request *req, - enum ldlm_type type, __u8 with_policy, + enum ldlm_type type, u8 with_policy, enum ldlm_mode mode, - __u64 *flags, void *lvb, __u32 lvb_len, + u64 *flags, void *lvb, u32 lvb_len, const struct lustre_handle *lockh, int rc); int ldlm_cli_update_pool(struct ptlrpc_request *req); int ldlm_cli_cancel(const struct lustre_handle *lockh, @@ -1255,7 +1255,7 @@ int ldlm_cli_cancel_unused_resource(struct ldlm_namespace *ns, int ldlm_cancel_resource_local(struct ldlm_resource *res, struct list_head *cancels, union ldlm_policy_data *policy, - enum ldlm_mode mode, __u64 lock_flags, + enum ldlm_mode mode, u64 lock_flags, enum ldlm_cancel_flags cancel_flags, void *opaque); int ldlm_cli_cancel_list_local(struct list_head *cancels, int count, diff --git a/drivers/staging/lustre/lustre/include/lustre_export.h b/drivers/staging/lustre/lustre/include/lustre_export.h index 79ad5aa..1c70259 100644 --- a/drivers/staging/lustre/lustre/include/lustre_export.h +++ b/drivers/staging/lustre/lustre/include/lustre_export.h @@ -101,12 +101,12 @@ struct obd_export { /** Active connection */ struct ptlrpc_connection *exp_connection; /** Connection count value from last successful reconnect rpc */ - __u32 exp_conn_cnt; + u32 exp_conn_cnt; struct list_head exp_outstanding_replies; struct list_head exp_uncommitted_replies; spinlock_t exp_uncommitted_replies_lock; /** Last committed transno for this export */ - __u64 exp_last_committed; + u64 exp_last_committed; /** On replay all requests waiting for replay are linked here */ struct list_head exp_req_replay_queue; /** @@ -139,12 +139,12 @@ struct obd_export { spinlock_t exp_bl_list_lock; }; -static inline __u64 *exp_connect_flags_ptr(struct obd_export *exp) +static inline u64 *exp_connect_flags_ptr(struct obd_export *exp) { return &exp->exp_connect_data.ocd_connect_flags; } -static inline __u64 exp_connect_flags(struct obd_export *exp) +static inline u64 exp_connect_flags(struct obd_export *exp) { return *exp_connect_flags_ptr(exp); } @@ -219,7 +219,7 @@ static inline bool imp_connect_lvb_type(struct obd_import *imp) return false; } -static inline __u64 exp_connect_ibits(struct obd_export *exp) +static inline u64 exp_connect_ibits(struct obd_export *exp) { struct obd_connect_data *ocd; @@ -239,9 +239,9 @@ static inline bool imp_connect_disp_stripe(struct obd_import *imp) #define KKUC_CT_DATA_MAGIC 0x092013cea struct kkuc_ct_data { - __u32 kcd_magic; + u32 kcd_magic; struct obd_uuid kcd_uuid; - __u32 kcd_archive; + u32 kcd_archive; }; /** @} export */ diff --git a/drivers/staging/lustre/lustre/include/lustre_fid.h b/drivers/staging/lustre/lustre/include/lustre_fid.h index 094ad28..f0afa8d 100644 --- a/drivers/staging/lustre/lustre/include/lustre_fid.h +++ b/drivers/staging/lustre/lustre/include/lustre_fid.h @@ -235,14 +235,14 @@ enum local_oid { SLAVE_LLOG_CATALOGS_OID = 4124UL, }; -static inline void lu_local_obj_fid(struct lu_fid *fid, __u32 oid) +static inline void lu_local_obj_fid(struct lu_fid *fid, u32 oid) { fid->f_seq = FID_SEQ_LOCAL_FILE; fid->f_oid = oid; fid->f_ver = 0; } -static inline void lu_local_name_obj_fid(struct lu_fid *fid, __u32 oid) +static inline void lu_local_name_obj_fid(struct lu_fid *fid, u32 oid) { fid->f_seq = FID_SEQ_LOCAL_NAME; fid->f_oid = oid; @@ -290,13 +290,13 @@ static inline int fid_is_quota(const struct lu_fid *fid) fid_seq(fid) == FID_SEQ_QUOTA_GLB; } -static inline int fid_seq_in_fldb(__u64 seq) +static inline int fid_seq_in_fldb(u64 seq) { return fid_seq_is_igif(seq) || fid_seq_is_norm(seq) || fid_seq_is_root(seq) || fid_seq_is_dot(seq); } -static inline void lu_last_id_fid(struct lu_fid *fid, __u64 seq, __u32 ost_idx) +static inline void lu_last_id_fid(struct lu_fid *fid, u64 seq, u32 ost_idx) { if (fid_seq_is_mdt0(seq)) { fid->f_seq = fid_idif_seq(0, ost_idx); @@ -352,7 +352,7 @@ struct lu_client_seq { * Sequence width, that is how many objects may be allocated in one * sequence. Default value for it is LUSTRE_SEQ_MAX_WIDTH. */ - __u64 lcs_width; + u64 lcs_width; /* wait queue for fid allocation and update indicator */ wait_queue_head_t lcs_waitq; @@ -409,8 +409,8 @@ static inline bool fid_res_name_eq(const struct lu_fid *fid, fid_extract_from_res_name(struct lu_fid *fid, const struct ldlm_res_id *res) { fid->f_seq = res->name[LUSTRE_RES_ID_SEQ_OFF]; - fid->f_oid = (__u32)(res->name[LUSTRE_RES_ID_VER_OID_OFF]); - fid->f_ver = (__u32)(res->name[LUSTRE_RES_ID_VER_OID_OFF] >> 32); + fid->f_oid = (u32)(res->name[LUSTRE_RES_ID_VER_OID_OFF]); + fid->f_ver = (u32)(res->name[LUSTRE_RES_ID_VER_OID_OFF] >> 32); LASSERT(fid_res_name_eq(fid, res)); } @@ -435,9 +435,9 @@ static inline void fid_extract_from_quota_res(struct lu_fid *glb_fid, { fid_extract_from_res_name(glb_fid, res); qid->qid_fid.f_seq = res->name[LUSTRE_RES_ID_QUOTA_SEQ_OFF]; - qid->qid_fid.f_oid = (__u32)res->name[LUSTRE_RES_ID_QUOTA_VER_OID_OFF]; + qid->qid_fid.f_oid = (u32)res->name[LUSTRE_RES_ID_QUOTA_VER_OID_OFF]; qid->qid_fid.f_ver = - (__u32)(res->name[LUSTRE_RES_ID_QUOTA_VER_OID_OFF] >> 32); + (u32)(res->name[LUSTRE_RES_ID_QUOTA_VER_OID_OFF] >> 32); } static inline void @@ -500,7 +500,7 @@ static inline int ostid_res_name_eq(const struct ost_id *oi, * Note: we need check oi_seq to decide where to set oi_id, * so oi_seq should always be set ahead of oi_id. */ -static inline int ostid_set_id(struct ost_id *oi, __u64 oid) +static inline int ostid_set_id(struct ost_id *oi, u64 oid) { if (fid_seq_is_mdt0(oi->oi.oi_seq)) { if (oid >= IDIF_MAX_OID) @@ -569,10 +569,10 @@ static inline void ost_fid_build_resid(const struct lu_fid *fid, * the time between re-used inode numbers is very long - 2^40 SEQ numbers, * or about 2^40 client mounts, if clients create less than 2^24 files/mount. */ -static inline __u64 fid_flatten(const struct lu_fid *fid) +static inline u64 fid_flatten(const struct lu_fid *fid) { - __u64 ino; - __u64 seq; + u64 ino; + u64 seq; if (fid_is_igif(fid)) { ino = lu_igif_ino(fid); @@ -586,7 +586,7 @@ static inline __u64 fid_flatten(const struct lu_fid *fid) return ino ? ino : fid_oid(fid); } -static inline __u32 fid_hash(const struct lu_fid *f, int bits) +static inline u32 fid_hash(const struct lu_fid *f, int bits) { /* all objects with same id and different versions will belong to same * collisions list. @@ -597,10 +597,10 @@ static inline __u32 fid_hash(const struct lu_fid *f, int bits) /** * map fid to 32 bit value for ino on 32bit systems. */ -static inline __u32 fid_flatten32(const struct lu_fid *fid) +static inline u32 fid_flatten32(const struct lu_fid *fid) { - __u32 ino; - __u64 seq; + u32 ino; + u64 seq; if (fid_is_igif(fid)) { ino = lu_igif_ino(fid); diff --git a/drivers/staging/lustre/lustre/include/lustre_fld.h b/drivers/staging/lustre/lustre/include/lustre_fld.h index f42122a..4bcabf7 100644 --- a/drivers/staging/lustre/lustre/include/lustre_fld.h +++ b/drivers/staging/lustre/lustre/include/lustre_fld.h @@ -62,7 +62,7 @@ struct lu_fld_target { struct list_head ft_chain; struct obd_export *ft_exp; struct lu_server_fld *ft_srv; - __u64 ft_idx; + u64 ft_idx; }; struct lu_server_fld { @@ -115,7 +115,7 @@ int fld_client_init(struct lu_client_fld *fld, void fld_client_flush(struct lu_client_fld *fld); int fld_client_lookup(struct lu_client_fld *fld, u64 seq, u32 *mds, - __u32 flags, const struct lu_env *env); + u32 flags, const struct lu_env *env); int fld_client_create(struct lu_client_fld *fld, struct lu_seq_range *range, @@ -128,7 +128,7 @@ int fld_client_add_target(struct lu_client_fld *fld, struct lu_fld_target *tar); int fld_client_del_target(struct lu_client_fld *fld, - __u64 idx); + u64 idx); void fld_client_debugfs_fini(struct lu_client_fld *fld); diff --git a/drivers/staging/lustre/lustre/include/lustre_ha.h b/drivers/staging/lustre/lustre/include/lustre_ha.h index cbd6898..af92a56 100644 --- a/drivers/staging/lustre/lustre/include/lustre_ha.h +++ b/drivers/staging/lustre/lustre/include/lustre_ha.h @@ -53,7 +53,7 @@ void ptlrpc_activate_import(struct obd_import *imp); void ptlrpc_deactivate_import(struct obd_import *imp); void ptlrpc_invalidate_import(struct obd_import *imp); -void ptlrpc_fail_import(struct obd_import *imp, __u32 conn_cnt); +void ptlrpc_fail_import(struct obd_import *imp, u32 conn_cnt); void ptlrpc_pinger_force(struct obd_import *imp); /** @} ha */ diff --git a/drivers/staging/lustre/lustre/include/lustre_handles.h b/drivers/staging/lustre/lustre/include/lustre_handles.h index 3556ce8..84f70f3 100644 --- a/drivers/staging/lustre/lustre/include/lustre_handles.h +++ b/drivers/staging/lustre/lustre/include/lustre_handles.h @@ -64,7 +64,7 @@ struct portals_handle_ops { */ struct portals_handle { struct list_head h_link; - __u64 h_cookie; + u64 h_cookie; const void *h_owner; struct portals_handle_ops *h_ops; @@ -81,7 +81,7 @@ struct portals_handle { void class_handle_hash(struct portals_handle *, struct portals_handle_ops *ops); void class_handle_unhash(struct portals_handle *); -void *class_handle2object(__u64 cookie, const void *owner); +void *class_handle2object(u64 cookie, const void *owner); void class_handle_free_cb(struct rcu_head *rcu); int class_handle_init(void); void class_handle_cleanup(void); diff --git a/drivers/staging/lustre/lustre/include/lustre_import.h b/drivers/staging/lustre/lustre/include/lustre_import.h index 8a8a125..db075be 100644 --- a/drivers/staging/lustre/lustre/include/lustre_import.h +++ b/drivers/staging/lustre/lustre/include/lustre_import.h @@ -69,10 +69,10 @@ struct adaptive_timeout { struct ptlrpc_at_array { struct list_head *paa_reqs_array; /** array to hold requests */ - __u32 paa_size; /** the size of array */ - __u32 paa_count; /** the total count of reqs */ + u32 paa_size; /** the size of array */ + u32 paa_count; /** the total count of reqs */ time64_t paa_deadline; /** the earliest deadline of reqs */ - __u32 *paa_reqs_count; /** the count of reqs in each entry */ + u32 *paa_reqs_count; /** the count of reqs in each entry */ }; #define IMP_AT_MAX_PORTALS 8 @@ -137,7 +137,7 @@ struct obd_import_conn { /** * Time (64 bit jiffies) of last connection attempt on this connection */ - __u64 oic_last_attempt; + u64 oic_last_attempt; }; /* state history */ @@ -190,7 +190,7 @@ struct obd_import { /** List of not replied requests */ struct list_head imp_unreplied_list; /** Known maximal replied XID */ - __u64 imp_known_replied_xid; + u64 imp_known_replied_xid; /** obd device for this import */ struct obd_device *imp_obd; @@ -227,23 +227,23 @@ struct obd_import { /** Current import generation. Incremented on every reconnect */ int imp_generation; /** Incremented every time we send reconnection request */ - __u32 imp_conn_cnt; + u32 imp_conn_cnt; /** * \see ptlrpc_free_committed remembers imp_generation value here * after a check to save on unnecessary replay list iterations */ int imp_last_generation_checked; /** Last transno we replayed */ - __u64 imp_last_replay_transno; + u64 imp_last_replay_transno; /** Last transno committed on remote side */ - __u64 imp_peer_committed_transno; + u64 imp_peer_committed_transno; /** * \see ptlrpc_free_committed remembers last_transno since its last * check here and if last_transno did not change since last run of * ptlrpc_free_committed and import generation is the same, we can * skip looking for requests to remove from replay list as optimisation */ - __u64 imp_last_transno_checked; + u64 imp_last_transno_checked; /** * Remote export handle. This is how remote side knows what export * we are talking to. Filled from response to connect request @@ -252,7 +252,7 @@ struct obd_import { /** When to perform next ping. time in jiffies. */ unsigned long imp_next_ping; /** When we last successfully connected. time in 64bit jiffies */ - __u64 imp_last_success_conn; + u64 imp_last_success_conn; /** List of all possible connection for import. */ struct list_head imp_conn_list; @@ -304,14 +304,14 @@ struct obd_import { imp_connect_tried:1, /* connected but not FULL yet */ imp_connected:1; - __u32 imp_connect_op; + u32 imp_connect_op; struct obd_connect_data imp_connect_data; - __u64 imp_connect_flags_orig; + u64 imp_connect_flags_orig; u64 imp_connect_flags2_orig; int imp_connect_error; - __u32 imp_msg_magic; - __u32 imp_msghdr_flags; /* adjusted based on server capability */ + u32 imp_msg_magic; + u32 imp_msghdr_flags; /* adjusted based on server capability */ struct imp_at imp_at; /* adaptive timeout data */ time64_t imp_last_reply_time; /* for health check */ diff --git a/drivers/staging/lustre/lustre/include/lustre_intent.h b/drivers/staging/lustre/lustre/include/lustre_intent.h index 51e5c0e..3f26d7a 100644 --- a/drivers/staging/lustre/lustre/include/lustre_intent.h +++ b/drivers/staging/lustre/lustre/include/lustre_intent.h @@ -41,14 +41,14 @@ struct lookup_intent { int it_op; int it_create_mode; - __u64 it_flags; + u64 it_flags; int it_disposition; int it_status; - __u64 it_lock_handle; - __u64 it_lock_bits; + u64 it_lock_handle; + u64 it_lock_bits; int it_lock_mode; int it_remote_lock_mode; - __u64 it_remote_lock_handle; + u64 it_remote_lock_handle; struct ptlrpc_request *it_request; unsigned int it_lock_set:1; }; diff --git a/drivers/staging/lustre/lustre/include/lustre_lmv.h b/drivers/staging/lustre/lustre/include/lustre_lmv.h index 080ec1f..c4f05d2 100644 --- a/drivers/staging/lustre/lustre/include/lustre_lmv.h +++ b/drivers/staging/lustre/lustre/include/lustre_lmv.h @@ -42,13 +42,13 @@ struct lmv_oinfo { }; struct lmv_stripe_md { - __u32 lsm_md_magic; - __u32 lsm_md_stripe_count; - __u32 lsm_md_master_mdt_index; - __u32 lsm_md_hash_type; - __u32 lsm_md_layout_version; - __u32 lsm_md_default_count; - __u32 lsm_md_default_index; + u32 lsm_md_magic; + u32 lsm_md_stripe_count; + u32 lsm_md_master_mdt_index; + u32 lsm_md_hash_type; + u32 lsm_md_layout_version; + u32 lsm_md_default_count; + u32 lsm_md_default_index; char lsm_md_pool_name[LOV_MAXPOOLNAME + 1]; struct lmv_oinfo lsm_md_oinfo[0]; }; @@ -56,7 +56,7 @@ struct lmv_stripe_md { static inline bool lsm_md_eq(const struct lmv_stripe_md *lsm1, const struct lmv_stripe_md *lsm2) { - __u32 idx; + u32 idx; if (lsm1->lsm_md_magic != lsm2->lsm_md_magic || lsm1->lsm_md_stripe_count != lsm2->lsm_md_stripe_count || @@ -82,7 +82,7 @@ struct lmv_stripe_md { static inline void lmv1_le_to_cpu(struct lmv_mds_md_v1 *lmv_dst, const struct lmv_mds_md_v1 *lmv_src) { - __u32 i; + u32 i; lmv_dst->lmv_magic = le32_to_cpu(lmv_src->lmv_magic); lmv_dst->lmv_stripe_count = le32_to_cpu(lmv_src->lmv_stripe_count); @@ -126,18 +126,18 @@ static inline void lmv_le_to_cpu(union lmv_mds_md *lmv_dst, static inline unsigned int lmv_hash_fnv1a(unsigned int count, const char *name, int namelen) { - __u64 hash; + u64 hash; hash = lustre_hash_fnv_1a_64(name, namelen); return do_div(hash, count); } -static inline int lmv_name_to_stripe_index(__u32 lmv_hash_type, +static inline int lmv_name_to_stripe_index(u32 lmv_hash_type, unsigned int stripe_count, const char *name, int namelen) { - __u32 hash_type = lmv_hash_type & LMV_HASH_TYPE_MASK; + u32 hash_type = lmv_hash_type & LMV_HASH_TYPE_MASK; int idx; LASSERT(namelen > 0); @@ -165,7 +165,7 @@ static inline int lmv_name_to_stripe_index(__u32 lmv_hash_type, return idx; } -static inline bool lmv_is_known_hash_type(__u32 type) +static inline bool lmv_is_known_hash_type(u32 type) { return (type & LMV_HASH_TYPE_MASK) == LMV_HASH_TYPE_FNV_1A_64 || (type & LMV_HASH_TYPE_MASK) == LMV_HASH_TYPE_ALL_CHARS; diff --git a/drivers/staging/lustre/lustre/include/lustre_log.h b/drivers/staging/lustre/lustre/include/lustre_log.h index 07f4e60..4ba4501 100644 --- a/drivers/staging/lustre/lustre/include/lustre_log.h +++ b/drivers/staging/lustre/lustre/include/lustre_log.h @@ -143,7 +143,7 @@ int llog_setup(const struct lu_env *env, struct obd_device *obd, struct llog_operations { int (*lop_next_block)(const struct lu_env *env, struct llog_handle *h, - int *curr_idx, int next_idx, __u64 *offset, + int *curr_idx, int next_idx, u64 *offset, void *buf, int len); int (*lop_prev_block)(const struct lu_env *env, struct llog_handle *h, int prev_idx, void *buf, int len); @@ -218,7 +218,7 @@ struct llog_handle { size_t lgh_hdr_size; int lgh_last_idx; int lgh_cur_idx; /* used during llog_process */ - __u64 lgh_cur_offset; /* used during llog_process */ + u64 lgh_cur_offset; /* used during llog_process */ struct llog_ctxt *lgh_ctxt; union { struct plain_handle_data phd; @@ -250,7 +250,7 @@ struct llog_ctxt { * llog chunk size, and llog record size can not be bigger than * loc_chunk_size */ - __u32 loc_chunk_size; + u32 loc_chunk_size; }; #define LLOG_PROC_BREAK 0x0001 @@ -348,7 +348,7 @@ static inline int llog_ctxt_null(struct obd_device *obd, int index) static inline int llog_next_block(const struct lu_env *env, struct llog_handle *loghandle, int *cur_idx, - int next_idx, __u64 *cur_offset, void *buf, + int next_idx, u64 *cur_offset, void *buf, int len) { struct llog_operations *lop; diff --git a/drivers/staging/lustre/lustre/include/lustre_mdc.h b/drivers/staging/lustre/lustre/include/lustre_mdc.h index 6ac7fc4..c1fb324 100644 --- a/drivers/staging/lustre/lustre/include/lustre_mdc.h +++ b/drivers/staging/lustre/lustre/include/lustre_mdc.h @@ -204,7 +204,7 @@ static inline void mdc_update_max_ea_from_body(struct obd_export *exp, if (cli->cl_max_mds_easize < body->mbo_max_mdsize) cli->cl_max_mds_easize = body->mbo_max_mdsize; - def_easize = min_t(__u32, body->mbo_max_mdsize, + def_easize = min_t(u32, body->mbo_max_mdsize, OBD_MAX_DEFAULT_EA_SIZE); cli->cl_default_mds_easize = def_easize; } diff --git a/drivers/staging/lustre/lustre/include/lustre_net.h b/drivers/staging/lustre/lustre/include/lustre_net.h index 8e34766..050a7ec 100644 --- a/drivers/staging/lustre/lustre/include/lustre_net.h +++ b/drivers/staging/lustre/lustre/include/lustre_net.h @@ -95,7 +95,7 @@ * use the negotiated per-client ocd_brw_size to determine the bulk * RPC count. */ -#define PTLRPC_BULK_OPS_MASK (~((__u64)PTLRPC_BULK_OPS_COUNT - 1)) +#define PTLRPC_BULK_OPS_MASK (~((u64)PTLRPC_BULK_OPS_COUNT - 1)) /** * Define maxima for bulk I/O. @@ -304,9 +304,9 @@ struct ptlrpc_connection { /** Client definition for PortalRPC */ struct ptlrpc_client { /** What lnet portal does this client send messages to by default */ - __u32 cli_request_portal; + u32 cli_request_portal; /** What portal do we expect replies on */ - __u32 cli_reply_portal; + u32 cli_reply_portal; /** Name of the client */ char *cli_name; }; @@ -327,7 +327,7 @@ struct ptlrpc_client { * least big enough for that. */ void *pointer_arg[11]; - __u64 space[7]; + u64 space[7]; }; struct ptlrpc_request_set; @@ -455,11 +455,11 @@ struct ptlrpc_reply_state { /** Size of the state */ int rs_size; /** opcode */ - __u32 rs_opc; + u32 rs_opc; /** Transaction number */ - __u64 rs_transno; + u64 rs_transno; /** xid */ - __u64 rs_xid; + u64 rs_xid; struct obd_export *rs_export; struct ptlrpc_service_part *rs_svcpt; /** Lnet metadata handle for the reply */ @@ -667,7 +667,7 @@ struct ptlrpc_srv_req { /** server-side history, used for debuging purposes. */ struct list_head sr_hist_list; /** history sequence # */ - __u64 sr_hist_seq; + u64 sr_hist_seq; /** the index of service's srv_at_array into which request is linked */ time64_t sr_at_index; /** authed uid */ @@ -809,9 +809,9 @@ struct ptlrpc_request { /** Reply message - server response */ struct lustre_msg *rq_repmsg; /** Transaction number */ - __u64 rq_transno; + u64 rq_transno; /** xid */ - __u64 rq_xid; + u64 rq_xid; /** bulk match bits */ u64 rq_mbits; /** @@ -871,8 +871,8 @@ struct ptlrpc_request { /** @} */ /** Fields that help to see if request and reply were swabbed or not */ - __u32 rq_req_swab_mask; - __u32 rq_rep_swab_mask; + u32 rq_req_swab_mask; + u32 rq_rep_swab_mask; /** how many early replies (for stats) */ int rq_early_count; @@ -1214,7 +1214,7 @@ struct ptlrpc_bulk_desc { /** {put,get}{source,sink}{kvec,kiov} */ enum ptlrpc_bulk_op_type bd_type; /** LNet portal for this bulk */ - __u32 bd_portal; + u32 bd_portal; /** Server side - export this bulk created for */ struct obd_export *bd_export; /** Client side - import this bulk was sent on */ @@ -1282,7 +1282,7 @@ struct ptlrpc_thread { * thread-private data (preallocated memory) */ void *t_data; - __u32 t_flags; + u32 t_flags; /** * service thread index, from ptlrpc_start_threads */ @@ -1329,23 +1329,23 @@ static inline int thread_is_running(struct ptlrpc_thread *thread) return !!(thread->t_flags & SVC_RUNNING); } -static inline void thread_clear_flags(struct ptlrpc_thread *thread, __u32 flags) +static inline void thread_clear_flags(struct ptlrpc_thread *thread, u32 flags) { thread->t_flags &= ~flags; } -static inline void thread_set_flags(struct ptlrpc_thread *thread, __u32 flags) +static inline void thread_set_flags(struct ptlrpc_thread *thread, u32 flags) { thread->t_flags = flags; } -static inline void thread_add_flags(struct ptlrpc_thread *thread, __u32 flags) +static inline void thread_add_flags(struct ptlrpc_thread *thread, u32 flags) { thread->t_flags |= flags; } static inline int thread_test_and_clear_flags(struct ptlrpc_thread *thread, - __u32 flags) + u32 flags) { if (thread->t_flags & flags) { thread->t_flags &= ~flags; @@ -1459,14 +1459,14 @@ struct ptlrpc_service { /** # buffers to allocate in 1 group */ int srv_nbuf_per_group; /** Local portal on which to receive requests */ - __u32 srv_req_portal; + u32 srv_req_portal; /** Portal on the client to send replies to */ - __u32 srv_rep_portal; + u32 srv_rep_portal; /** * Tags for lu_context associated with this thread, see struct * lu_context. */ - __u32 srv_ctx_tags; + u32 srv_ctx_tags; /** soft watchdog timeout multiplier */ int srv_watchdog_factor; /** under unregister_service */ @@ -1477,7 +1477,7 @@ struct ptlrpc_service { /** number of CPTs this service bound on */ int srv_ncpts; /** CPTs array this service bound on */ - __u32 *srv_cpts; + u32 *srv_cpts; /** 2^srv_cptab_bits >= cfs_cpt_numbert(srv_cptable) */ int srv_cpt_bits; /** CPT table this service is running over */ @@ -1561,9 +1561,9 @@ struct ptlrpc_service_part { /** # request buffers in history */ int scp_hist_nrqbds; /** sequence number for request */ - __u64 scp_hist_seq; + u64 scp_hist_seq; /** highest seq culled from history */ - __u64 scp_hist_seq_culled; + u64 scp_hist_seq_culled; /** * serialize the following fields, used for processing requests @@ -1849,12 +1849,12 @@ struct ptlrpc_request *ptlrpc_request_alloc_pool(struct obd_import *imp, const struct req_format *); void ptlrpc_request_free(struct ptlrpc_request *request); int ptlrpc_request_pack(struct ptlrpc_request *request, - __u32 version, int opcode); + u32 version, int opcode); struct ptlrpc_request *ptlrpc_request_alloc_pack(struct obd_import *, const struct req_format *, - __u32, int); + u32, int); int ptlrpc_request_bufs_pack(struct ptlrpc_request *request, - __u32 version, int opcode, char **bufs, + u32 version, int opcode, char **bufs, struct ptlrpc_cli_ctx *ctx); void ptlrpc_req_finished(struct ptlrpc_request *request); struct ptlrpc_request *ptlrpc_request_addref(struct ptlrpc_request *req); @@ -1896,9 +1896,9 @@ static inline void ptlrpc_release_bulk_page_pin(struct ptlrpc_bulk_desc *desc) void ptlrpc_retain_replayable_request(struct ptlrpc_request *req, struct obd_import *imp); -__u64 ptlrpc_next_xid(void); -__u64 ptlrpc_sample_next_xid(void); -__u64 ptlrpc_req_xid(struct ptlrpc_request *request); +u64 ptlrpc_next_xid(void); +u64 ptlrpc_sample_next_xid(void); +u64 ptlrpc_req_xid(struct ptlrpc_request *request); /* Set of routines to run a function in ptlrpcd context */ void *ptlrpcd_alloc_work(struct obd_import *imp, @@ -1945,7 +1945,7 @@ struct ptlrpc_service_thr_conf { /* set NUMA node affinity for service threads */ unsigned int tc_cpu_affinity; /* Tags for lu_context associated with service thread */ - __u32 tc_ctx_tags; + u32 tc_ctx_tags; }; struct ptlrpc_service_cpt_conf { @@ -2016,24 +2016,24 @@ void ptlrpc_buf_set_swabbed(struct ptlrpc_request *req, const int inout, int ptlrpc_unpack_rep_msg(struct ptlrpc_request *req, int len); int ptlrpc_unpack_req_msg(struct ptlrpc_request *req, int len); -void lustre_init_msg_v2(struct lustre_msg_v2 *msg, int count, __u32 *lens, +void lustre_init_msg_v2(struct lustre_msg_v2 *msg, int count, u32 *lens, char **bufs); -int lustre_pack_request(struct ptlrpc_request *, __u32 magic, int count, - __u32 *lens, char **bufs); -int lustre_pack_reply(struct ptlrpc_request *, int count, __u32 *lens, +int lustre_pack_request(struct ptlrpc_request *, u32 magic, int count, + u32 *lens, char **bufs); +int lustre_pack_reply(struct ptlrpc_request *, int count, u32 *lens, char **bufs); int lustre_pack_reply_v2(struct ptlrpc_request *req, int count, - __u32 *lens, char **bufs, int flags); + u32 *lens, char **bufs, int flags); #define LPRFL_EARLY_REPLY 1 -int lustre_pack_reply_flags(struct ptlrpc_request *, int count, __u32 *lens, +int lustre_pack_reply_flags(struct ptlrpc_request *, int count, u32 *lens, char **bufs, int flags); int lustre_shrink_msg(struct lustre_msg *msg, int segment, unsigned int newlen, int move_data); void lustre_free_reply_state(struct ptlrpc_reply_state *rs); int __lustre_unpack_msg(struct lustre_msg *m, int len); -u32 lustre_msg_hdr_size(__u32 magic, u32 count); -u32 lustre_msg_size(__u32 magic, int count, __u32 *lengths); -u32 lustre_msg_size_v2(int count, __u32 *lengths); +u32 lustre_msg_hdr_size(u32 magic, u32 count); +u32 lustre_msg_size(u32 magic, int count, u32 *lengths); +u32 lustre_msg_size_v2(int count, u32 *lengths); u32 lustre_packed_msg_size(struct lustre_msg *msg); u32 lustre_msg_early_size(void); void *lustre_msg_buf_v2(struct lustre_msg_v2 *m, u32 n, u32 min_size); @@ -2041,48 +2041,48 @@ int lustre_shrink_msg(struct lustre_msg *msg, int segment, u32 lustre_msg_buflen(struct lustre_msg *m, u32 n); u32 lustre_msg_bufcount(struct lustre_msg *m); char *lustre_msg_string(struct lustre_msg *m, u32 n, u32 max_len); -__u32 lustre_msghdr_get_flags(struct lustre_msg *msg); -void lustre_msghdr_set_flags(struct lustre_msg *msg, __u32 flags); -__u32 lustre_msg_get_flags(struct lustre_msg *msg); +u32 lustre_msghdr_get_flags(struct lustre_msg *msg); +void lustre_msghdr_set_flags(struct lustre_msg *msg, u32 flags); +u32 lustre_msg_get_flags(struct lustre_msg *msg); void lustre_msg_add_flags(struct lustre_msg *msg, u32 flags); void lustre_msg_set_flags(struct lustre_msg *msg, u32 flags); void lustre_msg_clear_flags(struct lustre_msg *msg, u32 flags); -__u32 lustre_msg_get_op_flags(struct lustre_msg *msg); +u32 lustre_msg_get_op_flags(struct lustre_msg *msg); void lustre_msg_add_op_flags(struct lustre_msg *msg, u32 flags); struct lustre_handle *lustre_msg_get_handle(struct lustre_msg *msg); -__u32 lustre_msg_get_type(struct lustre_msg *msg); +u32 lustre_msg_get_type(struct lustre_msg *msg); void lustre_msg_add_version(struct lustre_msg *msg, u32 version); -__u32 lustre_msg_get_opc(struct lustre_msg *msg); -__u16 lustre_msg_get_tag(struct lustre_msg *msg); -__u64 lustre_msg_get_last_committed(struct lustre_msg *msg); -__u64 *lustre_msg_get_versions(struct lustre_msg *msg); -__u64 lustre_msg_get_transno(struct lustre_msg *msg); -__u64 lustre_msg_get_slv(struct lustre_msg *msg); -__u32 lustre_msg_get_limit(struct lustre_msg *msg); -void lustre_msg_set_slv(struct lustre_msg *msg, __u64 slv); -void lustre_msg_set_limit(struct lustre_msg *msg, __u64 limit); +u32 lustre_msg_get_opc(struct lustre_msg *msg); +u16 lustre_msg_get_tag(struct lustre_msg *msg); +u64 lustre_msg_get_last_committed(struct lustre_msg *msg); +u64 *lustre_msg_get_versions(struct lustre_msg *msg); +u64 lustre_msg_get_transno(struct lustre_msg *msg); +u64 lustre_msg_get_slv(struct lustre_msg *msg); +u32 lustre_msg_get_limit(struct lustre_msg *msg); +void lustre_msg_set_slv(struct lustre_msg *msg, u64 slv); +void lustre_msg_set_limit(struct lustre_msg *msg, u64 limit); int lustre_msg_get_status(struct lustre_msg *msg); -__u32 lustre_msg_get_conn_cnt(struct lustre_msg *msg); -__u32 lustre_msg_get_magic(struct lustre_msg *msg); -__u32 lustre_msg_get_timeout(struct lustre_msg *msg); -__u32 lustre_msg_get_service_time(struct lustre_msg *msg); -__u32 lustre_msg_get_cksum(struct lustre_msg *msg); -__u32 lustre_msg_calc_cksum(struct lustre_msg *msg); +u32 lustre_msg_get_conn_cnt(struct lustre_msg *msg); +u32 lustre_msg_get_magic(struct lustre_msg *msg); +u32 lustre_msg_get_timeout(struct lustre_msg *msg); +u32 lustre_msg_get_service_time(struct lustre_msg *msg); +u32 lustre_msg_get_cksum(struct lustre_msg *msg); +u32 lustre_msg_calc_cksum(struct lustre_msg *msg); void lustre_msg_set_handle(struct lustre_msg *msg, struct lustre_handle *handle); -void lustre_msg_set_type(struct lustre_msg *msg, __u32 type); -void lustre_msg_set_opc(struct lustre_msg *msg, __u32 opc); +void lustre_msg_set_type(struct lustre_msg *msg, u32 type); +void lustre_msg_set_opc(struct lustre_msg *msg, u32 opc); void lustre_msg_set_last_xid(struct lustre_msg *msg, u64 last_xid); -void lustre_msg_set_tag(struct lustre_msg *msg, __u16 tag); -void lustre_msg_set_versions(struct lustre_msg *msg, __u64 *versions); -void lustre_msg_set_transno(struct lustre_msg *msg, __u64 transno); -void lustre_msg_set_status(struct lustre_msg *msg, __u32 status); -void lustre_msg_set_conn_cnt(struct lustre_msg *msg, __u32 conn_cnt); +void lustre_msg_set_tag(struct lustre_msg *msg, u16 tag); +void lustre_msg_set_versions(struct lustre_msg *msg, u64 *versions); +void lustre_msg_set_transno(struct lustre_msg *msg, u64 transno); +void lustre_msg_set_status(struct lustre_msg *msg, u32 status); +void lustre_msg_set_conn_cnt(struct lustre_msg *msg, u32 conn_cnt); void ptlrpc_request_set_replen(struct ptlrpc_request *req); -void lustre_msg_set_timeout(struct lustre_msg *msg, __u32 timeout); -void lustre_msg_set_service_time(struct lustre_msg *msg, __u32 service_time); +void lustre_msg_set_timeout(struct lustre_msg *msg, u32 timeout); +void lustre_msg_set_service_time(struct lustre_msg *msg, u32 service_time); void lustre_msg_set_jobid(struct lustre_msg *msg, char *jobid); -void lustre_msg_set_cksum(struct lustre_msg *msg, __u32 cksum); +void lustre_msg_set_cksum(struct lustre_msg *msg, u32 cksum); void lustre_msg_set_mbits(struct lustre_msg *msg, u64 mbits); static inline void @@ -2244,7 +2244,7 @@ static inline void ptlrpc_req_drop_rs(struct ptlrpc_request *req) req->rq_repmsg = NULL; } -static inline __u32 lustre_request_magic(struct ptlrpc_request *req) +static inline u32 lustre_request_magic(struct ptlrpc_request *req) { return lustre_msg_get_magic(req->rq_reqmsg); } @@ -2355,7 +2355,7 @@ int ptlrpc_del_timeout_client(struct list_head *obd_list, * procfs output related functions * @{ */ -const char *ll_opcode2str(__u32 opcode); +const char *ll_opcode2str(u32 opcode); void ptlrpc_lprocfs_register_obd(struct obd_device *obd); void ptlrpc_lprocfs_unregister_obd(struct obd_device *obd); void ptlrpc_lprocfs_brw(struct ptlrpc_request *req, int bytes); diff --git a/drivers/staging/lustre/lustre/include/lustre_nrs_fifo.h b/drivers/staging/lustre/lustre/include/lustre_nrs_fifo.h index b70d97d..0db4345f 100644 --- a/drivers/staging/lustre/lustre/include/lustre_nrs_fifo.h +++ b/drivers/staging/lustre/lustre/include/lustre_nrs_fifo.h @@ -59,12 +59,12 @@ struct nrs_fifo_head { /** * For debugging purposes. */ - __u64 fh_sequence; + u64 fh_sequence; }; struct nrs_fifo_req { struct list_head fr_list; - __u64 fr_sequence; + u64 fr_sequence; }; /** @} fifo */ diff --git a/drivers/staging/lustre/lustre/include/lustre_req_layout.h b/drivers/staging/lustre/lustre/include/lustre_req_layout.h index 3387ab2..2aba99f 100644 --- a/drivers/staging/lustre/lustre/include/lustre_req_layout.h +++ b/drivers/staging/lustre/lustre/include/lustre_req_layout.h @@ -66,7 +66,7 @@ struct req_capsule { struct ptlrpc_request *rc_req; const struct req_format *rc_fmt; enum req_location rc_loc; - __u32 rc_area[RCL_NR][REQ_MAX_FIELD_NR]; + u32 rc_area[RCL_NR][REQ_MAX_FIELD_NR]; }; void req_capsule_init(struct req_capsule *pill, struct ptlrpc_request *req, @@ -105,7 +105,7 @@ u32 req_capsule_get_size(const struct req_capsule *pill, const struct req_msg_field *field, enum req_location loc); u32 req_capsule_msg_size(struct req_capsule *pill, enum req_location loc); -u32 req_capsule_fmt_size(__u32 magic, const struct req_format *fmt, +u32 req_capsule_fmt_size(u32 magic, const struct req_format *fmt, enum req_location loc); void req_capsule_extend(struct req_capsule *pill, const struct req_format *fmt); diff --git a/drivers/staging/lustre/lustre/include/lustre_sec.h b/drivers/staging/lustre/lustre/include/lustre_sec.h index 43ff594..c622c8d 100644 --- a/drivers/staging/lustre/lustre/include/lustre_sec.h +++ b/drivers/staging/lustre/lustre/include/lustre_sec.h @@ -139,37 +139,37 @@ enum sptlrpc_bulk_service { #define FLVR_BULK_SVC_OFFSET (16) #define MAKE_FLVR(policy, mech, svc, btype, bsvc) \ - (((__u32)(policy) << FLVR_POLICY_OFFSET) | \ - ((__u32)(mech) << FLVR_MECH_OFFSET) | \ - ((__u32)(svc) << FLVR_SVC_OFFSET) | \ - ((__u32)(btype) << FLVR_BULK_TYPE_OFFSET) | \ - ((__u32)(bsvc) << FLVR_BULK_SVC_OFFSET)) + (((u32)(policy) << FLVR_POLICY_OFFSET) | \ + ((u32)(mech) << FLVR_MECH_OFFSET) | \ + ((u32)(svc) << FLVR_SVC_OFFSET) | \ + ((u32)(btype) << FLVR_BULK_TYPE_OFFSET) | \ + ((u32)(bsvc) << FLVR_BULK_SVC_OFFSET)) /* * extraction */ #define SPTLRPC_FLVR_POLICY(flavor) \ - ((((__u32)(flavor)) >> FLVR_POLICY_OFFSET) & 0xF) + ((((u32)(flavor)) >> FLVR_POLICY_OFFSET) & 0xF) #define SPTLRPC_FLVR_MECH(flavor) \ - ((((__u32)(flavor)) >> FLVR_MECH_OFFSET) & 0xF) + ((((u32)(flavor)) >> FLVR_MECH_OFFSET) & 0xF) #define SPTLRPC_FLVR_SVC(flavor) \ - ((((__u32)(flavor)) >> FLVR_SVC_OFFSET) & 0xF) + ((((u32)(flavor)) >> FLVR_SVC_OFFSET) & 0xF) #define SPTLRPC_FLVR_BULK_TYPE(flavor) \ - ((((__u32)(flavor)) >> FLVR_BULK_TYPE_OFFSET) & 0xF) + ((((u32)(flavor)) >> FLVR_BULK_TYPE_OFFSET) & 0xF) #define SPTLRPC_FLVR_BULK_SVC(flavor) \ - ((((__u32)(flavor)) >> FLVR_BULK_SVC_OFFSET) & 0xF) + ((((u32)(flavor)) >> FLVR_BULK_SVC_OFFSET) & 0xF) #define SPTLRPC_FLVR_BASE(flavor) \ - ((((__u32)(flavor)) >> FLVR_POLICY_OFFSET) & 0xFFF) + ((((u32)(flavor)) >> FLVR_POLICY_OFFSET) & 0xFFF) #define SPTLRPC_FLVR_BASE_SUB(flavor) \ - ((((__u32)(flavor)) >> FLVR_MECH_OFFSET) & 0xFF) + ((((u32)(flavor)) >> FLVR_MECH_OFFSET) & 0xFF) /* * gss subflavors */ #define MAKE_BASE_SUBFLVR(mech, svc) \ - ((__u32)(mech) | \ - ((__u32)(svc) << (FLVR_SVC_OFFSET - FLVR_MECH_OFFSET))) + ((u32)(mech) | \ + ((u32)(svc) << (FLVR_SVC_OFFSET - FLVR_MECH_OFFSET))) #define SPTLRPC_SUBFLVR_KRB5N \ MAKE_BASE_SUBFLVR(SPTLRPC_MECH_GSS_KRB5, SPTLRPC_SVC_NULL) @@ -222,17 +222,17 @@ enum sptlrpc_bulk_service { #define SPTLRPC_FLVR_DEFAULT SPTLRPC_FLVR_NULL -#define SPTLRPC_FLVR_INVALID ((__u32)0xFFFFFFFF) -#define SPTLRPC_FLVR_ANY ((__u32)0xFFF00000) +#define SPTLRPC_FLVR_INVALID ((u32)0xFFFFFFFF) +#define SPTLRPC_FLVR_ANY ((u32)0xFFF00000) /** * extract the useful part from wire flavor */ -#define WIRE_FLVR(wflvr) (((__u32)(wflvr)) & 0x000FFFFF) +#define WIRE_FLVR(wflvr) (((u32)(wflvr)) & 0x000FFFFF) /** @} flavor */ -static inline void flvr_set_svc(__u32 *flvr, __u32 svc) +static inline void flvr_set_svc(u32 *flvr, u32 svc) { LASSERT(svc < SPTLRPC_SVC_MAX); *flvr = MAKE_FLVR(SPTLRPC_FLVR_POLICY(*flvr), @@ -242,7 +242,7 @@ static inline void flvr_set_svc(__u32 *flvr, __u32 svc) SPTLRPC_FLVR_BULK_SVC(*flvr)); } -static inline void flvr_set_bulk_svc(__u32 *flvr, __u32 svc) +static inline void flvr_set_bulk_svc(u32 *flvr, u32 svc) { LASSERT(svc < SPTLRPC_BULK_SVC_MAX); *flvr = MAKE_FLVR(SPTLRPC_FLVR_POLICY(*flvr), @@ -253,7 +253,7 @@ static inline void flvr_set_bulk_svc(__u32 *flvr, __u32 svc) } struct bulk_spec_hash { - __u8 hash_alg; + u8 hash_alg; }; /** @@ -264,11 +264,11 @@ struct sptlrpc_flavor { /** * wire flavor, should be renamed to sf_wire. */ - __u32 sf_rpc; + u32 sf_rpc; /** * general flags of PTLRPC_SEC_FL_* */ - __u32 sf_flags; + u32 sf_flags; /** * rpc flavor specification */ @@ -303,10 +303,10 @@ enum lustre_sec_part { * two Lustre parts. */ struct sptlrpc_rule { - __u32 sr_netid; /* LNET network ID */ - __u8 sr_from; /* sec_part */ - __u8 sr_to; /* sec_part */ - __u16 sr_padding; + u32 sr_netid; /* LNET network ID */ + u8 sr_from; /* sec_part */ + u8 sr_to; /* sec_part */ + u16 sr_padding; struct sptlrpc_flavor sr_flvr; }; @@ -757,7 +757,7 @@ struct ptlrpc_sec_sops { struct ptlrpc_sec_policy { struct module *sp_owner; char *sp_name; - __u16 sp_policy; /* policy number */ + u16 sp_policy; /* policy number */ struct ptlrpc_sec_cops *sp_cops; /* client ops */ struct ptlrpc_sec_sops *sp_sops; /* server ops */ }; @@ -819,13 +819,13 @@ struct ptlrpc_svc_ctx { #define LUSTRE_MAX_GROUPS (128) struct ptlrpc_user_desc { - __u32 pud_uid; - __u32 pud_gid; - __u32 pud_fsuid; - __u32 pud_fsgid; - __u32 pud_cap; - __u32 pud_ngroups; - __u32 pud_groups[0]; + u32 pud_uid; + u32 pud_gid; + u32 pud_fsuid; + u32 pud_fsgid; + u32 pud_cap; + u32 pud_ngroups; + u32 pud_groups[0]; }; /* @@ -843,20 +843,20 @@ enum sptlrpc_bulk_hash_alg { BULK_HASH_ALG_MAX }; -const char *sptlrpc_get_hash_name(__u8 hash_alg); -__u8 sptlrpc_get_hash_alg(const char *algname); +const char *sptlrpc_get_hash_name(u8 hash_alg); +u8 sptlrpc_get_hash_alg(const char *algname); enum { BSD_FL_ERR = 1, }; struct ptlrpc_bulk_sec_desc { - __u8 bsd_version; /* 0 */ - __u8 bsd_type; /* SPTLRPC_BULK_XXX */ - __u8 bsd_svc; /* SPTLRPC_BULK_SVC_XXXX */ - __u8 bsd_flags; /* flags */ - __u32 bsd_nob; /* nob of bulk data */ - __u8 bsd_data[0]; /* policy-specific token */ + u8 bsd_version; /* 0 */ + u8 bsd_type; /* SPTLRPC_BULK_XXX */ + u8 bsd_svc; /* SPTLRPC_BULK_SVC_XXXX */ + u8 bsd_flags; /* flags */ + u32 bsd_nob; /* nob of bulk data */ + u8 bsd_data[0]; /* policy-specific token */ }; /* @@ -887,8 +887,8 @@ void _sptlrpc_enlarge_msg_inplace(struct lustre_msg *msg, int sptlrpc_register_policy(struct ptlrpc_sec_policy *policy); int sptlrpc_unregister_policy(struct ptlrpc_sec_policy *policy); -__u32 sptlrpc_name2flavor_base(const char *name); -const char *sptlrpc_flavor2name_base(__u32 flvr); +u32 sptlrpc_name2flavor_base(const char *name); +const char *sptlrpc_flavor2name_base(u32 flvr); char *sptlrpc_flavor2name_bulk(struct sptlrpc_flavor *sf, char *buf, int bufsize); char *sptlrpc_flavor2name(struct sptlrpc_flavor *sf, char *buf, int bufsize); @@ -1047,7 +1047,7 @@ int sptlrpc_cli_unwrap_bulk_write(struct ptlrpc_request *req, struct ptlrpc_bulk_desc *desc); /* bulk helpers (internal use only by policies) */ -int sptlrpc_get_bulk_checksum(struct ptlrpc_bulk_desc *desc, __u8 alg, +int sptlrpc_get_bulk_checksum(struct ptlrpc_bulk_desc *desc, u8 alg, void *buf, int buflen); int bulk_sec_desc_unpack(struct lustre_msg *msg, int offset, int swabbed); @@ -1055,7 +1055,7 @@ int sptlrpc_get_bulk_checksum(struct ptlrpc_bulk_desc *desc, __u8 alg, /* user descriptor helpers */ static inline int sptlrpc_user_desc_size(int ngroups) { - return sizeof(struct ptlrpc_user_desc) + ngroups * sizeof(__u32); + return sizeof(struct ptlrpc_user_desc) + ngroups * sizeof(u32); } int sptlrpc_current_user_desc_size(void); diff --git a/drivers/staging/lustre/lustre/include/lustre_swab.h b/drivers/staging/lustre/lustre/include/lustre_swab.h index 6939ac1..1758dd9 100644 --- a/drivers/staging/lustre/lustre/include/lustre_swab.h +++ b/drivers/staging/lustre/lustre/include/lustre_swab.h @@ -62,7 +62,7 @@ void lustre_swab_ost_lvb(struct ost_lvb *lvb); void lustre_swab_obd_quotactl(struct obd_quotactl *q); void lustre_swab_lquota_lvb(struct lquota_lvb *lvb); -void lustre_swab_generic_32s(__u32 *val); +void lustre_swab_generic_32s(u32 *val); void lustre_swab_mdt_body(struct mdt_body *b); void lustre_swab_mdt_ioepoch(struct mdt_ioepoch *b); void lustre_swab_mdt_rec_setattr(struct mdt_rec_setattr *sa); @@ -79,7 +79,7 @@ void lustre_swab_mgs_config_body(struct mgs_config_body *body); void lustre_swab_mgs_config_res(struct mgs_config_res *body); void lustre_swab_ost_body(struct ost_body *b); -void lustre_swab_ost_last_id(__u64 *id); +void lustre_swab_ost_last_id(u64 *id); void lustre_swab_fiemap(struct fiemap *fiemap); void lustre_swab_lov_user_md_v1(struct lov_user_md_v1 *lum); void lustre_swab_lov_user_md_v3(struct lov_user_md_v3 *lum); @@ -107,6 +107,6 @@ void lustre_swab_lov_user_md_objects(struct lov_user_ost_data *lod, void dump_rniobuf(struct niobuf_remote *rnb); void dump_ioo(struct obd_ioobj *nb); void dump_ost_body(struct ost_body *ob); -void dump_rcs(__u32 *rc); +void dump_rcs(u32 *rc); #endif diff --git a/drivers/staging/lustre/lustre/include/obd.h b/drivers/staging/lustre/lustre/include/obd.h index a5dc573..0bb3cf8 100644 --- a/drivers/staging/lustre/lustre/include/obd.h +++ b/drivers/staging/lustre/lustre/include/obd.h @@ -55,7 +55,7 @@ struct osc_async_rc { int ar_rc; int ar_force_sync; - __u64 ar_min_xid; + u64 ar_min_xid; }; struct lov_oinfo { /* per-stripe data structure */ @@ -64,12 +64,12 @@ struct lov_oinfo { /* per-stripe data structure */ int loi_ost_gen; /* generation of this loi_ost_idx */ unsigned long loi_kms_valid:1; - __u64 loi_kms; /* known minimum size */ + u64 loi_kms; /* known minimum size */ struct ost_lvb loi_lvb; struct osc_async_rc loi_ar; }; -static inline void loi_kms_set(struct lov_oinfo *oinfo, __u64 kms) +static inline void loi_kms_set(struct lov_oinfo *oinfo, u64 kms) { oinfo->loi_kms = kms; oinfo->loi_kms_valid = 1; @@ -85,7 +85,7 @@ static inline void loi_kms_set(struct lov_oinfo *oinfo, __u64 kms) /* obd info for a particular level (lov, osc). */ struct obd_info { /* OBD_STATFS_* flags */ - __u64 oi_flags; + u64 oi_flags; /* lsm data specific for every OSC. */ struct lov_stripe_md *oi_md; /* statfs data specific for every OSC, if needed at all. */ @@ -243,13 +243,13 @@ struct client_obd { struct list_head cl_loi_hp_ready_list; struct list_head cl_loi_write_list; struct list_head cl_loi_read_list; - __u32 cl_r_in_flight; - __u32 cl_w_in_flight; + u32 cl_r_in_flight; + u32 cl_w_in_flight; /* just a sum of the loi/lop pending numbers to be exported by sysfs */ atomic_t cl_pending_w_pages; atomic_t cl_pending_r_pages; - __u32 cl_max_pages_per_rpc; - __u32 cl_max_rpcs_in_flight; + u32 cl_max_pages_per_rpc; + u32 cl_max_rpcs_in_flight; struct obd_histogram cl_read_rpc_hist; struct obd_histogram cl_write_rpc_hist; struct obd_histogram cl_read_page_hist; @@ -322,7 +322,7 @@ struct client_obd { unsigned int cl_checksum:1, /* 0 = disabled, 1 = enabled */ cl_checksum_dump:1; /* same */ /* supported checksum types that are worked out at connect time */ - __u32 cl_supp_cksum_types; + u32 cl_supp_cksum_types; /* checksum algorithm to be used */ enum cksum_type cl_cksum_type; @@ -347,7 +347,7 @@ struct client_obd { #define obd2cli_tgt(obd) ((char *)(obd)->u.cli.cl_target_uuid.uuid) struct obd_id_info { - __u32 idx; + u32 idx; u64 *data; }; @@ -356,12 +356,12 @@ struct echo_client_obd { spinlock_t ec_lock; struct list_head ec_objects; struct list_head ec_locks; - __u64 ec_unique; + u64 ec_unique; }; /* Generic subset of OSTs */ struct ost_pool { - __u32 *op_array; /* array of index of lov_obd->lov_tgts */ + u32 *op_array; /* array of index of lov_obd->lov_tgts */ unsigned int op_count; /* number of OSTs in the array */ unsigned int op_size; /* allocated size of lp_array */ struct rw_semaphore op_rw_sem; /* to protect ost_pool use */ @@ -375,8 +375,8 @@ struct lov_tgt_desc { struct obd_uuid ltd_uuid; struct obd_device *ltd_obd; struct obd_export *ltd_exp; - __u32 ltd_gen; - __u32 ltd_index; /* index in lov_obd->tgts */ + u32 ltd_gen; + u32 ltd_index; /* index in lov_obd->tgts */ unsigned long ltd_active:1,/* is this target up for requests */ ltd_activate:1,/* should target be activated */ ltd_reap:1; /* should this target be deleted */ @@ -389,8 +389,8 @@ struct lov_obd { struct mutex lov_lock; struct obd_connect_data lov_ocd; atomic_t lov_refcount; - __u32 lov_death_row;/* tgts scheduled to be deleted */ - __u32 lov_tgt_size; /* size of tgts array */ + u32 lov_death_row;/* tgts scheduled to be deleted */ + u32 lov_tgt_size; /* size of tgts array */ int lov_connects; int lov_pool_count; struct rhashtable lov_pools_hash_body; /* used for key access */ @@ -433,10 +433,10 @@ struct lmv_obd { }; struct niobuf_local { - __u64 lnb_file_offset; - __u32 lnb_page_offset; - __u32 lnb_len; - __u32 lnb_flags; + u64 lnb_file_offset; + u32 lnb_page_offset; + u32 lnb_len; + u32 lnb_flags; int lnb_rc; struct page *lnb_page; void *lnb_data; @@ -576,7 +576,7 @@ struct obd_device { spinlock_t obd_dev_lock; /* protect OBD bitfield above */ spinlock_t obd_osfs_lock; struct obd_statfs obd_osfs; /* locked by obd_osfs_lock */ - __u64 obd_osfs_age; + u64 obd_osfs_age; u64 obd_last_committed; struct mutex obd_dev_mutex; struct lvfs_run_ctxt obd_lvfs_ctxt; @@ -728,9 +728,9 @@ struct md_op_data { size_t op_namelen; struct lmv_stripe_md *op_mea1; struct lmv_stripe_md *op_mea2; - __u32 op_suppgids[2]; - __u32 op_fsuid; - __u32 op_fsgid; + u32 op_suppgids[2]; + u32 op_fsuid; + u32 op_fsgid; kernel_cap_t op_cap; void *op_data; size_t op_data_size; @@ -739,16 +739,16 @@ struct md_op_data { struct iattr op_attr; enum op_xvalid op_xvalid; /* eXtra validity flags */ unsigned int op_attr_flags; - __u64 op_valid; + u64 op_valid; loff_t op_attr_blocks; - __u32 op_flags; + u32 op_flags; /* Various operation flags. */ enum mds_op_bias op_bias; /* Used by readdir */ - __u64 op_offset; + u64 op_offset; /* used to transfer info between the stacks of MD client * see enum op_cli_flags @@ -756,7 +756,7 @@ struct md_op_data { enum md_cli_flags op_cli_flags; /* File object data version for HSM release, on client */ - __u64 op_data_version; + u64 op_data_version; struct lustre_handle op_lease_handle; /* File security context, for creates. */ @@ -765,7 +765,7 @@ struct md_op_data { u32 op_file_secctx_size; /* default stripe offset */ - __u32 op_default_stripe_offset; + u32 op_default_stripe_offset; u32 op_projid; }; @@ -795,10 +795,10 @@ struct obd_ops { int (*iocontrol)(unsigned int cmd, struct obd_export *exp, int len, void *karg, void __user *uarg); int (*get_info)(const struct lu_env *env, struct obd_export *, - __u32 keylen, void *key, __u32 *vallen, void *val); + u32 keylen, void *key, u32 *vallen, void *val); int (*set_info_async)(const struct lu_env *, struct obd_export *, - __u32 keylen, void *key, - __u32 vallen, void *val, + u32 keylen, void *key, + u32 vallen, void *val, struct ptlrpc_request_set *set); int (*setup)(struct obd_device *dev, struct lustre_cfg *cfg); int (*precleanup)(struct obd_device *dev); @@ -838,9 +838,9 @@ struct obd_ops { * about this. */ int (*statfs)(const struct lu_env *, struct obd_export *exp, - struct obd_statfs *osfs, __u64 max_age, __u32 flags); + struct obd_statfs *osfs, u64 max_age, u32 flags); int (*statfs_async)(struct obd_export *exp, struct obd_info *oinfo, - __u64 max_age, struct ptlrpc_request_set *set); + u64 max_age, struct ptlrpc_request_set *set); int (*create)(const struct lu_env *env, struct obd_export *exp, struct obdo *oa); int (*destroy)(const struct lu_env *env, struct obd_export *exp, @@ -908,7 +908,7 @@ struct obd_client_handle { struct lu_fid och_fid; struct md_open_data *och_mod; struct lustre_handle och_lease_handle; /* open lock for lease */ - __u32 och_magic; + u32 och_magic; fmode_t och_flags; }; @@ -925,10 +925,10 @@ struct md_ops { struct md_open_data *, struct ptlrpc_request **); int (*create)(struct obd_export *, struct md_op_data *, const void *, size_t, umode_t, uid_t, gid_t, - kernel_cap_t, __u64, struct ptlrpc_request **); + kernel_cap_t, u64, struct ptlrpc_request **); int (*enqueue)(struct obd_export *, struct ldlm_enqueue_info *, const union ldlm_policy_data *, struct md_op_data *, - struct lustre_handle *, __u64); + struct lustre_handle *, u64); int (*getattr)(struct obd_export *, struct md_op_data *, struct ptlrpc_request **); int (*getattr_name)(struct obd_export *, struct md_op_data *, @@ -936,7 +936,7 @@ struct md_ops { int (*intent_lock)(struct obd_export *, struct md_op_data *, struct lookup_intent *, struct ptlrpc_request **, - ldlm_blocking_callback, __u64); + ldlm_blocking_callback, u64); int (*link)(struct obd_export *, struct md_op_data *, struct ptlrpc_request **); int (*rename)(struct obd_export *, struct md_op_data *, @@ -947,7 +947,7 @@ struct md_ops { int (*fsync)(struct obd_export *, const struct lu_fid *, struct ptlrpc_request **); int (*read_page)(struct obd_export *, struct md_op_data *, - struct md_callback *cb_op, __u64 hash_offset, + struct md_callback *cb_op, u64 hash_offset, struct page **ppage); int (*unlink)(struct obd_export *, struct md_op_data *, struct ptlrpc_request **); @@ -977,9 +977,9 @@ struct md_ops { int (*clear_open_replay_data)(struct obd_export *, struct obd_client_handle *); int (*set_lock_data)(struct obd_export *, const struct lustre_handle *, - void *, __u64 *); + void *, u64 *); - enum ldlm_mode (*lock_match)(struct obd_export *, __u64, + enum ldlm_mode (*lock_match)(struct obd_export *, u64, const struct lu_fid *, enum ldlm_type, union ldlm_policy_data *, enum ldlm_mode, struct lustre_handle *); @@ -997,7 +997,7 @@ struct md_ops { struct md_enqueue_info *); int (*revalidate_lock)(struct obd_export *, struct lookup_intent *, - struct lu_fid *, __u64 *bits); + struct lu_fid *, u64 *bits); int (*unpackmd)(struct obd_export *exp, struct lmv_stripe_md **plsm, const union lmv_mds_md *lmv, size_t lmv_size); diff --git a/drivers/staging/lustre/lustre/include/obd_class.h b/drivers/staging/lustre/lustre/include/obd_class.h index cc00915..b64ba8b 100644 --- a/drivers/staging/lustre/lustre/include/obd_class.h +++ b/drivers/staging/lustre/lustre/include/obd_class.h @@ -92,8 +92,8 @@ int obd_connect_flags2str(char *page, int count, u64 flags, u64 flags2, int obd_get_request_slot(struct client_obd *cli); void obd_put_request_slot(struct client_obd *cli); -__u32 obd_get_max_rpcs_in_flight(struct client_obd *cli); -int obd_set_max_rpcs_in_flight(struct client_obd *cli, __u32 max); +u32 obd_get_max_rpcs_in_flight(struct client_obd *cli); +int obd_set_max_rpcs_in_flight(struct client_obd *cli, u32 max); int obd_set_max_mod_rpcs_in_flight(struct client_obd *cli, u16 max); int obd_mod_rpc_stats_seq_show(struct client_obd *cli, struct seq_file *seq); @@ -356,8 +356,8 @@ static inline int class_devno_max(void) } static inline int obd_get_info(const struct lu_env *env, - struct obd_export *exp, __u32 keylen, - void *key, __u32 *vallen, void *val) + struct obd_export *exp, u32 keylen, + void *key, u32 *vallen, void *val) { int rc; @@ -873,7 +873,7 @@ static inline int obd_destroy_export(struct obd_export *exp) */ static inline int obd_statfs_async(struct obd_export *exp, struct obd_info *oinfo, - __u64 max_age, + u64 max_age, struct ptlrpc_request_set *rqset) { int rc = 0; @@ -909,8 +909,8 @@ static inline int obd_statfs_async(struct obd_export *exp, } static inline int obd_statfs_rqset(struct obd_export *exp, - struct obd_statfs *osfs, __u64 max_age, - __u32 flags) + struct obd_statfs *osfs, u64 max_age, + u32 flags) { struct ptlrpc_request_set *set = NULL; struct obd_info oinfo = { @@ -936,8 +936,8 @@ static inline int obd_statfs_rqset(struct obd_export *exp, * target. Use a value of "jiffies + HZ" to guarantee freshness. */ static inline int obd_statfs(const struct lu_env *env, struct obd_export *exp, - struct obd_statfs *osfs, __u64 max_age, - __u32 flags) + struct obd_statfs *osfs, u64 max_age, + u32 flags) { struct obd_device *obd = exp->exp_obd; int rc = 0; @@ -1509,7 +1509,7 @@ static inline int md_clear_open_replay_data(struct obd_export *exp, static inline int md_set_lock_data(struct obd_export *exp, const struct lustre_handle *lockh, - void *data, __u64 *bits) + void *data, u64 *bits) { int rc; @@ -1537,7 +1537,7 @@ static inline int md_cancel_unused(struct obd_export *exp, flags, opaque); } -static inline enum ldlm_mode md_lock_match(struct obd_export *exp, __u64 flags, +static inline enum ldlm_mode md_lock_match(struct obd_export *exp, u64 flags, const struct lu_fid *fid, enum ldlm_type type, union ldlm_policy_data *policy, @@ -1583,7 +1583,7 @@ static inline int md_intent_getattr_async(struct obd_export *exp, static inline int md_revalidate_lock(struct obd_export *exp, struct lookup_intent *it, - struct lu_fid *fid, __u64 *bits) + struct lu_fid *fid, u64 *bits) { int rc; @@ -1669,9 +1669,9 @@ static inline void class_uuid_unparse(class_uuid_t uu, struct obd_uuid *out) /* lustre_peer.c */ int lustre_uuid_to_peer(const char *uuid, lnet_nid_t *peer_nid, int index); -int class_add_uuid(const char *uuid, __u64 nid); +int class_add_uuid(const char *uuid, u64 nid); int class_del_uuid(const char *uuid); -int class_check_uuid(struct obd_uuid *uuid, __u64 nid); +int class_check_uuid(struct obd_uuid *uuid, u64 nid); /* class_obd.c */ extern char obd_jobid_node[]; -- 1.8.3.1 From jsimmons at infradead.org Thu Jan 31 17:19:10 2019 From: jsimmons at infradead.org (James Simmons) Date: Thu, 31 Jan 2019 12:19:10 -0500 Subject: [lustre-devel] [PATCH 06/26] ldlm: use kernel types for kernel code In-Reply-To: <1548955170-13456-1-git-send-email-jsimmons@infradead.org> References: <1548955170-13456-1-git-send-email-jsimmons@infradead.org> Message-ID: <1548955170-13456-7-git-send-email-jsimmons@infradead.org> Lustre ldlm code was originally both a user land and kernel implementation. The source contains many types of the form __u32 but since this is mostly kernel code change the types to kernel internal types. Signed-off-by: James Simmons --- drivers/staging/lustre/lustre/ldlm/ldlm_extent.c | 8 +++--- drivers/staging/lustre/lustre/ldlm/ldlm_flock.c | 2 +- drivers/staging/lustre/lustre/ldlm/ldlm_internal.h | 12 ++++---- drivers/staging/lustre/lustre/ldlm/ldlm_lock.c | 14 +++++----- drivers/staging/lustre/lustre/ldlm/ldlm_pool.c | 22 +++++++-------- drivers/staging/lustre/lustre/ldlm/ldlm_request.c | 32 +++++++++++----------- drivers/staging/lustre/lustre/ldlm/ldlm_resource.c | 22 +++++++-------- 7 files changed, 56 insertions(+), 56 deletions(-) diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_extent.c b/drivers/staging/lustre/lustre/ldlm/ldlm_extent.c index 225c023..99aef0b 100644 --- a/drivers/staging/lustre/lustre/ldlm/ldlm_extent.c +++ b/drivers/staging/lustre/lustre/ldlm/ldlm_extent.c @@ -57,7 +57,7 @@ #define START(node) ((node)->l_policy_data.l_extent.start) #define LAST(node) ((node)->l_policy_data.l_extent.end) -INTERVAL_TREE_DEFINE(struct ldlm_lock, l_rb, __u64, __subtree_last, +INTERVAL_TREE_DEFINE(struct ldlm_lock, l_rb, u64, __subtree_last, START, LAST, static, extent); /* When a lock is cancelled by a client, the KMS may undergo change if this @@ -66,11 +66,11 @@ * * NB: A lock on [x,y] protects a KMS of up to y + 1 bytes! */ -__u64 ldlm_extent_shift_kms(struct ldlm_lock *lock, __u64 old_kms) +u64 ldlm_extent_shift_kms(struct ldlm_lock *lock, u64 old_kms) { struct ldlm_resource *res = lock->l_resource; struct ldlm_lock *lck; - __u64 kms = 0; + u64 kms = 0; /* don't let another thread in ldlm_extent_shift_kms race in * just after we finish and take our lock into account in its @@ -192,7 +192,7 @@ void ldlm_extent_policy_local_to_wire(const union ldlm_policy_data *lpolicy, } void ldlm_extent_search(struct rb_root_cached *root, - __u64 start, __u64 end, + u64 start, u64 end, bool (*matches)(struct ldlm_lock *lock, void *data), void *data) { diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_flock.c b/drivers/staging/lustre/lustre/ldlm/ldlm_flock.c index 94f3b1e..baa5b3a 100644 --- a/drivers/staging/lustre/lustre/ldlm/ldlm_flock.c +++ b/drivers/staging/lustre/lustre/ldlm/ldlm_flock.c @@ -312,7 +312,7 @@ static int ldlm_process_flock_lock(struct ldlm_lock *req) * \retval <0 : failure */ int -ldlm_flock_completion_ast(struct ldlm_lock *lock, __u64 flags, void *data) +ldlm_flock_completion_ast(struct ldlm_lock *lock, u64 flags, void *data) { struct file_lock *getlk = lock->l_ast_data; int rc = 0; diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_internal.h b/drivers/staging/lustre/lustre/ldlm/ldlm_internal.h index b64e2be0..d8dcf8a 100644 --- a/drivers/staging/lustre/lustre/ldlm/ldlm_internal.h +++ b/drivers/staging/lustre/lustre/ldlm/ldlm_internal.h @@ -136,10 +136,10 @@ struct ldlm_lock * ldlm_lock_create(struct ldlm_namespace *ns, const struct ldlm_res_id *id, enum ldlm_type type, enum ldlm_mode mode, const struct ldlm_callback_suite *cbs, - void *data, __u32 lvb_len, enum lvb_type lvb_type); + void *data, u32 lvb_len, enum lvb_type lvb_type); enum ldlm_error ldlm_lock_enqueue(struct ldlm_namespace *ns, struct ldlm_lock **lock, void *cookie, - __u64 *flags); + u64 *flags); void ldlm_lock_addref_internal(struct ldlm_lock *lock, enum ldlm_mode mode); void ldlm_lock_addref_internal_nolock(struct ldlm_lock *lock, enum ldlm_mode mode); @@ -176,7 +176,7 @@ void ldlm_handle_bl_callback(struct ldlm_namespace *ns, void ldlm_extent_add_lock(struct ldlm_resource *res, struct ldlm_lock *lock); void ldlm_extent_unlink_lock(struct ldlm_lock *lock); void ldlm_extent_search(struct rb_root_cached *root, - __u64 start, __u64 end, + u64 start, u64 end, bool (*matches)(struct ldlm_lock *lock, void *data), void *data); @@ -195,9 +195,9 @@ struct ldlm_state { }; /* ldlm_pool.c */ -__u64 ldlm_pool_get_slv(struct ldlm_pool *pl); -void ldlm_pool_set_clv(struct ldlm_pool *pl, __u64 clv); -__u32 ldlm_pool_get_lvf(struct ldlm_pool *pl); +u64 ldlm_pool_get_slv(struct ldlm_pool *pl); +void ldlm_pool_set_clv(struct ldlm_pool *pl, u64 clv); +u32 ldlm_pool_get_lvf(struct ldlm_pool *pl); int ldlm_init(void); void ldlm_exit(void); diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_lock.c b/drivers/staging/lustre/lustre/ldlm/ldlm_lock.c index ebdfc11..e726e76 100644 --- a/drivers/staging/lustre/lustre/ldlm/ldlm_lock.c +++ b/drivers/staging/lustre/lustre/ldlm/ldlm_lock.c @@ -508,7 +508,7 @@ void ldlm_lock2handle(const struct ldlm_lock *lock, struct lustre_handle *lockh) * Return NULL if flag already set */ struct ldlm_lock *__ldlm_handle2lock(const struct lustre_handle *handle, - __u64 flags) + u64 flags) { struct ldlm_lock *lock; @@ -1043,7 +1043,7 @@ struct lock_match_data { struct ldlm_lock *lmd_lock; enum ldlm_mode *lmd_mode; union ldlm_policy_data *lmd_policy; - __u64 lmd_flags; + u64 lmd_flags; int lmd_unref; }; @@ -1250,7 +1250,7 @@ void ldlm_lock_allow_match(struct ldlm_lock *lock) * keep caller code unchanged), the context failure will be discovered by * caller sometime later. */ -enum ldlm_mode ldlm_lock_match(struct ldlm_namespace *ns, __u64 flags, +enum ldlm_mode ldlm_lock_match(struct ldlm_namespace *ns, u64 flags, const struct ldlm_res_id *res_id, enum ldlm_type type, union ldlm_policy_data *policy, @@ -1313,7 +1313,7 @@ enum ldlm_mode ldlm_lock_match(struct ldlm_namespace *ns, __u64 flags, if (lock) { ldlm_lock2handle(lock, lockh); if ((flags & LDLM_FL_LVB_READY) && !ldlm_is_lvb_ready(lock)) { - __u64 wait_flags = LDLM_FL_LVB_READY | + u64 wait_flags = LDLM_FL_LVB_READY | LDLM_FL_DESTROYED | LDLM_FL_FAIL_NOTIFIED; if (lock->l_completion_ast) { @@ -1381,7 +1381,7 @@ enum ldlm_mode ldlm_lock_match(struct ldlm_namespace *ns, __u64 flags, EXPORT_SYMBOL(ldlm_lock_match); enum ldlm_mode ldlm_revalidate_lock_handle(const struct lustre_handle *lockh, - __u64 *bits) + u64 *bits) { struct ldlm_lock *lock; enum ldlm_mode mode = 0; @@ -1519,7 +1519,7 @@ struct ldlm_lock *ldlm_lock_create(struct ldlm_namespace *ns, enum ldlm_type type, enum ldlm_mode mode, const struct ldlm_callback_suite *cbs, - void *data, __u32 lvb_len, + void *data, u32 lvb_len, enum lvb_type lvb_type) { struct ldlm_lock *lock; @@ -1580,7 +1580,7 @@ struct ldlm_lock *ldlm_lock_create(struct ldlm_namespace *ns, */ enum ldlm_error ldlm_lock_enqueue(struct ldlm_namespace *ns, struct ldlm_lock **lockp, - void *cookie, __u64 *flags) + void *cookie, u64 *flags) { struct ldlm_lock *lock = *lockp; struct ldlm_resource *res = lock->l_resource; diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_pool.c b/drivers/staging/lustre/lustre/ldlm/ldlm_pool.c index 36d14ee..e94d8a3 100644 --- a/drivers/staging/lustre/lustre/ldlm/ldlm_pool.c +++ b/drivers/staging/lustre/lustre/ldlm/ldlm_pool.c @@ -137,22 +137,22 @@ */ #define LDLM_POOL_SLV_SHIFT (10) -static inline __u64 dru(__u64 val, __u32 shift, int round_up) +static inline u64 dru(u64 val, u32 shift, int round_up) { return (val + (round_up ? (1 << shift) - 1 : 0)) >> shift; } -static inline __u64 ldlm_pool_slv_max(__u32 L) +static inline u64 ldlm_pool_slv_max(u32 L) { /* * Allow to have all locks for 1 client for 10 hrs. * Formula is the following: limit * 10h / 1 client. */ - __u64 lim = (__u64)L * LDLM_POOL_MAX_AGE / 1; + u64 lim = (u64)L * LDLM_POOL_MAX_AGE / 1; return lim; } -static inline __u64 ldlm_pool_slv_min(__u32 L) +static inline u64 ldlm_pool_slv_min(u32 L) { return 1; } @@ -212,7 +212,7 @@ static inline int ldlm_pool_t2gsp(unsigned int t) static void ldlm_pool_recalc_stats(struct ldlm_pool *pl) { int grant_plan = pl->pl_grant_plan; - __u64 slv = pl->pl_server_lock_volume; + u64 slv = pl->pl_server_lock_volume; int granted = atomic_read(&pl->pl_granted); int grant_rate = atomic_read(&pl->pl_grant_rate); int cancel_rate = atomic_read(&pl->pl_cancel_rate); @@ -430,8 +430,8 @@ static int lprocfs_pool_state_seq_show(struct seq_file *m, void *unused) int granted, grant_rate, cancel_rate; int grant_speed, lvf; struct ldlm_pool *pl = m->private; - __u64 slv, clv; - __u32 limit; + u64 slv, clv; + u32 limit; spin_lock(&pl->pl_lock); slv = pl->pl_server_lock_volume; @@ -739,9 +739,9 @@ void ldlm_pool_del(struct ldlm_pool *pl, struct ldlm_lock *lock) * * \pre ->pl_lock is not locked. */ -__u64 ldlm_pool_get_slv(struct ldlm_pool *pl) +u64 ldlm_pool_get_slv(struct ldlm_pool *pl) { - __u64 slv; + u64 slv; spin_lock(&pl->pl_lock); slv = pl->pl_server_lock_volume; @@ -754,7 +754,7 @@ __u64 ldlm_pool_get_slv(struct ldlm_pool *pl) * * \pre ->pl_lock is not locked. */ -void ldlm_pool_set_clv(struct ldlm_pool *pl, __u64 clv) +void ldlm_pool_set_clv(struct ldlm_pool *pl, u64 clv) { spin_lock(&pl->pl_lock); pl->pl_client_lock_volume = clv; @@ -764,7 +764,7 @@ void ldlm_pool_set_clv(struct ldlm_pool *pl, __u64 clv) /** * Returns current LVF from \a pl. */ -__u32 ldlm_pool_get_lvf(struct ldlm_pool *pl) +u32 ldlm_pool_get_lvf(struct ldlm_pool *pl) { return atomic_read(&pl->pl_lock_volume_factor); } diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_request.c b/drivers/staging/lustre/lustre/ldlm/ldlm_request.c index c09359a..a7fe8c6 100644 --- a/drivers/staging/lustre/lustre/ldlm/ldlm_request.c +++ b/drivers/staging/lustre/lustre/ldlm/ldlm_request.c @@ -104,7 +104,7 @@ static int ldlm_request_bufsize(int count, int type) return sizeof(struct ldlm_request) + avail; } -static void ldlm_expired_completion_wait(struct ldlm_lock *lock, __u32 conn_cnt) +static void ldlm_expired_completion_wait(struct ldlm_lock *lock, u32 conn_cnt) { struct obd_import *imp; struct obd_device *obd; @@ -213,13 +213,13 @@ static int ldlm_completion_tail(struct ldlm_lock *lock, void *data) * or penultimate cases happen in some other thread. * */ -int ldlm_completion_ast(struct ldlm_lock *lock, __u64 flags, void *data) +int ldlm_completion_ast(struct ldlm_lock *lock, u64 flags, void *data) { /* XXX ALLOCATE - 160 bytes */ struct obd_device *obd; struct obd_import *imp = NULL; - __u32 timeout; - __u32 conn_cnt = 0; + u32 timeout; + u32 conn_cnt = 0; int rc = 0; if (flags == LDLM_FL_WAIT_NOREPROC) { @@ -337,9 +337,9 @@ static void failed_lock_cleanup(struct ldlm_namespace *ns, * Called after receiving reply from server. */ int ldlm_cli_enqueue_fini(struct obd_export *exp, struct ptlrpc_request *req, - enum ldlm_type type, __u8 with_policy, + enum ldlm_type type, u8 with_policy, enum ldlm_mode mode, - __u64 *flags, void *lvb, __u32 lvb_len, + u64 *flags, void *lvb, u32 lvb_len, const struct lustre_handle *lockh, int rc) { struct ldlm_namespace *ns = exp->exp_obd->obd_namespace; @@ -670,8 +670,8 @@ static struct ptlrpc_request *ldlm_enqueue_pack(struct obd_export *exp, int ldlm_cli_enqueue(struct obd_export *exp, struct ptlrpc_request **reqp, struct ldlm_enqueue_info *einfo, const struct ldlm_res_id *res_id, - union ldlm_policy_data const *policy, __u64 *flags, - void *lvb, __u32 lvb_len, enum lvb_type lvb_type, + union ldlm_policy_data const *policy, u64 *flags, + void *lvb, u32 lvb_len, enum lvb_type lvb_type, struct lustre_handle *lockh, int async) { struct ldlm_namespace *ns; @@ -792,9 +792,9 @@ int ldlm_cli_enqueue(struct obd_export *exp, struct ptlrpc_request **reqp, * \retval LDLM_FL_CANCELING otherwise; * \retval LDLM_FL_BL_AST if there is a need for a separate CANCEL RPC. */ -static __u64 ldlm_cli_cancel_local(struct ldlm_lock *lock) +static u64 ldlm_cli_cancel_local(struct ldlm_lock *lock) { - __u64 rc = LDLM_FL_LOCAL_ONLY; + u64 rc = LDLM_FL_LOCAL_ONLY; if (lock->l_conn_export) { bool local_only; @@ -960,8 +960,8 @@ static inline struct ldlm_pool *ldlm_imp2pl(struct obd_import *imp) int ldlm_cli_update_pool(struct ptlrpc_request *req) { struct obd_device *obd; - __u64 new_slv; - __u32 new_limit; + u64 new_slv; + u32 new_limit; if (unlikely(!req->rq_import || !req->rq_import->imp_obd || !imp_connect_lru_resize(req->rq_import))) { @@ -1014,7 +1014,7 @@ int ldlm_cli_cancel(const struct lustre_handle *lockh, { struct obd_export *exp; int avail, flags, count = 1; - __u64 rc = 0; + u64 rc = 0; struct ldlm_namespace *ns; struct ldlm_lock *lock; LIST_HEAD(cancels); @@ -1080,7 +1080,7 @@ int ldlm_cli_cancel_list_local(struct list_head *cancels, int count, LIST_HEAD(head); struct ldlm_lock *lock, *next; int left = 0, bl_ast = 0; - __u64 rc; + u64 rc; left = count; list_for_each_entry_safe(lock, next, cancels, l_bl_ast) { @@ -1169,7 +1169,7 @@ static enum ldlm_policy_res ldlm_cancel_lrur_policy(struct ldlm_namespace *ns, { unsigned long cur = jiffies; struct ldlm_pool *pl = &ns->ns_pool; - __u64 slv, lvf, lv; + u64 slv, lvf, lv; unsigned long la; /* Stop LRU processing when we reach past @count or have checked all @@ -1562,7 +1562,7 @@ int ldlm_cancel_lru(struct ldlm_namespace *ns, int nr, int ldlm_cancel_resource_local(struct ldlm_resource *res, struct list_head *cancels, union ldlm_policy_data *policy, - enum ldlm_mode mode, __u64 lock_flags, + enum ldlm_mode mode, u64 lock_flags, enum ldlm_cancel_flags cancel_flags, void *opaque) { diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_resource.c b/drivers/staging/lustre/lustre/ldlm/ldlm_resource.c index 11c0b88..e0b9918 100644 --- a/drivers/staging/lustre/lustre/ldlm/ldlm_resource.c +++ b/drivers/staging/lustre/lustre/ldlm/ldlm_resource.c @@ -132,7 +132,7 @@ static ssize_t resource_count_show(struct kobject *kobj, struct attribute *attr, { struct ldlm_namespace *ns = container_of(kobj, struct ldlm_namespace, ns_kobj); - __u64 res = 0; + u64 res = 0; struct cfs_hash_bd bd; int i; @@ -148,7 +148,7 @@ static ssize_t lock_count_show(struct kobject *kobj, struct attribute *attr, { struct ldlm_namespace *ns = container_of(kobj, struct ldlm_namespace, ns_kobj); - __u64 locks; + u64 locks; locks = lprocfs_stats_collector(ns->ns_stats, LDLM_NSS_LOCKS, LPROCFS_FIELDS_FLAGS_SUM); @@ -172,7 +172,7 @@ static ssize_t lru_size_show(struct kobject *kobj, struct attribute *attr, { struct ldlm_namespace *ns = container_of(kobj, struct ldlm_namespace, ns_kobj); - __u32 *nr = &ns->ns_max_unused; + u32 *nr = &ns->ns_max_unused; if (ns_connect_lru_resize(ns)) nr = &ns->ns_nr_unused; @@ -421,12 +421,12 @@ static unsigned int ldlm_res_hop_fid_hash(struct cfs_hash *hs, { const struct ldlm_res_id *id = key; struct lu_fid fid; - __u32 hash; - __u32 val; + u32 hash; + u32 val; fid.f_seq = id->name[LUSTRE_RES_ID_SEQ_OFF]; - fid.f_oid = (__u32)id->name[LUSTRE_RES_ID_VER_OID_OFF]; - fid.f_ver = (__u32)(id->name[LUSTRE_RES_ID_VER_OID_OFF] >> 32); + fid.f_oid = (u32)id->name[LUSTRE_RES_ID_VER_OID_OFF]; + fid.f_ver = (u32)(id->name[LUSTRE_RES_ID_VER_OID_OFF] >> 32); hash = fid_flatten32(&fid); hash += (hash >> 4) + (hash << 12); /* mixing oid and seq */ @@ -694,7 +694,7 @@ struct ldlm_namespace *ldlm_namespace_new(struct obd_device *obd, char *name, * locks with refs. */ static void cleanup_resource(struct ldlm_resource *res, struct list_head *q, - __u64 flags) + u64 flags) { int rc = 0; bool local_only = !!(flags & LDLM_FL_LOCAL_ONLY); @@ -764,7 +764,7 @@ static int ldlm_resource_clean(struct cfs_hash *hs, struct cfs_hash_bd *bd, struct hlist_node *hnode, void *arg) { struct ldlm_resource *res = cfs_hash_object(hs, hnode); - __u64 flags = *(__u64 *)arg; + u64 flags = *(u64 *)arg; cleanup_resource(res, &res->lr_granted, flags); cleanup_resource(res, &res->lr_waiting, flags); @@ -795,7 +795,7 @@ static int ldlm_resource_complain(struct cfs_hash *hs, struct cfs_hash_bd *bd, * evicted and all of its state needs to be destroyed. * Also used during shutdown. */ -int ldlm_namespace_cleanup(struct ldlm_namespace *ns, __u64 flags) +int ldlm_namespace_cleanup(struct ldlm_namespace *ns, u64 flags) { if (!ns) { CDEBUG(D_INFO, "NULL ns, skipping cleanup\n"); @@ -1048,7 +1048,7 @@ struct ldlm_resource * struct hlist_node *hnode; struct ldlm_resource *res = NULL; struct cfs_hash_bd bd; - __u64 version; + u64 version; int ns_refcount = 0; int rc; -- 1.8.3.1 From jsimmons at infradead.org Thu Jan 31 17:19:07 2019 From: jsimmons at infradead.org (James Simmons) Date: Thu, 31 Jan 2019 12:19:07 -0500 Subject: [lustre-devel] [PATCH 03/26] lnet: use kernel types for lnet selftest kernel code In-Reply-To: <1548955170-13456-1-git-send-email-jsimmons@infradead.org> References: <1548955170-13456-1-git-send-email-jsimmons@infradead.org> Message-ID: <1548955170-13456-4-git-send-email-jsimmons@infradead.org> LNet self test was originally both a user land and kernel implementation. The source contains many types of the form __u32 but since this is mostly kernel code change the types to kernel internal types. Signed-off-by: James Simmons --- drivers/staging/lustre/lnet/selftest/brw_test.c | 20 ++-- drivers/staging/lustre/lnet/selftest/console.h | 2 +- drivers/staging/lustre/lnet/selftest/rpc.c | 22 ++-- drivers/staging/lustre/lnet/selftest/rpc.h | 132 ++++++++++++------------ 4 files changed, 88 insertions(+), 88 deletions(-) diff --git a/drivers/staging/lustre/lnet/selftest/brw_test.c b/drivers/staging/lustre/lnet/selftest/brw_test.c index e372ff3..eb8b1e9 100644 --- a/drivers/staging/lustre/lnet/selftest/brw_test.c +++ b/drivers/staging/lustre/lnet/selftest/brw_test.c @@ -153,7 +153,7 @@ static int brw_inject_one_error(void) } static void -brw_fill_page(struct page *pg, int off, int len, int pattern, __u64 magic) +brw_fill_page(struct page *pg, int off, int len, int pattern, u64 magic) { char *addr = page_address(pg) + off; int i; @@ -186,10 +186,10 @@ static int brw_inject_one_error(void) } static int -brw_check_page(struct page *pg, int off, int len, int pattern, __u64 magic) +brw_check_page(struct page *pg, int off, int len, int pattern, u64 magic) { char *addr = page_address(pg) + off; - __u64 data = 0; /* make compiler happy */ + u64 data = 0; /* make compiler happy */ int i; LASSERT(addr); @@ -199,13 +199,13 @@ static int brw_inject_one_error(void) return 0; if (pattern == LST_BRW_CHECK_SIMPLE) { - data = *((__u64 *)addr); + data = *((u64 *)addr); if (data != magic) goto bad_data; if (len > BRW_MSIZE) { addr += PAGE_SIZE - BRW_MSIZE; - data = *((__u64 *)addr); + data = *((u64 *)addr); if (data != magic) goto bad_data; } @@ -230,7 +230,7 @@ static int brw_inject_one_error(void) } static void -brw_fill_bulk(struct srpc_bulk *bk, int pattern, __u64 magic) +brw_fill_bulk(struct srpc_bulk *bk, int pattern, u64 magic) { int i; struct page *pg; @@ -246,7 +246,7 @@ static int brw_inject_one_error(void) } static int -brw_check_bulk(struct srpc_bulk *bk, int pattern, __u64 magic) +brw_check_bulk(struct srpc_bulk *bk, int pattern, u64 magic) { int i; struct page *pg; @@ -331,7 +331,7 @@ static int brw_inject_one_error(void) static void brw_client_done_rpc(struct sfw_test_unit *tsu, struct srpc_client_rpc *rpc) { - __u64 magic = BRW_MAGIC; + u64 magic = BRW_MAGIC; struct sfw_test_instance *tsi = tsu->tsu_instance; struct sfw_session *sn = tsi->tsi_batch->bat_session; struct srpc_msg *msg = &rpc->crpc_replymsg; @@ -397,7 +397,7 @@ static int brw_inject_one_error(void) static int brw_bulk_ready(struct srpc_server_rpc *rpc, int status) { - __u64 magic = BRW_MAGIC; + u64 magic = BRW_MAGIC; struct srpc_brw_reply *reply = &rpc->srpc_replymsg.msg_body.brw_reply; struct srpc_brw_reqst *reqst; struct srpc_msg *reqstmsg; @@ -452,7 +452,7 @@ static int brw_inject_one_error(void) __swab64s(&reqst->brw_rpyid); __swab64s(&reqst->brw_bulkid); } - LASSERT(reqstmsg->msg_type == (__u32)srpc_service2request(sv->sv_id)); + LASSERT(reqstmsg->msg_type == (u32)srpc_service2request(sv->sv_id)); reply->brw_status = 0; rpc->srpc_done = brw_server_rpc_done; diff --git a/drivers/staging/lustre/lnet/selftest/console.h b/drivers/staging/lustre/lnet/selftest/console.h index eaad07c..b5709a4 100644 --- a/drivers/staging/lustre/lnet/selftest/console.h +++ b/drivers/staging/lustre/lnet/selftest/console.h @@ -153,7 +153,7 @@ struct lstcon_session { unsigned int ses_force:1; /* force creating */ unsigned int ses_shutdown:1; /* session is shutting down */ unsigned int ses_expired:1; /* console is timedout */ - __u64 ses_id_cookie; /* batch id cookie */ + u64 ses_id_cookie; /* batch id cookie */ char ses_name[LST_NAME_SIZE];/* session name */ struct lstcon_rpc_trans *ses_ping; /* session pinger */ struct stt_timer ses_ping_timer; /* timer for pinger */ diff --git a/drivers/staging/lustre/lnet/selftest/rpc.c b/drivers/staging/lustre/lnet/selftest/rpc.c index 26132ab..2a30107 100644 --- a/drivers/staging/lustre/lnet/selftest/rpc.c +++ b/drivers/staging/lustre/lnet/selftest/rpc.c @@ -57,7 +57,7 @@ enum srpc_state { struct lnet_handle_eq rpc_lnet_eq; /* _the_ LNet event queue */ enum srpc_state rpc_state; struct srpc_counters rpc_counters; - __u64 rpc_matchbits; /* matchbits counter */ + u64 rpc_matchbits; /* matchbits counter */ } srpc_data; static inline int @@ -159,10 +159,10 @@ struct srpc_bulk * return bk; } -static inline __u64 +static inline u64 srpc_next_id(void) { - __u64 id; + u64 id; spin_lock(&srpc_data.rpc_glock); id = srpc_data.rpc_matchbits++; @@ -354,7 +354,7 @@ struct srpc_bulk * } static int -srpc_post_passive_rdma(int portal, int local, __u64 matchbits, void *buf, +srpc_post_passive_rdma(int portal, int local, u64 matchbits, void *buf, int len, int options, struct lnet_process_id peer, struct lnet_handle_md *mdh, struct srpc_event *ev) { @@ -393,7 +393,7 @@ struct srpc_bulk * } static int -srpc_post_active_rdma(int portal, __u64 matchbits, void *buf, int len, +srpc_post_active_rdma(int portal, u64 matchbits, void *buf, int len, int options, struct lnet_process_id peer, lnet_nid_t self, struct lnet_handle_md *mdh, struct srpc_event *ev) @@ -813,7 +813,7 @@ struct srpc_bulk * srpc_prepare_reply(struct srpc_client_rpc *rpc) { struct srpc_event *ev = &rpc->crpc_replyev; - __u64 *id = &rpc->crpc_reqstmsg.msg_body.reqst.rpyid; + u64 *id = &rpc->crpc_reqstmsg.msg_body.reqst.rpyid; int rc; ev->ev_fired = 0; @@ -839,7 +839,7 @@ struct srpc_bulk * { struct srpc_bulk *bk = &rpc->crpc_bulk; struct srpc_event *ev = &rpc->crpc_bulkev; - __u64 *id = &rpc->crpc_reqstmsg.msg_body.reqst.bulkid; + u64 *id = &rpc->crpc_reqstmsg.msg_body.reqst.bulkid; int rc; int opt; @@ -872,7 +872,7 @@ struct srpc_bulk * { struct srpc_event *ev = &rpc->srpc_ev; struct srpc_bulk *bk = rpc->srpc_bulk; - __u64 id = rpc->srpc_reqstbuf->buf_msg.msg_body.reqst.bulkid; + u64 id = rpc->srpc_reqstbuf->buf_msg.msg_body.reqst.bulkid; int rc; int opt; @@ -1362,7 +1362,7 @@ struct srpc_client_rpc * struct srpc_buffer *buffer = rpc->srpc_reqstbuf; struct srpc_service_cd *scd = rpc->srpc_scd; struct srpc_service *sv = scd->scd_svc; - __u64 rpyid; + u64 rpyid; int rc; LASSERT(buffer); @@ -1415,7 +1415,7 @@ struct srpc_client_rpc * LASSERT(!in_interrupt()); if (ev->status) { - __u32 errors; + u32 errors; spin_lock(&srpc_data.rpc_glock); if (ev->status != -ECANCELED) /* cancellation is not error */ @@ -1604,7 +1604,7 @@ struct srpc_client_rpc * /* 1 second pause to avoid timestamp reuse */ schedule_timeout_uninterruptible(HZ); - srpc_data.rpc_matchbits = ((__u64)ktime_get_real_seconds()) << 48; + srpc_data.rpc_matchbits = ((u64)ktime_get_real_seconds()) << 48; srpc_data.rpc_state = SRPC_STATE_NONE; diff --git a/drivers/staging/lustre/lnet/selftest/rpc.h b/drivers/staging/lustre/lnet/selftest/rpc.h index 9ce3367..ae1c07f 100644 --- a/drivers/staging/lustre/lnet/selftest/rpc.h +++ b/drivers/staging/lustre/lnet/selftest/rpc.h @@ -66,70 +66,70 @@ enum srpc_msg_type { * All srpc_*_reqst_t's 1st field must be matchbits of reply buffer, * and 2nd field matchbits of bulk buffer if any. * - * All srpc_*_reply_t's 1st field must be a __u32 status, and 2nd field + * All srpc_*_reply_t's 1st field must be a u32 status, and 2nd field * session id if needed. */ struct srpc_generic_reqst { - __u64 rpyid; /* reply buffer matchbits */ - __u64 bulkid; /* bulk buffer matchbits */ + u64 rpyid; /* reply buffer matchbits */ + u64 bulkid; /* bulk buffer matchbits */ } __packed; struct srpc_generic_reply { - __u32 status; + u32 status; struct lst_sid sid; } __packed; /* FRAMEWORK RPCs */ struct srpc_mksn_reqst { - __u64 mksn_rpyid; /* reply buffer matchbits */ + u64 mksn_rpyid; /* reply buffer matchbits */ struct lst_sid mksn_sid; /* session id */ - __u32 mksn_force; /* use brute force */ + u32 mksn_force; /* use brute force */ char mksn_name[LST_NAME_SIZE]; } __packed; /* make session request */ struct srpc_mksn_reply { - __u32 mksn_status; /* session status */ + u32 mksn_status; /* session status */ struct lst_sid mksn_sid; /* session id */ - __u32 mksn_timeout; /* session timeout */ + u32 mksn_timeout; /* session timeout */ char mksn_name[LST_NAME_SIZE]; } __packed; /* make session reply */ struct srpc_rmsn_reqst { - __u64 rmsn_rpyid; /* reply buffer matchbits */ + u64 rmsn_rpyid; /* reply buffer matchbits */ struct lst_sid rmsn_sid; /* session id */ } __packed; /* remove session request */ struct srpc_rmsn_reply { - __u32 rmsn_status; + u32 rmsn_status; struct lst_sid rmsn_sid; /* session id */ } __packed; /* remove session reply */ struct srpc_join_reqst { - __u64 join_rpyid; /* reply buffer matchbits */ + u64 join_rpyid; /* reply buffer matchbits */ struct lst_sid join_sid; /* session id to join */ char join_group[LST_NAME_SIZE]; /* group name */ } __packed; struct srpc_join_reply { - __u32 join_status; /* returned status */ + u32 join_status; /* returned status */ struct lst_sid join_sid; /* session id */ - __u32 join_timeout; /* # seconds' inactivity to + u32 join_timeout; /* # seconds' inactivity to * expire */ char join_session[LST_NAME_SIZE]; /* session name */ } __packed; struct srpc_debug_reqst { - __u64 dbg_rpyid; /* reply buffer matchbits */ + u64 dbg_rpyid; /* reply buffer matchbits */ struct lst_sid dbg_sid; /* session id */ - __u32 dbg_flags; /* bitmap of debug */ + u32 dbg_flags; /* bitmap of debug */ } __packed; struct srpc_debug_reply { - __u32 dbg_status; /* returned code */ + u32 dbg_status; /* returned code */ struct lst_sid dbg_sid; /* session id */ - __u32 dbg_timeout; /* session timeout */ - __u32 dbg_nbatch; /* # of batches in the node */ + u32 dbg_timeout; /* session timeout */ + u32 dbg_nbatch; /* # of batches in the node */ char dbg_name[LST_NAME_SIZE]; /* session name */ } __packed; @@ -138,29 +138,29 @@ struct srpc_debug_reply { #define SRPC_BATCH_OPC_QUERY 3 struct srpc_batch_reqst { - __u64 bar_rpyid; /* reply buffer matchbits */ + u64 bar_rpyid; /* reply buffer matchbits */ struct lst_sid bar_sid; /* session id */ struct lst_bid bar_bid; /* batch id */ - __u32 bar_opc; /* create/start/stop batch */ - __u32 bar_testidx; /* index of test */ - __u32 bar_arg; /* parameters */ + u32 bar_opc; /* create/start/stop batch */ + u32 bar_testidx; /* index of test */ + u32 bar_arg; /* parameters */ } __packed; struct srpc_batch_reply { - __u32 bar_status; /* status of request */ + u32 bar_status; /* status of request */ struct lst_sid bar_sid; /* session id */ - __u32 bar_active; /* # of active tests in batch/test */ - __u32 bar_time; /* remained time */ + u32 bar_active; /* # of active tests in batch/test */ + u32 bar_time; /* remained time */ } __packed; struct srpc_stat_reqst { - __u64 str_rpyid; /* reply buffer matchbits */ + u64 str_rpyid; /* reply buffer matchbits */ struct lst_sid str_sid; /* session id */ - __u32 str_type; /* type of stat */ + u32 str_type; /* type of stat */ } __packed; struct srpc_stat_reply { - __u32 str_status; + u32 str_status; struct lst_sid str_sid; struct sfw_counters str_fw; struct srpc_counters str_rpc; @@ -168,36 +168,36 @@ struct srpc_stat_reply { } __packed; struct test_bulk_req { - __u32 blk_opc; /* bulk operation code */ - __u32 blk_npg; /* # of pages */ - __u32 blk_flags; /* reserved flags */ + u32 blk_opc; /* bulk operation code */ + u32 blk_npg; /* # of pages */ + u32 blk_flags; /* reserved flags */ } __packed; struct test_bulk_req_v1 { - __u16 blk_opc; /* bulk operation code */ - __u16 blk_flags; /* data check flags */ - __u32 blk_len; /* data length */ - __u32 blk_offset; /* offset */ + u16 blk_opc; /* bulk operation code */ + u16 blk_flags; /* data check flags */ + u32 blk_len; /* data length */ + u32 blk_offset; /* offset */ } __packed; struct test_ping_req { - __u32 png_size; /* size of ping message */ - __u32 png_flags; /* reserved flags */ + u32 png_size; /* size of ping message */ + u32 png_flags; /* reserved flags */ } __packed; struct srpc_test_reqst { - __u64 tsr_rpyid; /* reply buffer matchbits */ - __u64 tsr_bulkid; /* bulk buffer matchbits */ + u64 tsr_rpyid; /* reply buffer matchbits */ + u64 tsr_bulkid; /* bulk buffer matchbits */ struct lst_sid tsr_sid; /* session id */ struct lst_bid tsr_bid; /* batch id */ - __u32 tsr_service; /* test type: bulk|ping|... */ - __u32 tsr_loop; /* test client loop count or + u32 tsr_service; /* test type: bulk|ping|... */ + u32 tsr_loop; /* test client loop count or * # server buffers needed */ - __u32 tsr_concur; /* concurrency of test */ - __u8 tsr_is_client; /* is test client or not */ - __u8 tsr_stop_onerr; /* stop on error */ - __u32 tsr_ndest; /* # of dest nodes */ + u32 tsr_concur; /* concurrency of test */ + u8 tsr_is_client; /* is test client or not */ + u8 tsr_stop_onerr; /* stop on error */ + u32 tsr_ndest; /* # of dest nodes */ union { struct test_ping_req ping; @@ -207,47 +207,47 @@ struct srpc_test_reqst { } __packed; struct srpc_test_reply { - __u32 tsr_status; /* returned code */ + u32 tsr_status; /* returned code */ struct lst_sid tsr_sid; } __packed; /* TEST RPCs */ struct srpc_ping_reqst { - __u64 pnr_rpyid; - __u32 pnr_magic; - __u32 pnr_seq; - __u64 pnr_time_sec; - __u64 pnr_time_usec; + u64 pnr_rpyid; + u32 pnr_magic; + u32 pnr_seq; + u64 pnr_time_sec; + u64 pnr_time_usec; } __packed; struct srpc_ping_reply { - __u32 pnr_status; - __u32 pnr_magic; - __u32 pnr_seq; + u32 pnr_status; + u32 pnr_magic; + u32 pnr_seq; } __packed; struct srpc_brw_reqst { - __u64 brw_rpyid; /* reply buffer matchbits */ - __u64 brw_bulkid; /* bulk buffer matchbits */ - __u32 brw_rw; /* read or write */ - __u32 brw_len; /* bulk data len */ - __u32 brw_flags; /* bulk data patterns */ + u64 brw_rpyid; /* reply buffer matchbits */ + u64 brw_bulkid; /* bulk buffer matchbits */ + u32 brw_rw; /* read or write */ + u32 brw_len; /* bulk data len */ + u32 brw_flags; /* bulk data patterns */ } __packed; /* bulk r/w request */ struct srpc_brw_reply { - __u32 brw_status; + u32 brw_status; } __packed; /* bulk r/w reply */ #define SRPC_MSG_MAGIC 0xeeb0f00d #define SRPC_MSG_VERSION 1 struct srpc_msg { - __u32 msg_magic; /* magic number */ - __u32 msg_version; /* message version number */ - __u32 msg_type; /* type of message body: srpc_msg_type */ - __u32 msg_reserved0; - __u32 msg_reserved1; - __u32 msg_ses_feats; /* test session features */ + u32 msg_magic; /* magic number */ + u32 msg_version; /* message version number */ + u32 msg_type; /* type of message body: srpc_msg_type */ + u32 msg_reserved0; + u32 msg_reserved1; + u32 msg_ses_feats; /* test session features */ union { struct srpc_generic_reqst reqst; struct srpc_generic_reply reply; -- 1.8.3.1 From jsimmons at infradead.org Thu Jan 31 17:19:11 2019 From: jsimmons at infradead.org (James Simmons) Date: Thu, 31 Jan 2019 12:19:11 -0500 Subject: [lustre-devel] [PATCH 07/26] obdclass: use kernel types for kernel code In-Reply-To: <1548955170-13456-1-git-send-email-jsimmons@infradead.org> References: <1548955170-13456-1-git-send-email-jsimmons@infradead.org> Message-ID: <1548955170-13456-8-git-send-email-jsimmons@infradead.org> Lustre obdclass code was originally both a user land and kernel implementation. The source contains many types of the form __u32 but since this is mostly kernel code change the types to kernel internal types. Signed-off-by: James Simmons --- drivers/staging/lustre/lustre/obdclass/cl_io.c | 2 +- drivers/staging/lustre/lustre/obdclass/cl_lock.c | 2 +- drivers/staging/lustre/lustre/obdclass/cl_object.c | 2 +- drivers/staging/lustre/lustre/obdclass/class_obd.c | 14 +++---- drivers/staging/lustre/lustre/obdclass/debug.c | 16 ++++---- drivers/staging/lustre/lustre/obdclass/genops.c | 10 ++--- drivers/staging/lustre/lustre/obdclass/llog_swab.c | 14 +++---- .../lustre/lustre/obdclass/lprocfs_counters.c | 2 +- .../lustre/lustre/obdclass/lprocfs_status.c | 46 +++++++++++----------- drivers/staging/lustre/lustre/obdclass/lu_object.c | 26 ++++++------ .../lustre/lustre/obdclass/lustre_handles.c | 4 +- .../staging/lustre/lustre/obdclass/lustre_peer.c | 4 +- .../staging/lustre/lustre/obdclass/obd_config.c | 4 +- drivers/staging/lustre/lustre/obdclass/obd_mount.c | 8 ++-- 14 files changed, 77 insertions(+), 77 deletions(-) diff --git a/drivers/staging/lustre/lustre/obdclass/cl_io.c b/drivers/staging/lustre/lustre/obdclass/cl_io.c index 84c7710..d3f2455 100644 --- a/drivers/staging/lustre/lustre/obdclass/cl_io.c +++ b/drivers/staging/lustre/lustre/obdclass/cl_io.c @@ -205,7 +205,7 @@ int cl_io_rw_init(const struct lu_env *env, struct cl_io *io, LU_OBJECT_HEADER(D_VFSTRACE, env, &io->ci_obj->co_lu, "io range: %u [%llu, %llu) %u %u\n", - iot, (__u64)pos, (__u64)pos + count, + iot, (u64)pos, (u64)pos + count, io->u.ci_rw.crw_nonblock, io->u.ci_wr.wr_append); io->u.ci_rw.crw_pos = pos; io->u.ci_rw.crw_count = count; diff --git a/drivers/staging/lustre/lustre/obdclass/cl_lock.c b/drivers/staging/lustre/lustre/obdclass/cl_lock.c index 23c1609..425ca9c 100644 --- a/drivers/staging/lustre/lustre/obdclass/cl_lock.c +++ b/drivers/staging/lustre/lustre/obdclass/cl_lock.c @@ -180,7 +180,7 @@ int cl_lock_request(const struct lu_env *env, struct cl_io *io, struct cl_lock *lock) { struct cl_sync_io *anchor = NULL; - __u32 enq_flags = lock->cll_descr.cld_enq_flags; + u32 enq_flags = lock->cll_descr.cld_enq_flags; int rc; rc = cl_lock_init(env, lock, io); diff --git a/drivers/staging/lustre/lustre/obdclass/cl_object.c b/drivers/staging/lustre/lustre/obdclass/cl_object.c index b2bf570..5b59a71 100644 --- a/drivers/staging/lustre/lustre/obdclass/cl_object.c +++ b/drivers/staging/lustre/lustre/obdclass/cl_object.c @@ -592,7 +592,7 @@ static void cl_env_init0(struct cl_env *cle, void *debug) cl_env_inc(CS_busy); } -static struct lu_env *cl_env_new(__u32 ctx_tags, __u32 ses_tags, void *debug) +static struct lu_env *cl_env_new(u32 ctx_tags, u32 ses_tags, void *debug) { struct lu_env *env; struct cl_env *cle; diff --git a/drivers/staging/lustre/lustre/obdclass/class_obd.c b/drivers/staging/lustre/lustre/obdclass/class_obd.c index 75345dd..e130cf7 100644 --- a/drivers/staging/lustre/lustre/obdclass/class_obd.c +++ b/drivers/staging/lustre/lustre/obdclass/class_obd.c @@ -120,7 +120,7 @@ int lustre_get_jobid(char *jobid) } EXPORT_SYMBOL(lustre_get_jobid); -static int class_resolve_dev_name(__u32 len, const char *name) +static int class_resolve_dev_name(u32 len, const char *name) { int rc; int dev; @@ -594,19 +594,19 @@ static long obd_class_ioctl(struct file *filp, unsigned int cmd, static int obd_init_checks(void) { - __u64 u64val, div64val; + u64 u64val, div64val; char buf[64]; int len, ret = 0; CDEBUG(D_INFO, "LPU64=%s, LPD64=%s, LPX64=%s\n", "%llu", "%lld", "%#llx"); - CDEBUG(D_INFO, "OBD_OBJECT_EOF = %#llx\n", (__u64)OBD_OBJECT_EOF); + CDEBUG(D_INFO, "OBD_OBJECT_EOF = %#llx\n", (u64)OBD_OBJECT_EOF); u64val = OBD_OBJECT_EOF; CDEBUG(D_INFO, "u64val OBD_OBJECT_EOF = %#llx\n", u64val); if (u64val != OBD_OBJECT_EOF) { - CERROR("__u64 %#llx(%d) != 0xffffffffffffffff\n", + CERROR("u64 %#llx(%d) != 0xffffffffffffffff\n", u64val, (int)sizeof(u64val)); ret = -EINVAL; } @@ -619,12 +619,12 @@ static int obd_init_checks(void) div64val = OBD_OBJECT_EOF; CDEBUG(D_INFO, "u64val OBD_OBJECT_EOF = %#llx\n", u64val); if (u64val != OBD_OBJECT_EOF) { - CERROR("__u64 %#llx(%d) != 0xffffffffffffffff\n", + CERROR("u64 %#llx(%d) != 0xffffffffffffffff\n", u64val, (int)sizeof(u64val)); ret = -EOVERFLOW; } if (u64val >> 8 != OBD_OBJECT_EOF >> 8) { - CERROR("__u64 %#llx(%d) != 0xffffffffffffffff\n", + CERROR("u64 %#llx(%d) != 0xffffffffffffffff\n", u64val, (int)sizeof(u64val)); return -EOVERFLOW; } @@ -654,7 +654,7 @@ static int obd_init_checks(void) } if ((u64val & ~PAGE_MASK) >= PAGE_SIZE) { CWARN("mask failed: u64val %llu >= %llu\n", u64val, - (__u64)PAGE_SIZE); + (u64)PAGE_SIZE); ret = -EINVAL; } diff --git a/drivers/staging/lustre/lustre/obdclass/debug.c b/drivers/staging/lustre/lustre/obdclass/debug.c index 2156a82..2e526c7 100644 --- a/drivers/staging/lustre/lustre/obdclass/debug.c +++ b/drivers/staging/lustre/lustre/obdclass/debug.c @@ -43,8 +43,8 @@ #include #include -#define LPDS sizeof(__u64) -int block_debug_setup(void *addr, int len, __u64 off, __u64 id) +#define LPDS sizeof(u64) +int block_debug_setup(void *addr, int len, u64 off, u64 id) { LASSERT(addr); @@ -58,9 +58,9 @@ int block_debug_setup(void *addr, int len, __u64 off, __u64 id) } EXPORT_SYMBOL(block_debug_setup); -int block_debug_check(char *who, void *addr, int end, __u64 off, __u64 id) +int block_debug_check(char *who, void *addr, int end, u64 off, u64 id) { - __u64 ne_off; + u64 ne_off; int err = 0; LASSERT(addr); @@ -69,24 +69,24 @@ int block_debug_check(char *who, void *addr, int end, __u64 off, __u64 id) id = le64_to_cpu(id); if (memcmp(addr, (char *)&ne_off, LPDS)) { CDEBUG(D_ERROR, "%s: id %#llx offset %llu off: %#llx != %#llx\n", - who, id, off, *(__u64 *)addr, ne_off); + who, id, off, *(u64 *)addr, ne_off); err = -EINVAL; } if (memcmp(addr + LPDS, (char *)&id, LPDS)) { CDEBUG(D_ERROR, "%s: id %#llx offset %llu id: %#llx != %#llx\n", - who, id, off, *(__u64 *)(addr + LPDS), id); + who, id, off, *(u64 *)(addr + LPDS), id); err = -EINVAL; } addr += end - LPDS - LPDS; if (memcmp(addr, (char *)&ne_off, LPDS)) { CDEBUG(D_ERROR, "%s: id %#llx offset %llu end off: %#llx != %#llx\n", - who, id, off, *(__u64 *)addr, ne_off); + who, id, off, *(u64 *)addr, ne_off); err = -EINVAL; } if (memcmp(addr + LPDS, (char *)&id, LPDS)) { CDEBUG(D_ERROR, "%s: id %#llx offset %llu end id: %#llx != %#llx\n", - who, id, off, *(__u64 *)(addr + LPDS), id); + who, id, off, *(u64 *)(addr + LPDS), id); err = -EINVAL; } diff --git a/drivers/staging/lustre/lustre/obdclass/genops.c b/drivers/staging/lustre/lustre/obdclass/genops.c index 03df181..3d4d6e1 100644 --- a/drivers/staging/lustre/lustre/obdclass/genops.c +++ b/drivers/staging/lustre/lustre/obdclass/genops.c @@ -1366,17 +1366,17 @@ void obd_put_request_slot(struct client_obd *cli) } EXPORT_SYMBOL(obd_put_request_slot); -__u32 obd_get_max_rpcs_in_flight(struct client_obd *cli) +u32 obd_get_max_rpcs_in_flight(struct client_obd *cli) { return cli->cl_max_rpcs_in_flight; } EXPORT_SYMBOL(obd_get_max_rpcs_in_flight); -int obd_set_max_rpcs_in_flight(struct client_obd *cli, __u32 max) +int obd_set_max_rpcs_in_flight(struct client_obd *cli, u32 max) { struct obd_request_slot_waiter *orsw; const char *typ_name; - __u32 old; + u32 old; int diff; int rc; int i; @@ -1424,7 +1424,7 @@ int obd_set_max_rpcs_in_flight(struct client_obd *cli, __u32 max) } EXPORT_SYMBOL(obd_set_max_rpcs_in_flight); -int obd_set_max_mod_rpcs_in_flight(struct client_obd *cli, __u16 max) +int obd_set_max_mod_rpcs_in_flight(struct client_obd *cli, u16 max) { struct obd_connect_data *ocd; u16 maxmodrpcs; @@ -1564,7 +1564,7 @@ static inline bool obd_skip_mod_rpc_slot(const struct lookup_intent *it) * Returns the tag to be set in the request message. Tag 0 * is reserved for non-modifying requests. */ -u16 obd_get_mod_rpc_slot(struct client_obd *cli, __u32 opc, +u16 obd_get_mod_rpc_slot(struct client_obd *cli, u32 opc, struct lookup_intent *it) { bool close_req = false; diff --git a/drivers/staging/lustre/lustre/obdclass/llog_swab.c b/drivers/staging/lustre/lustre/obdclass/llog_swab.c index f18330f..fddc1ea 100644 --- a/drivers/staging/lustre/lustre/obdclass/llog_swab.c +++ b/drivers/staging/lustre/lustre/obdclass/llog_swab.c @@ -358,12 +358,12 @@ void lustre_swab_lustre_cfg(struct lustre_cfg *lcfg) /* used only for compatibility with old on-disk cfg_marker data */ struct cfg_marker32 { - __u32 cm_step; - __u32 cm_flags; - __u32 cm_vers; - __u32 padding; - __u32 cm_createtime; - __u32 cm_canceltime; + u32 cm_step; + u32 cm_flags; + u32 cm_vers; + u32 padding; + u32 cm_createtime; + u32 cm_canceltime; char cm_tgtname[MTI_NAME_MAXLEN]; char cm_comment[MTI_NAME_MAXLEN]; }; @@ -381,7 +381,7 @@ void lustre_swab_cfg_marker(struct cfg_marker *marker, int swab, int size) __swab32s(&marker->cm_vers); } if (size == sizeof(*cm32)) { - __u32 createtime, canceltime; + u32 createtime, canceltime; /* There was a problem with the original declaration of * cfg_marker on 32-bit systems because it used time_t as * a wire protocol structure, and didn't verify this in diff --git a/drivers/staging/lustre/lustre/obdclass/lprocfs_counters.c b/drivers/staging/lustre/lustre/obdclass/lprocfs_counters.c index 85f09af..77bc66f 100644 --- a/drivers/staging/lustre/lustre/obdclass/lprocfs_counters.c +++ b/drivers/staging/lustre/lustre/obdclass/lprocfs_counters.c @@ -82,7 +82,7 @@ void lprocfs_counter_add(struct lprocfs_stats *stats, int idx, long amount) percpu_cntr->lc_sum += amount; if (header->lc_config & LPROCFS_CNTR_STDDEV) - percpu_cntr->lc_sumsquare += (__s64)amount * amount; + percpu_cntr->lc_sumsquare += (s64)amount * amount; if (amount < percpu_cntr->lc_min) percpu_cntr->lc_min = amount; if (amount > percpu_cntr->lc_max) diff --git a/drivers/staging/lustre/lustre/obdclass/lprocfs_status.c b/drivers/staging/lustre/lustre/obdclass/lprocfs_status.c index acfea7a..cc70402 100644 --- a/drivers/staging/lustre/lustre/obdclass/lprocfs_status.c +++ b/drivers/staging/lustre/lustre/obdclass/lprocfs_status.c @@ -118,7 +118,7 @@ int obd_connect_flags2str(char *page, int count, u64 flags, u64 flags2, const char *sep) { - __u64 mask; + u64 mask; int i, ret = 0; BUILD_BUG_ON(ARRAY_SIZE(obd_connect_names) < 65); @@ -385,8 +385,8 @@ static ssize_t kbytestotal_show(struct kobject *kobj, struct attribute *attr, get_jiffies_64() - OBD_STATFS_CACHE_SECONDS * HZ, OBD_STATFS_NODELAY); if (!rc) { - __u32 blk_size = osfs.os_bsize >> 10; - __u64 result = osfs.os_blocks; + u32 blk_size = osfs.os_bsize >> 10; + u64 result = osfs.os_blocks; while (blk_size >>= 1) result <<= 1; @@ -408,8 +408,8 @@ static ssize_t kbytesfree_show(struct kobject *kobj, struct attribute *attr, get_jiffies_64() - OBD_STATFS_CACHE_SECONDS * HZ, OBD_STATFS_NODELAY); if (!rc) { - __u32 blk_size = osfs.os_bsize >> 10; - __u64 result = osfs.os_bfree; + u32 blk_size = osfs.os_bsize >> 10; + u64 result = osfs.os_bfree; while (blk_size >>= 1) result <<= 1; @@ -431,8 +431,8 @@ static ssize_t kbytesavail_show(struct kobject *kobj, struct attribute *attr, get_jiffies_64() - OBD_STATFS_CACHE_SECONDS * HZ, OBD_STATFS_NODELAY); if (!rc) { - __u32 blk_size = osfs.os_bsize >> 10; - __u64 result = osfs.os_bavail; + u32 blk_size = osfs.os_bsize >> 10; + u64 result = osfs.os_bavail; while (blk_size >>= 1) result <<= 1; @@ -702,7 +702,7 @@ static int obd_import_flags2str(struct obd_import *imp, struct seq_file *m) static void obd_connect_seq_flags2str(struct seq_file *m, u64 flags, u64 flags2, const char *sep) { - __u64 mask; + u64 mask; int i; bool first = true; @@ -813,8 +813,8 @@ int lprocfs_rd_import(struct seq_file *m, void *data) header = &obd->obd_svc_stats->ls_cnt_header[PTLRPC_REQWAIT_CNTR]; lprocfs_stats_collect(obd->obd_svc_stats, PTLRPC_REQWAIT_CNTR, &ret); if (ret.lc_count != 0) { - /* first argument to do_div MUST be __u64 */ - __u64 sum = ret.lc_sum; + /* first argument to do_div MUST be u64 */ + u64 sum = ret.lc_sum; do_div(sum, ret.lc_count); ret.lc_sum = sum; @@ -861,8 +861,8 @@ int lprocfs_rd_import(struct seq_file *m, void *data) PTLRPC_LAST_CNTR + BRW_READ_BYTES + rw, &ret); if (ret.lc_sum > 0 && ret.lc_count > 0) { - /* first argument to do_div MUST be __u64 */ - __u64 sum = ret.lc_sum; + /* first argument to do_div MUST be u64 */ + u64 sum = ret.lc_sum; do_div(sum, ret.lc_count); ret.lc_sum = sum; @@ -877,8 +877,8 @@ int lprocfs_rd_import(struct seq_file *m, void *data) header = &obd->obd_svc_stats->ls_cnt_header[j]; lprocfs_stats_collect(obd->obd_svc_stats, j, &ret); if (ret.lc_sum > 0 && ret.lc_count != 0) { - /* first argument to do_div MUST be __u64 */ - __u64 sum = ret.lc_sum; + /* first argument to do_div MUST be u64 */ + u64 sum = ret.lc_sum; do_div(sum, ret.lc_count); ret.lc_sum = sum; @@ -994,7 +994,7 @@ int lprocfs_rd_timeouts(struct seq_file *m, void *data) int lprocfs_rd_connect_flags(struct seq_file *m, void *data) { struct obd_device *obd = data; - __u64 flags, flags2; + u64 flags, flags2; int rc; rc = lprocfs_climp_check(obd); @@ -1217,13 +1217,13 @@ void lprocfs_free_stats(struct lprocfs_stats **statsh) } EXPORT_SYMBOL(lprocfs_free_stats); -__u64 lprocfs_stats_collector(struct lprocfs_stats *stats, int idx, +u64 lprocfs_stats_collector(struct lprocfs_stats *stats, int idx, enum lprocfs_fields_flags field) { unsigned int i; unsigned int num_cpu; unsigned long flags = 0; - __u64 ret = 0; + u64 ret = 0; LASSERT(stats); @@ -1471,12 +1471,12 @@ void ldebugfs_free_md_stats(struct obd_device *obd) } EXPORT_SYMBOL(ldebugfs_free_md_stats); -__s64 lprocfs_read_helper(struct lprocfs_counter *lc, +s64 lprocfs_read_helper(struct lprocfs_counter *lc, struct lprocfs_counter_header *header, enum lprocfs_stats_flags flags, enum lprocfs_fields_flags field) { - __s64 ret = 0; + s64 ret = 0; if (!lc || !header) return 0; @@ -1521,17 +1521,17 @@ int lprocfs_write_helper(const char __user *buffer, unsigned long count, EXPORT_SYMBOL(lprocfs_write_helper); int lprocfs_write_u64_helper(const char __user *buffer, unsigned long count, - __u64 *val) + u64 *val) { return lprocfs_write_frac_u64_helper(buffer, count, val, 1); } EXPORT_SYMBOL(lprocfs_write_u64_helper); int lprocfs_write_frac_u64_helper(const char __user *buffer, - unsigned long count, __u64 *val, int mult) + unsigned long count, u64 *val, int mult) { char kernbuf[22], *end, *pbuf; - __u64 whole, frac = 0, units; + u64 whole, frac = 0, units; unsigned int frac_d = 1; int sign = 1; @@ -1557,7 +1557,7 @@ int lprocfs_write_frac_u64_helper(const char __user *buffer, pbuf = end + 1; - /* need to limit frac_d to a __u32 */ + /* need to limit frac_d to a u32 */ if (strlen(pbuf) > 10) pbuf[10] = '\0'; diff --git a/drivers/staging/lustre/lustre/obdclass/lu_object.c b/drivers/staging/lustre/lustre/obdclass/lu_object.c index c513e55..a132d87 100644 --- a/drivers/staging/lustre/lustre/obdclass/lu_object.c +++ b/drivers/staging/lustre/lustre/obdclass/lu_object.c @@ -106,7 +106,7 @@ enum { MODULE_PARM_DESC(lu_cache_nr, "Maximum number of objects in lu_object cache"); static void lu_object_free(const struct lu_env *env, struct lu_object *o); -static __u32 ls_stats_read(struct lprocfs_stats *stats, int idx); +static u32 ls_stats_read(struct lprocfs_stats *stats, int idx); wait_queue_head_t * lu_site_wq_from_fid(struct lu_site *site, struct lu_fid *fid) @@ -590,7 +590,7 @@ void lu_object_print(const struct lu_env *env, void *cookie, static struct lu_object *htable_lookup(struct lu_site *s, struct cfs_hash_bd *bd, const struct lu_fid *f, - __u64 *version) + u64 *version) { struct lu_site_bkt_data *bkt; struct lu_object_header *h; @@ -643,18 +643,18 @@ static struct lu_object *lu_object_find(const struct lu_env *env, */ static void lu_object_limit(const struct lu_env *env, struct lu_device *dev) { - __u64 size, nr; + u64 size, nr; if (lu_cache_nr == LU_CACHE_NR_UNLIMITED) return; size = cfs_hash_size_get(dev->ld_site->ls_obj_hash); - nr = (__u64)lu_cache_nr; + nr = (u64)lu_cache_nr; if (size <= nr) return; lu_site_purge_objects(env, dev->ld_site, - min_t(__u64, size - nr, LU_CACHE_NR_MAX_ADJUST), + min_t(u64, size - nr, LU_CACHE_NR_MAX_ADJUST), false); } @@ -675,7 +675,7 @@ struct lu_object *lu_object_find_at(const struct lu_env *env, struct lu_site *s; struct cfs_hash *hs; struct cfs_hash_bd bd; - __u64 version = 0; + u64 version = 0; /* * This uses standard index maintenance protocol: @@ -884,7 +884,7 @@ static unsigned int lu_obj_hop_hash(struct cfs_hash *hs, const void *key, unsigned int mask) { struct lu_fid *fid = (struct lu_fid *)key; - __u32 hash; + u32 hash; hash = fid_flatten32(fid); hash += (hash >> 4) + (hash << 12); /* mixing oid and seq */ @@ -1593,7 +1593,7 @@ static int keys_init(struct lu_context *ctx) /** * Initialize context data-structure. Create values for all keys. */ -int lu_context_init(struct lu_context *ctx, __u32 tags) +int lu_context_init(struct lu_context *ctx, u32 tags) { int rc; @@ -1705,10 +1705,10 @@ int lu_context_refill(struct lu_context *ctx) * predefined when the lu_device type are registered, during the module probe * phase. */ -__u32 lu_context_tags_default; -__u32 lu_session_tags_default; +u32 lu_context_tags_default; +u32 lu_session_tags_default; -int lu_env_init(struct lu_env *env, __u32 tags) +int lu_env_init(struct lu_env *env, u32 tags) { int result; @@ -1939,12 +1939,12 @@ void lu_global_fini(void) lu_ref_global_fini(); } -static __u32 ls_stats_read(struct lprocfs_stats *stats, int idx) +static u32 ls_stats_read(struct lprocfs_stats *stats, int idx) { struct lprocfs_counter ret; lprocfs_stats_collect(stats, idx, &ret); - return (__u32)ret.lc_count; + return (u32)ret.lc_count; } /** diff --git a/drivers/staging/lustre/lustre/obdclass/lustre_handles.c b/drivers/staging/lustre/lustre/obdclass/lustre_handles.c index cdc8dc1..b296877 100644 --- a/drivers/staging/lustre/lustre/obdclass/lustre_handles.c +++ b/drivers/staging/lustre/lustre/obdclass/lustre_handles.c @@ -42,7 +42,7 @@ #include #include -static __u64 handle_base; +static u64 handle_base; #define HANDLE_INCR 7 static spinlock_t handle_base_lock; @@ -132,7 +132,7 @@ void class_handle_unhash(struct portals_handle *h) } EXPORT_SYMBOL(class_handle_unhash); -void *class_handle2object(__u64 cookie, const void *owner) +void *class_handle2object(u64 cookie, const void *owner) { struct handle_bucket *bucket; struct portals_handle *h; diff --git a/drivers/staging/lustre/lustre/obdclass/lustre_peer.c b/drivers/staging/lustre/lustre/obdclass/lustre_peer.c index 5705b0a..8e7f3a8 100644 --- a/drivers/staging/lustre/lustre/obdclass/lustre_peer.c +++ b/drivers/staging/lustre/lustre/obdclass/lustre_peer.c @@ -80,7 +80,7 @@ int lustre_uuid_to_peer(const char *uuid, lnet_nid_t *peer_nid, int index) /* Add a nid to a niduuid. Multiple nids can be added to a single uuid; * LNET will choose the best one. */ -int class_add_uuid(const char *uuid, __u64 nid) +int class_add_uuid(const char *uuid, u64 nid) { struct uuid_nid_data *data, *entry; int found = 0; @@ -173,7 +173,7 @@ int class_del_uuid(const char *uuid) } /* check if @nid exists in nid list of @uuid */ -int class_check_uuid(struct obd_uuid *uuid, __u64 nid) +int class_check_uuid(struct obd_uuid *uuid, u64 nid) { struct uuid_nid_data *entry; int found = 0; diff --git a/drivers/staging/lustre/lustre/obdclass/obd_config.c b/drivers/staging/lustre/lustre/obdclass/obd_config.c index 7d00ca4..887afda 100644 --- a/drivers/staging/lustre/lustre/obdclass/obd_config.c +++ b/drivers/staging/lustre/lustre/obdclass/obd_config.c @@ -168,7 +168,7 @@ static int parse_nid(char *buf, void *value, int quiet) static int parse_net(char *buf, void *value) { - __u32 *net = value; + u32 *net = value; *net = libcfs_str2net(buf); CDEBUG(D_INFO, "Net %s\n", libcfs_net2str(*net)); @@ -1415,7 +1415,7 @@ int class_config_llog_handler(const struct lu_env *env, */ if (lcfg->lcfg_nal != 0 && /* pre-newconfig log? */ (lcfg->lcfg_nid >> 32) == 0) { - __u32 addr = (__u32)(lcfg->lcfg_nid & 0xffffffff); + u32 addr = (u32)(lcfg->lcfg_nid & 0xffffffff); lcfg_new->lcfg_nid = LNET_MKNID(LNET_MKNET(lcfg->lcfg_nal, 0), addr); diff --git a/drivers/staging/lustre/lustre/obdclass/obd_mount.c b/drivers/staging/lustre/lustre/obdclass/obd_mount.c index db5e1b5..eab3216 100644 --- a/drivers/staging/lustre/lustre/obdclass/obd_mount.c +++ b/drivers/staging/lustre/lustre/obdclass/obd_mount.c @@ -269,7 +269,7 @@ int lustre_start_mgc(struct super_block *sb) if (lmd_is_client(lsi->lsi_lmd)) { int has_ir; int vallen = sizeof(*data); - __u32 *flags = &lsi->lsi_lmd->lmd_flags; + u32 *flags = &lsi->lsi_lmd->lmd_flags; rc = obd_get_info(NULL, obd->obd_self_export, strlen(KEY_CONN_DATA), KEY_CONN_DATA, @@ -621,7 +621,7 @@ static int server_name2fsname(const char *svname, char *fsname, * rc < 0 on error * if endptr isn't NULL it is set to end of name */ -static int server_name2index(const char *svname, __u32 *idx, +static int server_name2index(const char *svname, u32 *idx, const char **endptr) { unsigned long index; @@ -721,7 +721,7 @@ int lustre_check_exclusion(struct super_block *sb, char *svname) { struct lustre_sb_info *lsi = s2lsi(sb); struct lustre_mount_data *lmd = lsi->lsi_lmd; - __u32 index; + u32 index; int i, rc; rc = server_name2index(svname, &index, NULL); @@ -745,7 +745,7 @@ int lustre_check_exclusion(struct super_block *sb, char *svname) static int lmd_make_exclusion(struct lustre_mount_data *lmd, const char *ptr) { const char *s1 = ptr, *s2; - __u32 index = 0, *exclude_list; + u32 index = 0, *exclude_list; int rc = 0, devmax; /* The shortest an ost name can be is 8 chars: -OST0000. -- 1.8.3.1 From jsimmons at infradead.org Thu Jan 31 17:19:16 2019 From: jsimmons at infradead.org (James Simmons) Date: Thu, 31 Jan 2019 12:19:16 -0500 Subject: [lustre-devel] [PATCH 12/26] lmv: cleanup white spaces In-Reply-To: <1548955170-13456-1-git-send-email-jsimmons@infradead.org> References: <1548955170-13456-1-git-send-email-jsimmons@infradead.org> Message-ID: <1548955170-13456-13-git-send-email-jsimmons@infradead.org> The lmv code is very messy and difficult to read. Remove excess white space and properly align data structures so they are easy on the eyes. Signed-off-by: James Simmons --- drivers/staging/lustre/lustre/lmv/lmv_intent.c | 38 +-- drivers/staging/lustre/lustre/lmv/lmv_obd.c | 334 ++++++++++++------------- drivers/staging/lustre/lustre/lmv/lproc_lmv.c | 24 +- 3 files changed, 198 insertions(+), 198 deletions(-) diff --git a/drivers/staging/lustre/lustre/lmv/lmv_intent.c b/drivers/staging/lustre/lustre/lmv/lmv_intent.c index bc364b6..8892426 100644 --- a/drivers/staging/lustre/lustre/lmv/lmv_intent.c +++ b/drivers/staging/lustre/lustre/lmv/lmv_intent.c @@ -54,15 +54,15 @@ static int lmv_intent_remote(struct obd_export *exp, struct lookup_intent *it, ldlm_blocking_callback cb_blocking, u64 extra_lock_flags) { - struct obd_device *obd = exp->exp_obd; - struct lmv_obd *lmv = &obd->u.lmv; - struct ptlrpc_request *req = NULL; - struct lustre_handle plock; - struct md_op_data *op_data; - struct lmv_tgt_desc *tgt; - struct mdt_body *body; - int pmode; - int rc = 0; + struct obd_device *obd = exp->exp_obd; + struct lmv_obd *lmv = &obd->u.lmv; + struct ptlrpc_request *req = NULL; + struct lustre_handle plock; + struct md_op_data *op_data; + struct lmv_tgt_desc *tgt; + struct mdt_body *body; + int pmode; + int rc = 0; body = req_capsule_server_get(&(*reqp)->rq_pill, &RMF_MDT_BODY); if (!body) @@ -264,11 +264,11 @@ static int lmv_intent_open(struct obd_export *exp, struct md_op_data *op_data, ldlm_blocking_callback cb_blocking, u64 extra_lock_flags) { - struct obd_device *obd = exp->exp_obd; - struct lmv_obd *lmv = &obd->u.lmv; - struct lmv_tgt_desc *tgt; - struct mdt_body *body; - int rc; + struct obd_device *obd = exp->exp_obd; + struct lmv_obd *lmv = &obd->u.lmv; + struct lmv_tgt_desc *tgt; + struct mdt_body *body; + int rc; if (it->it_flags & MDS_OPEN_BY_FID) { LASSERT(fid_is_sane(&op_data->op_fid2)); @@ -356,11 +356,11 @@ static int lmv_intent_lookup(struct obd_export *exp, u64 extra_lock_flags) { struct lmv_stripe_md *lsm = op_data->op_mea1; - struct obd_device *obd = exp->exp_obd; - struct lmv_obd *lmv = &obd->u.lmv; - struct lmv_tgt_desc *tgt = NULL; + struct obd_device *obd = exp->exp_obd; + struct lmv_obd *lmv = &obd->u.lmv; + struct lmv_tgt_desc *tgt = NULL; struct mdt_body *body; - int rc = 0; + int rc = 0; /* * If it returns ERR_PTR(-EBADFD) then it is an unknown hash type @@ -477,7 +477,7 @@ int lmv_intent_lock(struct obd_export *exp, struct md_op_data *op_data, ldlm_blocking_callback cb_blocking, u64 extra_lock_flags) { - int rc; + int rc; LASSERT(fid_is_sane(&op_data->op_fid1)); diff --git a/drivers/staging/lustre/lustre/lmv/lmv_obd.c b/drivers/staging/lustre/lustre/lmv/lmv_obd.c index 65ae944..1c7379b 100644 --- a/drivers/staging/lustre/lustre/lmv/lmv_obd.c +++ b/drivers/staging/lustre/lustre/lmv/lmv_obd.c @@ -80,9 +80,9 @@ static int lmv_set_mdc_active(struct lmv_obd *lmv, const struct obd_uuid *uuid, int activate) { struct lmv_tgt_desc *tgt = NULL; - struct obd_device *obd; - u32 i; - int rc = 0; + struct obd_device *obd; + u32 i; + int rc = 0; CDEBUG(D_INFO, "Searching in lmv %p for uuid %s (activate=%d)\n", lmv, uuid->uuid, activate); @@ -126,7 +126,7 @@ static int lmv_set_mdc_active(struct lmv_obd *lmv, const struct obd_uuid *uuid, activate ? "" : "in"); lmv_activate_target(lmv, tgt, activate); - out_lmv_lock: +out_lmv_lock: spin_unlock(&lmv->lmv_lock); return rc; } @@ -143,9 +143,9 @@ static int lmv_notify(struct obd_device *obd, struct obd_device *watched, enum obd_notify_event ev) { struct obd_connect_data *conn_data; - struct lmv_obd *lmv = &obd->u.lmv; - struct obd_uuid *uuid; - int rc = 0; + struct lmv_obd *lmv = &obd->u.lmv; + struct obd_uuid *uuid; + int rc = 0; if (strcmp(watched->obd_type->typ_name, LUSTRE_MDC_NAME)) { CERROR("unexpected notification of %s %s!\n", @@ -192,10 +192,10 @@ static int lmv_connect(const struct lu_env *env, struct obd_uuid *cluuid, struct obd_connect_data *data, void *localdata) { - struct lmv_obd *lmv = &obd->u.lmv; - struct lustre_handle conn = { 0 }; + struct lmv_obd *lmv = &obd->u.lmv; + struct lustre_handle conn = { 0 }; struct obd_export *exp; - int rc = 0; + int rc = 0; rc = class_connect(&conn, obd, cluuid); if (rc) { @@ -234,11 +234,11 @@ static int lmv_connect(const struct lu_env *env, static int lmv_init_ea_size(struct obd_export *exp, u32 easize, u32 def_easize) { - struct obd_device *obd = exp->exp_obd; - struct lmv_obd *lmv = &obd->u.lmv; + struct obd_device *obd = exp->exp_obd; + struct lmv_obd *lmv = &obd->u.lmv; u32 i; - int rc = 0; - int change = 0; + int rc = 0; + int change = 0; if (lmv->max_easize < easize) { lmv->max_easize = easize; @@ -277,13 +277,13 @@ static int lmv_init_ea_size(struct obd_export *exp, u32 easize, u32 def_easize) static int lmv_connect_mdc(struct obd_device *obd, struct lmv_tgt_desc *tgt) { - struct lmv_obd *lmv = &obd->u.lmv; - struct obd_uuid *cluuid = &lmv->cluuid; - struct obd_uuid lmv_mdc_uuid = { "LMV_MDC_UUID" }; - struct obd_device *mdc_obd; - struct obd_export *mdc_exp; - struct lu_fld_target target; - int rc; + struct lmv_obd *lmv = &obd->u.lmv; + struct obd_uuid *cluuid = &lmv->cluuid; + struct obd_uuid lmv_mdc_uuid = { "LMV_MDC_UUID" }; + struct obd_device *mdc_obd; + struct obd_export *mdc_exp; + struct lu_fld_target target; + int rc; mdc_obd = class_find_client_obd(&tgt->ltd_uuid, LUSTRE_MDC_NAME, &obd->obd_uuid); @@ -371,11 +371,11 @@ static void lmv_del_target(struct lmv_obd *lmv, int index) static int lmv_add_target(struct obd_device *obd, struct obd_uuid *uuidp, u32 index, int gen) { - struct lmv_obd *lmv = &obd->u.lmv; + struct lmv_obd *lmv = &obd->u.lmv; struct obd_device *mdc_obd; struct lmv_tgt_desc *tgt; int orig_tgt_count = 0; - int rc = 0; + int rc = 0; CDEBUG(D_CONFIG, "Target uuid: %s. index %d\n", uuidp->uuid, index); @@ -470,11 +470,11 @@ static int lmv_add_target(struct obd_device *obd, struct obd_uuid *uuidp, static int lmv_check_connect(struct obd_device *obd) { - struct lmv_obd *lmv = &obd->u.lmv; - struct lmv_tgt_desc *tgt; + struct lmv_obd *lmv = &obd->u.lmv; + struct lmv_tgt_desc *tgt; u32 i; - int rc; - int easize; + int rc; + int easize; if (lmv->connected) return 0; @@ -518,7 +518,7 @@ static int lmv_check_connect(struct obd_device *obd) mutex_unlock(&lmv->lmv_init_mutex); return 0; - out_disc: +out_disc: while (i-- > 0) { int rc2; @@ -542,9 +542,9 @@ static int lmv_check_connect(struct obd_device *obd) static int lmv_disconnect_mdc(struct obd_device *obd, struct lmv_tgt_desc *tgt) { - struct lmv_obd *lmv = &obd->u.lmv; - struct obd_device *mdc_obd; - int rc; + struct lmv_obd *lmv = &obd->u.lmv; + struct obd_device *mdc_obd; + int rc; mdc_obd = class_exp2obd(tgt->ltd_exp); @@ -582,9 +582,9 @@ static int lmv_disconnect_mdc(struct obd_device *obd, struct lmv_tgt_desc *tgt) static int lmv_disconnect(struct obd_export *exp) { - struct obd_device *obd = class_exp2obd(exp); - struct lmv_obd *lmv = &obd->u.lmv; - int rc; + struct obd_device *obd = class_exp2obd(exp); + struct lmv_obd *lmv = &obd->u.lmv; + int rc; u32 i; if (!lmv->tgts) @@ -615,14 +615,14 @@ static int lmv_disconnect(struct obd_export *exp) static int lmv_fid2path(struct obd_export *exp, int len, void *karg, void __user *uarg) { - struct obd_device *obddev = class_exp2obd(exp); - struct lmv_obd *lmv = &obddev->u.lmv; + struct obd_device *obddev = class_exp2obd(exp); + struct lmv_obd *lmv = &obddev->u.lmv; struct getinfo_fid2path *gf = karg; - struct lmv_tgt_desc *tgt; + struct lmv_tgt_desc *tgt; struct getinfo_fid2path *remote_gf = NULL; struct lu_fid root_fid; - int remote_gf_size = 0; - int rc; + int remote_gf_size = 0; + int rc; tgt = lmv_find_target(lmv, &gf->gf_fid); if (IS_ERR(tgt)) @@ -711,7 +711,7 @@ static int lmv_hsm_req_count(struct lmv_obd *lmv, const struct lmv_tgt_desc *tgt_mds) { u32 i, nr = 0; - struct lmv_tgt_desc *curr_tgt; + struct lmv_tgt_desc *curr_tgt; /* count how many requests must be sent to the given target */ for (i = 0; i < hur->hur_request.hr_itemcount; i++) { @@ -729,8 +729,8 @@ static int lmv_hsm_req_build(struct lmv_obd *lmv, const struct lmv_tgt_desc *tgt_mds, struct hsm_user_request *hur_out) { - int i, nr_out; - struct lmv_tgt_desc *curr_tgt; + int i, nr_out; + struct lmv_tgt_desc *curr_tgt; /* build the hsm_user_request for the given target */ hur_out->hur_request = hur_in->hur_request; @@ -857,12 +857,12 @@ static int lmv_hsm_ct_register(struct lmv_obd *lmv, unsigned int cmd, int len, static int lmv_iocontrol(unsigned int cmd, struct obd_export *exp, int len, void *karg, void __user *uarg) { - struct obd_device *obddev = class_exp2obd(exp); - struct lmv_obd *lmv = &obddev->u.lmv; + struct obd_device *obddev = class_exp2obd(exp); + struct lmv_obd *lmv = &obddev->u.lmv; struct lmv_tgt_desc *tgt = NULL; u32 i = 0; - int rc = 0; - int set = 0; + int rc = 0; + int set = 0; u32 count = lmv->desc.ld_tgt_count; if (count == 0) @@ -872,7 +872,7 @@ static int lmv_iocontrol(unsigned int cmd, struct obd_export *exp, case IOC_OBD_STATFS: { struct obd_ioctl_data *data = karg; struct obd_device *mdc_obd; - struct obd_statfs stat_buf = {0}; + struct obd_statfs stat_buf = { 0 }; u32 index; memcpy(&index, data->ioc_inlbuf2, sizeof(u32)); @@ -981,7 +981,7 @@ static int lmv_iocontrol(unsigned int cmd, struct obd_export *exp, case LL_IOC_HSM_STATE_GET: case LL_IOC_HSM_STATE_SET: case LL_IOC_HSM_ACTION: { - struct md_op_data *op_data = karg; + struct md_op_data *op_data = karg; tgt = lmv_find_target(lmv, &op_data->op_fid1); if (IS_ERR(tgt)) @@ -1059,8 +1059,8 @@ static int lmv_iocontrol(unsigned int cmd, struct obd_export *exp, break; } case LL_IOC_LOV_SWAP_LAYOUTS: { - struct md_op_data *op_data = karg; - struct lmv_tgt_desc *tgt1, *tgt2; + struct md_op_data *op_data = karg; + struct lmv_tgt_desc *tgt1, *tgt2; tgt1 = lmv_find_target(lmv, &op_data->op_fid1); if (IS_ERR(tgt1)) @@ -1162,8 +1162,8 @@ static int lmv_placement_policy(struct obd_device *obd, int __lmv_fid_alloc(struct lmv_obd *lmv, struct lu_fid *fid, u32 mds) { - struct lmv_tgt_desc *tgt; - int rc; + struct lmv_tgt_desc *tgt; + int rc; tgt = lmv_get_target(lmv, mds, NULL); if (IS_ERR(tgt)) @@ -1197,10 +1197,10 @@ int __lmv_fid_alloc(struct lmv_obd *lmv, struct lu_fid *fid, u32 mds) int lmv_fid_alloc(const struct lu_env *env, struct obd_export *exp, struct lu_fid *fid, struct md_op_data *op_data) { - struct obd_device *obd = class_exp2obd(exp); - struct lmv_obd *lmv = &obd->u.lmv; - u32 mds = 0; - int rc; + struct obd_device *obd = class_exp2obd(exp); + struct lmv_obd *lmv = &obd->u.lmv; + u32 mds = 0; + int rc; LASSERT(op_data); LASSERT(fid); @@ -1223,9 +1223,9 @@ int lmv_fid_alloc(const struct lu_env *env, struct obd_export *exp, static int lmv_setup(struct obd_device *obd, struct lustre_cfg *lcfg) { - struct lmv_obd *lmv = &obd->u.lmv; - struct lmv_desc *desc; - int rc; + struct lmv_obd *lmv = &obd->u.lmv; + struct lmv_desc *desc; + int rc; if (LUSTRE_CFG_BUFLEN(lcfg, 1) < 1) { CERROR("LMV setup requires a descriptor\n"); @@ -1270,7 +1270,7 @@ static int lmv_setup(struct obd_device *obd, struct lustre_cfg *lcfg) static int lmv_cleanup(struct obd_device *obd) { - struct lmv_obd *lmv = &obd->u.lmv; + struct lmv_obd *lmv = &obd->u.lmv; fld_client_fini(&lmv->lmv_fld); if (lmv->tgts) { @@ -1289,11 +1289,11 @@ static int lmv_cleanup(struct obd_device *obd) static int lmv_process_config(struct obd_device *obd, u32 len, void *buf) { - struct lustre_cfg *lcfg = buf; - struct obd_uuid obd_uuid; - int gen; - u32 index; - int rc; + struct lustre_cfg *lcfg = buf; + struct obd_uuid obd_uuid; + int gen; + u32 index; + int rc; switch (lcfg->lcfg_command) { case LCFG_ADD_MDC: @@ -1329,10 +1329,10 @@ static int lmv_process_config(struct obd_device *obd, u32 len, void *buf) static int lmv_statfs(const struct lu_env *env, struct obd_export *exp, struct obd_statfs *osfs, u64 max_age, u32 flags) { - struct obd_device *obd = class_exp2obd(exp); - struct lmv_obd *lmv = &obd->u.lmv; - struct obd_statfs *temp; - int rc = 0; + struct obd_device *obd = class_exp2obd(exp); + struct lmv_obd *lmv = &obd->u.lmv; + struct obd_statfs *temp; + int rc = 0; u32 i; temp = kzalloc(sizeof(*temp), GFP_NOFS); @@ -1379,8 +1379,8 @@ static int lmv_statfs(const struct lu_env *env, struct obd_export *exp, static int lmv_get_root(struct obd_export *exp, const char *fileset, struct lu_fid *fid) { - struct obd_device *obd = exp->exp_obd; - struct lmv_obd *lmv = &obd->u.lmv; + struct obd_device *obd = exp->exp_obd; + struct lmv_obd *lmv = &obd->u.lmv; return md_get_root(lmv->tgts[0]->ltd_exp, fileset, fid); } @@ -1389,9 +1389,9 @@ static int lmv_getxattr(struct obd_export *exp, const struct lu_fid *fid, u64 obd_md_valid, const char *name, size_t buf_size, struct ptlrpc_request **req) { - struct obd_device *obd = exp->exp_obd; - struct lmv_obd *lmv = &obd->u.lmv; - struct lmv_tgt_desc *tgt; + struct obd_device *obd = exp->exp_obd; + struct lmv_obd *lmv = &obd->u.lmv; + struct lmv_tgt_desc *tgt; tgt = lmv_find_target(lmv, fid); if (IS_ERR(tgt)) @@ -1407,9 +1407,9 @@ static int lmv_setxattr(struct obd_export *exp, const struct lu_fid *fid, unsigned int xattr_flags, u32 suppgid, struct ptlrpc_request **req) { - struct obd_device *obd = exp->exp_obd; - struct lmv_obd *lmv = &obd->u.lmv; - struct lmv_tgt_desc *tgt; + struct obd_device *obd = exp->exp_obd; + struct lmv_obd *lmv = &obd->u.lmv; + struct lmv_tgt_desc *tgt; tgt = lmv_find_target(lmv, fid); if (IS_ERR(tgt)) @@ -1422,9 +1422,9 @@ static int lmv_setxattr(struct obd_export *exp, const struct lu_fid *fid, static int lmv_getattr(struct obd_export *exp, struct md_op_data *op_data, struct ptlrpc_request **request) { - struct obd_device *obd = exp->exp_obd; - struct lmv_obd *lmv = &obd->u.lmv; - struct lmv_tgt_desc *tgt; + struct obd_device *obd = exp->exp_obd; + struct lmv_obd *lmv = &obd->u.lmv; + struct lmv_tgt_desc *tgt; tgt = lmv_find_target(lmv, &op_data->op_fid1); if (IS_ERR(tgt)) @@ -1440,8 +1440,8 @@ static int lmv_getattr(struct obd_export *exp, struct md_op_data *op_data, static int lmv_null_inode(struct obd_export *exp, const struct lu_fid *fid) { - struct obd_device *obd = exp->exp_obd; - struct lmv_obd *lmv = &obd->u.lmv; + struct obd_device *obd = exp->exp_obd; + struct lmv_obd *lmv = &obd->u.lmv; u32 i; CDEBUG(D_INODE, "CBDATA for " DFID "\n", PFID(fid)); @@ -1463,9 +1463,9 @@ static int lmv_null_inode(struct obd_export *exp, const struct lu_fid *fid) static int lmv_close(struct obd_export *exp, struct md_op_data *op_data, struct md_open_data *mod, struct ptlrpc_request **request) { - struct obd_device *obd = exp->exp_obd; - struct lmv_obd *lmv = &obd->u.lmv; - struct lmv_tgt_desc *tgt; + struct obd_device *obd = exp->exp_obd; + struct lmv_obd *lmv = &obd->u.lmv; + struct lmv_tgt_desc *tgt; tgt = lmv_find_target(lmv, &op_data->op_fid1); if (IS_ERR(tgt)) @@ -1587,10 +1587,10 @@ static int lmv_create(struct obd_export *exp, struct md_op_data *op_data, uid_t uid, gid_t gid, kernel_cap_t cap_effective, u64 rdev, struct ptlrpc_request **request) { - struct obd_device *obd = exp->exp_obd; - struct lmv_obd *lmv = &obd->u.lmv; - struct lmv_tgt_desc *tgt; - int rc; + struct obd_device *obd = exp->exp_obd; + struct lmv_obd *lmv = &obd->u.lmv; + struct lmv_tgt_desc *tgt; + int rc; if (!lmv->desc.ld_active_tgt_count) return -EIO; @@ -1641,9 +1641,9 @@ static int lmv_create(struct obd_export *exp, struct md_op_data *op_data, const union ldlm_policy_data *policy, struct md_op_data *op_data, struct lustre_handle *lockh, u64 extra_lock_flags) { - struct obd_device *obd = exp->exp_obd; - struct lmv_obd *lmv = &obd->u.lmv; - struct lmv_tgt_desc *tgt; + struct obd_device *obd = exp->exp_obd; + struct lmv_obd *lmv = &obd->u.lmv; + struct lmv_tgt_desc *tgt; CDEBUG(D_INODE, "ENQUEUE on " DFID "\n", PFID(&op_data->op_fid1)); @@ -1662,12 +1662,12 @@ static int lmv_create(struct obd_export *exp, struct md_op_data *op_data, lmv_getattr_name(struct obd_export *exp, struct md_op_data *op_data, struct ptlrpc_request **preq) { - struct ptlrpc_request *req = NULL; - struct obd_device *obd = exp->exp_obd; - struct lmv_obd *lmv = &obd->u.lmv; - struct lmv_tgt_desc *tgt; - struct mdt_body *body; - int rc; + struct ptlrpc_request *req = NULL; + struct obd_device *obd = exp->exp_obd; + struct lmv_obd *lmv = &obd->u.lmv; + struct lmv_tgt_desc *tgt; + struct mdt_body *body; + int rc; tgt = lmv_locate_mds(lmv, op_data, &op_data->op_fid1); if (IS_ERR(tgt)) @@ -1707,7 +1707,7 @@ static int lmv_create(struct obd_export *exp, struct md_op_data *op_data, return rc; } -#define md_op_data_fid(op_data, fl) \ +#define md_op_data_fid(op_data, fl) \ (fl == MF_MDC_CANCEL_FID1 ? &op_data->op_fid1 : \ fl == MF_MDC_CANCEL_FID2 ? &op_data->op_fid2 : \ fl == MF_MDC_CANCEL_FID3 ? &op_data->op_fid3 : \ @@ -1718,11 +1718,11 @@ static int lmv_early_cancel(struct obd_export *exp, struct lmv_tgt_desc *tgt, struct md_op_data *op_data, int op_tgt, enum ldlm_mode mode, int bits, int flag) { - struct lu_fid *fid = md_op_data_fid(op_data, flag); - struct obd_device *obd = exp->exp_obd; - struct lmv_obd *lmv = &obd->u.lmv; + struct lu_fid *fid = md_op_data_fid(op_data, flag); + struct obd_device *obd = exp->exp_obd; + struct lmv_obd *lmv = &obd->u.lmv; union ldlm_policy_data policy = { { 0 } }; - int rc = 0; + int rc = 0; if (!fid_is_sane(fid)) return 0; @@ -1756,10 +1756,10 @@ static int lmv_early_cancel(struct obd_export *exp, struct lmv_tgt_desc *tgt, static int lmv_link(struct obd_export *exp, struct md_op_data *op_data, struct ptlrpc_request **request) { - struct obd_device *obd = exp->exp_obd; - struct lmv_obd *lmv = &obd->u.lmv; - struct lmv_tgt_desc *tgt; - int rc; + struct obd_device *obd = exp->exp_obd; + struct lmv_obd *lmv = &obd->u.lmv; + struct lmv_tgt_desc *tgt; + int rc; LASSERT(op_data->op_namelen != 0); @@ -1803,13 +1803,13 @@ static int lmv_rename(struct obd_export *exp, struct md_op_data *op_data, const char *new, size_t newlen, struct ptlrpc_request **request) { - struct obd_device *obd = exp->exp_obd; - struct lmv_obd *lmv = &obd->u.lmv; + struct obd_device *obd = exp->exp_obd; + struct lmv_obd *lmv = &obd->u.lmv; struct obd_export *target_exp; - struct lmv_tgt_desc *src_tgt; + struct lmv_tgt_desc *src_tgt; struct lmv_tgt_desc *tgt_tgt; struct mdt_body *body; - int rc; + int rc; LASSERT(oldlen != 0); @@ -1968,9 +1968,9 @@ static int lmv_rename(struct obd_export *exp, struct md_op_data *op_data, static int lmv_setattr(struct obd_export *exp, struct md_op_data *op_data, void *ea, size_t ealen, struct ptlrpc_request **request) { - struct obd_device *obd = exp->exp_obd; - struct lmv_obd *lmv = &obd->u.lmv; - struct lmv_tgt_desc *tgt; + struct obd_device *obd = exp->exp_obd; + struct lmv_obd *lmv = &obd->u.lmv; + struct lmv_tgt_desc *tgt; CDEBUG(D_INODE, "SETATTR for " DFID ", valid 0x%x/0x%x\n", PFID(&op_data->op_fid1), op_data->op_attr.ia_valid, @@ -1987,9 +1987,9 @@ static int lmv_setattr(struct obd_export *exp, struct md_op_data *op_data, static int lmv_fsync(struct obd_export *exp, const struct lu_fid *fid, struct ptlrpc_request **request) { - struct obd_device *obd = exp->exp_obd; - struct lmv_obd *lmv = &obd->u.lmv; - struct lmv_tgt_desc *tgt; + struct obd_device *obd = exp->exp_obd; + struct lmv_obd *lmv = &obd->u.lmv; + struct lmv_tgt_desc *tgt; tgt = lmv_find_target(lmv, fid); if (IS_ERR(tgt)) @@ -2341,13 +2341,13 @@ static int lmv_unlink(struct obd_export *exp, struct md_op_data *op_data, struct ptlrpc_request **request) { struct lmv_stripe_md *lsm = op_data->op_mea1; - struct obd_device *obd = exp->exp_obd; - struct lmv_obd *lmv = &obd->u.lmv; + struct obd_device *obd = exp->exp_obd; + struct lmv_obd *lmv = &obd->u.lmv; struct lmv_tgt_desc *parent_tgt = NULL; - struct lmv_tgt_desc *tgt = NULL; - struct mdt_body *body; + struct lmv_tgt_desc *tgt = NULL; + struct mdt_body *body; int stripe_index = 0; - int rc; + int rc; retry_unlink: /* For striped dir, we need to locate the parent as well */ @@ -2519,9 +2519,9 @@ static int lmv_precleanup(struct obd_device *obd) static int lmv_get_info(const struct lu_env *env, struct obd_export *exp, u32 keylen, void *key, u32 *vallen, void *val) { - struct obd_device *obd; - struct lmv_obd *lmv; - int rc = 0; + struct obd_device *obd; + struct lmv_obd *lmv; + int rc = 0; obd = class_exp2obd(exp); if (!obd) { @@ -2590,9 +2590,9 @@ static int lmv_set_info_async(const struct lu_env *env, struct obd_export *exp, u32 keylen, void *key, u32 vallen, void *val, struct ptlrpc_request_set *set) { - struct lmv_tgt_desc *tgt; - struct obd_device *obd; - struct lmv_obd *lmv; + struct lmv_tgt_desc *tgt; + struct obd_device *obd; + struct lmv_obd *lmv; int rc = 0; obd = class_exp2obd(exp); @@ -2756,10 +2756,10 @@ static int lmv_cancel_unused(struct obd_export *exp, const struct lu_fid *fid, enum ldlm_mode mode, enum ldlm_cancel_flags flags, void *opaque) { - struct obd_device *obd = exp->exp_obd; - struct lmv_obd *lmv = &obd->u.lmv; - int rc = 0; - int err; + struct obd_device *obd = exp->exp_obd; + struct lmv_obd *lmv = &obd->u.lmv; + int rc = 0; + int err; u32 i; LASSERT(fid); @@ -2782,7 +2782,7 @@ static int lmv_set_lock_data(struct obd_export *exp, const struct lustre_handle *lockh, void *data, u64 *bits) { - struct lmv_obd *lmv = &exp->exp_obd->u.lmv; + struct lmv_obd *lmv = &exp->exp_obd->u.lmv; struct lmv_tgt_desc *tgt = lmv->tgts[0]; if (!tgt || !tgt->ltd_exp) @@ -2798,9 +2798,9 @@ static enum ldlm_mode lmv_lock_match(struct obd_export *exp, u64 flags, enum ldlm_mode mode, struct lustre_handle *lockh) { - struct obd_device *obd = exp->exp_obd; - struct lmv_obd *lmv = &obd->u.lmv; - enum ldlm_mode rc; + struct obd_device *obd = exp->exp_obd; + struct lmv_obd *lmv = &obd->u.lmv; + enum ldlm_mode rc; int tgt; u32 i; @@ -2840,7 +2840,7 @@ static int lmv_get_lustre_md(struct obd_export *exp, struct obd_export *md_exp, struct lustre_md *md) { - struct lmv_obd *lmv = &exp->exp_obd->u.lmv; + struct lmv_obd *lmv = &exp->exp_obd->u.lmv; struct lmv_tgt_desc *tgt = lmv->tgts[0]; if (!tgt || !tgt->ltd_exp) @@ -2850,8 +2850,8 @@ static int lmv_get_lustre_md(struct obd_export *exp, static int lmv_free_lustre_md(struct obd_export *exp, struct lustre_md *md) { - struct obd_device *obd = exp->exp_obd; - struct lmv_obd *lmv = &obd->u.lmv; + struct obd_device *obd = exp->exp_obd; + struct lmv_obd *lmv = &obd->u.lmv; struct lmv_tgt_desc *tgt = lmv->tgts[0]; if (md->lmv) { @@ -2867,9 +2867,9 @@ static int lmv_set_open_replay_data(struct obd_export *exp, struct obd_client_handle *och, struct lookup_intent *it) { - struct obd_device *obd = exp->exp_obd; - struct lmv_obd *lmv = &obd->u.lmv; - struct lmv_tgt_desc *tgt; + struct obd_device *obd = exp->exp_obd; + struct lmv_obd *lmv = &obd->u.lmv; + struct lmv_tgt_desc *tgt; tgt = lmv_find_target(lmv, &och->och_fid); if (IS_ERR(tgt)) @@ -2881,9 +2881,9 @@ static int lmv_set_open_replay_data(struct obd_export *exp, static int lmv_clear_open_replay_data(struct obd_export *exp, struct obd_client_handle *och) { - struct obd_device *obd = exp->exp_obd; - struct lmv_obd *lmv = &obd->u.lmv; - struct lmv_tgt_desc *tgt; + struct obd_device *obd = exp->exp_obd; + struct lmv_obd *lmv = &obd->u.lmv; + struct lmv_tgt_desc *tgt; tgt = lmv_find_target(lmv, &och->och_fid); if (IS_ERR(tgt)) @@ -2895,9 +2895,9 @@ static int lmv_clear_open_replay_data(struct obd_export *exp, static int lmv_intent_getattr_async(struct obd_export *exp, struct md_enqueue_info *minfo) { - struct md_op_data *op_data = &minfo->mi_data; - struct obd_device *obd = exp->exp_obd; - struct lmv_obd *lmv = &obd->u.lmv; + struct md_op_data *op_data = &minfo->mi_data; + struct obd_device *obd = exp->exp_obd; + struct lmv_obd *lmv = &obd->u.lmv; struct lmv_tgt_desc *ptgt = NULL; struct lmv_tgt_desc *ctgt = NULL; @@ -2927,9 +2927,9 @@ static int lmv_intent_getattr_async(struct obd_export *exp, static int lmv_revalidate_lock(struct obd_export *exp, struct lookup_intent *it, struct lu_fid *fid, u64 *bits) { - struct obd_device *obd = exp->exp_obd; - struct lmv_obd *lmv = &obd->u.lmv; - struct lmv_tgt_desc *tgt; + struct obd_device *obd = exp->exp_obd; + struct lmv_obd *lmv = &obd->u.lmv; + struct lmv_tgt_desc *tgt; tgt = lmv_find_target(lmv, fid); if (IS_ERR(tgt)) @@ -2963,8 +2963,8 @@ static int lmv_revalidate_lock(struct obd_export *exp, struct lookup_intent *it, static int lmv_quotactl(struct obd_device *unused, struct obd_export *exp, struct obd_quotactl *oqctl) { - struct obd_device *obd = class_exp2obd(exp); - struct lmv_obd *lmv = &obd->u.lmv; + struct obd_device *obd = class_exp2obd(exp); + struct lmv_obd *lmv = &obd->u.lmv; struct lmv_tgt_desc *tgt = lmv->tgts[0]; int rc = 0; u64 curspace = 0, curinodes = 0; @@ -3045,20 +3045,20 @@ static int lmv_merge_attr(struct obd_export *exp, } static struct obd_ops lmv_obd_ops = { - .owner = THIS_MODULE, - .setup = lmv_setup, - .cleanup = lmv_cleanup, - .precleanup = lmv_precleanup, - .process_config = lmv_process_config, - .connect = lmv_connect, - .disconnect = lmv_disconnect, - .statfs = lmv_statfs, - .get_info = lmv_get_info, - .set_info_async = lmv_set_info_async, - .notify = lmv_notify, - .get_uuid = lmv_get_uuid, - .iocontrol = lmv_iocontrol, - .quotactl = lmv_quotactl + .owner = THIS_MODULE, + .setup = lmv_setup, + .cleanup = lmv_cleanup, + .precleanup = lmv_precleanup, + .process_config = lmv_process_config, + .connect = lmv_connect, + .disconnect = lmv_disconnect, + .statfs = lmv_statfs, + .get_info = lmv_get_info, + .set_info_async = lmv_set_info_async, + .notify = lmv_notify, + .get_uuid = lmv_get_uuid, + .iocontrol = lmv_iocontrol, + .quotactl = lmv_quotactl }; static struct md_ops lmv_md_ops = { diff --git a/drivers/staging/lustre/lustre/lmv/lproc_lmv.c b/drivers/staging/lustre/lustre/lmv/lproc_lmv.c index 4e30026..e40473c 100644 --- a/drivers/staging/lustre/lustre/lmv/lproc_lmv.c +++ b/drivers/staging/lustre/lustre/lmv/lproc_lmv.c @@ -78,8 +78,8 @@ static ssize_t desc_uuid_show(struct kobject *kobj, struct attribute *attr, static void *lmv_tgt_seq_start(struct seq_file *p, loff_t *pos) { - struct obd_device *dev = p->private; - struct lmv_obd *lmv = &dev->u.lmv; + struct obd_device *dev = p->private; + struct lmv_obd *lmv = &dev->u.lmv; while (*pos < lmv->tgts_size) { if (lmv->tgts[*pos]) @@ -96,8 +96,8 @@ static void lmv_tgt_seq_stop(struct seq_file *p, void *v) static void *lmv_tgt_seq_next(struct seq_file *p, void *v, loff_t *pos) { - struct obd_device *dev = p->private; - struct lmv_obd *lmv = &dev->u.lmv; + struct obd_device *dev = p->private; + struct lmv_obd *lmv = &dev->u.lmv; ++*pos; while (*pos < lmv->tgts_size) { @@ -106,12 +106,12 @@ static void *lmv_tgt_seq_next(struct seq_file *p, void *v, loff_t *pos) ++*pos; } - return NULL; + return NULL; } static int lmv_tgt_seq_show(struct seq_file *p, void *v) { - struct lmv_tgt_desc *tgt = v; + struct lmv_tgt_desc *tgt = v; if (!tgt) return 0; @@ -123,16 +123,16 @@ static int lmv_tgt_seq_show(struct seq_file *p, void *v) } static const struct seq_operations lmv_tgt_sops = { - .start = lmv_tgt_seq_start, - .stop = lmv_tgt_seq_stop, - .next = lmv_tgt_seq_next, - .show = lmv_tgt_seq_show, + .start = lmv_tgt_seq_start, + .stop = lmv_tgt_seq_stop, + .next = lmv_tgt_seq_next, + .show = lmv_tgt_seq_show, }; static int lmv_target_seq_open(struct inode *inode, struct file *file) { - struct seq_file *seq; - int rc; + struct seq_file *seq; + int rc; rc = seq_open(file, &lmv_tgt_sops); if (rc) -- 1.8.3.1 From jsimmons at infradead.org Thu Jan 31 17:19:17 2019 From: jsimmons at infradead.org (James Simmons) Date: Thu, 31 Jan 2019 12:19:17 -0500 Subject: [lustre-devel] [PATCH 13/26] lov: cleanup white spaces In-Reply-To: <1548955170-13456-1-git-send-email-jsimmons@infradead.org> References: <1548955170-13456-1-git-send-email-jsimmons@infradead.org> Message-ID: <1548955170-13456-14-git-send-email-jsimmons@infradead.org> The lov code is very messy and difficult to read. Remove excess white space and properly align data structures so they are easy on the eyes. Signed-off-by: James Simmons --- .../staging/lustre/lustre/lov/lov_cl_internal.h | 50 +++---- drivers/staging/lustre/lustre/lov/lov_dev.c | 62 ++++----- drivers/staging/lustre/lustre/lov/lov_internal.h | 56 ++++---- drivers/staging/lustre/lustre/lov/lov_io.c | 136 +++++++++--------- drivers/staging/lustre/lustre/lov/lov_lock.c | 34 ++--- drivers/staging/lustre/lustre/lov/lov_obd.c | 21 ++- drivers/staging/lustre/lustre/lov/lov_object.c | 154 ++++++++++----------- drivers/staging/lustre/lustre/lov/lov_offset.c | 6 +- drivers/staging/lustre/lustre/lov/lov_pack.c | 4 +- drivers/staging/lustre/lustre/lov/lov_page.c | 18 +-- drivers/staging/lustre/lustre/lov/lov_pool.c | 20 +-- drivers/staging/lustre/lustre/lov/lov_request.c | 12 +- drivers/staging/lustre/lustre/lov/lovsub_dev.c | 32 ++--- drivers/staging/lustre/lustre/lov/lovsub_lock.c | 4 +- drivers/staging/lustre/lustre/lov/lovsub_object.c | 29 ++-- drivers/staging/lustre/lustre/lov/lovsub_page.c | 2 +- drivers/staging/lustre/lustre/lov/lproc_lov.c | 18 +-- 17 files changed, 328 insertions(+), 330 deletions(-) diff --git a/drivers/staging/lustre/lustre/lov/lov_cl_internal.h b/drivers/staging/lustre/lustre/lov/lov_cl_internal.h index d83b8de..22ef7b2 100644 --- a/drivers/staging/lustre/lustre/lov/lov_cl_internal.h +++ b/drivers/staging/lustre/lustre/lov/lov_cl_internal.h @@ -95,12 +95,12 @@ struct lov_device { /* * XXX Locking of lov-private data is missing. */ - struct cl_device ld_cl; - struct lov_obd *ld_lov; + struct cl_device ld_cl; + struct lov_obd *ld_lov; /** size of lov_device::ld_target[] array */ - u32 ld_target_nr; - struct lovsub_device **ld_target; - u32 ld_flags; + u32 ld_target_nr; + struct lovsub_device **ld_target; + u32 ld_flags; }; /** @@ -180,7 +180,7 @@ struct lov_layout_raid0 { * function corresponding to the current layout type. */ struct lov_object { - struct cl_object lo_cl; + struct cl_object lo_cl; /** * Serializes object operations with transitions between layout types. * @@ -203,15 +203,15 @@ struct lov_object { * How many IOs are on going on this object. Layout can be changed * only if there is no active IO. */ - atomic_t lo_active_ios; + atomic_t lo_active_ios; /** * Waitq - wait for no one else is using lo_lsm */ - wait_queue_head_t lo_waitq; + wait_queue_head_t lo_waitq; /** * Layout metadata. NULL if empty layout. */ - struct lov_stripe_md *lo_lsm; + struct lov_stripe_md *lo_lsm; union lov_layout_state { struct lov_layout_state_empty { @@ -259,9 +259,9 @@ struct lov_lock_sub { * lov-specific lock state. */ struct lov_lock { - struct cl_lock_slice lls_cl; + struct cl_lock_slice lls_cl; /** Number of sub-locks in this lock */ - int lls_nr; + int lls_nr; /** sublock array */ struct lov_lock_sub lls_sub[0]; }; @@ -277,43 +277,43 @@ struct lov_page { */ struct lovsub_device { - struct cl_device acid_cl; - struct cl_device *acid_next; + struct cl_device acid_cl; + struct cl_device *acid_next; }; struct lovsub_object { struct cl_object_header lso_header; struct cl_object lso_cl; struct lov_object *lso_super; - int lso_index; + int lso_index; }; /** * Lock state at lovsub layer. */ struct lovsub_lock { - struct cl_lock_slice lss_cl; + struct cl_lock_slice lss_cl; }; /** * Describe the environment settings for sublocks. */ struct lov_sublock_env { - const struct lu_env *lse_env; - struct cl_io *lse_io; + const struct lu_env *lse_env; + struct cl_io *lse_io; }; struct lovsub_page { - struct cl_page_slice lsb_cl; + struct cl_page_slice lsb_cl; }; struct lov_thread_info { struct cl_object_conf lti_stripe_conf; - struct lu_fid lti_fid; - struct ost_lvb lti_lvb; + struct lu_fid lti_fid; + struct ost_lvb lti_lvb; struct cl_2queue lti_cl2q; struct cl_page_list lti_plist; - wait_queue_entry_t lti_waiter; + wait_queue_entry_t lti_waiter; }; /** @@ -354,12 +354,12 @@ struct lov_io_sub { */ struct lov_io { /** super-class */ - struct cl_io_slice lis_cl; + struct cl_io_slice lis_cl; /** * Pointer to the object slice. This is a duplicate of * lov_io::lis_cl::cis_object. */ - struct lov_object *lis_object; + struct lov_object *lis_object; /** * Original end-of-io position for this IO, set by the upper layer as * cl_io::u::ci_rw::pos + cl_io::u::ci_rw::count. lov remembers this, @@ -401,8 +401,8 @@ struct lov_io { }; struct lov_session { - struct lov_io ls_io; - struct lov_sublock_env ls_subenv; + struct lov_io ls_io; + struct lov_sublock_env ls_subenv; }; extern struct lu_device_type lov_device_type; diff --git a/drivers/staging/lustre/lustre/lov/lov_dev.c b/drivers/staging/lustre/lustre/lov/lov_dev.c index 67d30fb..a55b3f9 100644 --- a/drivers/staging/lustre/lustre/lov/lov_dev.c +++ b/drivers/staging/lustre/lustre/lov/lov_dev.c @@ -113,9 +113,9 @@ static void lov_key_fini(const struct lu_context *ctx, } struct lu_context_key lov_key = { - .lct_tags = LCT_CL_THREAD, - .lct_init = lov_key_init, - .lct_fini = lov_key_fini + .lct_tags = LCT_CL_THREAD, + .lct_init = lov_key_init, + .lct_fini = lov_key_fini }; static void *lov_session_key_init(const struct lu_context *ctx, @@ -138,9 +138,9 @@ static void lov_session_key_fini(const struct lu_context *ctx, } struct lu_context_key lov_session_key = { - .lct_tags = LCT_SESSION, - .lct_init = lov_session_key_init, - .lct_fini = lov_session_key_fini + .lct_tags = LCT_SESSION, + .lct_init = lov_session_key_init, + .lct_fini = lov_session_key_fini }; /* type constructor/destructor: lov_type_{init,fini,start,stop}() */ @@ -181,8 +181,8 @@ static int lov_device_init(const struct lu_env *env, struct lu_device *d, lov_foreach_target(ld, i) { struct lovsub_device *lsd; - struct cl_device *cl; - struct lov_tgt_desc *desc; + struct cl_device *cl; + struct lov_tgt_desc *desc; desc = ld->ld_lov->lov_tgts[i]; if (!desc) @@ -230,7 +230,7 @@ static void lov_cl_del_target(const struct lu_env *env, struct lu_device *dev, static int lov_expand_targets(const struct lu_env *env, struct lov_device *dev) { - int result; + int result; u32 tgt_size; u32 sub_size; @@ -238,8 +238,8 @@ static int lov_expand_targets(const struct lu_env *env, struct lov_device *dev) tgt_size = dev->ld_lov->lov_tgt_size; sub_size = dev->ld_target_nr; if (sub_size < tgt_size) { - struct lovsub_device **newd; - const size_t sz = sizeof(newd[0]); + struct lovsub_device **newd; + const size_t sz = sizeof(newd[0]); newd = kcalloc(tgt_size, sz, GFP_NOFS); if (newd) { @@ -247,7 +247,7 @@ static int lov_expand_targets(const struct lu_env *env, struct lov_device *dev) memcpy(newd, dev->ld_target, sub_size * sz); kfree(dev->ld_target); } - dev->ld_target = newd; + dev->ld_target = newd; dev->ld_target_nr = tgt_size; } else { result = -ENOMEM; @@ -259,11 +259,11 @@ static int lov_expand_targets(const struct lu_env *env, struct lov_device *dev) static int lov_cl_add_target(const struct lu_env *env, struct lu_device *dev, u32 index) { - struct obd_device *obd = dev->ld_obd; - struct lov_device *ld = lu2lov_dev(dev); - struct lov_tgt_desc *tgt; + struct obd_device *obd = dev->ld_obd; + struct lov_device *ld = lu2lov_dev(dev); + struct lov_tgt_desc *tgt; struct lovsub_device *lsd; - struct cl_device *cl; + struct cl_device *cl; int rc; lov_tgts_getref(obd); @@ -330,8 +330,8 @@ static int lov_process_config(const struct lu_env *env, } static const struct lu_device_operations lov_lu_ops = { - .ldo_object_alloc = lov_object_alloc, - .ldo_process_config = lov_process_config, + .ldo_object_alloc = lov_object_alloc, + .ldo_process_config = lov_process_config, }; static struct lu_device *lov_device_alloc(const struct lu_env *env, @@ -349,7 +349,7 @@ static struct lu_device *lov_device_alloc(const struct lu_env *env, cl_device_init(&ld->ld_cl, t); d = lov2lu_dev(ld); - d->ld_ops = &lov_lu_ops; + d->ld_ops = &lov_lu_ops; /* setup the LOV OBD */ obd = class_name2obd(lustre_cfg_string(cfg, 0)); @@ -365,24 +365,24 @@ static struct lu_device *lov_device_alloc(const struct lu_env *env, } static const struct lu_device_type_operations lov_device_type_ops = { - .ldto_init = lov_type_init, - .ldto_fini = lov_type_fini, + .ldto_init = lov_type_init, + .ldto_fini = lov_type_fini, - .ldto_start = lov_type_start, - .ldto_stop = lov_type_stop, + .ldto_start = lov_type_start, + .ldto_stop = lov_type_stop, - .ldto_device_alloc = lov_device_alloc, - .ldto_device_free = lov_device_free, + .ldto_device_alloc = lov_device_alloc, + .ldto_device_free = lov_device_free, - .ldto_device_init = lov_device_init, - .ldto_device_fini = lov_device_fini + .ldto_device_init = lov_device_init, + .ldto_device_fini = lov_device_fini }; struct lu_device_type lov_device_type = { - .ldt_tags = LU_DEVICE_CL, - .ldt_name = LUSTRE_LOV_NAME, - .ldt_ops = &lov_device_type_ops, - .ldt_ctx_tags = LCT_CL_THREAD + .ldt_tags = LU_DEVICE_CL, + .ldt_name = LUSTRE_LOV_NAME, + .ldt_ops = &lov_device_type_ops, + .ldt_ctx_tags = LCT_CL_THREAD }; /** @} lov */ diff --git a/drivers/staging/lustre/lustre/lov/lov_internal.h b/drivers/staging/lustre/lustre/lov/lov_internal.h index 9708f1b..f69f2d6 100644 --- a/drivers/staging/lustre/lustre/lov/lov_internal.h +++ b/drivers/staging/lustre/lustre/lov/lov_internal.h @@ -169,29 +169,29 @@ struct lsm_operations { * already a 32-bit value the compiler handles this directly. */ #if BITS_PER_LONG == 64 -# define lov_do_div64(n, base) ({ \ - u64 __base = (base); \ - u64 __rem; \ - __rem = ((u64)(n)) % __base; \ - (n) = ((u64)(n)) / __base; \ - __rem; \ +# define lov_do_div64(n, base) ({ \ + u64 __base = (base); \ + u64 __rem; \ + __rem = ((u64)(n)) % __base; \ + (n) = ((u64)(n)) / __base; \ + __rem; \ }) #elif BITS_PER_LONG == 32 -# define lov_do_div64(n, base) ({ \ - u64 __rem; \ +# define lov_do_div64(n, base) ({ \ + u64 __rem; \ if ((sizeof(base) > 4) && (((base) & 0xffffffff00000000ULL) != 0)) { \ int __remainder; \ LASSERTF(!((base) & (LOV_MIN_STRIPE_SIZE - 1)), "64 bit lov " \ - "division %llu / %llu\n", (n), (u64)(base)); \ - __remainder = (n) & (LOV_MIN_STRIPE_SIZE - 1); \ - (n) >>= LOV_MIN_STRIPE_BITS; \ - __rem = do_div(n, (base) >> LOV_MIN_STRIPE_BITS); \ - __rem <<= LOV_MIN_STRIPE_BITS; \ - __rem += __remainder; \ - } else { \ - __rem = do_div(n, base); \ - } \ - __rem; \ + "division %llu / %llu\n", (n), (u64)(base)); \ + __remainder = (n) & (LOV_MIN_STRIPE_SIZE - 1); \ + (n) >>= LOV_MIN_STRIPE_BITS; \ + __rem = do_div(n, (base) >> LOV_MIN_STRIPE_BITS); \ + __rem <<= LOV_MIN_STRIPE_BITS; \ + __rem += __remainder; \ + } else { \ + __rem = do_div(n, base); \ + } \ + __rem; \ }) #endif @@ -215,21 +215,21 @@ struct pool_desc { void lov_pool_hash_destroy(struct rhashtable *tbl); struct lov_request { - struct obd_info rq_oi; - struct lov_request_set *rq_rqset; + struct obd_info rq_oi; + struct lov_request_set *rq_rqset; - struct list_head rq_link; + struct list_head rq_link; - int rq_idx; /* index in lov->tgts array */ + int rq_idx; /* index in lov->tgts array */ }; struct lov_request_set { - struct obd_info *set_oi; - struct obd_device *set_obd; - int set_count; - atomic_t set_completes; - atomic_t set_success; - struct list_head set_list; + struct obd_info *set_oi; + struct obd_device *set_obd; + int set_count; + atomic_t set_completes; + atomic_t set_success; + struct list_head set_list; }; extern struct kmem_cache *lov_oinfo_slab; diff --git a/drivers/staging/lustre/lustre/lov/lov_io.c b/drivers/staging/lustre/lustre/lov/lov_io.c index 47bb618..de43f47 100644 --- a/drivers/staging/lustre/lustre/lov/lov_io.c +++ b/drivers/staging/lustre/lustre/lov/lov_io.c @@ -91,9 +91,9 @@ static int lov_io_sub_init(const struct lu_env *env, struct lov_io *lio, struct lov_io_sub *sub) { struct lov_object *lov = lio->lis_object; - struct cl_io *sub_io; - struct cl_object *sub_obj; - struct cl_io *io = lio->lis_cl.cis_io; + struct cl_io *sub_io; + struct cl_object *sub_obj; + struct cl_io *io = lio->lis_cl.cis_io; int index = lov_comp_entry(sub->sub_subio_index); int stripe = lov_comp_stripe(sub->sub_subio_index); int rc = 0; @@ -377,11 +377,11 @@ static u64 lov_offset_mod(u64 val, int delta) static int lov_io_iter_init(const struct lu_env *env, const struct cl_io_slice *ios) { - struct lov_io *lio = cl2lov_io(env, ios); + struct lov_io *lio = cl2lov_io(env, ios); struct lov_stripe_md *lsm = lio->lis_object->lo_lsm; struct cl_io *io = ios->cis_io; struct lov_layout_entry *le; - struct lov_io_sub *sub; + struct lov_io_sub *sub; struct lu_extent ext; int rc = 0; int index; @@ -461,9 +461,9 @@ static int lov_io_iter_init(const struct lu_env *env, static int lov_io_rw_iter_init(const struct lu_env *env, const struct cl_io_slice *ios) { - struct lov_io *lio = cl2lov_io(env, ios); + struct lov_io *lio = cl2lov_io(env, ios); struct lov_stripe_md *lsm = lio->lis_object->lo_lsm; - struct cl_io *io = ios->cis_io; + struct cl_io *io = ios->cis_io; u64 start = io->u.ci_rw.crw_pos; struct lov_stripe_md_entry *lse; int index; @@ -872,8 +872,8 @@ static int lov_io_fault_start(const struct lu_env *env, const struct cl_io_slice *ios) { struct cl_fault_io *fio; - struct lov_io *lio; - struct lov_io_sub *sub; + struct lov_io *lio; + struct lov_io_sub *sub; fio = &ios->cis_io->u.ci_fault; lio = cl2lov_io(env, ios); @@ -906,31 +906,31 @@ static void lov_io_fsync_end(const struct lu_env *env, static const struct cl_io_operations lov_io_ops = { .op = { [CIT_READ] = { - .cio_fini = lov_io_fini, - .cio_iter_init = lov_io_rw_iter_init, - .cio_iter_fini = lov_io_iter_fini, - .cio_lock = lov_io_lock, - .cio_unlock = lov_io_unlock, - .cio_start = lov_io_start, - .cio_end = lov_io_end + .cio_fini = lov_io_fini, + .cio_iter_init = lov_io_rw_iter_init, + .cio_iter_fini = lov_io_iter_fini, + .cio_lock = lov_io_lock, + .cio_unlock = lov_io_unlock, + .cio_start = lov_io_start, + .cio_end = lov_io_end }, [CIT_WRITE] = { - .cio_fini = lov_io_fini, - .cio_iter_init = lov_io_rw_iter_init, - .cio_iter_fini = lov_io_iter_fini, - .cio_lock = lov_io_lock, - .cio_unlock = lov_io_unlock, - .cio_start = lov_io_start, - .cio_end = lov_io_end + .cio_fini = lov_io_fini, + .cio_iter_init = lov_io_rw_iter_init, + .cio_iter_fini = lov_io_iter_fini, + .cio_lock = lov_io_lock, + .cio_unlock = lov_io_unlock, + .cio_start = lov_io_start, + .cio_end = lov_io_end }, [CIT_SETATTR] = { - .cio_fini = lov_io_fini, - .cio_iter_init = lov_io_setattr_iter_init, - .cio_iter_fini = lov_io_iter_fini, - .cio_lock = lov_io_lock, - .cio_unlock = lov_io_unlock, - .cio_start = lov_io_start, - .cio_end = lov_io_end + .cio_fini = lov_io_fini, + .cio_iter_init = lov_io_setattr_iter_init, + .cio_iter_fini = lov_io_iter_fini, + .cio_lock = lov_io_lock, + .cio_unlock = lov_io_unlock, + .cio_start = lov_io_start, + .cio_end = lov_io_end }, [CIT_DATA_VERSION] = { .cio_fini = lov_io_fini, @@ -942,22 +942,22 @@ static void lov_io_fsync_end(const struct lu_env *env, .cio_end = lov_io_data_version_end, }, [CIT_FAULT] = { - .cio_fini = lov_io_fini, - .cio_iter_init = lov_io_iter_init, - .cio_iter_fini = lov_io_iter_fini, - .cio_lock = lov_io_lock, - .cio_unlock = lov_io_unlock, - .cio_start = lov_io_fault_start, - .cio_end = lov_io_end + .cio_fini = lov_io_fini, + .cio_iter_init = lov_io_iter_init, + .cio_iter_fini = lov_io_iter_fini, + .cio_lock = lov_io_lock, + .cio_unlock = lov_io_unlock, + .cio_start = lov_io_fault_start, + .cio_end = lov_io_end }, [CIT_FSYNC] = { - .cio_fini = lov_io_fini, - .cio_iter_init = lov_io_iter_init, - .cio_iter_fini = lov_io_iter_fini, - .cio_lock = lov_io_lock, - .cio_unlock = lov_io_unlock, - .cio_start = lov_io_start, - .cio_end = lov_io_fsync_end + .cio_fini = lov_io_fini, + .cio_iter_init = lov_io_iter_init, + .cio_iter_fini = lov_io_iter_fini, + .cio_lock = lov_io_lock, + .cio_unlock = lov_io_unlock, + .cio_start = lov_io_start, + .cio_end = lov_io_fsync_end }, [CIT_LADVISE] = { .cio_fini = lov_io_fini, @@ -969,12 +969,12 @@ static void lov_io_fsync_end(const struct lu_env *env, .cio_end = lov_io_end }, [CIT_MISC] = { - .cio_fini = lov_io_fini + .cio_fini = lov_io_fini } }, .cio_read_ahead = lov_io_read_ahead, - .cio_submit = lov_io_submit, - .cio_commit_async = lov_io_commit_async, + .cio_submit = lov_io_submit, + .cio_commit_async = lov_io_commit_async, }; /***************************************************************************** @@ -1013,48 +1013,48 @@ static void lov_empty_impossible(const struct lu_env *env, static const struct cl_io_operations lov_empty_io_ops = { .op = { [CIT_READ] = { - .cio_fini = lov_empty_io_fini, + .cio_fini = lov_empty_io_fini, }, [CIT_WRITE] = { - .cio_fini = lov_empty_io_fini, - .cio_iter_init = LOV_EMPTY_IMPOSSIBLE, - .cio_lock = LOV_EMPTY_IMPOSSIBLE, - .cio_start = LOV_EMPTY_IMPOSSIBLE, - .cio_end = LOV_EMPTY_IMPOSSIBLE + .cio_fini = lov_empty_io_fini, + .cio_iter_init = LOV_EMPTY_IMPOSSIBLE, + .cio_lock = LOV_EMPTY_IMPOSSIBLE, + .cio_start = LOV_EMPTY_IMPOSSIBLE, + .cio_end = LOV_EMPTY_IMPOSSIBLE }, [CIT_SETATTR] = { - .cio_fini = lov_empty_io_fini, - .cio_iter_init = LOV_EMPTY_IMPOSSIBLE, - .cio_lock = LOV_EMPTY_IMPOSSIBLE, - .cio_start = LOV_EMPTY_IMPOSSIBLE, - .cio_end = LOV_EMPTY_IMPOSSIBLE + .cio_fini = lov_empty_io_fini, + .cio_iter_init = LOV_EMPTY_IMPOSSIBLE, + .cio_lock = LOV_EMPTY_IMPOSSIBLE, + .cio_start = LOV_EMPTY_IMPOSSIBLE, + .cio_end = LOV_EMPTY_IMPOSSIBLE }, [CIT_FAULT] = { - .cio_fini = lov_empty_io_fini, - .cio_iter_init = LOV_EMPTY_IMPOSSIBLE, - .cio_lock = LOV_EMPTY_IMPOSSIBLE, - .cio_start = LOV_EMPTY_IMPOSSIBLE, - .cio_end = LOV_EMPTY_IMPOSSIBLE + .cio_fini = lov_empty_io_fini, + .cio_iter_init = LOV_EMPTY_IMPOSSIBLE, + .cio_lock = LOV_EMPTY_IMPOSSIBLE, + .cio_start = LOV_EMPTY_IMPOSSIBLE, + .cio_end = LOV_EMPTY_IMPOSSIBLE }, [CIT_FSYNC] = { - .cio_fini = lov_empty_io_fini + .cio_fini = lov_empty_io_fini }, [CIT_LADVISE] = { .cio_fini = lov_empty_io_fini }, [CIT_MISC] = { - .cio_fini = lov_empty_io_fini + .cio_fini = lov_empty_io_fini } }, .cio_submit = lov_empty_io_submit, - .cio_commit_async = LOV_EMPTY_IMPOSSIBLE + .cio_commit_async = LOV_EMPTY_IMPOSSIBLE }; int lov_io_init_composite(const struct lu_env *env, struct cl_object *obj, struct cl_io *io) { - struct lov_io *lio = lov_env_io(env); - struct lov_object *lov = cl2lov(obj); + struct lov_io *lio = lov_env_io(env); + struct lov_object *lov = cl2lov(obj); INIT_LIST_HEAD(&lio->lis_active); io->ci_result = lov_io_slice_init(lio, lov, io); diff --git a/drivers/staging/lustre/lustre/lov/lov_lock.c b/drivers/staging/lustre/lustre/lov/lov_lock.c index 9a46424..039c902 100644 --- a/drivers/staging/lustre/lustre/lov/lov_lock.c +++ b/drivers/staging/lustre/lustre/lov/lov_lock.c @@ -54,9 +54,9 @@ static struct lov_sublock_env *lov_sublock_env_get(const struct lu_env *env, struct lov_lock_sub *lls) { struct lov_sublock_env *subenv; - struct lov_io *lio = lov_env_io(env); - struct cl_io *io = lio->lis_cl.cis_io; - struct lov_io_sub *sub; + struct lov_io *lio = lov_env_io(env); + struct cl_io *io = lio->lis_cl.cis_io; + struct lov_io_sub *sub; subenv = &lov_env_session(env)->ls_subenv; @@ -71,7 +71,7 @@ static struct lov_sublock_env *lov_sublock_env_get(const struct lu_env *env, */ if (!io || !cl_object_same(io->ci_obj, parent->cll_descr.cld_obj)) { subenv->lse_env = env; - subenv->lse_io = io; + subenv->lse_io = io; } else { sub = lov_sub_get(env, lio, lls->sub_index); if (!IS_ERR(sub)) { @@ -154,7 +154,7 @@ static struct lov_lock *lov_lock_sub_init(const struct lu_env *env, */ lovlck = kvzalloc(offsetof(struct lov_lock, lls_sub[nr]), - GFP_NOFS); + GFP_NOFS); if (!lovlck) return ERR_PTR(-ENOMEM); @@ -178,11 +178,11 @@ static struct lov_lock *lov_lock_sub_init(const struct lu_env *env, continue; LASSERT(!descr->cld_obj); - descr->cld_obj = lovsub2cl(r0->lo_sub[i]); + descr->cld_obj = lovsub2cl(r0->lo_sub[i]); descr->cld_start = cl_index(descr->cld_obj, start); - descr->cld_end = cl_index(descr->cld_obj, end); - descr->cld_mode = lock->cll_descr.cld_mode; - descr->cld_gid = lock->cll_descr.cld_gid; + descr->cld_end = cl_index(descr->cld_obj, end); + descr->cld_mode = lock->cll_descr.cld_mode; + descr->cld_gid = lock->cll_descr.cld_gid; descr->cld_enq_flags = lock->cll_descr.cld_enq_flags; lls->sub_index = lov_comp_index(index, i); @@ -244,7 +244,7 @@ static int lov_lock_enqueue(const struct lu_env *env, int rc = 0; for (i = 0; i < lovlck->lls_nr; ++i) { - struct lov_lock_sub *lls = &lovlck->lls_sub[i]; + struct lov_lock_sub *lls = &lovlck->lls_sub[i]; struct lov_sublock_env *subenv; subenv = lov_sublock_env_get(env, lock, lls); @@ -293,7 +293,7 @@ static int lov_lock_print(const struct lu_env *env, void *cookie, lu_printer_t p, const struct cl_lock_slice *slice) { struct lov_lock *lck = cl2lov_lock(slice); - int i; + int i; (*p)(env, cookie, "%d\n", lck->lls_nr); for (i = 0; i < lck->lls_nr; ++i) { @@ -307,10 +307,10 @@ static int lov_lock_print(const struct lu_env *env, void *cookie, } static const struct cl_lock_operations lov_lock_ops = { - .clo_fini = lov_lock_fini, - .clo_enqueue = lov_lock_enqueue, - .clo_cancel = lov_lock_cancel, - .clo_print = lov_lock_print + .clo_fini = lov_lock_fini, + .clo_enqueue = lov_lock_enqueue, + .clo_cancel = lov_lock_cancel, + .clo_print = lov_lock_print }; int lov_lock_init_composite(const struct lu_env *env, struct cl_object *obj, @@ -345,8 +345,8 @@ static int lov_empty_lock_print(const struct lu_env *env, void *cookie, /* XXX: more methods will be added later. */ static const struct cl_lock_operations lov_empty_lock_ops = { - .clo_fini = lov_empty_lock_fini, - .clo_print = lov_empty_lock_print + .clo_fini = lov_empty_lock_fini, + .clo_print = lov_empty_lock_print }; int lov_lock_init_empty(const struct lu_env *env, struct cl_object *obj, diff --git a/drivers/staging/lustre/lustre/lov/lov_obd.c b/drivers/staging/lustre/lustre/lov/lov_obd.c index 109dd69..04d0a9e 100644 --- a/drivers/staging/lustre/lustre/lov/lov_obd.c +++ b/drivers/staging/lustre/lustre/lov/lov_obd.c @@ -425,7 +425,7 @@ static int lov_set_osc_active(struct obd_device *obd, struct obd_uuid *uuid, CERROR("Unknown event(%d) for uuid %s", ev, uuid->uuid); } - out: +out: lov_tgts_putref(obd); return index; } @@ -925,7 +925,7 @@ int lov_process_config_base(struct obd_device *obd, struct lustre_cfg *lcfg, static int lov_statfs_async(struct obd_export *exp, struct obd_info *oinfo, u64 max_age, struct ptlrpc_request_set *rqset) { - struct obd_device *obd = class_exp2obd(exp); + struct obd_device *obd = class_exp2obd(exp); struct lov_request_set *set; struct lov_request *req; struct lov_obd *lov; @@ -997,7 +997,7 @@ static int lov_iocontrol(unsigned int cmd, struct obd_export *exp, int len, case IOC_OBD_STATFS: { struct obd_ioctl_data *data = karg; struct obd_device *osc_obd; - struct obd_statfs stat_buf = {0}; + struct obd_statfs stat_buf = { 0 }; u32 index; u32 flags; @@ -1281,11 +1281,11 @@ void lov_stripe_unlock(struct lov_stripe_md *md) static int lov_quotactl(struct obd_device *obd, struct obd_export *exp, struct obd_quotactl *oqctl) { - struct lov_obd *lov = &obd->u.lov; + struct lov_obd *lov = &obd->u.lov; struct lov_tgt_desc *tgt; - u64 curspace = 0; - u64 bhardlimit = 0; - int i, rc = 0; + u64 curspace = 0; + u64 bhardlimit = 0; + int i, rc = 0; if (oqctl->qc_cmd != Q_GETOQUOTA && oqctl->qc_cmd != LUSTRE_Q_SETQUOTA) { @@ -1336,10 +1336,9 @@ static int lov_quotactl(struct obd_device *obd, struct obd_export *exp, } static struct obd_ops lov_obd_ops = { - .owner = THIS_MODULE, - .setup = lov_setup, - .cleanup = lov_cleanup, - /*.process_config = lov_process_config,*/ + .owner = THIS_MODULE, + .setup = lov_setup, + .cleanup = lov_cleanup, .connect = lov_connect, .disconnect = lov_disconnect, .statfs = lov_statfs, diff --git a/drivers/staging/lustre/lustre/lov/lov_object.c b/drivers/staging/lustre/lustre/lov/lov_object.c index 72f42fc..397ecc1 100644 --- a/drivers/staging/lustre/lustre/lov/lov_object.c +++ b/drivers/staging/lustre/lustre/lov/lov_object.c @@ -133,7 +133,7 @@ static int lov_init_sub(const struct lu_env *env, struct lov_object *lov, return -EIO; } - hdr = cl_object_header(lov2cl(lov)); + hdr = cl_object_header(lov2cl(lov)); subhdr = cl_object_header(subobj); CDEBUG(D_INODE, @@ -155,7 +155,7 @@ static int lov_init_sub(const struct lu_env *env, struct lov_object *lov, r0->lo_sub[stripe]->lso_index = idx; result = 0; } else { - struct lu_object *old_obj; + struct lu_object *old_obj; struct lov_object *old_lov; unsigned int mask = D_INODE; @@ -392,16 +392,16 @@ static void lov_subobject_kill(const struct lu_env *env, struct lov_object *lov, struct lov_layout_raid0 *r0, struct lovsub_object *los, int idx) { - struct cl_object *sub; - struct lu_site *site; + struct cl_object *sub; + struct lu_site *site; wait_queue_head_t *wq; - wait_queue_entry_t *waiter; + wait_queue_entry_t *waiter; LASSERT(r0->lo_sub[idx] == los); - sub = lovsub2cl(los); + sub = lovsub2cl(los); site = sub->co_lu.lo_dev->ld_site; - wq = lu_site_wq_from_fid(site, &sub->co_lu.lo_header->loh_fid); + wq = lu_site_wq_from_fid(site, &sub->co_lu.lo_header->loh_fid); cl_object_kill(env, sub); /* release a reference to the sub-object and ... */ @@ -570,8 +570,8 @@ static int lov_print_composite(const struct lu_env *env, void *cookie, static int lov_print_released(const struct lu_env *env, void *cookie, lu_printer_t p, const struct lu_object *o) { - struct lov_object *lov = lu2lov(o); - struct lov_stripe_md *lsm = lov->lo_lsm; + struct lov_object *lov = lu2lov(o); + struct lov_stripe_md *lsm = lov->lo_lsm; (*p)(env, cookie, "released: %s, lsm{%p 0x%08X %d %u}:\n", @@ -684,24 +684,24 @@ static int lov_attr_get_composite(const struct lu_env *env, static const struct lov_layout_operations lov_dispatch[] = { [LLT_EMPTY] = { - .llo_init = lov_init_empty, - .llo_delete = lov_delete_empty, - .llo_fini = lov_fini_empty, - .llo_print = lov_print_empty, - .llo_page_init = lov_page_init_empty, - .llo_lock_init = lov_lock_init_empty, - .llo_io_init = lov_io_init_empty, - .llo_getattr = lov_attr_get_empty + .llo_init = lov_init_empty, + .llo_delete = lov_delete_empty, + .llo_fini = lov_fini_empty, + .llo_print = lov_print_empty, + .llo_page_init = lov_page_init_empty, + .llo_lock_init = lov_lock_init_empty, + .llo_io_init = lov_io_init_empty, + .llo_getattr = lov_attr_get_empty }, [LLT_RELEASED] = { - .llo_init = lov_init_released, - .llo_delete = lov_delete_empty, - .llo_fini = lov_fini_released, - .llo_print = lov_print_released, - .llo_page_init = lov_page_init_empty, - .llo_lock_init = lov_lock_init_empty, - .llo_io_init = lov_io_init_released, - .llo_getattr = lov_attr_get_empty + .llo_init = lov_init_released, + .llo_delete = lov_delete_empty, + .llo_fini = lov_fini_released, + .llo_print = lov_print_released, + .llo_page_init = lov_page_init_empty, + .llo_lock_init = lov_lock_init_empty, + .llo_io_init = lov_io_init_released, + .llo_getattr = lov_attr_get_empty }, [LLT_COMP] = { .llo_init = lov_init_composite, @@ -718,14 +718,14 @@ static int lov_attr_get_composite(const struct lu_env *env, /** * Performs a double-dispatch based on the layout type of an object. */ -#define LOV_2DISPATCH_NOLOCK(obj, op, ...) \ -({ \ - struct lov_object *__obj = (obj); \ - enum lov_layout_type __llt; \ - \ - __llt = __obj->lo_type; \ +#define LOV_2DISPATCH_NOLOCK(obj, op, ...) \ +({ \ + struct lov_object *__obj = (obj); \ + enum lov_layout_type __llt; \ + \ + __llt = __obj->lo_type; \ LASSERT(__llt < ARRAY_SIZE(lov_dispatch)); \ - lov_dispatch[__llt].op(__VA_ARGS__); \ + lov_dispatch[__llt].op(__VA_ARGS__); \ }) /** @@ -763,18 +763,18 @@ static inline void lov_conf_thaw(struct lov_object *lov) up_read(&lov->lo_type_guard); } -#define LOV_2DISPATCH_MAYLOCK(obj, op, lock, ...) \ -({ \ - struct lov_object *__obj = (obj); \ - int __lock = !!(lock); \ - typeof(lov_dispatch[0].op(__VA_ARGS__)) __result; \ - \ - if (__lock) \ - lov_conf_freeze(__obj); \ - __result = LOV_2DISPATCH_NOLOCK(obj, op, __VA_ARGS__); \ - if (__lock) \ - lov_conf_thaw(__obj); \ - __result; \ +#define LOV_2DISPATCH_MAYLOCK(obj, op, lock, ...) \ +({ \ + struct lov_object *__obj = (obj); \ + int __lock = !!(lock); \ + typeof(lov_dispatch[0].op(__VA_ARGS__)) __result; \ + \ + if (__lock) \ + lov_conf_freeze(__obj); \ + __result = LOV_2DISPATCH_NOLOCK(obj, op, __VA_ARGS__); \ + if (__lock) \ + lov_conf_thaw(__obj); \ + __result; \ }) /** @@ -783,16 +783,16 @@ static inline void lov_conf_thaw(struct lov_object *lov) #define LOV_2DISPATCH(obj, op, ...) \ LOV_2DISPATCH_MAYLOCK(obj, op, 1, __VA_ARGS__) -#define LOV_2DISPATCH_VOID(obj, op, ...) \ -do { \ - struct lov_object *__obj = (obj); \ - enum lov_layout_type __llt; \ - \ - lov_conf_freeze(__obj); \ - __llt = __obj->lo_type; \ - LASSERT(__llt < ARRAY_SIZE(lov_dispatch)); \ - lov_dispatch[__llt].op(__VA_ARGS__); \ - lov_conf_thaw(__obj); \ +#define LOV_2DISPATCH_VOID(obj, op, ...) \ +do { \ + struct lov_object *__obj = (obj); \ + enum lov_layout_type __llt; \ + \ + lov_conf_freeze(__obj); \ + __llt = __obj->lo_type; \ + LASSERT(__llt < ARRAY_SIZE(lov_dispatch)); \ + lov_dispatch[__llt].op(__VA_ARGS__); \ + lov_conf_thaw(__obj); \ } while (0) static void lov_conf_lock(struct lov_object *lov) @@ -901,10 +901,10 @@ static int lov_layout_change(const struct lu_env *unused, int lov_object_init(const struct lu_env *env, struct lu_object *obj, const struct lu_object_conf *conf) { - struct lov_object *lov = lu2lov(obj); + struct lov_object *lov = lu2lov(obj); struct lov_device *dev = lov_object_dev(lov); - const struct cl_object_conf *cconf = lu2cl_conf(conf); - union lov_layout_state *set = &lov->u; + const struct cl_object_conf *cconf = lu2cl_conf(conf); + union lov_layout_state *set = &lov->u; const struct lov_layout_operations *ops; struct lov_stripe_md *lsm = NULL; int rc; @@ -938,9 +938,9 @@ int lov_object_init(const struct lu_env *env, struct lu_object *obj, static int lov_conf_set(const struct lu_env *env, struct cl_object *obj, const struct cl_object_conf *conf) { - struct lov_stripe_md *lsm = NULL; - struct lov_object *lov = cl2lov(obj); - int result = 0; + struct lov_stripe_md *lsm = NULL; + struct lov_object *lov = cl2lov(obj); + int result = 0; if (conf->coc_opc == OBJECT_CONF_SET && conf->u.coc_layout.lb_buf) { @@ -1662,25 +1662,25 @@ static loff_t lov_object_maxbytes(struct cl_object *obj) } static const struct cl_object_operations lov_ops = { - .coo_page_init = lov_page_init, - .coo_lock_init = lov_lock_init, - .coo_io_init = lov_io_init, - .coo_attr_get = lov_attr_get, - .coo_attr_update = lov_attr_update, - .coo_conf_set = lov_conf_set, - .coo_getstripe = lov_object_getstripe, - .coo_layout_get = lov_object_layout_get, - .coo_maxbytes = lov_object_maxbytes, - .coo_fiemap = lov_object_fiemap, + .coo_page_init = lov_page_init, + .coo_lock_init = lov_lock_init, + .coo_io_init = lov_io_init, + .coo_attr_get = lov_attr_get, + .coo_attr_update = lov_attr_update, + .coo_conf_set = lov_conf_set, + .coo_getstripe = lov_object_getstripe, + .coo_layout_get = lov_object_layout_get, + .coo_maxbytes = lov_object_maxbytes, + .coo_fiemap = lov_object_fiemap, }; static const struct lu_object_operations lov_lu_obj_ops = { - .loo_object_init = lov_object_init, - .loo_object_delete = lov_object_delete, - .loo_object_release = NULL, - .loo_object_free = lov_object_free, - .loo_object_print = lov_object_print, - .loo_object_invariant = NULL + .loo_object_init = lov_object_init, + .loo_object_delete = lov_object_delete, + .loo_object_release = NULL, + .loo_object_free = lov_object_free, + .loo_object_print = lov_object_print, + .loo_object_invariant = NULL }; struct lu_object *lov_object_alloc(const struct lu_env *env, @@ -1688,7 +1688,7 @@ struct lu_object *lov_object_alloc(const struct lu_env *env, struct lu_device *dev) { struct lov_object *lov; - struct lu_object *obj; + struct lu_object *obj; lov = kmem_cache_zalloc(lov_object_kmem, GFP_NOFS); if (lov) { diff --git a/drivers/staging/lustre/lustre/lov/lov_offset.c b/drivers/staging/lustre/lustre/lov/lov_offset.c index ab02c34..26f5066 100644 --- a/drivers/staging/lustre/lustre/lov/lov_offset.c +++ b/drivers/staging/lustre/lustre/lov/lov_offset.c @@ -135,7 +135,7 @@ pgoff_t lov_stripe_pgoff(struct lov_stripe_md *lsm, int index, int lov_stripe_offset(struct lov_stripe_md *lsm, int index, u64 lov_off, int stripeno, u64 *obdoff) { - unsigned long ssize = lsm->lsm_entries[index]->lsme_stripe_size; + unsigned long ssize = lsm->lsm_entries[index]->lsme_stripe_size; u64 stripe_off, this_stripe, swidth; int ret = 0; @@ -188,7 +188,7 @@ int lov_stripe_offset(struct lov_stripe_md *lsm, int index, u64 lov_off, u64 lov_size_to_stripe(struct lov_stripe_md *lsm, int index, u64 file_size, int stripeno) { - unsigned long ssize = lsm->lsm_entries[index]->lsme_stripe_size; + unsigned long ssize = lsm->lsm_entries[index]->lsme_stripe_size; u64 stripe_off, this_stripe, swidth; if (file_size == OBD_OBJECT_EOF) @@ -270,7 +270,7 @@ int lov_stripe_intersects(struct lov_stripe_md *lsm, int index, int stripeno, /* compute which stripe number "lov_off" will be written into */ int lov_stripe_number(struct lov_stripe_md *lsm, int index, u64 lov_off) { - unsigned long ssize = lsm->lsm_entries[index]->lsme_stripe_size; + unsigned long ssize = lsm->lsm_entries[index]->lsme_stripe_size; u64 stripe_off, swidth; swidth = stripe_width(lsm, index); diff --git a/drivers/staging/lustre/lustre/lov/lov_pack.c b/drivers/staging/lustre/lustre/lov/lov_pack.c index fde5160..18ce9f9 100644 --- a/drivers/staging/lustre/lustre/lov/lov_pack.c +++ b/drivers/staging/lustre/lustre/lov/lov_pack.c @@ -52,7 +52,7 @@ void lov_dump_lmm_common(int level, void *lmmp) { struct lov_mds_md *lmm = lmmp; - struct ost_id oi; + struct ost_id oi; lmm_oi_le_to_cpu(&oi, &lmm->lmm_oi); CDEBUG(level, "objid " DOSTID ", magic 0x%08x, pattern %#x\n", @@ -76,7 +76,7 @@ static void lov_dump_lmm_objects(int level, struct lov_ost_data *lod, } for (i = 0; i < stripe_count; ++i, ++lod) { - struct ost_id oi; + struct ost_id oi; ostid_le_to_cpu(&lod->l_ost_oi, &oi); CDEBUG(level, "stripe %u idx %u subobj " DOSTID "\n", i, diff --git a/drivers/staging/lustre/lustre/lov/lov_page.c b/drivers/staging/lustre/lustre/lov/lov_page.c index 90e2981..08485a9 100644 --- a/drivers/staging/lustre/lustre/lov/lov_page.c +++ b/drivers/staging/lustre/lustre/lov/lov_page.c @@ -62,24 +62,24 @@ static int lov_comp_page_print(const struct lu_env *env, } static const struct cl_page_operations lov_comp_page_ops = { - .cpo_print = lov_comp_page_print + .cpo_print = lov_comp_page_print }; int lov_page_init_composite(const struct lu_env *env, struct cl_object *obj, struct cl_page *page, pgoff_t index) { struct lov_object *loo = cl2lov(obj); - struct lov_io *lio = lov_env_io(env); + struct lov_io *lio = lov_env_io(env); struct lov_layout_raid0 *r0; - struct cl_object *subobj; - struct cl_object *o; + struct cl_object *subobj; + struct cl_object *o; struct lov_io_sub *sub; - struct lov_page *lpg = cl_object_page_slice(obj, page); + struct lov_page *lpg = cl_object_page_slice(obj, page); u64 offset; - u64 suboff; - int stripe; + u64 suboff; + int stripe; int entry; - int rc; + int rc; offset = cl_offset(obj, index); entry = lov_lsm_entry(loo->lo_lsm, offset); @@ -127,7 +127,7 @@ static int lov_empty_page_print(const struct lu_env *env, } static const struct cl_page_operations lov_empty_page_ops = { - .cpo_print = lov_empty_page_print + .cpo_print = lov_empty_page_print }; int lov_page_init_empty(const struct lu_env *env, struct cl_object *obj, diff --git a/drivers/staging/lustre/lustre/lov/lov_pool.c b/drivers/staging/lustre/lustre/lov/lov_pool.c index 177f5a5..833fac9 100644 --- a/drivers/staging/lustre/lustre/lov/lov_pool.c +++ b/drivers/staging/lustre/lustre/lov/lov_pool.c @@ -96,9 +96,9 @@ void lov_pool_putref(struct pool_desc *pool) */ #define POOL_IT_MAGIC 0xB001CEA0 struct pool_iterator { - int magic; - struct pool_desc *pool; - int idx; /* from 0 to pool_tgt_size - 1 */ + int magic; + struct pool_desc *pool; + int idx; /* from 0 to pool_tgt_size - 1 */ }; static void *pool_proc_next(struct seq_file *s, void *v, loff_t *pos) @@ -204,10 +204,10 @@ static int pool_proc_show(struct seq_file *s, void *v) } static const struct seq_operations pool_proc_ops = { - .start = pool_proc_start, - .next = pool_proc_next, - .stop = pool_proc_stop, - .show = pool_proc_show, + .start = pool_proc_start, + .next = pool_proc_next, + .stop = pool_proc_stop, + .show = pool_proc_show, }; static int pool_proc_open(struct inode *inode, struct file *file) @@ -224,9 +224,9 @@ static int pool_proc_open(struct inode *inode, struct file *file) } static const struct file_operations pool_proc_operations = { - .open = pool_proc_open, - .read = seq_read, - .llseek = seq_lseek, + .open = pool_proc_open, + .read = seq_read, + .llseek = seq_lseek, .release = seq_release, }; diff --git a/drivers/staging/lustre/lustre/lov/lov_request.c b/drivers/staging/lustre/lustre/lov/lov_request.c index 45dca36..7f591ba 100644 --- a/drivers/staging/lustre/lustre/lov/lov_request.c +++ b/drivers/staging/lustre/lustre/lov/lov_request.c @@ -137,12 +137,12 @@ static int lov_check_and_wait_active(struct lov_obd *lov, int ost_idx) } #define LOV_U64_MAX ((u64)~0ULL) -#define LOV_SUM_MAX(tot, add) \ - do { \ - if ((tot) + (add) < (tot)) \ - (tot) = LOV_U64_MAX; \ - else \ - (tot) += (add); \ +#define LOV_SUM_MAX(tot, add) \ + do { \ + if ((tot) + (add) < (tot)) \ + (tot) = LOV_U64_MAX; \ + else \ + (tot) += (add); \ } while (0) static int lov_fini_statfs(struct obd_device *obd, struct obd_statfs *osfs, diff --git a/drivers/staging/lustre/lustre/lov/lovsub_dev.c b/drivers/staging/lustre/lustre/lov/lovsub_dev.c index 7e89a2e..69380fc 100644 --- a/drivers/staging/lustre/lustre/lov/lovsub_dev.c +++ b/drivers/staging/lustre/lustre/lov/lovsub_dev.c @@ -52,7 +52,7 @@ static int lovsub_device_init(const struct lu_env *env, struct lu_device *d, const char *name, struct lu_device *next) { - struct lovsub_device *lsd = lu2lovsub_dev(d); + struct lovsub_device *lsd = lu2lovsub_dev(d); struct lu_device_type *ldt; int rc; @@ -85,8 +85,8 @@ static struct lu_device *lovsub_device_fini(const struct lu_env *env, static struct lu_device *lovsub_device_free(const struct lu_env *env, struct lu_device *d) { - struct lovsub_device *lsd = lu2lovsub_dev(d); - struct lu_device *next = cl2lu_dev(lsd->acid_next); + struct lovsub_device *lsd = lu2lovsub_dev(d); + struct lu_device *next = cl2lu_dev(lsd->acid_next); if (atomic_read(&d->ld_ref) && d->ld_site) { LIBCFS_DEBUG_MSG_DATA_DECL(msgdata, D_ERROR, NULL); @@ -98,16 +98,16 @@ static struct lu_device *lovsub_device_free(const struct lu_env *env, } static const struct lu_device_operations lovsub_lu_ops = { - .ldo_object_alloc = lovsub_object_alloc, - .ldo_process_config = NULL, - .ldo_recovery_complete = NULL + .ldo_object_alloc = lovsub_object_alloc, + .ldo_process_config = NULL, + .ldo_recovery_complete = NULL }; static struct lu_device *lovsub_device_alloc(const struct lu_env *env, struct lu_device_type *t, struct lustre_cfg *cfg) { - struct lu_device *d; + struct lu_device *d; struct lovsub_device *lsd; lsd = kzalloc(sizeof(*lsd), GFP_NOFS); @@ -117,7 +117,7 @@ static struct lu_device *lovsub_device_alloc(const struct lu_env *env, result = cl_device_init(&lsd->acid_cl, t); if (result == 0) { d = lovsub2lu_dev(lsd); - d->ld_ops = &lovsub_lu_ops; + d->ld_ops = &lovsub_lu_ops; } else { d = ERR_PTR(result); } @@ -128,20 +128,20 @@ static struct lu_device *lovsub_device_alloc(const struct lu_env *env, } static const struct lu_device_type_operations lovsub_device_type_ops = { - .ldto_device_alloc = lovsub_device_alloc, - .ldto_device_free = lovsub_device_free, + .ldto_device_alloc = lovsub_device_alloc, + .ldto_device_free = lovsub_device_free, - .ldto_device_init = lovsub_device_init, - .ldto_device_fini = lovsub_device_fini + .ldto_device_init = lovsub_device_init, + .ldto_device_fini = lovsub_device_fini }; #define LUSTRE_LOVSUB_NAME "lovsub" struct lu_device_type lovsub_device_type = { - .ldt_tags = LU_DEVICE_CL, - .ldt_name = LUSTRE_LOVSUB_NAME, - .ldt_ops = &lovsub_device_type_ops, - .ldt_ctx_tags = LCT_CL_THREAD + .ldt_tags = LU_DEVICE_CL, + .ldt_name = LUSTRE_LOVSUB_NAME, + .ldt_ops = &lovsub_device_type_ops, + .ldt_ctx_tags = LCT_CL_THREAD }; /** @} lov */ diff --git a/drivers/staging/lustre/lustre/lov/lovsub_lock.c b/drivers/staging/lustre/lustre/lov/lovsub_lock.c index ea492be..7b67c92 100644 --- a/drivers/staging/lustre/lustre/lov/lovsub_lock.c +++ b/drivers/staging/lustre/lustre/lov/lovsub_lock.c @@ -52,14 +52,14 @@ static void lovsub_lock_fini(const struct lu_env *env, struct cl_lock_slice *slice) { - struct lovsub_lock *lsl; + struct lovsub_lock *lsl; lsl = cl2lovsub_lock(slice); kmem_cache_free(lovsub_lock_kmem, lsl); } static const struct cl_lock_operations lovsub_lock_ops = { - .clo_fini = lovsub_lock_fini, + .clo_fini = lovsub_lock_fini, }; int lovsub_lock_init(const struct lu_env *env, struct cl_object *obj, diff --git a/drivers/staging/lustre/lustre/lov/lovsub_object.c b/drivers/staging/lustre/lustre/lov/lovsub_object.c index da4b7f1..6ba09f1 100644 --- a/drivers/staging/lustre/lustre/lov/lovsub_object.c +++ b/drivers/staging/lustre/lustre/lov/lovsub_object.c @@ -52,10 +52,9 @@ int lovsub_object_init(const struct lu_env *env, struct lu_object *obj, const struct lu_object_conf *conf) { - struct lovsub_device *dev = lu2lovsub_dev(obj->lo_dev); - struct lu_object *below; - struct lu_device *under; - + struct lovsub_device *dev = lu2lovsub_dev(obj->lo_dev); + struct lu_object *below; + struct lu_device *under; int result; under = &dev->acid_next->cd_lu_dev; @@ -73,7 +72,7 @@ int lovsub_object_init(const struct lu_env *env, struct lu_object *obj, static void lovsub_object_free(const struct lu_env *env, struct lu_object *obj) { struct lovsub_object *los = lu2lovsub(obj); - struct lov_object *lov = los->lso_super; + struct lov_object *lov = los->lso_super; /* We can't assume lov was assigned here, because of the shadow * object handling in lu_object_find. @@ -146,20 +145,20 @@ static void lovsub_req_attr_set(const struct lu_env *env, struct cl_object *obj, } static const struct cl_object_operations lovsub_ops = { - .coo_page_init = lovsub_page_init, - .coo_lock_init = lovsub_lock_init, - .coo_attr_update = lovsub_attr_update, + .coo_page_init = lovsub_page_init, + .coo_lock_init = lovsub_lock_init, + .coo_attr_update = lovsub_attr_update, .coo_glimpse = lovsub_object_glimpse, .coo_req_attr_set = lovsub_req_attr_set }; static const struct lu_object_operations lovsub_lu_obj_ops = { - .loo_object_init = lovsub_object_init, - .loo_object_delete = NULL, - .loo_object_release = NULL, - .loo_object_free = lovsub_object_free, - .loo_object_print = lovsub_object_print, - .loo_object_invariant = NULL + .loo_object_init = lovsub_object_init, + .loo_object_delete = NULL, + .loo_object_release = NULL, + .loo_object_free = lovsub_object_free, + .loo_object_print = lovsub_object_print, + .loo_object_invariant = NULL }; struct lu_object *lovsub_object_alloc(const struct lu_env *env, @@ -167,7 +166,7 @@ struct lu_object *lovsub_object_alloc(const struct lu_env *env, struct lu_device *dev) { struct lovsub_object *los; - struct lu_object *obj; + struct lu_object *obj; los = kmem_cache_zalloc(lovsub_object_kmem, GFP_NOFS); if (los) { diff --git a/drivers/staging/lustre/lustre/lov/lovsub_page.c b/drivers/staging/lustre/lustre/lov/lovsub_page.c index 915520b..a8aa583 100644 --- a/drivers/staging/lustre/lustre/lov/lovsub_page.c +++ b/drivers/staging/lustre/lustre/lov/lovsub_page.c @@ -53,7 +53,7 @@ static void lovsub_page_fini(const struct lu_env *env, } static const struct cl_page_operations lovsub_page_ops = { - .cpo_fini = lovsub_page_fini + .cpo_fini = lovsub_page_fini }; int lovsub_page_init(const struct lu_env *env, struct cl_object *obj, diff --git a/drivers/staging/lustre/lustre/lov/lproc_lov.c b/drivers/staging/lustre/lustre/lov/lproc_lov.c index 771c6f8..fc53f23 100644 --- a/drivers/staging/lustre/lustre/lov/lproc_lov.c +++ b/drivers/staging/lustre/lustre/lov/lproc_lov.c @@ -239,10 +239,10 @@ static int lov_tgt_seq_show(struct seq_file *p, void *v) } static const struct seq_operations lov_tgt_sops = { - .start = lov_tgt_seq_start, - .stop = lov_tgt_seq_stop, - .next = lov_tgt_seq_next, - .show = lov_tgt_seq_show, + .start = lov_tgt_seq_start, + .stop = lov_tgt_seq_stop, + .next = lov_tgt_seq_next, + .show = lov_tgt_seq_show, }; static int lov_target_seq_open(struct inode *inode, struct file *file) @@ -260,11 +260,11 @@ static int lov_target_seq_open(struct inode *inode, struct file *file) } static const struct file_operations lov_debugfs_target_fops = { - .owner = THIS_MODULE, - .open = lov_target_seq_open, - .read = seq_read, - .llseek = seq_lseek, - .release = lprocfs_seq_release, + .owner = THIS_MODULE, + .open = lov_target_seq_open, + .read = seq_read, + .llseek = seq_lseek, + .release = lprocfs_seq_release, }; static struct attribute *lov_attrs[] = { -- 1.8.3.1 From jsimmons at infradead.org Thu Jan 31 17:19:21 2019 From: jsimmons at infradead.org (James Simmons) Date: Thu, 31 Jan 2019 12:19:21 -0500 Subject: [lustre-devel] [PATCH 17/26] obdecho: cleanup white spaces In-Reply-To: <1548955170-13456-1-git-send-email-jsimmons@infradead.org> References: <1548955170-13456-1-git-send-email-jsimmons@infradead.org> Message-ID: <1548955170-13456-18-git-send-email-jsimmons@infradead.org> The obdecho code is very messy and difficult to read. Remove excess white space and properly align data structures so they are easy on the eyes. Signed-off-by: James Simmons --- .../staging/lustre/lustre/obdecho/echo_client.c | 280 ++++++++++----------- .../staging/lustre/lustre/obdecho/echo_internal.h | 4 +- 2 files changed, 142 insertions(+), 142 deletions(-) diff --git a/drivers/staging/lustre/lustre/obdecho/echo_client.c b/drivers/staging/lustre/lustre/obdecho/echo_client.c index 4f9dbc4..1ebd985 100644 --- a/drivers/staging/lustre/lustre/obdecho/echo_client.c +++ b/drivers/staging/lustre/lustre/obdecho/echo_client.c @@ -52,41 +52,41 @@ */ struct echo_device { - struct cl_device ed_cl; - struct echo_client_obd *ed_ec; + struct cl_device ed_cl; + struct echo_client_obd *ed_ec; - struct cl_site ed_site_myself; - struct lu_site *ed_site; - struct lu_device *ed_next; + struct cl_site ed_site_myself; + struct lu_site *ed_site; + struct lu_device *ed_next; }; struct echo_object { - struct cl_object eo_cl; - struct cl_object_header eo_hdr; - - struct echo_device *eo_dev; - struct list_head eo_obj_chain; - struct lov_oinfo *eo_oinfo; - atomic_t eo_npages; - int eo_deleted; + struct cl_object eo_cl; + struct cl_object_header eo_hdr; + + struct echo_device *eo_dev; + struct list_head eo_obj_chain; + struct lov_oinfo *eo_oinfo; + atomic_t eo_npages; + int eo_deleted; }; struct echo_object_conf { - struct cl_object_conf eoc_cl; - struct lov_oinfo **eoc_oinfo; + struct cl_object_conf eoc_cl; + struct lov_oinfo **eoc_oinfo; }; struct echo_page { - struct cl_page_slice ep_cl; - unsigned long ep_lock; + struct cl_page_slice ep_cl; + unsigned long ep_lock; }; struct echo_lock { - struct cl_lock_slice el_cl; - struct list_head el_chain; - struct echo_object *el_object; - u64 el_cookie; - atomic_t el_refcount; + struct cl_lock_slice el_cl; + struct list_head el_chain; + struct echo_object *el_object; + u64 el_cookie; + atomic_t el_refcount; }; static int echo_client_setup(const struct lu_env *env, @@ -159,19 +159,19 @@ static int cl_echo_object_brw(struct echo_object *eco, int rw, u64 offset, struct page **pages, int npages, int async); struct echo_thread_info { - struct echo_object_conf eti_conf; - struct lustre_md eti_md; - - struct cl_2queue eti_queue; - struct cl_io eti_io; - struct cl_lock eti_lock; - struct lu_fid eti_fid; - struct lu_fid eti_fid2; + struct echo_object_conf eti_conf; + struct lustre_md eti_md; + + struct cl_2queue eti_queue; + struct cl_io eti_io; + struct cl_lock eti_lock; + struct lu_fid eti_fid; + struct lu_fid eti_fid2; }; /* No session used right now */ struct echo_session_info { - unsigned long dummy; + unsigned long dummy; }; static struct kmem_cache *echo_lock_kmem; @@ -288,20 +288,20 @@ static int echo_page_print(const struct lu_env *env, } static const struct cl_page_operations echo_page_ops = { - .cpo_own = echo_page_own, - .cpo_disown = echo_page_disown, - .cpo_discard = echo_page_discard, - .cpo_fini = echo_page_fini, - .cpo_print = echo_page_print, - .cpo_is_vmlocked = echo_page_is_vmlocked, + .cpo_own = echo_page_own, + .cpo_disown = echo_page_disown, + .cpo_discard = echo_page_discard, + .cpo_fini = echo_page_fini, + .cpo_print = echo_page_print, + .cpo_is_vmlocked = echo_page_is_vmlocked, .io = { [CRT_READ] = { .cpo_prep = echo_page_prep, - .cpo_completion = echo_page_completion, + .cpo_completion = echo_page_completion, }, [CRT_WRITE] = { .cpo_prep = echo_page_prep, - .cpo_completion = echo_page_completion, + .cpo_completion = echo_page_completion, } } }; @@ -324,7 +324,7 @@ static void echo_lock_fini(const struct lu_env *env, } static const struct cl_lock_operations echo_lock_ops = { - .clo_fini = echo_lock_fini, + .clo_fini = echo_lock_fini, }; /** @} echo_lock */ @@ -383,10 +383,10 @@ static int echo_conf_set(const struct lu_env *env, struct cl_object *obj, } static const struct cl_object_operations echo_cl_obj_ops = { - .coo_page_init = echo_page_init, - .coo_lock_init = echo_lock_init, - .coo_io_init = echo_io_init, - .coo_conf_set = echo_conf_set + .coo_page_init = echo_page_init, + .coo_lock_init = echo_lock_init, + .coo_io_init = echo_io_init, + .coo_conf_set = echo_conf_set }; /** @} echo_cl_ops */ @@ -400,15 +400,15 @@ static int echo_conf_set(const struct lu_env *env, struct cl_object *obj, static int echo_object_init(const struct lu_env *env, struct lu_object *obj, const struct lu_object_conf *conf) { - struct echo_device *ed = cl2echo_dev(lu2cl_dev(obj->lo_dev)); - struct echo_client_obd *ec = ed->ed_ec; + struct echo_device *ed = cl2echo_dev(lu2cl_dev(obj->lo_dev)); + struct echo_client_obd *ec = ed->ed_ec; struct echo_object *eco = cl2echo_obj(lu2cl(obj)); const struct cl_object_conf *cconf; struct echo_object_conf *econf; if (ed->ed_next) { - struct lu_object *below; - struct lu_device *under; + struct lu_object *below; + struct lu_device *under; under = ed->ed_next; below = under->ld_ops->ldo_object_alloc(env, obj->lo_header, @@ -442,7 +442,7 @@ static int echo_object_init(const struct lu_env *env, struct lu_object *obj, static void echo_object_free(const struct lu_env *env, struct lu_object *obj) { - struct echo_object *eco = cl2echo_obj(lu2cl(obj)); + struct echo_object *eco = cl2echo_obj(lu2cl(obj)); struct echo_client_obd *ec = eco->eo_dev->ed_ec; LASSERT(atomic_read(&eco->eo_npages) == 0); @@ -467,12 +467,12 @@ static int echo_object_print(const struct lu_env *env, void *cookie, } static const struct lu_object_operations echo_lu_obj_ops = { - .loo_object_init = echo_object_init, - .loo_object_delete = NULL, - .loo_object_release = NULL, - .loo_object_free = echo_object_free, - .loo_object_print = echo_object_print, - .loo_object_invariant = NULL + .loo_object_init = echo_object_init, + .loo_object_delete = NULL, + .loo_object_release = NULL, + .loo_object_free = echo_object_free, + .loo_object_print = echo_object_print, + .loo_object_invariant = NULL }; /** @} echo_lu_ops */ @@ -504,13 +504,13 @@ static struct lu_object *echo_object_alloc(const struct lu_env *env, lu_object_add_top(&hdr->coh_lu, obj); eco->eo_cl.co_ops = &echo_cl_obj_ops; - obj->lo_ops = &echo_lu_obj_ops; + obj->lo_ops = &echo_lu_obj_ops; } return obj; } static const struct lu_device_operations echo_device_lu_ops = { - .ldo_object_alloc = echo_object_alloc, + .ldo_object_alloc = echo_object_alloc, }; /** @} echo_lu_dev_ops */ @@ -571,9 +571,9 @@ static void echo_thread_key_fini(const struct lu_context *ctx, } static struct lu_context_key echo_thread_key = { - .lct_tags = LCT_CL_THREAD, - .lct_init = echo_thread_key_init, - .lct_fini = echo_thread_key_fini, + .lct_tags = LCT_CL_THREAD, + .lct_init = echo_thread_key_init, + .lct_fini = echo_thread_key_fini, }; static void *echo_session_key_init(const struct lu_context *ctx, @@ -596,9 +596,9 @@ static void echo_session_key_fini(const struct lu_context *ctx, } static struct lu_context_key echo_session_key = { - .lct_tags = LCT_SESSION, - .lct_init = echo_session_key_init, - .lct_fini = echo_session_key_fini, + .lct_tags = LCT_SESSION, + .lct_init = echo_session_key_init, + .lct_fini = echo_session_key_fini, }; LU_TYPE_INIT_FINI(echo, &echo_thread_key, &echo_session_key); @@ -607,11 +607,11 @@ static struct lu_device *echo_device_alloc(const struct lu_env *env, struct lu_device_type *t, struct lustre_cfg *cfg) { - struct lu_device *next; + struct lu_device *next; struct echo_device *ed; - struct cl_device *cd; - struct obd_device *obd = NULL; /* to keep compiler happy */ - struct obd_device *tgt; + struct cl_device *cd; + struct obd_device *obd = NULL; /* to keep compiler happy */ + struct obd_device *tgt; const char *tgt_type_name; int rc, err; @@ -729,10 +729,10 @@ static void echo_lock_release(const struct lu_env *env, static struct lu_device *echo_device_free(const struct lu_env *env, struct lu_device *d) { - struct echo_device *ed = cl2echo_dev(lu2cl_dev(d)); - struct echo_client_obd *ec = ed->ed_ec; - struct echo_object *eco; - struct lu_device *next = ed->ed_next; + struct echo_device *ed = cl2echo_dev(lu2cl_dev(d)); + struct echo_client_obd *ec = ed->ed_ec; + struct echo_object *eco; + struct lu_device *next = ed->ed_next; CDEBUG(D_INFO, "echo device:%p is going to be freed, next = %p\n", ed, next); @@ -786,23 +786,23 @@ static struct lu_device *echo_device_free(const struct lu_env *env, } static const struct lu_device_type_operations echo_device_type_ops = { - .ldto_init = echo_type_init, - .ldto_fini = echo_type_fini, + .ldto_init = echo_type_init, + .ldto_fini = echo_type_fini, - .ldto_start = echo_type_start, - .ldto_stop = echo_type_stop, + .ldto_start = echo_type_start, + .ldto_stop = echo_type_stop, - .ldto_device_alloc = echo_device_alloc, - .ldto_device_free = echo_device_free, - .ldto_device_init = echo_device_init, - .ldto_device_fini = echo_device_fini + .ldto_device_alloc = echo_device_alloc, + .ldto_device_free = echo_device_free, + .ldto_device_init = echo_device_init, + .ldto_device_fini = echo_device_fini }; static struct lu_device_type echo_device_type = { - .ldt_tags = LU_DEVICE_CL, - .ldt_name = LUSTRE_ECHO_CLIENT_NAME, - .ldt_ops = &echo_device_type_ops, - .ldt_ctx_tags = LCT_CL_THREAD, + .ldt_tags = LU_DEVICE_CL, + .ldt_name = LUSTRE_ECHO_CLIENT_NAME, + .ldt_ops = &echo_device_type_ops, + .ldt_ctx_tags = LCT_CL_THREAD, }; /** @} echo_init */ @@ -823,7 +823,7 @@ static struct lu_device *echo_device_free(const struct lu_env *env, struct echo_object_conf *conf; struct lov_oinfo *oinfo = NULL; struct echo_object *eco; - struct cl_object *obj; + struct cl_object *obj; struct lu_fid *fid; u16 refcheck; int rc; @@ -858,7 +858,7 @@ static struct lu_device *echo_device_free(const struct lu_env *env, */ conf->eoc_oinfo = &oinfo; - fid = &info->eti_fid; + fid = &info->eti_fid; rc = ostid_to_fid(fid, (struct ost_id *)oi, 0); if (rc != 0) { eco = ERR_PTR(rc); @@ -928,10 +928,10 @@ static int __cl_echo_enqueue(struct lu_env *env, struct echo_object *eco, memset(lck, 0, sizeof(*lck)); descr = &lck->cll_descr; - descr->cld_obj = obj; + descr->cld_obj = obj; descr->cld_start = cl_index(obj, start); - descr->cld_end = cl_index(obj, end); - descr->cld_mode = mode == LCK_PW ? CLM_WRITE : CLM_READ; + descr->cld_end = cl_index(obj, end); + descr->cld_mode = mode == LCK_PW ? CLM_WRITE : CLM_READ; descr->cld_enq_flags = enqflags; io->ci_obj = obj; @@ -957,7 +957,7 @@ static int __cl_echo_cancel(struct lu_env *env, struct echo_device *ed, u64 cookie) { struct echo_client_obd *ec = ed->ed_ec; - struct echo_lock *ecl = NULL; + struct echo_lock *ecl = NULL; int found = 0, still_used = 0; spin_lock(&ec->ec_lock); @@ -997,14 +997,14 @@ static void echo_commit_callback(const struct lu_env *env, struct cl_io *io, static int cl_echo_object_brw(struct echo_object *eco, int rw, u64 offset, struct page **pages, int npages, int async) { - struct lu_env *env; + struct lu_env *env; struct echo_thread_info *info; - struct cl_object *obj = echo_obj2cl(eco); - struct echo_device *ed = eco->eo_dev; - struct cl_2queue *queue; - struct cl_io *io; - struct cl_page *clp; - struct lustre_handle lh = { 0 }; + struct cl_object *obj = echo_obj2cl(eco); + struct echo_device *ed = eco->eo_dev; + struct cl_2queue *queue; + struct cl_io *io; + struct cl_page *clp; + struct lustre_handle lh = { 0 }; size_t page_size = cl_page_size(obj); u16 refcheck; int rc; @@ -1016,9 +1016,9 @@ static int cl_echo_object_brw(struct echo_object *eco, int rw, u64 offset, if (IS_ERR(env)) return PTR_ERR(env); - info = echo_env_info(env); - io = &info->eti_io; - queue = &info->eti_queue; + info = echo_env_info(env); + io = &info->eti_io; + queue = &info->eti_queue; cl_2queue_init(queue); @@ -1097,10 +1097,10 @@ static int cl_echo_object_brw(struct echo_object *eco, int rw, u64 offset, static int echo_create_object(const struct lu_env *env, struct echo_device *ed, struct obdo *oa) { - struct echo_object *eco; + struct echo_object *eco; struct echo_client_obd *ec = ed->ed_ec; - int rc; - int created = 0; + int rc; + int created = 0; if (!(oa->o_valid & OBD_MD_FLID) || !(oa->o_valid & OBD_MD_FLGROUP) || @@ -1133,7 +1133,7 @@ static int echo_create_object(const struct lu_env *env, struct echo_device *ed, CDEBUG(D_INFO, "oa oid " DOSTID "\n", POSTID(&oa->o_oi)); - failed: +failed: if (created && rc) obd_destroy(env, ec->ec_exp, oa); if (rc) @@ -1144,8 +1144,8 @@ static int echo_create_object(const struct lu_env *env, struct echo_device *ed, static int echo_get_object(struct echo_object **ecop, struct echo_device *ed, struct obdo *oa) { - struct echo_object *eco; - int rc; + struct echo_object *eco; + int rc; if (!(oa->o_valid & OBD_MD_FLID) || !(oa->o_valid & OBD_MD_FLGROUP) || !ostid_id(&oa->o_oi)) { @@ -1176,10 +1176,10 @@ static void echo_put_object(struct echo_object *eco) echo_client_page_debug_setup(struct page *page, int rw, u64 id, u64 offset, u64 count) { - char *addr; - u64 stripe_off; - u64 stripe_id; - int delta; + char *addr; + u64 stripe_off; + u64 stripe_id; + int delta; /* no partial pages on the client */ LASSERT(count == PAGE_SIZE); @@ -1204,12 +1204,12 @@ static void echo_put_object(struct echo_object *eco) static int echo_client_page_debug_check(struct page *page, u64 id, u64 offset, u64 count) { - u64 stripe_off; - u64 stripe_id; - char *addr; - int delta; - int rc; - int rc2; + u64 stripe_off; + u64 stripe_id; + char *addr; + int delta; + int rc; + int rc2; /* no partial pages on the client */ LASSERT(count == PAGE_SIZE); @@ -1237,16 +1237,16 @@ static int echo_client_kbrw(struct echo_device *ed, int rw, struct obdo *oa, struct echo_object *eco, u64 offset, u64 count, int async) { - u32 npages; + u32 npages; struct brw_page *pga; struct brw_page *pgp; - struct page **pages; - u64 off; - int i; - int rc; - int verify; - gfp_t gfp_mask; - int brw_flags = 0; + struct page **pages; + u64 off; + int i; + int rc; + int verify; + gfp_t gfp_mask; + int brw_flags = 0; verify = (ostid_id(&oa->o_oi) != ECHO_PERSISTENT_OBJID && (oa->o_valid & OBD_MD_FLFLAGS) != 0 && @@ -1301,7 +1301,7 @@ static int echo_client_kbrw(struct echo_device *ed, int rw, struct obdo *oa, LASSERT(ed->ed_next); rc = cl_echo_object_brw(eco, rw, offset, pages, npages, async); - out: +out: if (rc != 0 || rw != OBD_BRW_READ) verify = 0; @@ -1474,16 +1474,16 @@ static int echo_client_brw_ioctl(const struct lu_env *env, int rw, echo_client_iocontrol(unsigned int cmd, struct obd_export *exp, int len, void *karg, void __user *uarg) { - struct obd_device *obd = exp->exp_obd; - struct echo_device *ed = obd2echo_dev(obd); + struct obd_device *obd = exp->exp_obd; + struct echo_device *ed = obd2echo_dev(obd); struct echo_client_obd *ec = ed->ed_ec; - struct echo_object *eco; - struct obd_ioctl_data *data = karg; - struct lu_env *env; - struct obdo *oa; - struct lu_fid fid; - int rw = OBD_BRW_READ; - int rc = 0; + struct echo_object *eco; + struct obd_ioctl_data *data = karg; + struct lu_env *env; + struct obdo *oa; + struct lu_fid fid; + int rw = OBD_BRW_READ; + int rc = 0; oa = &data->ioc_obdo1; if (!(oa->o_valid & OBD_MD_FLGROUP)) { @@ -1652,7 +1652,7 @@ static int echo_client_connect(const struct lu_env *env, struct obd_device *src, struct obd_uuid *cluuid, struct obd_connect_data *data, void *localdata) { - int rc; + int rc; struct lustre_handle conn = { 0 }; rc = class_connect(&conn, src, cluuid); @@ -1664,7 +1664,7 @@ static int echo_client_connect(const struct lu_env *env, static int echo_client_disconnect(struct obd_export *exp) { - int rc; + int rc; if (!exp) { rc = -EINVAL; @@ -1673,15 +1673,15 @@ static int echo_client_disconnect(struct obd_export *exp) rc = class_disconnect(exp); goto out; - out: +out: return rc; } static struct obd_ops echo_client_obd_ops = { - .owner = THIS_MODULE, - .iocontrol = echo_client_iocontrol, - .connect = echo_client_connect, - .disconnect = echo_client_disconnect + .owner = THIS_MODULE, + .iocontrol = echo_client_iocontrol, + .connect = echo_client_connect, + .disconnect = echo_client_disconnect }; static int echo_client_init(void) diff --git a/drivers/staging/lustre/lustre/obdecho/echo_internal.h b/drivers/staging/lustre/lustre/obdecho/echo_internal.h index ac7a209..8094a94 100644 --- a/drivers/staging/lustre/lustre/obdecho/echo_internal.h +++ b/drivers/staging/lustre/lustre/obdecho/echo_internal.h @@ -33,8 +33,8 @@ #define _ECHO_INTERNAL_H /* The persistent object (i.e. actually stores stuff!) */ -#define ECHO_PERSISTENT_OBJID 1ULL -#define ECHO_PERSISTENT_SIZE ((u64)(1 << 20)) +#define ECHO_PERSISTENT_OBJID 1ULL +#define ECHO_PERSISTENT_SIZE ((u64)(1 << 20)) /* block size to use for data verification */ #define OBD_ECHO_BLOCK_SIZE (4 << 10) -- 1.8.3.1 From jsimmons at infradead.org Thu Jan 31 17:19:12 2019 From: jsimmons at infradead.org (James Simmons) Date: Thu, 31 Jan 2019 12:19:12 -0500 Subject: [lustre-devel] [PATCH 08/26] lustre: convert remaining code to kernel types In-Reply-To: <1548955170-13456-1-git-send-email-jsimmons@infradead.org> References: <1548955170-13456-1-git-send-email-jsimmons@infradead.org> Message-ID: <1548955170-13456-9-git-send-email-jsimmons@infradead.org> Convert the remaining Lustre kernel code to use the proper kernel types. Signed-off-by: James Simmons --- drivers/staging/lustre/lustre/fid/fid_lib.c | 2 +- drivers/staging/lustre/lustre/fid/fid_request.c | 4 +- drivers/staging/lustre/lustre/fid/lproc_fid.c | 4 +- drivers/staging/lustre/lustre/fld/fld_cache.c | 4 +- drivers/staging/lustre/lustre/fld/fld_internal.h | 12 ++-- drivers/staging/lustre/lustre/fld/fld_request.c | 8 +-- drivers/staging/lustre/lustre/llite/dir.c | 30 ++++----- drivers/staging/lustre/lustre/llite/file.c | 46 +++++++------- drivers/staging/lustre/lustre/llite/lcommon_misc.c | 4 +- .../staging/lustre/lustre/llite/llite_internal.h | 74 +++++++++++----------- drivers/staging/lustre/lustre/llite/llite_lib.c | 12 ++-- drivers/staging/lustre/lustre/llite/llite_mmap.c | 2 +- drivers/staging/lustre/lustre/llite/llite_nfs.c | 12 ++-- drivers/staging/lustre/lustre/llite/lproc_llite.c | 6 +- drivers/staging/lustre/lustre/llite/namei.c | 16 ++--- drivers/staging/lustre/lustre/llite/range_lock.c | 4 +- drivers/staging/lustre/lustre/llite/range_lock.h | 10 +-- drivers/staging/lustre/lustre/llite/rw.c | 10 +-- drivers/staging/lustre/lustre/llite/statahead.c | 26 ++++---- drivers/staging/lustre/lustre/llite/vvp_internal.h | 2 +- drivers/staging/lustre/lustre/llite/vvp_io.c | 12 ++-- drivers/staging/lustre/lustre/llite/xattr_cache.c | 6 +- drivers/staging/lustre/lustre/lmv/lmv_intent.c | 8 +-- drivers/staging/lustre/lustre/lmv/lmv_internal.h | 2 +- drivers/staging/lustre/lustre/lmv/lmv_obd.c | 50 +++++++-------- .../staging/lustre/lustre/lov/lov_cl_internal.h | 4 +- drivers/staging/lustre/lustre/lov/lov_dev.c | 10 +-- drivers/staging/lustre/lustre/lov/lov_internal.h | 20 +++--- drivers/staging/lustre/lustre/lov/lov_merge.c | 8 +-- drivers/staging/lustre/lustre/lov/lov_obd.c | 46 +++++++------- drivers/staging/lustre/lustre/lov/lov_pack.c | 2 +- drivers/staging/lustre/lustre/lov/lov_pool.c | 4 +- drivers/staging/lustre/lustre/lov/lov_request.c | 4 +- drivers/staging/lustre/lustre/mdc/mdc_internal.h | 24 +++---- drivers/staging/lustre/lustre/mdc/mdc_lib.c | 22 +++---- drivers/staging/lustre/lustre/mdc/mdc_locks.c | 20 +++--- drivers/staging/lustre/lustre/mdc/mdc_reint.c | 6 +- drivers/staging/lustre/lustre/mdc/mdc_request.c | 42 ++++++------ drivers/staging/lustre/lustre/mgc/mgc_request.c | 16 ++--- .../staging/lustre/lustre/obdecho/echo_client.c | 6 +- .../staging/lustre/lustre/obdecho/echo_internal.h | 2 +- drivers/staging/lustre/lustre/osc/osc_cache.c | 10 +-- .../staging/lustre/lustre/osc/osc_cl_internal.h | 2 +- drivers/staging/lustre/lustre/osc/osc_internal.h | 6 +- drivers/staging/lustre/lustre/osc/osc_io.c | 10 +-- drivers/staging/lustre/lustre/osc/osc_lock.c | 12 ++-- drivers/staging/lustre/lustre/osc/osc_object.c | 2 +- drivers/staging/lustre/lustre/osc/osc_request.c | 38 +++++------ 48 files changed, 341 insertions(+), 341 deletions(-) diff --git a/drivers/staging/lustre/lustre/fid/fid_lib.c b/drivers/staging/lustre/lustre/fid/fid_lib.c index ac52b37..6b06847 100644 --- a/drivers/staging/lustre/lustre/fid/fid_lib.c +++ b/drivers/staging/lustre/lustre/fid/fid_lib.c @@ -60,7 +60,7 @@ */ const struct lu_seq_range LUSTRE_SEQ_SPACE_RANGE = { .lsr_start = FID_SEQ_NORMAL, - .lsr_end = (__u64)~0ULL, + .lsr_end = (u64)~0ULL, }; /* Zero range, used for init and other purposes. */ diff --git a/drivers/staging/lustre/lustre/fid/fid_request.c b/drivers/staging/lustre/lustre/fid/fid_request.c index f91242c..3f79f22 100644 --- a/drivers/staging/lustre/lustre/fid/fid_request.c +++ b/drivers/staging/lustre/lustre/fid/fid_request.c @@ -52,13 +52,13 @@ static struct dentry *seq_debugfs_dir; static int seq_client_rpc(struct lu_client_seq *seq, - struct lu_seq_range *output, __u32 opc, + struct lu_seq_range *output, u32 opc, const char *opcname) { struct obd_export *exp = seq->lcs_exp; struct ptlrpc_request *req; struct lu_seq_range *out, *in; - __u32 *op; + u32 *op; unsigned int debug_mask; int rc; diff --git a/drivers/staging/lustre/lustre/fid/lproc_fid.c b/drivers/staging/lustre/lustre/fid/lproc_fid.c index aa2df68..d583778 100644 --- a/drivers/staging/lustre/lustre/fid/lproc_fid.c +++ b/drivers/staging/lustre/lustre/fid/lproc_fid.c @@ -50,7 +50,7 @@ #include "fid_internal.h" /* Format: [0x64BIT_INT - 0x64BIT_INT] + 32 bytes just in case */ -#define MAX_FID_RANGE_STRLEN (32 + 2 * 2 * sizeof(__u64)) +#define MAX_FID_RANGE_STRLEN (32 + 2 * 2 * sizeof(u64)) /* * Note: this function is only used for testing, it is no safe for production * use. @@ -143,7 +143,7 @@ size_t count, loff_t *off) { struct lu_client_seq *seq; - __u64 max; + u64 max; int rc, val; seq = ((struct seq_file *)file->private_data)->private; diff --git a/drivers/staging/lustre/lustre/fld/fld_cache.c b/drivers/staging/lustre/lustre/fld/fld_cache.c index a7415c9..749d33b 100644 --- a/drivers/staging/lustre/lustre/fld/fld_cache.c +++ b/drivers/staging/lustre/lustre/fld/fld_cache.c @@ -94,7 +94,7 @@ struct fld_cache *fld_cache_init(const char *name, */ void fld_cache_fini(struct fld_cache *cache) { - __u64 pct; + u64 pct; LASSERT(cache); fld_cache_flush(cache); @@ -383,7 +383,7 @@ static int fld_cache_insert_nolock(struct fld_cache *cache, struct list_head *prev = NULL; const u64 new_start = f_new->fce_range.lsr_start; const u64 new_end = f_new->fce_range.lsr_end; - __u32 new_flags = f_new->fce_range.lsr_flags; + u32 new_flags = f_new->fce_range.lsr_flags; /* * Duplicate entries are eliminated in insert op. diff --git a/drivers/staging/lustre/lustre/fld/fld_internal.h b/drivers/staging/lustre/lustre/fld/fld_internal.h index e1d6aaa..66a0fb6 100644 --- a/drivers/staging/lustre/lustre/fld/fld_internal.h +++ b/drivers/staging/lustre/lustre/fld/fld_internal.h @@ -63,15 +63,15 @@ #include struct fld_stats { - __u64 fst_count; - __u64 fst_cache; - __u64 fst_inflight; + u64 fst_count; + u64 fst_cache; + u64 fst_inflight; }; struct lu_fld_hash { const char *fh_name; - int (*fh_hash_func)(struct lu_client_fld *, __u64); - struct lu_fld_target *(*fh_scan_func)(struct lu_client_fld *, __u64); + int (*fh_hash_func)(struct lu_client_fld *, u64); + struct lu_fld_target *(*fh_scan_func)(struct lu_client_fld *, u64); }; struct fld_cache_entry { @@ -130,7 +130,7 @@ enum { extern struct lu_fld_hash fld_hash[]; int fld_client_rpc(struct obd_export *exp, - struct lu_seq_range *range, __u32 fld_op, + struct lu_seq_range *range, u32 fld_op, struct ptlrpc_request **reqp); extern struct lprocfs_vars fld_client_debugfs_list[]; diff --git a/drivers/staging/lustre/lustre/fld/fld_request.c b/drivers/staging/lustre/lustre/fld/fld_request.c index 7b0365b..8a915b9 100644 --- a/drivers/staging/lustre/lustre/fld/fld_request.c +++ b/drivers/staging/lustre/lustre/fld/fld_request.c @@ -193,7 +193,7 @@ int fld_client_add_target(struct lu_client_fld *fld, EXPORT_SYMBOL(fld_client_add_target); /* Remove export from FLD */ -int fld_client_del_target(struct lu_client_fld *fld, __u64 idx) +int fld_client_del_target(struct lu_client_fld *fld, u64 idx) { struct lu_fld_target *target, *tmp; @@ -303,12 +303,12 @@ void fld_client_fini(struct lu_client_fld *fld) EXPORT_SYMBOL(fld_client_fini); int fld_client_rpc(struct obd_export *exp, - struct lu_seq_range *range, __u32 fld_op, + struct lu_seq_range *range, u32 fld_op, struct ptlrpc_request **reqp) { struct ptlrpc_request *req = NULL; struct lu_seq_range *prange; - __u32 *op; + u32 *op; int rc = 0; struct obd_import *imp; @@ -383,7 +383,7 @@ int fld_client_rpc(struct obd_export *exp, } int fld_client_lookup(struct lu_client_fld *fld, u64 seq, u32 *mds, - __u32 flags, const struct lu_env *env) + u32 flags, const struct lu_env *env) { struct lu_seq_range res = { 0 }; struct lu_fld_target *target; diff --git a/drivers/staging/lustre/lustre/llite/dir.c b/drivers/staging/lustre/lustre/llite/dir.c index 2459f5c..4520344 100644 --- a/drivers/staging/lustre/lustre/llite/dir.c +++ b/drivers/staging/lustre/lustre/llite/dir.c @@ -138,7 +138,7 @@ * */ struct page *ll_get_dir_page(struct inode *dir, struct md_op_data *op_data, - __u64 offset) + u64 offset) { struct md_callback cb_op; struct page *page; @@ -180,9 +180,9 @@ void ll_release_page(struct inode *inode, struct page *page, bool remove) * IF_* flag shld be converted to particular OS file type in * platform llite module. */ -static __u16 ll_dirent_type_get(struct lu_dirent *ent) +static u16 ll_dirent_type_get(struct lu_dirent *ent) { - __u16 type = 0; + u16 type = 0; struct luda_type *lt; int len = 0; @@ -197,11 +197,11 @@ static __u16 ll_dirent_type_get(struct lu_dirent *ent) return type; } -int ll_dir_read(struct inode *inode, __u64 *ppos, struct md_op_data *op_data, +int ll_dir_read(struct inode *inode, u64 *ppos, struct md_op_data *op_data, struct dir_context *ctx) { struct ll_sb_info *sbi = ll_i2sbi(inode); - __u64 pos = *ppos; + u64 pos = *ppos; bool is_api32 = ll_need_32bit_api(sbi); int is_hash64 = sbi->ll_flags & LL_SBI_64BIT_HASH; struct page *page; @@ -213,8 +213,8 @@ int ll_dir_read(struct inode *inode, __u64 *ppos, struct md_op_data *op_data, while (rc == 0 && !done) { struct lu_dirpage *dp; struct lu_dirent *ent; - __u64 hash; - __u64 next; + u64 hash; + u64 next; if (IS_ERR(page)) { rc = PTR_ERR(page); @@ -225,11 +225,11 @@ int ll_dir_read(struct inode *inode, __u64 *ppos, struct md_op_data *op_data, dp = page_address(page); for (ent = lu_dirent_start(dp); ent && !done; ent = lu_dirent_next(ent)) { - __u16 type; + u16 type; int namelen; struct lu_fid fid; - __u64 lhash; - __u64 ino; + u64 lhash; + u64 ino; hash = le64_to_cpu(ent->lde_hash); if (hash < pos) @@ -294,7 +294,7 @@ static int ll_readdir(struct file *filp, struct dir_context *ctx) struct inode *inode = file_inode(filp); struct ll_file_data *lfd = LUSTRE_FPRIVATE(filp); struct ll_sb_info *sbi = ll_i2sbi(inode); - __u64 pos = lfd ? lfd->lfd_pos : 0; + u64 pos = lfd ? lfd->lfd_pos : 0; int hash64 = sbi->ll_flags & LL_SBI_64BIT_HASH; bool api32 = ll_need_32bit_api(sbi); struct md_op_data *op_data; @@ -327,7 +327,7 @@ static int ll_readdir(struct file *filp, struct dir_context *ctx) */ if (file_dentry(filp)->d_parent && file_dentry(filp)->d_parent->d_inode) { - __u64 ibits = MDS_INODELOCK_UPDATE; + u64 ibits = MDS_INODELOCK_UPDATE; struct inode *parent; parent = file_dentry(filp)->d_parent->d_inode; @@ -760,7 +760,7 @@ static int ll_ioc_copy_start(struct super_block *sb, struct hsm_copy *copy) /* For archive request, we need to read the current file version. */ if (copy->hc_hai.hai_action == HSMA_ARCHIVE) { struct inode *inode; - __u64 data_version = 0; + u64 data_version = 0; /* Get inode for this fid */ inode = search_inode_for_lustre(sb, ©->hc_hai.hai_fid); @@ -845,7 +845,7 @@ static int ll_ioc_copy_end(struct super_block *sb, struct hsm_copy *copy) (copy->hc_hai.hai_action == HSMA_RESTORE)) && (copy->hc_errval == 0)) { struct inode *inode; - __u64 data_version = 0; + u64 data_version = 0; /* Get lsm for this fid */ inode = search_inode_for_lustre(sb, ©->hc_hai.hai_fid); @@ -1522,7 +1522,7 @@ static long ll_dir_ioctl(struct file *file, unsigned int cmd, unsigned long arg) case LL_IOC_FID2MDTIDX: { struct obd_export *exp = ll_i2mdexp(inode); struct lu_fid fid; - __u32 index; + u32 index; if (copy_from_user(&fid, (const struct lu_fid __user *)arg, sizeof(fid))) diff --git a/drivers/staging/lustre/lustre/llite/file.c b/drivers/staging/lustre/lustre/llite/file.c index 94574b7..f71e273 100644 --- a/drivers/staging/lustre/lustre/llite/file.c +++ b/drivers/staging/lustre/lustre/llite/file.c @@ -158,7 +158,7 @@ static int ll_close_inode_openhandle(struct inode *inode, case MDS_HSM_RELEASE: LASSERT(data); op_data->op_bias |= MDS_HSM_RELEASE; - op_data->op_data_version = *(__u64 *)data; + op_data->op_data_version = *(u64 *)data; op_data->op_lease_handle = och->och_lease_handle; op_data->op_attr.ia_valid |= ATTR_SIZE; op_data->op_xvalid |= OP_XVALID_BLOCKS; @@ -200,7 +200,7 @@ int ll_md_real_close(struct inode *inode, fmode_t fmode) struct ll_inode_info *lli = ll_i2info(inode); struct obd_client_handle **och_p; struct obd_client_handle *och; - __u64 *och_usecount; + u64 *och_usecount; int rc = 0; if (fmode & FMODE_WRITE) { @@ -243,7 +243,7 @@ static int ll_md_close(struct inode *inode, struct file *file) struct ll_file_data *fd = LUSTRE_FPRIVATE(file); struct ll_inode_info *lli = ll_i2info(inode); int lockmode; - __u64 flags = LDLM_FL_BLOCK_GRANTED | LDLM_FL_TEST_LOCK; + u64 flags = LDLM_FL_BLOCK_GRANTED | LDLM_FL_TEST_LOCK; struct lustre_handle lockh; union ldlm_policy_data policy = { .l_inodebits = { MDS_INODELOCK_OPEN } @@ -491,7 +491,7 @@ int ll_file_open(struct inode *inode, struct file *file) struct lookup_intent *it, oit = { .it_op = IT_OPEN, .it_flags = file->f_flags }; struct obd_client_handle **och_p = NULL; - __u64 *och_usecount = NULL; + u64 *och_usecount = NULL; struct ll_file_data *fd; int rc = 0; @@ -813,7 +813,7 @@ static int ll_lease_och_release(struct inode *inode, struct file *file) */ static struct obd_client_handle * ll_lease_open(struct inode *inode, struct file *file, fmode_t fmode, - __u64 open_flags) + u64 open_flags) { struct lookup_intent it = { .it_op = IT_OPEN }; struct ll_sb_info *sbi = ll_i2sbi(inode); @@ -1366,7 +1366,7 @@ static ssize_t ll_file_write_iter(struct kiocb *iocb, struct iov_iter *from) } int ll_lov_setstripe_ea_info(struct inode *inode, struct dentry *dentry, - __u64 flags, struct lov_user_md *lum, + u64 flags, struct lov_user_md *lum, int lum_size) { struct lookup_intent oit = { @@ -1483,7 +1483,7 @@ int ll_lov_getstripe_ea_info(struct inode *inode, const char *filename, static int ll_lov_setea(struct inode *inode, struct file *file, void __user *arg) { - __u64 flags = MDS_OPEN_HAS_OBJS | FMODE_WRITE; + u64 flags = MDS_OPEN_HAS_OBJS | FMODE_WRITE; struct lov_user_md *lump; int lum_size = sizeof(struct lov_user_md) + sizeof(struct lov_user_ost_data); @@ -1530,7 +1530,7 @@ static int ll_lov_setstripe(struct inode *inode, struct file *file, struct lov_user_md __user *lum = (struct lov_user_md __user *)arg; struct lov_user_md *klum; int lum_size, rc; - __u64 flags = FMODE_WRITE; + u64 flags = FMODE_WRITE; rc = ll_copy_user_md(lum, &klum); if (rc < 0) @@ -1828,7 +1828,7 @@ int ll_fid2path(struct inode *inode, void __user *arg) * LL_DV_RD_FLUSH: flush dirty pages, LCK_PR on OSTs * LL_DV_WR_FLUSH: drop all caching pages, LCK_PW on OSTs */ -int ll_data_version(struct inode *inode, __u64 *data_version, int flags) +int ll_data_version(struct inode *inode, u64 *data_version, int flags) { struct cl_object *obj = ll_i2info(inode)->lli_clob; struct lu_env *env; @@ -1876,7 +1876,7 @@ int ll_hsm_release(struct inode *inode) { struct lu_env *env; struct obd_client_handle *och = NULL; - __u64 data_version = 0; + u64 data_version = 0; int rc; u16 refcheck; @@ -1933,8 +1933,8 @@ static int ll_swap_layouts(struct file *file1, struct file *file2, { struct mdc_swap_layouts msl; struct md_op_data *op_data; - __u32 gid; - __u64 dv; + u32 gid; + u64 dv; struct ll_swap_stack *llss = NULL; int rc; @@ -2186,7 +2186,7 @@ static int ll_file_futimes_3(struct file *file, const struct ll_futimes_3 *lfu) * all that data into each client cache with fadvise() may not be, due to * much more data being sent to the client. */ -static int ll_ladvise(struct inode *inode, struct file *file, __u64 flags, +static int ll_ladvise(struct inode *inode, struct file *file, u64 flags, struct llapi_lu_ladvise *ladvise) { struct cl_ladvise_io *lio; @@ -2869,7 +2869,7 @@ int ll_fsync(struct file *file, loff_t start, loff_t end, int datasync) struct lustre_handle lockh = {0}; union ldlm_policy_data flock = { { 0 } }; int fl_type = file_lock->fl_type; - __u64 flags = 0; + u64 flags = 0; int rc; int rc2 = 0; @@ -3179,7 +3179,7 @@ int ll_migrate(struct inode *parent, struct file *file, int mdtidx, * \param l_req_mode [IN] searched lock mode * \retval boolean, true iff all bits are found */ -int ll_have_md_lock(struct inode *inode, __u64 *bits, +int ll_have_md_lock(struct inode *inode, u64 *bits, enum ldlm_mode l_req_mode) { struct lustre_handle lockh; @@ -3187,7 +3187,7 @@ int ll_have_md_lock(struct inode *inode, __u64 *bits, enum ldlm_mode mode = (l_req_mode == LCK_MINMODE) ? (LCK_CR | LCK_CW | LCK_PR | LCK_PW) : l_req_mode; struct lu_fid *fid; - __u64 flags; + u64 flags; int i; if (!inode) @@ -3220,8 +3220,8 @@ int ll_have_md_lock(struct inode *inode, __u64 *bits, return *bits == 0; } -enum ldlm_mode ll_take_md_lock(struct inode *inode, __u64 bits, - struct lustre_handle *lockh, __u64 flags, +enum ldlm_mode ll_take_md_lock(struct inode *inode, u64 bits, + struct lustre_handle *lockh, u64 flags, enum ldlm_mode mode) { union ldlm_policy_data policy = { .l_inodebits = { bits } }; @@ -3261,7 +3261,7 @@ static int ll_inode_revalidate_fini(struct inode *inode, int rc) return rc; } -static int __ll_inode_revalidate(struct dentry *dentry, __u64 ibits) +static int __ll_inode_revalidate(struct dentry *dentry, u64 ibits) { struct inode *inode = d_inode(dentry); struct ptlrpc_request *req = NULL; @@ -3371,7 +3371,7 @@ static int ll_merge_md_attr(struct inode *inode) return 0; } -static int ll_inode_revalidate(struct dentry *dentry, __u64 ibits) +static int ll_inode_revalidate(struct dentry *dentry, u64 ibits) { struct inode *inode = d_inode(dentry); int rc; @@ -3453,7 +3453,7 @@ int ll_getattr(const struct path *path, struct kstat *stat, } static int ll_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo, - __u64 start, __u64 len) + u64 start, u64 len) { int rc; size_t num_bytes; @@ -3888,7 +3888,7 @@ static int ll_layout_intent(struct inode *inode, struct layout_intent *intent) * is finished, this function should be called again to verify that layout * is not changed during IO time. */ -int ll_layout_refresh(struct inode *inode, __u32 *gen) +int ll_layout_refresh(struct inode *inode, u32 *gen) { struct ll_inode_info *lli = ll_i2info(inode); struct ll_sb_info *sbi = ll_i2sbi(inode); @@ -3963,7 +3963,7 @@ int ll_layout_write_intent(struct inode *inode, u64 start, u64 end) /** * This function send a restore request to the MDT */ -int ll_layout_restore(struct inode *inode, loff_t offset, __u64 length) +int ll_layout_restore(struct inode *inode, loff_t offset, u64 length) { struct hsm_user_request *hur; int len, rc; diff --git a/drivers/staging/lustre/lustre/llite/lcommon_misc.c b/drivers/staging/lustre/lustre/llite/lcommon_misc.c index 80563a2..75156d8 100644 --- a/drivers/staging/lustre/lustre/llite/lcommon_misc.c +++ b/drivers/staging/lustre/lustre/llite/lcommon_misc.c @@ -85,7 +85,7 @@ int cl_ocd_update(struct obd_device *host, struct obd_device *watched, { struct lustre_client_ocd *lco; struct client_obd *cli; - __u64 flags; + u64 flags; int result; if (!strcmp(watched->obd_type->typ_name, LUSTRE_OSC_NAME) && @@ -122,7 +122,7 @@ int cl_get_grouplock(struct cl_object *obj, unsigned long gid, int nonblock, struct cl_io *io; struct cl_lock *lock; struct cl_lock_descr *descr; - __u32 enqflags; + u32 enqflags; u16 refcheck; int rc; diff --git a/drivers/staging/lustre/lustre/llite/llite_internal.h b/drivers/staging/lustre/lustre/llite/llite_internal.h index c680a49..bf7e46f 100644 --- a/drivers/staging/lustre/lustre/llite/llite_internal.h +++ b/drivers/staging/lustre/lustre/llite/llite_internal.h @@ -113,7 +113,7 @@ enum ll_file_flags { }; struct ll_inode_info { - __u32 lli_inode_magic; + u32 lli_inode_magic; spinlock_t lli_lock; unsigned long lli_flags; @@ -130,9 +130,9 @@ struct ll_inode_info { struct obd_client_handle *lli_mds_read_och; struct obd_client_handle *lli_mds_write_och; struct obd_client_handle *lli_mds_exec_och; - __u64 lli_open_fd_read_count; - __u64 lli_open_fd_write_count; - __u64 lli_open_fd_exec_count; + u64 lli_open_fd_read_count; + u64 lli_open_fd_write_count; + u64 lli_open_fd_exec_count; /* Protects access to och pointers and their usage counters */ struct mutex lli_och_mutex; @@ -184,7 +184,7 @@ struct ll_inode_info { * "dmv" and gets the rest of the default layout itself * (count, hash, etc). */ - __u32 lli_def_stripe_offset; + u32 lli_def_stripe_offset; }; /* for non-directory */ @@ -204,7 +204,7 @@ struct ll_inode_info { struct rw_semaphore lli_glimpse_sem; unsigned long lli_glimpse_time; struct list_head lli_agl_list; - __u64 lli_agl_index; + u64 lli_agl_index; /* for writepage() only to communicate to fsync */ int lli_async_rc; @@ -236,7 +236,7 @@ struct ll_inode_info { /* mutex to request for layout lock exclusively. */ struct mutex lli_layout_mutex; /* Layout version, protected by lli_layout_lock */ - __u32 lli_layout_gen; + u32 lli_layout_gen; spinlock_t lli_layout_lock; u32 lli_projid; /* project id */ @@ -246,9 +246,9 @@ struct ll_inode_info { struct list_head lli_xattrs;/* ll_xattr_entry->xe_list */ }; -static inline __u32 ll_layout_version_get(struct ll_inode_info *lli) +static inline u32 ll_layout_version_get(struct ll_inode_info *lli) { - __u32 gen; + u32 gen; spin_lock(&lli->lli_layout_lock); gen = lli->lli_layout_gen; @@ -257,7 +257,7 @@ static inline __u32 ll_layout_version_get(struct ll_inode_info *lli) return gen; } -static inline void ll_layout_version_set(struct ll_inode_info *lli, __u32 gen) +static inline void ll_layout_version_set(struct ll_inode_info *lli, u32 gen) { spin_lock(&lli->lli_layout_lock); lli->lli_layout_gen = gen; @@ -267,7 +267,7 @@ static inline void ll_layout_version_set(struct ll_inode_info *lli, __u32 gen) int ll_xattr_cache_destroy(struct inode *inode); int ll_xattr_cache_get(struct inode *inode, const char *name, - char *buffer, size_t size, __u64 valid); + char *buffer, size_t size, u64 valid); static inline bool obd_connect_has_secctx(struct obd_connect_data *data) { @@ -466,7 +466,7 @@ struct lustre_client_ocd { * (LOVs) this mount is connected to. This field is updated by * cl_ocd_update() under ->lco_lock. */ - __u64 lco_flags; + u64 lco_flags; struct mutex lco_lock; struct obd_export *lco_md_exp; struct obd_export *lco_dt_exp; @@ -646,8 +646,8 @@ struct ll_readahead_state { struct ll_file_data { struct ll_readahead_state fd_ras; struct ll_grouplock fd_grouplock; - __u64 lfd_pos; - __u32 fd_flags; + u64 lfd_pos; + u32 fd_flags; fmode_t fd_omode; /* openhandle if lease exists for this file. * Borrow lli->lli_och_mutex to protect assignment @@ -672,8 +672,8 @@ static inline struct inode *ll_info2i(struct ll_inode_info *lli) return &lli->lli_vfs_inode; } -__u32 ll_i2suppgid(struct inode *i); -void ll_i2gids(__u32 *suppgids, struct inode *i1, struct inode *i2); +u32 ll_i2suppgid(struct inode *i); +void ll_i2gids(u32 *suppgids, struct inode *i1, struct inode *i2); static inline bool ll_need_32bit_api(struct ll_sb_info *sbi) { @@ -764,12 +764,12 @@ enum { /* llite/dir.c */ extern const struct file_operations ll_dir_operations; extern const struct inode_operations ll_dir_inode_operations; -int ll_dir_read(struct inode *inode, __u64 *ppos, struct md_op_data *op_data, +int ll_dir_read(struct inode *inode, u64 *ppos, struct md_op_data *op_data, struct dir_context *ctx); int ll_get_mdt_idx(struct inode *inode); int ll_get_mdt_idx_by_fid(struct ll_sb_info *sbi, const struct lu_fid *fid); struct page *ll_get_dir_page(struct inode *dir, struct md_op_data *op_data, - __u64 offset); + u64 offset); void ll_release_page(struct inode *inode, struct page *page, bool remove); /* llite/namei.c */ @@ -803,10 +803,10 @@ void ll_cl_add(struct file *file, const struct lu_env *env, struct cl_io *io, extern const struct file_operations ll_file_operations_flock; extern const struct file_operations ll_file_operations_noflock; extern const struct inode_operations ll_file_inode_operations; -int ll_have_md_lock(struct inode *inode, __u64 *bits, +int ll_have_md_lock(struct inode *inode, u64 *bits, enum ldlm_mode l_req_mode); -enum ldlm_mode ll_take_md_lock(struct inode *inode, __u64 bits, - struct lustre_handle *lockh, __u64 flags, +enum ldlm_mode ll_take_md_lock(struct inode *inode, u64 bits, + struct lustre_handle *lockh, u64 flags, enum ldlm_mode mode); int ll_file_open(struct inode *inode, struct file *file); int ll_file_release(struct inode *inode, struct file *file); @@ -832,7 +832,7 @@ int ll_ioctl_fsgetxattr(struct inode *inode, unsigned int cmd, int ll_ioctl_fssetxattr(struct inode *inode, unsigned int cmd, unsigned long arg); int ll_lov_setstripe_ea_info(struct inode *inode, struct dentry *dentry, - __u64 flags, struct lov_user_md *lum, + u64 flags, struct lov_user_md *lum, int lum_size); int ll_lov_getstripe_ea_info(struct inode *inode, const char *filename, struct lov_mds_md **lmm, int *lmm_size, @@ -844,7 +844,7 @@ int ll_dir_getstripe(struct inode *inode, void **lmmp, int *lmm_size, int ll_fsync(struct file *file, loff_t start, loff_t end, int data); int ll_merge_attr(const struct lu_env *env, struct inode *inode); int ll_fid2path(struct inode *inode, void __user *arg); -int ll_data_version(struct inode *inode, __u64 *data_version, int flags); +int ll_data_version(struct inode *inode, u64 *data_version, int flags); int ll_hsm_release(struct inode *inode); int ll_hsm_state_set(struct inode *inode, struct hsm_state_set *hss); @@ -904,7 +904,7 @@ enum { struct md_op_data *ll_prep_md_op_data(struct md_op_data *op_data, struct inode *i1, struct inode *i2, const char *name, size_t namelen, - u32 mode, __u32 opc, void *data); + u32 mode, u32 opc, void *data); void ll_finish_md_op_data(struct md_op_data *op_data); int ll_get_obd_name(struct inode *inode, unsigned int cmd, unsigned long arg); char *ll_get_fsname(struct super_block *sb, char *buf, int buflen); @@ -935,7 +935,7 @@ static inline ssize_t ll_lov_user_md_size(const struct lov_user_md *lum) /* llite/llite_nfs.c */ extern const struct export_operations lustre_export_operations; -__u32 get_uuid2int(const char *name, int len); +u32 get_uuid2int(const char *name, int len); void get_uuid2fsid(const char *name, int len, __kernel_fsid_t *fsid); struct inode *search_inode_for_lustre(struct super_block *sb, const struct lu_fid *fid); @@ -995,7 +995,7 @@ static inline struct vvp_io_args *ll_env_args(const struct lu_env *env) /* llite/llite_mmap.c */ -int ll_teardown_mmaps(struct address_space *mapping, __u64 first, __u64 last); +int ll_teardown_mmaps(struct address_space *mapping, u64 first, u64 last); int ll_file_mmap(struct file *file, struct vm_area_struct *vma); void policy_from_vma(union ldlm_policy_data *policy, struct vm_area_struct *vma, unsigned long addr, size_t count); @@ -1074,7 +1074,7 @@ static inline loff_t ll_file_maxbytes(struct inode *inode) ssize_t ll_listxattr(struct dentry *dentry, char *buffer, size_t size); int ll_xattr_list(struct inode *inode, const char *name, int type, - void *buffer, size_t size, __u64 valid); + void *buffer, size_t size, u64 valid); const struct xattr_handler *get_xattr_type(const char *name); /** @@ -1114,16 +1114,16 @@ struct ll_statahead_info { * refcount */ unsigned int sai_max; /* max ahead of lookup */ - __u64 sai_sent; /* stat requests sent count */ - __u64 sai_replied; /* stat requests which received + u64 sai_sent; /* stat requests sent count */ + u64 sai_replied; /* stat requests which received * reply */ - __u64 sai_index; /* index of statahead entry */ - __u64 sai_index_wait; /* index of entry which is the + u64 sai_index; /* index of statahead entry */ + u64 sai_index_wait; /* index of entry which is the * caller is waiting for */ - __u64 sai_hit; /* hit count */ - __u64 sai_miss; /* miss count: + u64 sai_hit; /* hit count */ + u64 sai_miss; /* miss count: * for "ls -al" case, it includes * hidden dentry miss; * for "ls -l" case, it does not @@ -1249,7 +1249,7 @@ static inline int ll_file_nolock(const struct file *file) } static inline void ll_set_lock_data(struct obd_export *exp, struct inode *inode, - struct lookup_intent *it, __u64 *bits) + struct lookup_intent *it, u64 *bits) { if (!it->it_lock_set) { struct lustre_handle handle; @@ -1318,8 +1318,8 @@ static inline void d_lustre_revalidate(struct dentry *dentry) } int ll_layout_conf(struct inode *inode, const struct cl_object_conf *conf); -int ll_layout_refresh(struct inode *inode, __u32 *gen); -int ll_layout_restore(struct inode *inode, loff_t start, __u64 length); +int ll_layout_refresh(struct inode *inode, u32 *gen); +int ll_layout_restore(struct inode *inode, loff_t start, u64 length); int ll_layout_write_intent(struct inode *inode, u64 start, u64 end); int ll_xattr_init(void); @@ -1341,6 +1341,6 @@ int cl_setattr_ost(struct cl_object *obj, const struct iattr *attr, void cl_inode_fini(struct inode *inode); u64 cl_fid_build_ino(const struct lu_fid *fid, bool api32); -__u32 cl_fid_build_gen(const struct lu_fid *fid); +u32 cl_fid_build_gen(const struct lu_fid *fid); #endif /* LLITE_INTERNAL_H */ diff --git a/drivers/staging/lustre/lustre/llite/llite_lib.c b/drivers/staging/lustre/lustre/llite/llite_lib.c index 7b1226b..88b08dd 100644 --- a/drivers/staging/lustre/lustre/llite/llite_lib.c +++ b/drivers/staging/lustre/lustre/llite/llite_lib.c @@ -2142,7 +2142,7 @@ int ll_remount_fs(struct super_block *sb, int *flags, char *data) struct ll_sb_info *sbi = ll_s2sbi(sb); char *profilenm = get_profile_name(sb); int err; - __u32 read_only; + u32 read_only; if ((bool)(*flags & SB_RDONLY) != sb_rdonly(sb)) { read_only = *flags & SB_RDONLY; @@ -2297,7 +2297,7 @@ int ll_obd_statfs(struct inode *inode, void __user *arg) struct obd_export *exp; char *buf = NULL; struct obd_ioctl_data *data = NULL; - __u32 type; + u32 type; int len = 0, rc; if (!inode) { @@ -2322,15 +2322,15 @@ int ll_obd_statfs(struct inode *inode, void __user *arg) goto out_statfs; } - if (data->ioc_inllen1 != sizeof(__u32) || - data->ioc_inllen2 != sizeof(__u32) || + if (data->ioc_inllen1 != sizeof(u32) || + data->ioc_inllen2 != sizeof(u32) || data->ioc_plen1 != sizeof(struct obd_statfs) || data->ioc_plen2 != sizeof(struct obd_uuid)) { rc = -EINVAL; goto out_statfs; } - memcpy(&type, data->ioc_inlbuf1, sizeof(__u32)); + memcpy(&type, data->ioc_inlbuf1, sizeof(u32)); if (type & LL_STATFS_LMV) { exp = sbi->ll_md_exp; } else if (type & LL_STATFS_LOV) { @@ -2352,7 +2352,7 @@ int ll_obd_statfs(struct inode *inode, void __user *arg) struct md_op_data *ll_prep_md_op_data(struct md_op_data *op_data, struct inode *i1, struct inode *i2, const char *name, size_t namelen, - u32 mode, __u32 opc, void *data) + u32 mode, u32 opc, void *data) { if (!name) { /* Do not reuse namelen for something else. */ diff --git a/drivers/staging/lustre/lustre/llite/llite_mmap.c b/drivers/staging/lustre/lustre/llite/llite_mmap.c index 33e23ee..c6e9f10 100644 --- a/drivers/staging/lustre/lustre/llite/llite_mmap.c +++ b/drivers/staging/lustre/lustre/llite/llite_mmap.c @@ -466,7 +466,7 @@ static void ll_vm_close(struct vm_area_struct *vma) /* XXX put nice comment here. talk about __free_pte -> dirty pages and * nopage's reference passing to the pte */ -int ll_teardown_mmaps(struct address_space *mapping, __u64 first, __u64 last) +int ll_teardown_mmaps(struct address_space *mapping, u64 first, u64 last) { int rc = -ENOENT; diff --git a/drivers/staging/lustre/lustre/llite/llite_nfs.c b/drivers/staging/lustre/lustre/llite/llite_nfs.c index 5e91e83..7c5c9b8 100644 --- a/drivers/staging/lustre/lustre/llite/llite_nfs.c +++ b/drivers/staging/lustre/lustre/llite/llite_nfs.c @@ -42,12 +42,12 @@ #include "llite_internal.h" #include -__u32 get_uuid2int(const char *name, int len) +u32 get_uuid2int(const char *name, int len) { - __u32 key0 = 0x12a3fe2d, key1 = 0x37abe8f9; + u32 key0 = 0x12a3fe2d, key1 = 0x37abe8f9; while (len--) { - __u32 key = key1 + (key0 ^ (*name++ * 7152373)); + u32 key = key1 + (key0 ^ (*name++ * 7152373)); if (key & 0x80000000) key -= 0x7fffffff; @@ -59,7 +59,7 @@ __u32 get_uuid2int(const char *name, int len) void get_uuid2fsid(const char *name, int len, __kernel_fsid_t *fsid) { - __u64 key = 0, key0 = 0x12a3fe2d, key1 = 0x37abe8f9; + u64 key = 0, key0 = 0x12a3fe2d, key1 = 0x37abe8f9; while (len--) { key = key1 + (key0 ^ (*name++ * 7152373)); @@ -186,7 +186,7 @@ struct lustre_nfs_fid { * 2 -- contains child file handle and parent file handle; * 255 -- error. */ -static int ll_encode_fh(struct inode *inode, __u32 *fh, int *plen, +static int ll_encode_fh(struct inode *inode, u32 *fh, int *plen, struct inode *parent) { int fileid_len = sizeof(struct lustre_nfs_fid) / 4; @@ -243,7 +243,7 @@ static int ll_get_name(struct dentry *dentry, char *name, .ctx.actor = ll_nfs_get_name_filldir, }; struct md_op_data *op_data; - __u64 pos = 0; + u64 pos = 0; if (!dir || !S_ISDIR(dir->i_mode)) { rc = -ENOTDIR; diff --git a/drivers/staging/lustre/lustre/llite/lproc_llite.c b/drivers/staging/lustre/lustre/llite/lproc_llite.c index 9404bb7..672de81 100644 --- a/drivers/staging/lustre/lustre/llite/lproc_llite.c +++ b/drivers/staging/lustre/lustre/llite/lproc_llite.c @@ -1232,8 +1232,8 @@ static void llite_kobj_release(struct kobject *kobj) }; static const struct llite_file_opcode { - __u32 opcode; - __u32 type; + u32 opcode; + u32 type; const char *opname; } llite_opcode_table[LPROC_LL_FILE_OPCODES] = { /* file operation */ @@ -1352,7 +1352,7 @@ int ll_debugfs_register_super(struct super_block *sb, const char *name) /* do counter init */ for (id = 0; id < LPROC_LL_FILE_OPCODES; id++) { - __u32 type = llite_opcode_table[id].type; + u32 type = llite_opcode_table[id].type; void *ptr = NULL; if (type & LPROCFS_TYPE_REGS) diff --git a/drivers/staging/lustre/lustre/llite/namei.c b/drivers/staging/lustre/lustre/llite/namei.c index b5b46f7..8bdf947 100644 --- a/drivers/staging/lustre/lustre/llite/namei.c +++ b/drivers/staging/lustre/lustre/llite/namei.c @@ -191,7 +191,7 @@ int ll_md_blocking_ast(struct ldlm_lock *lock, struct ldlm_lock_desc *desc, break; case LDLM_CB_CANCELING: { struct inode *inode = ll_inode_from_resource_lock(lock); - __u64 bits = lock->l_policy_data.l_inodebits.bits; + u64 bits = lock->l_policy_data.l_inodebits.bits; /* Inode is set to lock->l_resource->lr_lvb_inode * for mdc - bug 24555 @@ -348,12 +348,12 @@ int ll_md_blocking_ast(struct ldlm_lock *lock, struct ldlm_lock_desc *desc, return 0; } -__u32 ll_i2suppgid(struct inode *i) +u32 ll_i2suppgid(struct inode *i) { if (in_group_p(i->i_gid)) - return (__u32)from_kgid(&init_user_ns, i->i_gid); + return (u32)from_kgid(&init_user_ns, i->i_gid); else - return (__u32)(-1); + return (u32)(-1); } /* Pack the required supplementary groups into the supplied groups array. @@ -361,7 +361,7 @@ __u32 ll_i2suppgid(struct inode *i) * instead pack one or more groups from the user's supplementary group * array in case it might be useful. Not needed if doing an MDS-side upcall. */ -void ll_i2gids(__u32 *suppgids, struct inode *i1, struct inode *i2) +void ll_i2gids(u32 *suppgids, struct inode *i1, struct inode *i2) { LASSERT(i1); @@ -454,7 +454,7 @@ static int ll_lookup_it_finish(struct ptlrpc_request *request, struct inode *parent, struct dentry **de) { struct inode *inode = NULL; - __u64 bits = 0; + u64 bits = 0; int rc = 0; struct dentry *alias; @@ -536,7 +536,7 @@ static struct dentry *ll_lookup_it(struct inode *parent, struct dentry *dentry, struct ptlrpc_request *req = NULL; struct md_op_data *op_data = NULL; struct inode *inode; - __u32 opc; + u32 opc; int rc; if (dentry->d_name.len > ll_i2sbi(parent)->ll_namelen) @@ -901,7 +901,7 @@ void ll_update_times(struct ptlrpc_request *request, struct inode *inode) static int ll_new_node(struct inode *dir, struct dentry *dentry, const char *tgt, umode_t mode, int rdev, - __u32 opc) + u32 opc) { struct ptlrpc_request *request = NULL; struct md_op_data *op_data; diff --git a/drivers/staging/lustre/lustre/llite/range_lock.c b/drivers/staging/lustre/lustre/llite/range_lock.c index d37da8e..c1f0e1e 100644 --- a/drivers/staging/lustre/lustre/llite/range_lock.c +++ b/drivers/staging/lustre/lustre/llite/range_lock.c @@ -42,7 +42,7 @@ #define START(node) ((node)->rl_start) #define LAST(node) ((node)->rl_last) -INTERVAL_TREE_DEFINE(struct range_lock, rl_rb, __u64, __subtree_last, +INTERVAL_TREE_DEFINE(struct range_lock, rl_rb, u64, __subtree_last, START, LAST, static, range); /** * Initialize a range lock tree @@ -69,7 +69,7 @@ void range_lock_tree_init(struct range_lock_tree *tree) * Pre: Caller should have allocated the range lock node. * Post: The range lock node is meant to cover [start, end] region */ -int range_lock_init(struct range_lock *lock, __u64 start, __u64 end) +int range_lock_init(struct range_lock *lock, u64 start, u64 end) { RB_CLEAR_NODE(&lock->rl_rb); diff --git a/drivers/staging/lustre/lustre/llite/range_lock.h b/drivers/staging/lustre/lustre/llite/range_lock.h index 2a0704d..10566da 100644 --- a/drivers/staging/lustre/lustre/llite/range_lock.h +++ b/drivers/staging/lustre/lustre/llite/range_lock.h @@ -42,8 +42,8 @@ struct range_lock { struct rb_node rl_rb; - __u64 rl_start, rl_last; - __u64 __subtree_last; + u64 rl_start, rl_last; + u64 __subtree_last; /** * Process to enqueue this lock. */ @@ -56,17 +56,17 @@ struct range_lock { * Sequence number of range lock. This number is used to get to know * the order the locks are queued; this is required for range_cancel(). */ - __u64 rl_sequence; + u64 rl_sequence; }; struct range_lock_tree { struct rb_root_cached rlt_root; spinlock_t rlt_lock; /* protect range lock tree */ - __u64 rlt_sequence; + u64 rlt_sequence; }; void range_lock_tree_init(struct range_lock_tree *tree); -int range_lock_init(struct range_lock *lock, __u64 start, __u64 end); +int range_lock_init(struct range_lock *lock, u64 start, u64 end); int range_lock(struct range_lock_tree *tree, struct range_lock *lock); void range_unlock(struct range_lock_tree *tree, struct range_lock *lock); #endif diff --git a/drivers/staging/lustre/lustre/llite/rw.c b/drivers/staging/lustre/lustre/llite/rw.c index 55d8b31..e207d7c 100644 --- a/drivers/staging/lustre/lustre/llite/rw.c +++ b/drivers/staging/lustre/lustre/llite/rw.c @@ -272,8 +272,8 @@ static inline int stride_io_mode(struct ll_readahead_state *ras) stride_pg_count(pgoff_t st_off, unsigned long st_len, unsigned long st_pgs, unsigned long off, unsigned long length) { - __u64 start = off > st_off ? off - st_off : 0; - __u64 end = off + length > st_off ? off + length - st_off : 0; + u64 start = off > st_off ? off - st_off : 0; + u64 end = off + length > st_off ? off + length - st_off : 0; unsigned long start_left = 0; unsigned long end_left = 0; unsigned long pg_count; @@ -308,7 +308,7 @@ static inline int stride_io_mode(struct ll_readahead_state *ras) static int ria_page_count(struct ra_io_arg *ria) { - __u64 length = ria->ria_end >= ria->ria_start ? + u64 length = ria->ria_end >= ria->ria_start ? ria->ria_end - ria->ria_start + 1 : 0; return stride_pg_count(ria->ria_stoff, ria->ria_length, @@ -445,7 +445,7 @@ static int ll_readahead(const struct lu_env *env, struct cl_io *io, struct ra_io_arg *ria = <i->lti_ria; struct cl_object *clob; int ret = 0; - __u64 kms; + u64 kms; clob = io->ci_obj; inode = vvp_object_inode(clob); @@ -764,7 +764,7 @@ static void ras_update(struct ll_sb_info *sbi, struct inode *inode, * ras_requests and thus can never trigger this behavior. */ if (ras->ras_requests >= 2 && !ras->ras_request_index) { - __u64 kms_pages; + u64 kms_pages; kms_pages = (i_size_read(inode) + PAGE_SIZE - 1) >> PAGE_SHIFT; diff --git a/drivers/staging/lustre/lustre/llite/statahead.c b/drivers/staging/lustre/lustre/llite/statahead.c index 24c2335c..6f5c7ab 100644 --- a/drivers/staging/lustre/lustre/llite/statahead.c +++ b/drivers/staging/lustre/lustre/llite/statahead.c @@ -65,9 +65,9 @@ struct sa_entry { /* link into sai hash table locally */ struct list_head se_hash; /* entry index in the sai */ - __u64 se_index; + u64 se_index; /* low layer ldlm lock handle */ - __u64 se_handle; + u64 se_handle; /* entry status */ enum se_stat se_state; /* entry size, contains name */ @@ -163,15 +163,15 @@ static inline int sa_low_hit(struct ll_statahead_info *sai) * if the given index is behind of statahead window more than * SA_OMITTED_ENTRY_MAX, then it is old. */ -static inline int is_omitted_entry(struct ll_statahead_info *sai, __u64 index) +static inline int is_omitted_entry(struct ll_statahead_info *sai, u64 index) { - return ((__u64)sai->sai_max + index + SA_OMITTED_ENTRY_MAX < + return ((u64)sai->sai_max + index + SA_OMITTED_ENTRY_MAX < sai->sai_index); } /* allocate sa_entry and hash it to allow scanner process to find it */ static struct sa_entry * -sa_alloc(struct dentry *parent, struct ll_statahead_info *sai, __u64 index, +sa_alloc(struct dentry *parent, struct ll_statahead_info *sai, u64 index, const char *name, int len, const struct lu_fid *fid) { struct ll_inode_info *lli; @@ -309,7 +309,7 @@ static void sa_free(struct ll_statahead_info *sai, struct sa_entry *entry) __sa_make_ready(struct ll_statahead_info *sai, struct sa_entry *entry, int ret) { struct list_head *pos = &sai->sai_entries; - __u64 index = entry->se_index; + u64 index = entry->se_index; struct sa_entry *se; LASSERT(!sa_ready(entry)); @@ -492,7 +492,7 @@ static void ll_sai_put(struct ll_statahead_info *sai) static void ll_agl_trigger(struct inode *inode, struct ll_statahead_info *sai) { struct ll_inode_info *lli = ll_i2info(inode); - __u64 index = lli->lli_agl_index; + u64 index = lli->lli_agl_index; int rc; LASSERT(list_empty(&lli->lli_agl_list)); @@ -665,7 +665,7 @@ static int ll_statahead_interpret(struct ptlrpc_request *req, struct ll_inode_info *lli = ll_i2info(dir); struct ll_statahead_info *sai = lli->lli_sai; struct sa_entry *entry = (struct sa_entry *)minfo->mi_cbdata; - __u64 handle = 0; + u64 handle = 0; if (it_disposition(it, DISP_LOOKUP_NEG)) rc = -ENOENT; @@ -963,7 +963,7 @@ static int ll_statahead_thread(void *arg) struct ll_sb_info *sbi = ll_i2sbi(dir); struct ll_statahead_info *sai = lli->lli_sai; struct page *page = NULL; - __u64 pos = 0; + u64 pos = 0; int first = 0; int rc = 0; struct md_op_data *op_data; @@ -998,7 +998,7 @@ static int ll_statahead_thread(void *arg) ent && sai->sai_task && !sa_low_hit(sai); ent = lu_dirent_next(ent)) { struct lu_fid fid; - __u64 hash; + u64 hash; int namelen; char *name; @@ -1228,7 +1228,7 @@ static int is_first_dirent(struct inode *dir, struct dentry *dentry) const struct qstr *target = &dentry->d_name; struct md_op_data *op_data; struct page *page; - __u64 pos = 0; + u64 pos = 0; int dot_de; int rc = LS_NOT_FIRST_DE; @@ -1259,7 +1259,7 @@ static int is_first_dirent(struct inode *dir, struct dentry *dentry) dp = page_address(page); for (ent = lu_dirent_start(dp); ent; ent = lu_dirent_next(ent)) { - __u64 hash; + u64 hash; int namelen; char *name; @@ -1425,7 +1425,7 @@ static int revalidate_statahead_dentry(struct inode *dir, struct inode *inode = entry->se_inode; struct lookup_intent it = { .it_op = IT_GETATTR, .it_lock_handle = entry->se_handle }; - __u64 bits; + u64 bits; rc = md_revalidate_lock(ll_i2mdexp(dir), &it, ll_inode2fid(inode), &bits); diff --git a/drivers/staging/lustre/lustre/llite/vvp_internal.h b/drivers/staging/lustre/lustre/llite/vvp_internal.h index 70d62bf..e8712d8 100644 --- a/drivers/staging/lustre/lustre/llite/vvp_internal.h +++ b/drivers/staging/lustre/lustre/llite/vvp_internal.h @@ -100,7 +100,7 @@ struct vvp_io { /** * Layout version when this IO is initialized */ - __u32 vui_layout_gen; + u32 vui_layout_gen; /** * File descriptor against which IO is done. */ diff --git a/drivers/staging/lustre/lustre/llite/vvp_io.c b/drivers/staging/lustre/lustre/llite/vvp_io.c index d9f02ae..26a7897 100644 --- a/drivers/staging/lustre/lustre/llite/vvp_io.c +++ b/drivers/staging/lustre/lustre/llite/vvp_io.c @@ -188,7 +188,7 @@ static int vvp_prep_size(const struct lu_env *env, struct cl_object *obj, i_size_write(inode, kms); CDEBUG(D_VFSTRACE, DFID " updating i_size %llu\n", PFID(lu_object_fid(&obj->co_lu)), - (__u64)i_size_read(inode)); + (u64)i_size_read(inode)); } } @@ -204,7 +204,7 @@ static int vvp_prep_size(const struct lu_env *env, struct cl_object *obj, */ static int vvp_io_one_lock_index(const struct lu_env *env, struct cl_io *io, - __u32 enqflags, enum cl_lock_mode mode, + u32 enqflags, enum cl_lock_mode mode, pgoff_t start, pgoff_t end) { struct vvp_io *vio = vvp_env_io(env); @@ -234,7 +234,7 @@ static int vvp_io_one_lock_index(const struct lu_env *env, struct cl_io *io, } static int vvp_io_one_lock(const struct lu_env *env, struct cl_io *io, - __u32 enqflags, enum cl_lock_mode mode, + u32 enqflags, enum cl_lock_mode mode, loff_t start, loff_t end) { struct cl_object *obj = io->ci_obj; @@ -355,7 +355,7 @@ static void vvp_io_fini(const struct lu_env *env, const struct cl_io_slice *ios) } if (!io->ci_ignore_layout && io->ci_verify_layout) { - __u32 gen = 0; + u32 gen = 0; /* check layout version */ ll_layout_refresh(inode, &gen); @@ -590,8 +590,8 @@ static int vvp_io_setattr_lock(const struct lu_env *env, const struct cl_io_slice *ios) { struct cl_io *io = ios->cis_io; - __u64 new_size; - __u32 enqflags = 0; + u64 new_size; + u32 enqflags = 0; if (cl_io_is_trunc(io)) { new_size = io->u.ci_setattr.sa_attr.lvb_size; diff --git a/drivers/staging/lustre/lustre/llite/xattr_cache.c b/drivers/staging/lustre/lustre/llite/xattr_cache.c index 5da69ba0..bb235e0 100644 --- a/drivers/staging/lustre/lustre/llite/xattr_cache.c +++ b/drivers/staging/lustre/lustre/llite/xattr_cache.c @@ -338,7 +338,7 @@ static int ll_xattr_cache_refill(struct inode *inode) const char *xdata, *xval, *xtail, *xvtail; struct ll_inode_info *lli = ll_i2info(inode); struct mdt_body *body; - __u32 *xsizes; + u32 *xsizes; int rc, i; rc = ll_xattr_find_get_lock(inode, &oit, &req); @@ -373,7 +373,7 @@ static int ll_xattr_cache_refill(struct inode *inode) xval = req_capsule_server_sized_get(&req->rq_pill, &RMF_EAVALS, body->mbo_aclsize); xsizes = req_capsule_server_sized_get(&req->rq_pill, &RMF_EAVALS_LENS, - body->mbo_max_mdsize * sizeof(__u32)); + body->mbo_max_mdsize * sizeof(u32)); if (!xdata || !xval || !xsizes) { CERROR("wrong setxattr reply\n"); rc = -EPROTO; @@ -458,7 +458,7 @@ static int ll_xattr_cache_refill(struct inode *inode) * \retval -ENODATA no such attr or the list is empty */ int ll_xattr_cache_get(struct inode *inode, const char *name, char *buffer, - size_t size, __u64 valid) + size_t size, u64 valid) { struct ll_inode_info *lli = ll_i2info(inode); int rc = 0; diff --git a/drivers/staging/lustre/lustre/lmv/lmv_intent.c b/drivers/staging/lustre/lustre/lmv/lmv_intent.c index ba6410e..bc364b6 100644 --- a/drivers/staging/lustre/lustre/lmv/lmv_intent.c +++ b/drivers/staging/lustre/lustre/lmv/lmv_intent.c @@ -52,7 +52,7 @@ static int lmv_intent_remote(struct obd_export *exp, struct lookup_intent *it, const struct lu_fid *parent_fid, struct ptlrpc_request **reqp, ldlm_blocking_callback cb_blocking, - __u64 extra_lock_flags) + u64 extra_lock_flags) { struct obd_device *obd = exp->exp_obd; struct lmv_obd *lmv = &obd->u.lmv; @@ -262,7 +262,7 @@ static int lmv_intent_open(struct obd_export *exp, struct md_op_data *op_data, struct lookup_intent *it, struct ptlrpc_request **reqp, ldlm_blocking_callback cb_blocking, - __u64 extra_lock_flags) + u64 extra_lock_flags) { struct obd_device *obd = exp->exp_obd; struct lmv_obd *lmv = &obd->u.lmv; @@ -353,7 +353,7 @@ static int lmv_intent_lookup(struct obd_export *exp, struct lookup_intent *it, struct ptlrpc_request **reqp, ldlm_blocking_callback cb_blocking, - __u64 extra_lock_flags) + u64 extra_lock_flags) { struct lmv_stripe_md *lsm = op_data->op_mea1; struct obd_device *obd = exp->exp_obd; @@ -475,7 +475,7 @@ static int lmv_intent_lookup(struct obd_export *exp, int lmv_intent_lock(struct obd_export *exp, struct md_op_data *op_data, struct lookup_intent *it, struct ptlrpc_request **reqp, ldlm_blocking_callback cb_blocking, - __u64 extra_lock_flags) + u64 extra_lock_flags) { int rc; diff --git a/drivers/staging/lustre/lustre/lmv/lmv_internal.h b/drivers/staging/lustre/lustre/lmv/lmv_internal.h index f2c41c7..c0881ff 100644 --- a/drivers/staging/lustre/lustre/lmv/lmv_internal.h +++ b/drivers/staging/lustre/lustre/lmv/lmv_internal.h @@ -46,7 +46,7 @@ int lmv_intent_lock(struct obd_export *exp, struct md_op_data *op_data, struct lookup_intent *it, struct ptlrpc_request **reqp, ldlm_blocking_callback cb_blocking, - __u64 extra_lock_flags); + u64 extra_lock_flags); int lmv_fld_lookup(struct lmv_obd *lmv, const struct lu_fid *fid, u32 *mds); int __lmv_fid_alloc(struct lmv_obd *lmv, struct lu_fid *fid, u32 mds); diff --git a/drivers/staging/lustre/lustre/lmv/lmv_obd.c b/drivers/staging/lustre/lustre/lmv/lmv_obd.c index 7e4ffeb..65ae944 100644 --- a/drivers/staging/lustre/lustre/lmv/lmv_obd.c +++ b/drivers/staging/lustre/lustre/lmv/lmv_obd.c @@ -369,7 +369,7 @@ static void lmv_del_target(struct lmv_obd *lmv, int index) } static int lmv_add_target(struct obd_device *obd, struct obd_uuid *uuidp, - __u32 index, int gen) + u32 index, int gen) { struct lmv_obd *lmv = &obd->u.lmv; struct obd_device *mdc_obd; @@ -401,8 +401,8 @@ static int lmv_add_target(struct obd_device *obd, struct obd_uuid *uuidp, if (index >= lmv->tgts_size) { /* We need to reallocate the lmv target array. */ struct lmv_tgt_desc **newtgts, **old = NULL; - __u32 newsize = 1; - __u32 oldsize = 0; + u32 newsize = 1; + u32 oldsize = 0; while (newsize < index + 1) newsize <<= 1; @@ -757,7 +757,7 @@ static int lmv_hsm_ct_unregister(struct lmv_obd *lmv, unsigned int cmd, int len, struct lustre_kernelcomm *lk, void __user *uarg) { - __u32 i; + u32 i; /* unregister request (call from llapi_hsm_copytool_fini) */ for (i = 0; i < lmv->desc.ld_tgt_count; i++) { @@ -783,7 +783,7 @@ static int lmv_hsm_ct_register(struct lmv_obd *lmv, unsigned int cmd, int len, struct lustre_kernelcomm *lk, void __user *uarg) { struct file *filp; - __u32 i, j; + u32 i, j; int err; bool any_set = false; struct kkuc_ct_data kcd = { @@ -873,9 +873,9 @@ static int lmv_iocontrol(unsigned int cmd, struct obd_export *exp, struct obd_ioctl_data *data = karg; struct obd_device *mdc_obd; struct obd_statfs stat_buf = {0}; - __u32 index; + u32 index; - memcpy(&index, data->ioc_inlbuf2, sizeof(__u32)); + memcpy(&index, data->ioc_inlbuf2, sizeof(u32)); if (index >= count) return -ENODEV; @@ -971,7 +971,7 @@ static int lmv_iocontrol(unsigned int cmd, struct obd_export *exp, * Note: this is from llite(see ll_dir_ioctl()), @uarg does not * point to user space memory for FID2MDTIDX. */ - *(__u32 *)uarg = mdt_index; + *(u32 *)uarg = mdt_index; break; } case OBD_IOC_FID2PATH: { @@ -1292,7 +1292,7 @@ static int lmv_process_config(struct obd_device *obd, u32 len, void *buf) struct lustre_cfg *lcfg = buf; struct obd_uuid obd_uuid; int gen; - __u32 index; + u32 index; int rc; switch (lcfg->lcfg_command) { @@ -1327,7 +1327,7 @@ static int lmv_process_config(struct obd_device *obd, u32 len, void *buf) } static int lmv_statfs(const struct lu_env *env, struct obd_export *exp, - struct obd_statfs *osfs, __u64 max_age, __u32 flags) + struct obd_statfs *osfs, u64 max_age, u32 flags) { struct obd_device *obd = class_exp2obd(exp); struct lmv_obd *lmv = &obd->u.lmv; @@ -1585,7 +1585,7 @@ struct lmv_tgt_desc* static int lmv_create(struct obd_export *exp, struct md_op_data *op_data, const void *data, size_t datalen, umode_t mode, uid_t uid, gid_t gid, kernel_cap_t cap_effective, - __u64 rdev, struct ptlrpc_request **request) + u64 rdev, struct ptlrpc_request **request) { struct obd_device *obd = exp->exp_obd; struct lmv_obd *lmv = &obd->u.lmv; @@ -1639,7 +1639,7 @@ static int lmv_create(struct obd_export *exp, struct md_op_data *op_data, static int lmv_enqueue(struct obd_export *exp, struct ldlm_enqueue_info *einfo, const union ldlm_policy_data *policy, struct md_op_data *op_data, - struct lustre_handle *lockh, __u64 extra_lock_flags) + struct lustre_handle *lockh, u64 extra_lock_flags) { struct obd_device *obd = exp->exp_obd; struct lmv_obd *lmv = &obd->u.lmv; @@ -2029,7 +2029,7 @@ static int lmv_fsync(struct obd_export *exp, const struct lu_fid *fid, static int lmv_get_min_striped_entry(struct obd_export *exp, struct md_op_data *op_data, struct md_callback *cb_op, - __u64 hash_offset, int *stripe_offset, + u64 hash_offset, int *stripe_offset, struct lu_dirent **entp, struct page **ppage) { @@ -2046,7 +2046,7 @@ static int lmv_get_min_striped_entry(struct obd_export *exp, stripe_count = lsm->lsm_md_stripe_count; for (i = 0; i < stripe_count; i++) { - __u64 stripe_hash = hash_offset; + u64 stripe_hash = hash_offset; struct lu_dirent *ent = NULL; struct page *page = NULL; struct lu_dirpage *dp; @@ -2167,12 +2167,12 @@ static int lmv_get_min_striped_entry(struct obd_export *exp, static int lmv_read_striped_page(struct obd_export *exp, struct md_op_data *op_data, struct md_callback *cb_op, - __u64 offset, struct page **ppage) + u64 offset, struct page **ppage) { struct inode *master_inode = op_data->op_data; struct lu_fid master_fid = op_data->op_fid1; - __u64 hash_offset = offset; - __u32 ldp_flags; + u64 hash_offset = offset; + u32 ldp_flags; struct page *min_ent_page = NULL; struct page *ent_page = NULL; struct lu_dirent *min_ent = NULL; @@ -2203,7 +2203,7 @@ static int lmv_read_striped_page(struct obd_export *exp, ent = area; last_ent = ent; do { - __u16 ent_size; + u16 ent_size; /* Find the minum entry from all sub-stripes */ rc = lmv_get_min_striped_entry(exp, op_data, cb_op, hash_offset, @@ -2295,7 +2295,7 @@ static int lmv_read_striped_page(struct obd_export *exp, } static int lmv_read_page(struct obd_export *exp, struct md_op_data *op_data, - struct md_callback *cb_op, __u64 offset, + struct md_callback *cb_op, u64 offset, struct page **ppage) { struct lmv_stripe_md *lsm = op_data->op_mea1; @@ -2517,7 +2517,7 @@ static int lmv_precleanup(struct obd_device *obd) * \retval negative negated errno on failure */ static int lmv_get_info(const struct lu_env *env, struct obd_export *exp, - __u32 keylen, void *key, __u32 *vallen, void *val) + u32 keylen, void *key, u32 *vallen, void *val) { struct obd_device *obd; struct lmv_obd *lmv; @@ -2534,7 +2534,7 @@ static int lmv_get_info(const struct lu_env *env, struct obd_export *exp, if (keylen >= strlen("remote_flag") && !strcmp(key, "remote_flag")) { int i; - LASSERT(*vallen == sizeof(__u32)); + LASSERT(*vallen == sizeof(u32)); for (i = 0; i < lmv->desc.ld_tgt_count; i++) { struct lmv_tgt_desc *tgt = lmv->tgts[i]; @@ -2780,7 +2780,7 @@ static int lmv_cancel_unused(struct obd_export *exp, const struct lu_fid *fid, static int lmv_set_lock_data(struct obd_export *exp, const struct lustre_handle *lockh, - void *data, __u64 *bits) + void *data, u64 *bits) { struct lmv_obd *lmv = &exp->exp_obd->u.lmv; struct lmv_tgt_desc *tgt = lmv->tgts[0]; @@ -2791,7 +2791,7 @@ static int lmv_set_lock_data(struct obd_export *exp, return md_set_lock_data(tgt->ltd_exp, lockh, data, bits); } -static enum ldlm_mode lmv_lock_match(struct obd_export *exp, __u64 flags, +static enum ldlm_mode lmv_lock_match(struct obd_export *exp, u64 flags, const struct lu_fid *fid, enum ldlm_type type, union ldlm_policy_data *policy, @@ -2925,7 +2925,7 @@ static int lmv_intent_getattr_async(struct obd_export *exp, } static int lmv_revalidate_lock(struct obd_export *exp, struct lookup_intent *it, - struct lu_fid *fid, __u64 *bits) + struct lu_fid *fid, u64 *bits) { struct obd_device *obd = exp->exp_obd; struct lmv_obd *lmv = &obd->u.lmv; @@ -2967,7 +2967,7 @@ static int lmv_quotactl(struct obd_device *unused, struct obd_export *exp, struct lmv_obd *lmv = &obd->u.lmv; struct lmv_tgt_desc *tgt = lmv->tgts[0]; int rc = 0; - __u64 curspace = 0, curinodes = 0; + u64 curspace = 0, curinodes = 0; u32 i; if (!tgt || !tgt->ltd_exp || !tgt->ltd_active || diff --git a/drivers/staging/lustre/lustre/lov/lov_cl_internal.h b/drivers/staging/lustre/lustre/lov/lov_cl_internal.h index 5d4c83b..d83b8de 100644 --- a/drivers/staging/lustre/lustre/lov/lov_cl_internal.h +++ b/drivers/staging/lustre/lustre/lov/lov_cl_internal.h @@ -98,9 +98,9 @@ struct lov_device { struct cl_device ld_cl; struct lov_obd *ld_lov; /** size of lov_device::ld_target[] array */ - __u32 ld_target_nr; + u32 ld_target_nr; struct lovsub_device **ld_target; - __u32 ld_flags; + u32 ld_flags; }; /** diff --git a/drivers/staging/lustre/lustre/lov/lov_dev.c b/drivers/staging/lustre/lustre/lov/lov_dev.c index abf2ede..67d30fb 100644 --- a/drivers/staging/lustre/lustre/lov/lov_dev.c +++ b/drivers/staging/lustre/lustre/lov/lov_dev.c @@ -218,7 +218,7 @@ static struct lu_device *lov_device_free(const struct lu_env *env, } static void lov_cl_del_target(const struct lu_env *env, struct lu_device *dev, - __u32 index) + u32 index) { struct lov_device *ld = lu2lov_dev(dev); @@ -231,8 +231,8 @@ static void lov_cl_del_target(const struct lu_env *env, struct lu_device *dev, static int lov_expand_targets(const struct lu_env *env, struct lov_device *dev) { int result; - __u32 tgt_size; - __u32 sub_size; + u32 tgt_size; + u32 sub_size; result = 0; tgt_size = dev->ld_lov->lov_tgt_size; @@ -257,7 +257,7 @@ static int lov_expand_targets(const struct lu_env *env, struct lov_device *dev) } static int lov_cl_add_target(const struct lu_env *env, struct lu_device *dev, - __u32 index) + u32 index) { struct obd_device *obd = dev->ld_obd; struct lov_device *ld = lu2lov_dev(dev); @@ -304,7 +304,7 @@ static int lov_process_config(const struct lu_env *env, int cmd; int rc; int gen; - __u32 index; + u32 index; lov_tgts_getref(obd); diff --git a/drivers/staging/lustre/lustre/lov/lov_internal.h b/drivers/staging/lustre/lustre/lov/lov_internal.h index 2b31c99..9708f1b 100644 --- a/drivers/staging/lustre/lustre/lov/lov_internal.h +++ b/drivers/staging/lustre/lustre/lov/lov_internal.h @@ -241,7 +241,7 @@ struct lov_request_set { /* lov_merge.c */ int lov_merge_lvb_kms(struct lov_stripe_md *lsm, int index, - struct ost_lvb *lvb, __u64 *kms_place); + struct ost_lvb *lvb, u64 *kms_place); /* lov_offset.c */ u64 lov_stripe_size(struct lov_stripe_md *lsm, int index, u64 ost_size, @@ -267,17 +267,17 @@ int lov_prep_statfs_set(struct obd_device *obd, struct obd_info *oinfo, void lov_stripe_lock(struct lov_stripe_md *md); void lov_stripe_unlock(struct lov_stripe_md *md); void lov_fix_desc(struct lov_desc *desc); -void lov_fix_desc_stripe_size(__u64 *val); -void lov_fix_desc_stripe_count(__u32 *val); -void lov_fix_desc_pattern(__u32 *val); -void lov_fix_desc_qos_maxage(__u32 *val); +void lov_fix_desc_stripe_size(u64 *val); +void lov_fix_desc_stripe_count(u32 *val); +void lov_fix_desc_pattern(u32 *val); +void lov_fix_desc_qos_maxage(u32 *val); u16 lov_get_stripe_count(struct lov_obd *lov, u32 magic, u16 stripe_count); -int lov_connect_obd(struct obd_device *obd, __u32 index, int activate, +int lov_connect_obd(struct obd_device *obd, u32 index, int activate, struct obd_connect_data *data); int lov_setup(struct obd_device *obd, struct lustre_cfg *lcfg); int lov_process_config_base(struct obd_device *obd, struct lustre_cfg *lcfg, - __u32 *indexp, int *genp); -int lov_del_target(struct obd_device *obd, __u32 index, + u32 *indexp, int *genp); +int lov_del_target(struct obd_device *obd, u32 index, struct obd_uuid *uuidp, int gen); /* lov_pack.c */ @@ -303,8 +303,8 @@ struct lov_stripe_md *lov_unpackmd(struct lov_obd *lov, void *buf, /* ost_pool methods */ int lov_ost_pool_init(struct ost_pool *op, unsigned int count); int lov_ost_pool_extend(struct ost_pool *op, unsigned int min_count); -int lov_ost_pool_add(struct ost_pool *op, __u32 idx, unsigned int min_count); -int lov_ost_pool_remove(struct ost_pool *op, __u32 idx); +int lov_ost_pool_add(struct ost_pool *op, u32 idx, unsigned int min_count); +int lov_ost_pool_remove(struct ost_pool *op, u32 idx); int lov_ost_pool_free(struct ost_pool *op); /* high level pool methods */ diff --git a/drivers/staging/lustre/lustre/lov/lov_merge.c b/drivers/staging/lustre/lustre/lov/lov_merge.c index 79edc26..ab0ba12 100644 --- a/drivers/staging/lustre/lustre/lov/lov_merge.c +++ b/drivers/staging/lustre/lustre/lov/lov_merge.c @@ -42,12 +42,12 @@ * uptodate time on the local client. */ int lov_merge_lvb_kms(struct lov_stripe_md *lsm, int index, - struct ost_lvb *lvb, __u64 *kms_place) + struct ost_lvb *lvb, u64 *kms_place) { struct lov_stripe_md_entry *lse = lsm->lsm_entries[index]; - __u64 size = 0; - __u64 kms = 0; - __u64 blocks = 0; + u64 size = 0; + u64 kms = 0; + u64 blocks = 0; s64 current_mtime = lvb->lvb_mtime; s64 current_atime = lvb->lvb_atime; s64 current_ctime = lvb->lvb_ctime; diff --git a/drivers/staging/lustre/lustre/lov/lov_obd.c b/drivers/staging/lustre/lustre/lov/lov_obd.c index 6959b91..109dd69 100644 --- a/drivers/staging/lustre/lustre/lov/lov_obd.c +++ b/drivers/staging/lustre/lustre/lov/lov_obd.c @@ -123,7 +123,7 @@ static int lov_set_osc_active(struct obd_device *obd, struct obd_uuid *uuid, static int lov_notify(struct obd_device *obd, struct obd_device *watched, enum obd_notify_event ev); -int lov_connect_obd(struct obd_device *obd, __u32 index, int activate, +int lov_connect_obd(struct obd_device *obd, u32 index, int activate, struct obd_connect_data *data) { struct lov_obd *lov = &obd->u.lov; @@ -477,7 +477,7 @@ static int lov_notify(struct obd_device *obd, struct obd_device *watched, } static int lov_add_target(struct obd_device *obd, struct obd_uuid *uuidp, - __u32 index, int gen, int active) + u32 index, int gen, int active) { struct lov_obd *lov = &obd->u.lov; struct lov_tgt_desc *tgt; @@ -511,9 +511,9 @@ static int lov_add_target(struct obd_device *obd, struct obd_uuid *uuidp, if (index >= lov->lov_tgt_size) { /* We need to reallocate the lov target array. */ struct lov_tgt_desc **newtgts, **old = NULL; - __u32 newsize, oldsize = 0; + u32 newsize, oldsize = 0; - newsize = max_t(__u32, lov->lov_tgt_size, 2); + newsize = max_t(u32, lov->lov_tgt_size, 2); while (newsize < index + 1) newsize <<= 1; newtgts = kcalloc(newsize, sizeof(*newtgts), GFP_NOFS); @@ -609,7 +609,7 @@ static int lov_add_target(struct obd_device *obd, struct obd_uuid *uuidp, } /* Schedule a target for deletion */ -int lov_del_target(struct obd_device *obd, __u32 index, +int lov_del_target(struct obd_device *obd, u32 index, struct obd_uuid *uuidp, int gen) { struct lov_obd *lov = &obd->u.lov; @@ -681,7 +681,7 @@ static void __lov_del_obd(struct obd_device *obd, struct lov_tgt_desc *tgt) class_manual_cleanup(osc_obd); } -void lov_fix_desc_stripe_size(__u64 *val) +void lov_fix_desc_stripe_size(u64 *val) { if (*val < LOV_MIN_STRIPE_SIZE) { if (*val != 0) @@ -695,13 +695,13 @@ void lov_fix_desc_stripe_size(__u64 *val) } } -void lov_fix_desc_stripe_count(__u32 *val) +void lov_fix_desc_stripe_count(u32 *val) { if (*val == 0) *val = 1; } -void lov_fix_desc_pattern(__u32 *val) +void lov_fix_desc_pattern(u32 *val) { /* from lov_setstripe */ if ((*val != 0) && (*val != LOV_PATTERN_RAID0)) { @@ -710,7 +710,7 @@ void lov_fix_desc_pattern(__u32 *val) } } -void lov_fix_desc_qos_maxage(__u32 *val) +void lov_fix_desc_qos_maxage(u32 *val) { if (*val == 0) *val = LOV_DESC_QOS_MAXAGE_DEFAULT; @@ -843,7 +843,7 @@ static int lov_cleanup(struct obd_device *obd) } int lov_process_config_base(struct obd_device *obd, struct lustre_cfg *lcfg, - __u32 *indexp, int *genp) + u32 *indexp, int *genp) { struct obd_uuid obd_uuid; int cmd; @@ -853,7 +853,7 @@ int lov_process_config_base(struct obd_device *obd, struct lustre_cfg *lcfg, case LCFG_LOV_ADD_OBD: case LCFG_LOV_ADD_INA: case LCFG_LOV_DEL_OBD: { - __u32 index; + u32 index; int gen; /* lov_modify_tgts add 0:lov_mdsA 1:ost1_UUID 2:0 3:1 */ if (LUSTRE_CFG_BUFLEN(lcfg, 1) > sizeof(obd_uuid.uuid)) { @@ -923,7 +923,7 @@ int lov_process_config_base(struct obd_device *obd, struct lustre_cfg *lcfg, } static int lov_statfs_async(struct obd_export *exp, struct obd_info *oinfo, - __u64 max_age, struct ptlrpc_request_set *rqset) + u64 max_age, struct ptlrpc_request_set *rqset) { struct obd_device *obd = class_exp2obd(exp); struct lov_request_set *set; @@ -961,7 +961,7 @@ static int lov_statfs_async(struct obd_export *exp, struct obd_info *oinfo, } static int lov_statfs(const struct lu_env *env, struct obd_export *exp, - struct obd_statfs *osfs, __u64 max_age, __u32 flags) + struct obd_statfs *osfs, u64 max_age, u32 flags) { struct ptlrpc_request_set *set = NULL; struct obd_info oinfo = { @@ -998,10 +998,10 @@ static int lov_iocontrol(unsigned int cmd, struct obd_export *exp, int len, struct obd_ioctl_data *data = karg; struct obd_device *osc_obd; struct obd_statfs stat_buf = {0}; - __u32 index; - __u32 flags; + u32 index; + u32 flags; - memcpy(&index, data->ioc_inlbuf2, sizeof(__u32)); + memcpy(&index, data->ioc_inlbuf2, sizeof(u32)); if (index >= count) return -ENODEV; @@ -1021,7 +1021,7 @@ static int lov_iocontrol(unsigned int cmd, struct obd_export *exp, int len, sizeof(struct obd_uuid)))) return -EFAULT; - memcpy(&flags, data->ioc_inlbuf1, sizeof(__u32)); + memcpy(&flags, data->ioc_inlbuf1, sizeof(u32)); flags = flags & LL_STATFS_NODELAY ? OBD_STATFS_NODELAY : 0; /* got statfs data */ @@ -1040,7 +1040,7 @@ static int lov_iocontrol(unsigned int cmd, struct obd_export *exp, int len, struct obd_ioctl_data *data; struct lov_desc *desc; char *buf = NULL; - __u32 *genp; + u32 *genp; len = 0; if (obd_ioctl_getdata(&buf, &len, uarg)) @@ -1058,7 +1058,7 @@ static int lov_iocontrol(unsigned int cmd, struct obd_export *exp, int len, return -EINVAL; } - if (sizeof(__u32) * count > data->ioc_inllen3) { + if (sizeof(u32) * count > data->ioc_inllen3) { kvfree(buf); return -EINVAL; } @@ -1067,7 +1067,7 @@ static int lov_iocontrol(unsigned int cmd, struct obd_export *exp, int len, memcpy(desc, &lov->desc, sizeof(*desc)); uuidp = (struct obd_uuid *)data->ioc_inlbuf2; - genp = (__u32 *)data->ioc_inlbuf3; + genp = (u32 *)data->ioc_inlbuf3; /* the uuid will be empty for deleted OSTs */ for (i = 0; i < count; i++, uuidp++, genp++) { if (!lov->lov_tgts[i]) @@ -1172,7 +1172,7 @@ static int lov_iocontrol(unsigned int cmd, struct obd_export *exp, int len, } static int lov_get_info(const struct lu_env *env, struct obd_export *exp, - __u32 keylen, void *key, __u32 *vallen, void *val) + u32 keylen, void *key, u32 *vallen, void *val) { struct obd_device *obddev = class_exp2obd(exp); struct lov_obd *lov = &obddev->u.lov; @@ -1283,8 +1283,8 @@ static int lov_quotactl(struct obd_device *obd, struct obd_export *exp, { struct lov_obd *lov = &obd->u.lov; struct lov_tgt_desc *tgt; - __u64 curspace = 0; - __u64 bhardlimit = 0; + u64 curspace = 0; + u64 bhardlimit = 0; int i, rc = 0; if (oqctl->qc_cmd != Q_GETOQUOTA && diff --git a/drivers/staging/lustre/lustre/lov/lov_pack.c b/drivers/staging/lustre/lustre/lov/lov_pack.c index 0a6bb1e..fde5160 100644 --- a/drivers/staging/lustre/lustre/lov/lov_pack.c +++ b/drivers/staging/lustre/lustre/lov/lov_pack.c @@ -252,7 +252,7 @@ ssize_t lov_lsm_pack(const struct lov_stripe_md *lsm, void *buf, /* Find the max stripecount we should use */ u16 lov_get_stripe_count(struct lov_obd *lov, u32 magic, u16 stripe_count) { - __u32 max_stripes = LOV_MAX_STRIPE_COUNT_OLD; + u32 max_stripes = LOV_MAX_STRIPE_COUNT_OLD; if (!stripe_count) stripe_count = lov->desc.ld_default_stripe_count; diff --git a/drivers/staging/lustre/lustre/lov/lov_pool.c b/drivers/staging/lustre/lustre/lov/lov_pool.c index b90fb1c..177f5a5 100644 --- a/drivers/staging/lustre/lustre/lov/lov_pool.c +++ b/drivers/staging/lustre/lustre/lov/lov_pool.c @@ -273,7 +273,7 @@ int lov_ost_pool_extend(struct ost_pool *op, unsigned int min_count) return 0; } -int lov_ost_pool_add(struct ost_pool *op, __u32 idx, unsigned int min_count) +int lov_ost_pool_add(struct ost_pool *op, u32 idx, unsigned int min_count) { int rc = 0, i; @@ -298,7 +298,7 @@ int lov_ost_pool_add(struct ost_pool *op, __u32 idx, unsigned int min_count) return rc; } -int lov_ost_pool_remove(struct ost_pool *op, __u32 idx) +int lov_ost_pool_remove(struct ost_pool *op, u32 idx) { int i; diff --git a/drivers/staging/lustre/lustre/lov/lov_request.c b/drivers/staging/lustre/lustre/lov/lov_request.c index d13e8d1..45dca36 100644 --- a/drivers/staging/lustre/lustre/lov/lov_request.c +++ b/drivers/staging/lustre/lustre/lov/lov_request.c @@ -136,7 +136,7 @@ static int lov_check_and_wait_active(struct lov_obd *lov, int ost_idx) return rc; } -#define LOV_U64_MAX ((__u64)~0ULL) +#define LOV_U64_MAX ((u64)~0ULL) #define LOV_SUM_MAX(tot, add) \ do { \ if ((tot) + (add) < (tot)) \ @@ -188,7 +188,7 @@ static void lov_update_statfs(struct obd_statfs *osfs, int success) { int shift = 0, quit = 0; - __u64 tmp; + u64 tmp; if (success == 0) { memcpy(osfs, lov_sfs, sizeof(*lov_sfs)); diff --git a/drivers/staging/lustre/lustre/mdc/mdc_internal.h b/drivers/staging/lustre/lustre/mdc/mdc_internal.h index 6da9046..2b849e8 100644 --- a/drivers/staging/lustre/lustre/mdc/mdc_internal.h +++ b/drivers/staging/lustre/lustre/mdc/mdc_internal.h @@ -39,20 +39,20 @@ int mdc_tunables_init(struct obd_device *obd); void mdc_pack_body(struct ptlrpc_request *req, const struct lu_fid *fid, - __u64 valid, size_t ea_size, __u32 suppgid, u32 flags); + u64 valid, size_t ea_size, u32 suppgid, u32 flags); void mdc_swap_layouts_pack(struct ptlrpc_request *req, struct md_op_data *op_data); -void mdc_readdir_pack(struct ptlrpc_request *req, __u64 pgoff, size_t size, +void mdc_readdir_pack(struct ptlrpc_request *req, u64 pgoff, size_t size, const struct lu_fid *fid); -void mdc_getattr_pack(struct ptlrpc_request *req, __u64 valid, u32 flags, +void mdc_getattr_pack(struct ptlrpc_request *req, u64 valid, u32 flags, struct md_op_data *data, size_t ea_size); void mdc_setattr_pack(struct ptlrpc_request *req, struct md_op_data *op_data, void *ea, size_t ealen); void mdc_create_pack(struct ptlrpc_request *req, struct md_op_data *op_data, const void *data, size_t datalen, umode_t mode, uid_t uid, - gid_t gid, kernel_cap_t capability, __u64 rdev); + gid_t gid, kernel_cap_t capability, u64 rdev); void mdc_open_pack(struct ptlrpc_request *req, struct md_op_data *op_data, - umode_t mode, __u64 rdev, __u64 flags, const void *data, + umode_t mode, u64 rdev, u64 flags, const void *data, size_t datalen); void mdc_file_secctx_pack(struct ptlrpc_request *req, const char *secctx_name, @@ -68,7 +68,7 @@ void mdc_rename_pack(struct ptlrpc_request *req, struct md_op_data *op_data, /* mdc/mdc_locks.c */ int mdc_set_lock_data(struct obd_export *exp, const struct lustre_handle *lockh, - void *data, __u64 *bits); + void *data, u64 *bits); int mdc_null_inode(struct obd_export *exp, const struct lu_fid *fid); @@ -77,7 +77,7 @@ int mdc_intent_lock(struct obd_export *exp, struct lookup_intent *it, struct ptlrpc_request **reqp, ldlm_blocking_callback cb_blocking, - __u64 extra_lock_flags); + u64 extra_lock_flags); int mdc_enqueue(struct obd_export *exp, struct ldlm_enqueue_info *einfo, const union ldlm_policy_data *policy, @@ -86,7 +86,7 @@ int mdc_enqueue(struct obd_export *exp, struct ldlm_enqueue_info *einfo, int mdc_resource_get_unused(struct obd_export *exp, const struct lu_fid *fid, struct list_head *cancels, enum ldlm_mode mode, - __u64 bits); + u64 bits); /* mdc/mdc_request.c */ int mdc_fid_alloc(const struct lu_env *env, struct obd_export *exp, struct lu_fid *fid, struct md_op_data *op_data); @@ -101,7 +101,7 @@ int mdc_set_open_replay_data(struct obd_export *exp, int mdc_create(struct obd_export *exp, struct md_op_data *op_data, const void *data, size_t datalen, umode_t mode, uid_t uid, - gid_t gid, kernel_cap_t capability, __u64 rdev, + gid_t gid, kernel_cap_t capability, u64 rdev, struct ptlrpc_request **request); int mdc_link(struct obd_export *exp, struct md_op_data *op_data, struct ptlrpc_request **request); @@ -118,12 +118,12 @@ int mdc_cancel_unused(struct obd_export *exp, const struct lu_fid *fid, enum ldlm_cancel_flags flags, void *opaque); int mdc_revalidate_lock(struct obd_export *exp, struct lookup_intent *it, - struct lu_fid *fid, __u64 *bits); + struct lu_fid *fid, u64 *bits); int mdc_intent_getattr_async(struct obd_export *exp, struct md_enqueue_info *minfo); -enum ldlm_mode mdc_lock_match(struct obd_export *exp, __u64 flags, +enum ldlm_mode mdc_lock_match(struct obd_export *exp, u64 flags, const struct lu_fid *fid, enum ldlm_type type, union ldlm_policy_data *policy, enum ldlm_mode mode, @@ -141,7 +141,7 @@ static inline int mdc_prep_elc_req(struct obd_export *exp, count); } -static inline unsigned long hash_x_index(__u64 hash, int hash64) +static inline unsigned long hash_x_index(u64 hash, int hash64) { if (BITS_PER_LONG == 32 && hash64) hash >>= 32; diff --git a/drivers/staging/lustre/lustre/mdc/mdc_lib.c b/drivers/staging/lustre/lustre/mdc/mdc_lib.c index a1b1e75..3dfc863 100644 --- a/drivers/staging/lustre/lustre/mdc/mdc_lib.c +++ b/drivers/staging/lustre/lustre/mdc/mdc_lib.c @@ -42,7 +42,7 @@ static void set_mrc_cr_flags(struct mdt_rec_create *mrc, u64 flags) mrc->cr_flags_h = (u32)(flags >> 32); } -static void __mdc_pack_body(struct mdt_body *b, __u32 suppgid) +static void __mdc_pack_body(struct mdt_body *b, u32 suppgid) { b->mbo_suppgid = suppgid; b->mbo_uid = from_kuid(&init_user_ns, current_uid()); @@ -65,7 +65,7 @@ void mdc_swap_layouts_pack(struct ptlrpc_request *req, } void mdc_pack_body(struct ptlrpc_request *req, const struct lu_fid *fid, - __u64 valid, size_t ea_size, __u32 suppgid, u32 flags) + u64 valid, size_t ea_size, u32 suppgid, u32 flags) { struct mdt_body *b = req_capsule_client_get(&req->rq_pill, &RMF_MDT_BODY); @@ -134,7 +134,7 @@ void mdc_file_secctx_pack(struct ptlrpc_request *req, const char *secctx_name, memcpy(buf, secctx, buf_size); } -void mdc_readdir_pack(struct ptlrpc_request *req, __u64 pgoff, size_t size, +void mdc_readdir_pack(struct ptlrpc_request *req, u64 pgoff, size_t size, const struct lu_fid *fid) { struct mdt_body *b = req_capsule_client_get(&req->rq_pill, @@ -151,11 +151,11 @@ void mdc_readdir_pack(struct ptlrpc_request *req, __u64 pgoff, size_t size, void mdc_create_pack(struct ptlrpc_request *req, struct md_op_data *op_data, const void *data, size_t datalen, umode_t mode, uid_t uid, gid_t gid, kernel_cap_t cap_effective, - __u64 rdev) + u64 rdev) { struct mdt_rec_create *rec; char *tmp; - __u64 flags; + u64 flags; BUILD_BUG_ON(sizeof(struct mdt_rec_reint) != sizeof(struct mdt_rec_create)); rec = req_capsule_client_get(&req->rq_pill, &RMF_REC_REINT); @@ -189,9 +189,9 @@ void mdc_create_pack(struct ptlrpc_request *req, struct md_op_data *op_data, op_data->op_file_secctx_size); } -static inline __u64 mds_pack_open_flags(__u64 flags) +static inline u64 mds_pack_open_flags(u64 flags) { - __u64 cr_flags = (flags & (FMODE_READ | FMODE_WRITE | + u64 cr_flags = (flags & (FMODE_READ | FMODE_WRITE | MDS_OPEN_FL_INTERNAL)); if (flags & O_CREAT) cr_flags |= MDS_OPEN_CREAT; @@ -218,12 +218,12 @@ static inline __u64 mds_pack_open_flags(__u64 flags) /* packing of MDS records */ void mdc_open_pack(struct ptlrpc_request *req, struct md_op_data *op_data, - umode_t mode, __u64 rdev, __u64 flags, const void *lmm, + umode_t mode, u64 rdev, u64 flags, const void *lmm, size_t lmmlen) { struct mdt_rec_create *rec; char *tmp; - __u64 cr_flags; + u64 cr_flags; BUILD_BUG_ON(sizeof(struct mdt_rec_reint) != sizeof(struct mdt_rec_create)); rec = req_capsule_client_get(&req->rq_pill, &RMF_REC_REINT); @@ -268,7 +268,7 @@ void mdc_open_pack(struct ptlrpc_request *req, struct md_op_data *op_data, static inline u64 attr_pack(unsigned int ia_valid, enum op_xvalid ia_xvalid) { - __u64 sa_valid = 0; + u64 sa_valid = 0; if (ia_valid & ATTR_MODE) sa_valid |= MDS_ATTR_MODE; @@ -483,7 +483,7 @@ void mdc_rename_pack(struct ptlrpc_request *req, struct md_op_data *op_data, } } -void mdc_getattr_pack(struct ptlrpc_request *req, __u64 valid, u32 flags, +void mdc_getattr_pack(struct ptlrpc_request *req, u64 valid, u32 flags, struct md_op_data *op_data, size_t ea_size) { struct mdt_body *b = req_capsule_client_get(&req->rq_pill, diff --git a/drivers/staging/lustre/lustre/mdc/mdc_locks.c b/drivers/staging/lustre/lustre/mdc/mdc_locks.c index a60959d..e16dce6 100644 --- a/drivers/staging/lustre/lustre/mdc/mdc_locks.c +++ b/drivers/staging/lustre/lustre/mdc/mdc_locks.c @@ -96,7 +96,7 @@ int it_open_error(int phase, struct lookup_intent *it) /* this must be called on a lockh that is known to have a referenced lock */ int mdc_set_lock_data(struct obd_export *exp, const struct lustre_handle *lockh, - void *data, __u64 *bits) + void *data, u64 *bits) { struct ldlm_lock *lock; struct inode *new_inode = data; @@ -131,7 +131,7 @@ int mdc_set_lock_data(struct obd_export *exp, const struct lustre_handle *lockh, return 0; } -enum ldlm_mode mdc_lock_match(struct obd_export *exp, __u64 flags, +enum ldlm_mode mdc_lock_match(struct obd_export *exp, u64 flags, const struct lu_fid *fid, enum ldlm_type type, union ldlm_policy_data *policy, enum ldlm_mode mode, @@ -319,7 +319,7 @@ static int mdc_save_lovea(struct ptlrpc_request *req, /* pack the intent */ lit = req_capsule_client_get(&req->rq_pill, &RMF_LDLM_INTENT); - lit->opc = (__u64)it->it_op; + lit->opc = (u64)it->it_op; /* pack the intended request */ mdc_open_pack(req, op_data, it->it_create_mode, 0, it->it_flags, lmm, @@ -423,7 +423,7 @@ static struct ptlrpc_request *mdc_intent_unlink_pack(struct obd_export *exp, /* pack the intent */ lit = req_capsule_client_get(&req->rq_pill, &RMF_LDLM_INTENT); - lit->opc = (__u64)it->it_op; + lit->opc = (u64)it->it_op; /* pack the intended request */ mdc_unlink_pack(req, op_data); @@ -463,7 +463,7 @@ static struct ptlrpc_request *mdc_intent_getattr_pack(struct obd_export *exp, /* pack the intent */ lit = req_capsule_client_get(&req->rq_pill, &RMF_LDLM_INTENT); - lit->opc = (__u64)it->it_op; + lit->opc = (u64)it->it_op; if (obddev->u.cli.cl_default_mds_easize > 0) easize = obddev->u.cli.cl_default_mds_easize; @@ -504,7 +504,7 @@ static struct ptlrpc_request *mdc_intent_layout_pack(struct obd_export *exp, /* pack the intent */ lit = req_capsule_client_get(&req->rq_pill, &RMF_LDLM_INTENT); - lit->opc = (__u64)it->it_op; + lit->opc = (u64)it->it_op; /* pack the layout intent request */ layout = req_capsule_client_get(&req->rq_pill, &RMF_LAYOUT_INTENT); @@ -1031,7 +1031,7 @@ static int mdc_finish_intent_lock(struct obd_export *exp, } int mdc_revalidate_lock(struct obd_export *exp, struct lookup_intent *it, - struct lu_fid *fid, __u64 *bits) + struct lu_fid *fid, u64 *bits) { /* We could just return 1 immediately, but since we should only * be called in revalidate_it if we already have a lock, let's @@ -1126,7 +1126,7 @@ int mdc_revalidate_lock(struct obd_export *exp, struct lookup_intent *it, */ int mdc_intent_lock(struct obd_export *exp, struct md_op_data *op_data, struct lookup_intent *it, struct ptlrpc_request **reqp, - ldlm_blocking_callback cb_blocking, __u64 extra_lock_flags) + ldlm_blocking_callback cb_blocking, u64 extra_lock_flags) { struct ldlm_enqueue_info einfo = { .ei_type = LDLM_IBITS, @@ -1192,7 +1192,7 @@ static int mdc_intent_getattr_async_interpret(const struct lu_env *env, struct lustre_handle *lockh; struct obd_device *obddev; struct ldlm_reply *lockrep; - __u64 flags = LDLM_FL_HAS_INTENT; + u64 flags = LDLM_FL_HAS_INTENT; it = &minfo->mi_it; lockh = &minfo->mi_lockh; @@ -1240,7 +1240,7 @@ int mdc_intent_getattr_async(struct obd_export *exp, .l_inodebits = { MDS_INODELOCK_LOOKUP | MDS_INODELOCK_UPDATE } }; int rc = 0; - __u64 flags = LDLM_FL_HAS_INTENT; + u64 flags = LDLM_FL_HAS_INTENT; CDEBUG(D_DLMTRACE, "name: %.*s in inode " DFID ", intent: %s flags %#Lo\n", diff --git a/drivers/staging/lustre/lustre/mdc/mdc_reint.c b/drivers/staging/lustre/lustre/mdc/mdc_reint.c index bdffe6d..765c908 100644 --- a/drivers/staging/lustre/lustre/mdc/mdc_reint.c +++ b/drivers/staging/lustre/lustre/mdc/mdc_reint.c @@ -64,7 +64,7 @@ static int mdc_reint(struct ptlrpc_request *request, int level) */ int mdc_resource_get_unused(struct obd_export *exp, const struct lu_fid *fid, struct list_head *cancels, enum ldlm_mode mode, - __u64 bits) + u64 bits) { struct ldlm_namespace *ns = exp->exp_obd->obd_namespace; union ldlm_policy_data policy = {}; @@ -103,7 +103,7 @@ int mdc_setattr(struct obd_export *exp, struct md_op_data *op_data, LIST_HEAD(cancels); struct ptlrpc_request *req; int count = 0, rc; - __u64 bits; + u64 bits; bits = MDS_INODELOCK_UPDATE; if (op_data->op_attr.ia_valid & (ATTR_MODE | ATTR_UID | ATTR_GID)) @@ -151,7 +151,7 @@ int mdc_setattr(struct obd_export *exp, struct md_op_data *op_data, int mdc_create(struct obd_export *exp, struct md_op_data *op_data, const void *data, size_t datalen, umode_t mode, uid_t uid, gid_t gid, kernel_cap_t cap_effective, - __u64 rdev, struct ptlrpc_request **request) + u64 rdev, struct ptlrpc_request **request) { struct ptlrpc_request *req; int level, rc; diff --git a/drivers/staging/lustre/lustre/mdc/mdc_request.c b/drivers/staging/lustre/lustre/mdc/mdc_request.c index 09b30ef..1aee1c5 100644 --- a/drivers/staging/lustre/lustre/mdc/mdc_request.c +++ b/drivers/staging/lustre/lustre/mdc/mdc_request.c @@ -278,7 +278,7 @@ static int mdc_xattr_common(struct obd_export *exp, int opcode, u64 valid, const char *xattr_name, const char *input, int input_size, int output_size, int flags, - __u32 suppgid, struct ptlrpc_request **request) + u32 suppgid, struct ptlrpc_request **request) { struct ptlrpc_request *req; int xattr_namelen = 0; @@ -594,7 +594,7 @@ void mdc_replay_open(struct ptlrpc_request *req) close_req = mod->mod_close_req; if (close_req) { - __u32 opc = lustre_msg_get_opc(close_req->rq_reqmsg); + u32 opc = lustre_msg_get_opc(close_req->rq_reqmsg); struct mdt_ioepoch *epoch; LASSERT(opc == MDS_CLOSE); @@ -977,8 +977,8 @@ static void mdc_release_page(struct page *page, int remove) put_page(page); } -static struct page *mdc_page_locate(struct address_space *mapping, __u64 *hash, - __u64 *start, __u64 *end, int hash64) +static struct page *mdc_page_locate(struct address_space *mapping, u64 *hash, + u64 *start, u64 *end, int hash64) { /* * Complement of hash is used as an index so that @@ -1107,8 +1107,8 @@ static void mdc_adjust_dirpages(struct page **pages, int cfs_pgs, int lu_pgs) for (i = 0; i < cfs_pgs; i++) { struct lu_dirpage *dp = kmap(pages[i]); - __u64 hash_end = le64_to_cpu(dp->ldp_hash_end); - __u32 flags = le32_to_cpu(dp->ldp_flags); + u64 hash_end = le64_to_cpu(dp->ldp_hash_end); + u32 flags = le32_to_cpu(dp->ldp_flags); struct lu_dirpage *first = dp; while (--lu_pgs > 0) { @@ -1159,7 +1159,7 @@ static void mdc_adjust_dirpages(struct page **pages, int cfs_pgs, int lu_pgs) /* parameters for readdir page */ struct readpage_param { struct md_op_data *rp_mod; - __u64 rp_off; + u64 rp_off; int rp_hash64; struct obd_export *rp_exp; struct md_callback *rp_cb; @@ -1234,7 +1234,7 @@ static int mdc_read_page_remote(void *data, struct page *page0) CDEBUG(D_CACHE, "read %d/%d pages\n", rd_pgs, npages); for (i = 1; i < npages; i++) { unsigned long offset; - __u64 hash; + u64 hash; int ret; page = page_pool[i]; @@ -1285,7 +1285,7 @@ static int mdc_read_page_remote(void *data, struct page *page0) * errno(<0) get the page failed */ static int mdc_read_page(struct obd_export *exp, struct md_op_data *op_data, - struct md_callback *cb_op, __u64 hash_offset, + struct md_callback *cb_op, u64 hash_offset, struct page **ppage) { struct lookup_intent it = { .it_op = IT_READDIR }; @@ -1293,8 +1293,8 @@ static int mdc_read_page(struct obd_export *exp, struct md_op_data *op_data, struct inode *dir = op_data->op_data; struct address_space *mapping; struct lu_dirpage *dp; - __u64 start = 0; - __u64 end = 0; + u64 start = 0; + u64 end = 0; struct lustre_handle lockh; struct ptlrpc_request *enq_req = NULL; struct readpage_param rp_param; @@ -1418,7 +1418,7 @@ static int mdc_read_page(struct obd_export *exp, struct md_op_data *op_data, static int mdc_statfs(const struct lu_env *env, struct obd_export *exp, struct obd_statfs *osfs, - __u64 max_age, __u32 flags) + u64 max_age, u32 flags) { struct obd_device *obd = class_exp2obd(exp); struct ptlrpc_request *req; @@ -1476,7 +1476,7 @@ static int mdc_statfs(const struct lu_env *env, static int mdc_ioc_fid2path(struct obd_export *exp, struct getinfo_fid2path *gf) { - __u32 keylen, vallen; + u32 keylen, vallen; void *key; int rc; @@ -1567,9 +1567,9 @@ static int mdc_ioc_hsm_progress(struct obd_export *exp, return rc; } -static int mdc_ioc_hsm_ct_register(struct obd_import *imp, __u32 archives) +static int mdc_ioc_hsm_ct_register(struct obd_import *imp, u32 archives) { - __u32 *archive_mask; + u32 *archive_mask; struct ptlrpc_request *req; int rc; @@ -1967,7 +1967,7 @@ static int mdc_iocontrol(unsigned int cmd, struct obd_export *exp, int len, case IOC_OBD_STATFS: { struct obd_statfs stat_buf = {0}; - if (*((__u32 *)data->ioc_inlbuf2) != 0) { + if (*((u32 *)data->ioc_inlbuf2) != 0) { rc = -ENODEV; goto out; } @@ -2056,7 +2056,7 @@ static int mdc_get_info_rpc(struct obd_export *exp, req_capsule_set_size(&req->rq_pill, &RMF_GETINFO_KEY, RCL_CLIENT, keylen); req_capsule_set_size(&req->rq_pill, &RMF_GETINFO_VALLEN, - RCL_CLIENT, sizeof(__u32)); + RCL_CLIENT, sizeof(u32)); rc = ptlrpc_request_pack(req, LUSTRE_MDS_VERSION, MDS_GET_INFO); if (rc) { @@ -2067,7 +2067,7 @@ static int mdc_get_info_rpc(struct obd_export *exp, tmp = req_capsule_client_get(&req->rq_pill, &RMF_GETINFO_KEY); memcpy(tmp, key, keylen); tmp = req_capsule_client_get(&req->rq_pill, &RMF_GETINFO_VALLEN); - memcpy(tmp, &vallen, sizeof(__u32)); + memcpy(tmp, &vallen, sizeof(u32)); req_capsule_set_size(&req->rq_pill, &RMF_GETINFO_VAL, RCL_SERVER, vallen); @@ -2119,7 +2119,7 @@ static void lustre_swab_hal(struct hsm_action_list *h) static void lustre_swab_kuch(struct kuc_hdr *l) { __swab16s(&l->kuc_magic); - /* __u8 l->kuc_transport */ + /* u8 l->kuc_transport */ __swab16s(&l->kuc_msgtype); __swab16s(&l->kuc_msglen); } @@ -2128,7 +2128,7 @@ static int mdc_ioc_hsm_ct_start(struct obd_export *exp, struct lustre_kernelcomm *lk) { struct obd_import *imp = class_exp2cliimp(exp); - __u32 archive = lk->lk_data; + u32 archive = lk->lk_data; int rc = 0; if (lk->lk_group != KUC_GRP_HSM) { @@ -2264,7 +2264,7 @@ static int mdc_set_info_async(const struct lu_env *env, } static int mdc_get_info(const struct lu_env *env, struct obd_export *exp, - __u32 keylen, void *key, __u32 *vallen, void *val) + u32 keylen, void *key, u32 *vallen, void *val) { int rc = -EINVAL; diff --git a/drivers/staging/lustre/lustre/mgc/mgc_request.c b/drivers/staging/lustre/lustre/mgc/mgc_request.c index ca74c75..dc80081 100644 --- a/drivers/staging/lustre/lustre/mgc/mgc_request.c +++ b/drivers/staging/lustre/lustre/mgc/mgc_request.c @@ -53,7 +53,7 @@ static int mgc_name2resid(char *name, int len, struct ldlm_res_id *res_id, int type) { - __u64 resname = 0; + u64 resname = 0; if (len > sizeof(resname)) { CERROR("name too long: %s\n", name); @@ -883,10 +883,10 @@ static int mgc_set_mgs_param(struct obd_export *exp, } /* Take a config lock so we can get cancel notifications */ -static int mgc_enqueue(struct obd_export *exp, __u32 type, - union ldlm_policy_data *policy, __u32 mode, - __u64 *flags, void *bl_cb, void *cp_cb, void *gl_cb, - void *data, __u32 lvb_len, void *lvb_swabber, +static int mgc_enqueue(struct obd_export *exp, u32 type, + union ldlm_policy_data *policy, u32 mode, + u64 *flags, void *bl_cb, void *cp_cb, void *gl_cb, + void *data, u32 lvb_len, void *lvb_swabber, struct lustre_handle *lockh) { struct config_llog_data *cld = data; @@ -1055,7 +1055,7 @@ static int mgc_set_info_async(const struct lu_env *env, struct obd_export *exp, } static int mgc_get_info(const struct lu_env *env, struct obd_export *exp, - __u32 keylen, void *key, __u32 *vallen, void *val) + u32 keylen, void *key, u32 *vallen, void *val) { int rc = -EINVAL; @@ -1120,7 +1120,7 @@ enum { static int mgc_apply_recover_logs(struct obd_device *mgc, struct config_llog_data *cld, - __u64 max_version, + u64 max_version, void *data, int datalen, bool mne_swab) { struct config_llog_instance *cfg = &cld->cld_cfg; @@ -1597,7 +1597,7 @@ static bool mgc_import_in_recovery(struct obd_import *imp) int mgc_process_log(struct obd_device *mgc, struct config_llog_data *cld) { struct lustre_handle lockh = { 0 }; - __u64 flags = LDLM_FL_NO_LRU; + u64 flags = LDLM_FL_NO_LRU; bool retry = false; int rc = 0, rcl; diff --git a/drivers/staging/lustre/lustre/obdecho/echo_client.c b/drivers/staging/lustre/lustre/obdecho/echo_client.c index 39b7ab1..4f9dbc4 100644 --- a/drivers/staging/lustre/lustre/obdecho/echo_client.c +++ b/drivers/staging/lustre/lustre/obdecho/echo_client.c @@ -85,7 +85,7 @@ struct echo_lock { struct cl_lock_slice el_cl; struct list_head el_chain; struct echo_object *el_object; - __u64 el_cookie; + u64 el_cookie; atomic_t el_refcount; }; @@ -912,7 +912,7 @@ static int cl_echo_object_put(struct echo_object *eco) static int __cl_echo_enqueue(struct lu_env *env, struct echo_object *eco, u64 start, u64 end, int mode, - __u64 *cookie, __u32 enqflags) + u64 *cookie, u32 enqflags) { struct cl_io *io; struct cl_lock *lck; @@ -954,7 +954,7 @@ static int __cl_echo_enqueue(struct lu_env *env, struct echo_object *eco, } static int __cl_echo_cancel(struct lu_env *env, struct echo_device *ed, - __u64 cookie) + u64 cookie) { struct echo_client_obd *ec = ed->ed_ec; struct echo_lock *ecl = NULL; diff --git a/drivers/staging/lustre/lustre/obdecho/echo_internal.h b/drivers/staging/lustre/lustre/obdecho/echo_internal.h index 42faa16..ac7a209 100644 --- a/drivers/staging/lustre/lustre/obdecho/echo_internal.h +++ b/drivers/staging/lustre/lustre/obdecho/echo_internal.h @@ -34,7 +34,7 @@ /* The persistent object (i.e. actually stores stuff!) */ #define ECHO_PERSISTENT_OBJID 1ULL -#define ECHO_PERSISTENT_SIZE ((__u64)(1 << 20)) +#define ECHO_PERSISTENT_SIZE ((u64)(1 << 20)) /* block size to use for data verification */ #define OBD_ECHO_BLOCK_SIZE (4 << 10) diff --git a/drivers/staging/lustre/lustre/osc/osc_cache.c b/drivers/staging/lustre/lustre/osc/osc_cache.c index 7e80a07..bef422c 100644 --- a/drivers/staging/lustre/lustre/osc/osc_cache.c +++ b/drivers/staging/lustre/lustre/osc/osc_cache.c @@ -880,7 +880,7 @@ int osc_extent_finish(const struct lu_env *env, struct osc_extent *ext, int nr_pages = ext->oe_nr_pages; int lost_grant = 0; int blocksize = cli->cl_import->imp_obd->obd_osfs.os_bsize ? : 4096; - __u64 last_off = 0; + u64 last_off = 0; int last_count = -1; OSC_EXTENT_DUMP(D_CACHE, ext, "extent finished.\n"); @@ -991,7 +991,7 @@ static int osc_extent_truncate(struct osc_extent *ext, pgoff_t trunc_index, struct osc_async_page *tmp; int pages_in_chunk = 0; int ppc_bits = cli->cl_chunkbits - PAGE_SHIFT; - __u64 trunc_chunk = trunc_index >> ppc_bits; + u64 trunc_chunk = trunc_index >> ppc_bits; int grants = 0; int nr_pages = 0; int rc = 0; @@ -1799,7 +1799,7 @@ static int osc_list_maint(struct client_obd *cli, struct osc_object *osc) * sync so that the app can get a sync error and break the cycle of queueing * pages for which writeback will fail. */ -static void osc_process_ar(struct osc_async_rc *ar, __u64 xid, +static void osc_process_ar(struct osc_async_rc *ar, u64 xid, int rc) { if (rc) { @@ -1824,7 +1824,7 @@ static void osc_ap_completion(const struct lu_env *env, struct client_obd *cli, { struct osc_object *osc = oap->oap_obj; struct lov_oinfo *loi = osc->oo_oinfo; - __u64 xid = 0; + u64 xid = 0; if (oap->oap_request) { xid = ptlrpc_req_xid(oap->oap_request); @@ -3127,7 +3127,7 @@ static bool check_and_discard_cb(const struct lu_env *env, struct cl_io *io, tmp = osc_dlmlock_at_pgoff(env, osc, index, OSC_DAP_FL_TEST_LOCK); if (tmp) { - __u64 end = tmp->l_policy_data.l_extent.end; + u64 end = tmp->l_policy_data.l_extent.end; /* Cache the first-non-overlapped index so as to skip * all pages within [index, oti_fn_index). This is safe * because if tmp lock is canceled, it will discard diff --git a/drivers/staging/lustre/lustre/osc/osc_cl_internal.h b/drivers/staging/lustre/lustre/osc/osc_cl_internal.h index c0f58f4..c89c894 100644 --- a/drivers/staging/lustre/lustre/osc/osc_cl_internal.h +++ b/drivers/staging/lustre/lustre/osc/osc_cl_internal.h @@ -255,7 +255,7 @@ struct osc_lock { /* underlying DLM lock */ struct ldlm_lock *ols_dlmlock; /* DLM flags with which osc_lock::ols_lock was enqueued */ - __u64 ols_flags; + u64 ols_flags; /* osc_lock::ols_lock handle */ struct lustre_handle ols_handle; struct ldlm_enqueue_info ols_einfo; diff --git a/drivers/staging/lustre/lustre/osc/osc_internal.h b/drivers/staging/lustre/lustre/osc/osc_internal.h index c61ef89..4033365 100644 --- a/drivers/staging/lustre/lustre/osc/osc_internal.h +++ b/drivers/staging/lustre/lustre/osc/osc_internal.h @@ -91,7 +91,7 @@ static inline void osc_wake_cache_waiters(struct client_obd *cli) wake_up(&cli->cl_cache_waiters); } -int osc_shrink_grant_to_target(struct client_obd *cli, __u64 target_bytes); +int osc_shrink_grant_to_target(struct client_obd *cli, u64 target_bytes); void osc_update_next_shrink(struct client_obd *cli); /* @@ -103,7 +103,7 @@ typedef int (*osc_enqueue_upcall_f)(void *cookie, struct lustre_handle *lockh, int rc); int osc_enqueue_base(struct obd_export *exp, struct ldlm_res_id *res_id, - __u64 *flags, union ldlm_policy_data *policy, + u64 *flags, union ldlm_policy_data *policy, struct ost_lvb *lvb, int kms_valid, osc_enqueue_upcall_f upcall, void *cookie, struct ldlm_enqueue_info *einfo, @@ -111,7 +111,7 @@ int osc_enqueue_base(struct obd_export *exp, struct ldlm_res_id *res_id, int osc_match_base(struct obd_export *exp, struct ldlm_res_id *res_id, enum ldlm_type type, union ldlm_policy_data *policy, - enum ldlm_mode mode, __u64 *flags, void *data, + enum ldlm_mode mode, u64 *flags, void *data, struct lustre_handle *lockh, int unref); int osc_setattr_async(struct obd_export *exp, struct obdo *oa, diff --git a/drivers/staging/lustre/lustre/osc/osc_io.c b/drivers/staging/lustre/lustre/osc/osc_io.c index 0a7bfe2..cf5b3cc 100644 --- a/drivers/staging/lustre/lustre/osc/osc_io.c +++ b/drivers/staging/lustre/lustre/osc/osc_io.c @@ -240,7 +240,7 @@ static void osc_page_touch_at(const struct lu_env *env, struct lov_oinfo *loi = cl2osc(obj)->oo_oinfo; struct cl_attr *attr = &osc_env_info(env)->oti_attr; int valid; - __u64 kms; + u64 kms; /* offset within stripe */ kms = cl_offset(obj, idx) + to; @@ -454,7 +454,7 @@ static bool trunc_check_cb(const struct lu_env *env, struct cl_io *io, { struct cl_page *page = ops->ops_cl.cpl_page; struct osc_async_page *oap; - __u64 start = *(__u64 *)cbdata; + u64 start = *(u64 *)cbdata; oap = &ops->ops_oap; if (oap->oap_cmd & OBD_BRW_WRITE && @@ -470,7 +470,7 @@ static bool trunc_check_cb(const struct lu_env *env, struct cl_io *io, } static void osc_trunc_check(const struct lu_env *env, struct cl_io *io, - struct osc_io *oio, __u64 size) + struct osc_io *oio, u64 size) { struct cl_object *clob; int partial; @@ -498,7 +498,7 @@ static int osc_io_setattr_start(const struct lu_env *env, struct cl_attr *attr = &osc_env_info(env)->oti_attr; struct obdo *oa = &oio->oi_oa; struct osc_async_cbargs *cbargs = &oio->oi_cbarg; - __u64 size = io->u.ci_setattr.sa_attr.lvb_size; + u64 size = io->u.ci_setattr.sa_attr.lvb_size; unsigned int ia_avalid = io->u.ci_setattr.sa_avalid; enum op_xvalid ia_xvalid = io->u.ci_setattr.sa_xvalid; int result = 0; @@ -615,7 +615,7 @@ static void osc_io_setattr_end(const struct lu_env *env, } if (cl_io_is_trunc(io)) { - __u64 size = io->u.ci_setattr.sa_attr.lvb_size; + u64 size = io->u.ci_setattr.sa_attr.lvb_size; osc_trunc_check(env, io, oio, size); osc_cache_truncate_end(env, oio->oi_trunc); diff --git a/drivers/staging/lustre/lustre/osc/osc_lock.c b/drivers/staging/lustre/lustre/osc/osc_lock.c index 1781243..06d813e 100644 --- a/drivers/staging/lustre/lustre/osc/osc_lock.c +++ b/drivers/staging/lustre/lustre/osc/osc_lock.c @@ -153,9 +153,9 @@ static void osc_lock_build_policy(const struct lu_env *env, policy->l_extent.gid = d->cld_gid; } -static __u64 osc_enq2ldlm_flags(__u32 enqflags) +static u64 osc_enq2ldlm_flags(u32 enqflags) { - __u64 result = 0; + u64 result = 0; LASSERT((enqflags & ~CEF_MASK) == 0); @@ -200,7 +200,7 @@ static void osc_lock_lvb_update(const struct lu_env *env, cl_object_attr_lock(obj); if (dlmlock) { - __u64 size; + u64 size; check_res_locked(dlmlock->l_resource); LASSERT(lvb == dlmlock->l_lvb_data); @@ -450,7 +450,7 @@ static int __osc_dlm_blocking_ast(const struct lu_env *env, if (obj) { struct ldlm_extent *extent = &dlmlock->l_policy_data.l_extent; struct cl_attr *attr = &osc_env_info(env)->oti_attr; - __u64 old_kms; + u64 old_kms; /* Destroy pages covered by the extent of the DLM lock */ result = osc_lock_flush(cl2osc(obj), @@ -1146,7 +1146,7 @@ int osc_lock_init(const struct lu_env *env, const struct cl_io *io) { struct osc_lock *oscl; - __u32 enqflags = lock->cll_descr.cld_enq_flags; + u32 enqflags = lock->cll_descr.cld_enq_flags; oscl = kmem_cache_zalloc(osc_lock_kmem, GFP_NOFS); if (!oscl) @@ -1200,7 +1200,7 @@ struct ldlm_lock *osc_dlmlock_at_pgoff(const struct lu_env *env, struct lustre_handle lockh; struct ldlm_lock *lock = NULL; enum ldlm_mode mode; - __u64 flags; + u64 flags; ostid_build_res_name(&obj->oo_oinfo->loi_oi, resname); osc_index2policy(policy, osc2cl(obj), index, index); diff --git a/drivers/staging/lustre/lustre/osc/osc_object.c b/drivers/staging/lustre/lustre/osc/osc_object.c index e9ecb77..1097380 100644 --- a/drivers/staging/lustre/lustre/osc/osc_object.c +++ b/drivers/staging/lustre/lustre/osc/osc_object.c @@ -173,7 +173,7 @@ static int osc_attr_update(const struct lu_env *env, struct cl_object *obj, lvb->lvb_blocks = attr->cat_blocks; if (valid & CAT_KMS) { CDEBUG(D_CACHE, "set kms from %llu to %llu\n", - oinfo->loi_kms, (__u64)attr->cat_kms); + oinfo->loi_kms, (u64)attr->cat_kms); loi_kms_set(oinfo, attr->cat_kms); } return 0; diff --git a/drivers/staging/lustre/lustre/osc/osc_request.c b/drivers/staging/lustre/lustre/osc/osc_request.c index 2599caa..e92c8ac 100644 --- a/drivers/staging/lustre/lustre/osc/osc_request.c +++ b/drivers/staging/lustre/lustre/osc/osc_request.c @@ -101,7 +101,7 @@ struct osc_enqueue_args { struct obd_export *oa_exp; enum ldlm_type oa_type; enum ldlm_mode oa_mode; - __u64 *oa_flags; + u64 *oa_flags; osc_enqueue_upcall_f oa_upcall; void *oa_cookie; struct ost_lvb *oa_lvb; @@ -535,7 +535,7 @@ int osc_sync_base(struct osc_object *obj, struct obdo *oa, */ static int osc_resource_get_unused(struct obd_export *exp, struct obdo *oa, struct list_head *cancels, - enum ldlm_mode mode, __u64 lock_flags) + enum ldlm_mode mode, u64 lock_flags) { struct ldlm_namespace *ns = exp->exp_obd->obd_namespace; struct ldlm_res_id res_id; @@ -783,7 +783,7 @@ static void osc_shrink_grant_local(struct client_obd *cli, struct obdo *oa) */ static int osc_shrink_grant(struct client_obd *cli) { - __u64 target_bytes = (cli->cl_max_rpcs_in_flight + 1) * + u64 target_bytes = (cli->cl_max_rpcs_in_flight + 1) * (cli->cl_max_pages_per_rpc << PAGE_SHIFT); spin_lock(&cli->cl_loi_list_lock); @@ -794,7 +794,7 @@ static int osc_shrink_grant(struct client_obd *cli) return osc_shrink_grant_to_target(cli, target_bytes); } -int osc_shrink_grant_to_target(struct client_obd *cli, __u64 target_bytes) +int osc_shrink_grant_to_target(struct client_obd *cli, u64 target_bytes) { int rc = 0; struct ost_body *body; @@ -1000,7 +1000,7 @@ static int check_write_rcs(struct ptlrpc_request *req, u32 page_count, struct brw_page **pga) { int i; - __u32 *remote_rcs; + u32 *remote_rcs; remote_rcs = req_capsule_server_sized_get(&req->rq_pill, &RMF_RCS, sizeof(*remote_rcs) * @@ -1055,7 +1055,7 @@ static u32 osc_checksum_bulk(int nob, u32 pg_count, struct brw_page **pga, int opc, enum cksum_type cksum_type) { - __u32 cksum; + u32 cksum; int i = 0; struct ahash_request *hdesc; unsigned int bufsize; @@ -1285,7 +1285,7 @@ static int osc_brw_prep_request(int cmd, struct client_obd *cli, oa->o_cksum = body->oa.o_cksum; /* 1 RC per niobuf */ req_capsule_set_size(pill, &RMF_RCS, RCL_SERVER, - sizeof(__u32) * niocount); + sizeof(u32) * niocount); } else { if (cli->cl_checksum && !sptlrpc_flavor_has_bulk(&req->rq_flvr)) { @@ -1395,7 +1395,7 @@ static int check_write_checksum(struct obdo *oa, u32 client_cksum, u32 server_cksum, struct osc_brw_async_args *aa) { - __u32 new_cksum; + u32 new_cksum; char *msg; enum cksum_type cksum_type; @@ -1452,7 +1452,7 @@ static int osc_brw_fini_request(struct ptlrpc_request *req, int rc) &req->rq_import->imp_connection->c_peer; struct client_obd *cli = aa->aa_cli; struct ost_body *body; - __u32 client_cksum = 0; + u32 client_cksum = 0; if (rc < 0 && rc != -EDQUOT) { DEBUG_REQ(D_INFO, req, "Failed request with rc = %d\n", rc); @@ -1534,7 +1534,7 @@ static int osc_brw_fini_request(struct ptlrpc_request *req, int rc) if (body->oa.o_valid & OBD_MD_FLCKSUM) { static int cksum_counter; - __u32 server_cksum = body->oa.o_cksum; + u32 server_cksum = body->oa.o_cksum; char *via = ""; char *router = ""; enum cksum_type cksum_type; @@ -2050,7 +2050,7 @@ static int osc_set_lock_data(struct ldlm_lock *lock, void *data) static int osc_enqueue_fini(struct ptlrpc_request *req, osc_enqueue_upcall_f upcall, void *cookie, struct lustre_handle *lockh, enum ldlm_mode mode, - __u64 *flags, int agl, int errcode) + u64 *flags, int agl, int errcode) { bool intent = *flags & LDLM_FL_HAS_INTENT; int rc; @@ -2090,8 +2090,8 @@ static int osc_enqueue_interpret(const struct lu_env *env, struct lustre_handle *lockh = &aa->oa_lockh; enum ldlm_mode mode = aa->oa_mode; struct ost_lvb *lvb = aa->oa_lvb; - __u32 lvb_len = sizeof(*lvb); - __u64 flags = 0; + u32 lvb_len = sizeof(*lvb); + u64 flags = 0; /* ldlm_cli_enqueue is holding a reference on the lock, so it must * be valid. @@ -2143,7 +2143,7 @@ static int osc_enqueue_interpret(const struct lu_env *env, * release locks just after they are obtained. */ int osc_enqueue_base(struct obd_export *exp, struct ldlm_res_id *res_id, - __u64 *flags, union ldlm_policy_data *policy, + u64 *flags, union ldlm_policy_data *policy, struct ost_lvb *lvb, int kms_valid, osc_enqueue_upcall_f upcall, void *cookie, struct ldlm_enqueue_info *einfo, @@ -2153,7 +2153,7 @@ int osc_enqueue_base(struct obd_export *exp, struct ldlm_res_id *res_id, struct lustre_handle lockh = { 0 }; struct ptlrpc_request *req = NULL; int intent = *flags & LDLM_FL_HAS_INTENT; - __u64 match_flags = *flags; + u64 match_flags = *flags; enum ldlm_mode mode; int rc; @@ -2292,11 +2292,11 @@ int osc_enqueue_base(struct obd_export *exp, struct ldlm_res_id *res_id, int osc_match_base(struct obd_export *exp, struct ldlm_res_id *res_id, enum ldlm_type type, union ldlm_policy_data *policy, - enum ldlm_mode mode, __u64 *flags, void *data, + enum ldlm_mode mode, u64 *flags, void *data, struct lustre_handle *lockh, int unref) { struct obd_device *obd = exp->exp_obd; - __u64 lflags = *flags; + u64 lflags = *flags; enum ldlm_mode rc; if (OBD_FAIL_CHECK(OBD_FAIL_OSC_MATCH)) @@ -2371,7 +2371,7 @@ static int osc_statfs_interpret(const struct lu_env *env, } static int osc_statfs_async(struct obd_export *exp, - struct obd_info *oinfo, __u64 max_age, + struct obd_info *oinfo, u64 max_age, struct ptlrpc_request_set *rqset) { struct obd_device *obd = class_exp2obd(exp); @@ -2415,7 +2415,7 @@ static int osc_statfs_async(struct obd_export *exp, } static int osc_statfs(const struct lu_env *env, struct obd_export *exp, - struct obd_statfs *osfs, __u64 max_age, __u32 flags) + struct obd_statfs *osfs, u64 max_age, u32 flags) { struct obd_device *obd = class_exp2obd(exp); struct obd_statfs *msfs; -- 1.8.3.1 From jsimmons at infradead.org Thu Jan 31 17:19:24 2019 From: jsimmons at infradead.org (James Simmons) Date: Thu, 31 Jan 2019 12:19:24 -0500 Subject: [lustre-devel] [PATCH 20/26] lustre: first batch to cleanup white spaces in internal headers In-Reply-To: <1548955170-13456-1-git-send-email-jsimmons@infradead.org> References: <1548955170-13456-1-git-send-email-jsimmons@infradead.org> Message-ID: <1548955170-13456-21-git-send-email-jsimmons@infradead.org> The internal headers are very messy and difficult to read. Remove excess white space and properly align data structures so they are easy on the eyes. This is the first batch since it covers many lines of changes. Signed-off-by: James Simmons --- drivers/staging/lustre/lustre/include/cl_object.h | 338 ++++++++++----------- .../staging/lustre/lustre/include/lprocfs_status.h | 77 ++--- drivers/staging/lustre/lustre/include/lu_object.h | 322 ++++++++++---------- .../staging/lustre/lustre/include/lustre_disk.h | 42 +-- drivers/staging/lustre/lustre/include/lustre_dlm.h | 256 ++++++++-------- .../lustre/lustre/include/lustre_dlm_flags.h | 326 ++++++++++---------- 6 files changed, 682 insertions(+), 679 deletions(-) diff --git a/drivers/staging/lustre/lustre/include/cl_object.h b/drivers/staging/lustre/lustre/include/cl_object.h index 3109c04..b8ae41d 100644 --- a/drivers/staging/lustre/lustre/include/cl_object.h +++ b/drivers/staging/lustre/lustre/include/cl_object.h @@ -49,16 +49,16 @@ * * - cl_page * - * - cl_lock represents an extent lock on an object. + * - cl_lock represents an extent lock on an object. * - * - cl_io represents high-level i/o activity such as whole read/write - * system call, or write-out of pages from under the lock being - * canceled. cl_io has sub-ios that can be stopped and resumed - * independently, thus achieving high degree of transfer - * parallelism. Single cl_io can be advanced forward by - * the multiple threads (although in the most usual case of - * read/write system call it is associated with the single user - * thread, that issued the system call). + * - cl_io represents high-level i/o activity such as whole read/write + * system call, or write-out of pages from under the lock being + * canceled. cl_io has sub-ios that can be stopped and resumed + * independently, thus achieving high degree of transfer + * parallelism. Single cl_io can be advanced forward by + * the multiple threads (although in the most usual case of + * read/write system call it is associated with the single user + * thread, that issued the system call). * * Terminology * @@ -135,39 +135,39 @@ struct cl_device { */ struct cl_attr { /** Object size, in bytes */ - loff_t cat_size; + loff_t cat_size; /** * Known minimal size, in bytes. * * This is only valid when at least one DLM lock is held. */ - loff_t cat_kms; + loff_t cat_kms; /** Modification time. Measured in seconds since epoch. */ - time64_t cat_mtime; + time64_t cat_mtime; /** Access time. Measured in seconds since epoch. */ - time64_t cat_atime; + time64_t cat_atime; /** Change time. Measured in seconds since epoch. */ - time64_t cat_ctime; + time64_t cat_ctime; /** * Blocks allocated to this cl_object on the server file system. * * \todo XXX An interface for block size is needed. */ - u64 cat_blocks; + u64 cat_blocks; /** * User identifier for quota purposes. */ - uid_t cat_uid; + uid_t cat_uid; /** * Group identifier for quota purposes. */ - gid_t cat_gid; + gid_t cat_gid; /* nlink of the directory */ - u64 cat_nlink; + u64 cat_nlink; /* Project identifier for quota purpose. */ - u32 cat_projid; + u32 cat_projid; }; /** @@ -223,11 +223,11 @@ enum cl_attr_valid { */ struct cl_object { /** super class */ - struct lu_object co_lu; + struct lu_object co_lu; /** per-object-layer operations */ - const struct cl_object_operations *co_ops; + const struct cl_object_operations *co_ops; /** offset of page slice in cl_page buffer */ - int co_slice_off; + int co_slice_off; }; /** @@ -237,30 +237,30 @@ struct cl_object { */ struct cl_object_conf { /** Super-class. */ - struct lu_object_conf coc_lu; + struct lu_object_conf coc_lu; union { /** * Object layout. This is consumed by lov. */ - struct lu_buf coc_layout; + struct lu_buf coc_layout; /** * Description of particular stripe location in the * cluster. This is consumed by osc. */ - struct lov_oinfo *coc_oinfo; + struct lov_oinfo *coc_oinfo; } u; /** * VFS inode. This is consumed by vvp. */ - struct inode *coc_inode; + struct inode *coc_inode; /** * Layout lock handle. */ - struct ldlm_lock *coc_lock; + struct ldlm_lock *coc_lock; /** * Operation to handle layout, OBJECT_CONF_XYZ. */ - int coc_opc; + int coc_opc; }; enum { @@ -283,13 +283,13 @@ enum { struct cl_layout { /** the buffer to return the layout in lov_mds_md format. */ - struct lu_buf cl_buf; + struct lu_buf cl_buf; /** size of layout in lov_mds_md format. */ - size_t cl_size; + size_t cl_size; /** Layout generation. */ - u32 cl_layout_gen; + u32 cl_layout_gen; /** whether layout is a composite one */ - bool cl_is_composite; + bool cl_is_composite; }; /** @@ -421,7 +421,7 @@ struct cl_object_header { /** Standard lu_object_header. cl_object::co_lu::lo_header points * here. */ - struct lu_object_header coh_lu; + struct lu_object_header coh_lu; /** * Parent object. It is assumed that an object has a well-defined @@ -454,16 +454,16 @@ struct cl_object_header { * Helper macro: iterate over all layers of the object \a obj, assigning every * layer top-to-bottom to \a slice. */ -#define cl_object_for_each(slice, obj) \ - list_for_each_entry((slice), \ - &(obj)->co_lu.lo_header->loh_layers, \ - co_lu.lo_linkage) +#define cl_object_for_each(slice, obj) \ + list_for_each_entry((slice), \ + &(obj)->co_lu.lo_header->loh_layers, \ + co_lu.lo_linkage) /** * Helper macro: iterate over all layers of the object \a obj, assigning every * layer bottom-to-top to \a slice. */ -#define cl_object_for_each_reverse(slice, obj) \ - list_for_each_entry_reverse((slice), \ +#define cl_object_for_each_reverse(slice, obj) \ + list_for_each_entry_reverse((slice), \ &(obj)->co_lu.lo_header->loh_layers, \ co_lu.lo_linkage) /** @} cl_object */ @@ -717,39 +717,39 @@ enum cl_page_type { */ struct cl_page { /** Reference counter. */ - atomic_t cp_ref; + atomic_t cp_ref; /** An object this page is a part of. Immutable after creation. */ - struct cl_object *cp_obj; + struct cl_object *cp_obj; /** vmpage */ - struct page *cp_vmpage; + struct page *cp_vmpage; /** Linkage of pages within group. Pages must be owned */ - struct list_head cp_batch; + struct list_head cp_batch; /** List of slices. Immutable after creation. */ - struct list_head cp_layers; + struct list_head cp_layers; /** * Page state. This field is const to avoid accidental update, it is * modified only internally within cl_page.c. Protected by a VM lock. */ - const enum cl_page_state cp_state; + const enum cl_page_state cp_state; /** * Page type. Only CPT_TRANSIENT is used so far. Immutable after * creation. */ - enum cl_page_type cp_type; + enum cl_page_type cp_type; /** * Owning IO in cl_page_state::CPS_OWNED state. Sub-page can be owned * by sub-io. Protected by a VM lock. */ - struct cl_io *cp_owner; + struct cl_io *cp_owner; /** List of references to this page, for debugging. */ - struct lu_ref cp_reference; + struct lu_ref cp_reference; /** Link to an object, for debugging. */ - struct lu_ref_link cp_obj_ref; + struct lu_ref_link cp_obj_ref; /** Link to a queue, for debugging. */ - struct lu_ref_link cp_queue_ref; + struct lu_ref_link cp_queue_ref; /** Assigned if doing a sync_io */ - struct cl_sync_io *cp_sync_io; + struct cl_sync_io *cp_sync_io; }; /** @@ -758,7 +758,7 @@ struct cl_page { * \see vvp_page, lov_page, osc_page */ struct cl_page_slice { - struct cl_page *cpl_page; + struct cl_page *cpl_page; pgoff_t cpl_index; /** * Object slice corresponding to this page slice. Immutable after @@ -767,7 +767,7 @@ struct cl_page_slice { struct cl_object *cpl_obj; const struct cl_page_operations *cpl_ops; /** Linkage into cl_page::cp_layers. Immutable after creation. */ - struct list_head cpl_linkage; + struct list_head cpl_linkage; }; /** @@ -986,25 +986,25 @@ struct cl_page_operations { /** * Helper macro, dumping detailed information about \a page into a log. */ -#define CL_PAGE_DEBUG(mask, env, page, format, ...) \ -do { \ - if (cfs_cdebug_show(mask, DEBUG_SUBSYSTEM)) { \ +#define CL_PAGE_DEBUG(mask, env, page, format, ...) \ +do { \ + if (cfs_cdebug_show(mask, DEBUG_SUBSYSTEM)) { \ LIBCFS_DEBUG_MSG_DATA_DECL(msgdata, mask, NULL); \ cl_page_print(env, &msgdata, lu_cdebug_printer, page); \ - CDEBUG(mask, format, ## __VA_ARGS__); \ - } \ + CDEBUG(mask, format, ## __VA_ARGS__); \ + } \ } while (0) /** * Helper macro, dumping shorter information about \a page into a log. */ -#define CL_PAGE_HEADER(mask, env, page, format, ...) \ -do { \ - if (cfs_cdebug_show(mask, DEBUG_SUBSYSTEM)) { \ - LIBCFS_DEBUG_MSG_DATA_DECL(msgdata, mask, NULL); \ +#define CL_PAGE_HEADER(mask, env, page, format, ...) \ +do { \ + if (cfs_cdebug_show(mask, DEBUG_SUBSYSTEM)) { \ + LIBCFS_DEBUG_MSG_DATA_DECL(msgdata, mask, NULL); \ cl_page_header_print(env, &msgdata, lu_cdebug_printer, page); \ CDEBUG(mask, format, ## __VA_ARGS__); \ - } \ + } \ } while (0) static inline struct page *cl_page_vmpage(struct cl_page *page) @@ -1145,24 +1145,24 @@ static inline bool __page_in_use(const struct cl_page *page, int refc) */ struct cl_lock_descr { /** Object this lock is granted for. */ - struct cl_object *cld_obj; + struct cl_object *cld_obj; /** Index of the first page protected by this lock. */ - pgoff_t cld_start; + pgoff_t cld_start; /** Index of the last page (inclusive) protected by this lock. */ - pgoff_t cld_end; + pgoff_t cld_end; /** Group ID, for group lock */ - u64 cld_gid; + u64 cld_gid; /** Lock mode. */ - enum cl_lock_mode cld_mode; + enum cl_lock_mode cld_mode; /** * flags to enqueue lock. A combination of bit-flags from * enum cl_enq_flags. */ - u32 cld_enq_flags; + u32 cld_enq_flags; }; #define DDESCR "%s(%d):[%lu, %lu]:%x" -#define PDESCR(descr) \ +#define PDESCR(descr) \ cl_lock_mode_name((descr)->cld_mode), (descr)->cld_mode, \ (descr)->cld_start, (descr)->cld_end, (descr)->cld_enq_flags @@ -1173,9 +1173,9 @@ struct cl_lock_descr { */ struct cl_lock { /** List of slices. Immutable after creation. */ - struct list_head cll_layers; + struct list_head cll_layers; /** lock attribute, extent, cl_object, etc. */ - struct cl_lock_descr cll_descr; + struct cl_lock_descr cll_descr; }; /** @@ -1184,14 +1184,14 @@ struct cl_lock { * \see vvp_lock, lov_lock, lovsub_lock, osc_lock */ struct cl_lock_slice { - struct cl_lock *cls_lock; + struct cl_lock *cls_lock; /** Object slice corresponding to this lock slice. Immutable after * creation. */ struct cl_object *cls_obj; const struct cl_lock_operations *cls_ops; /** Linkage into cl_lock::cll_layers. Immutable after creation. */ - struct list_head cls_linkage; + struct list_head cls_linkage; }; /** @@ -1236,22 +1236,22 @@ struct cl_lock_operations { const struct cl_lock_slice *slice); }; -#define CL_LOCK_DEBUG(mask, env, lock, format, ...) \ -do { \ +#define CL_LOCK_DEBUG(mask, env, lock, format, ...) \ +do { \ LIBCFS_DEBUG_MSG_DATA_DECL(msgdata, mask, NULL); \ \ - if (cfs_cdebug_show(mask, DEBUG_SUBSYSTEM)) { \ + if (cfs_cdebug_show(mask, DEBUG_SUBSYSTEM)) { \ cl_lock_print(env, &msgdata, lu_cdebug_printer, lock); \ - CDEBUG(mask, format, ## __VA_ARGS__); \ - } \ + CDEBUG(mask, format, ## __VA_ARGS__); \ + } \ } while (0) -#define CL_LOCK_ASSERT(expr, env, lock) do { \ - if (likely(expr)) \ - break; \ +#define CL_LOCK_ASSERT(expr, env, lock) do { \ + if (likely(expr)) \ + break; \ \ CL_LOCK_DEBUG(D_ERROR, env, lock, "failed at %s.\n", #expr); \ - LBUG(); \ + LBUG(); \ } while (0) /** @} cl_lock */ @@ -1276,9 +1276,9 @@ struct cl_lock_operations { * @{ */ struct cl_page_list { - unsigned int pl_nr; - struct list_head pl_pages; - struct task_struct *pl_owner; + unsigned int pl_nr; + struct list_head pl_pages; + struct task_struct *pl_owner; }; /** @@ -1286,8 +1286,8 @@ struct cl_page_list { * contains an incoming page list and an outgoing page list. */ struct cl_2queue { - struct cl_page_list c2_qin; - struct cl_page_list c2_qout; + struct cl_page_list c2_qin; + struct cl_page_list c2_qout; }; /** @} cl_page_list */ @@ -1424,16 +1424,16 @@ enum cl_io_state { * \see vvp_io, lov_io, osc_io */ struct cl_io_slice { - struct cl_io *cis_io; + struct cl_io *cis_io; /** corresponding object slice. Immutable after creation. */ - struct cl_object *cis_obj; + struct cl_object *cis_obj; /** io operations. Immutable after creation. */ - const struct cl_io_operations *cis_iop; + const struct cl_io_operations *cis_iop; /** * linkage into a list of all slices for a given cl_io, hanging off * cl_io::ci_layers. Immutable after creation. */ - struct list_head cis_linkage; + struct list_head cis_linkage; }; typedef void (*cl_commit_cbt)(const struct lu_env *, struct cl_io *, @@ -1445,16 +1445,16 @@ struct cl_read_ahead { * This is determined DLM lock coverage, RPC and stripe boundary. * cra_end is included. */ - pgoff_t cra_end; + pgoff_t cra_end; /* optimal RPC size for this read, by pages */ - unsigned long cra_rpc_size; + unsigned long cra_rpc_size; /* * Release callback. If readahead holds resources underneath, this * function should be called to release it. */ void (*cra_release)(const struct lu_env *env, void *cbdata); /* Callback data for cra_release routine */ - void *cra_cbdata; + void *cra_cbdata; }; static inline void cl_read_ahead_release(const struct lu_env *env, @@ -1594,18 +1594,18 @@ enum cl_enq_flags { * instruct server to not block, if conflicting lock is found. Instead * -EWOULDBLOCK is returned immediately. */ - CEF_NONBLOCK = 0x00000001, + CEF_NONBLOCK = 0x00000001, /** * take lock asynchronously (out of order), as it cannot * deadlock. This is for LDLM_FL_HAS_INTENT locks used for glimpsing. */ - CEF_ASYNC = 0x00000002, + CEF_ASYNC = 0x00000002, /** * tell the server to instruct (though a flag in the blocking ast) an * owner of the conflicting lock, that it can drop dirty pages * protected by this lock, without sending them to the server. */ - CEF_DISCARD_DATA = 0x00000004, + CEF_DISCARD_DATA = 0x00000004, /** * tell the sub layers that it must be a `real' lock. This is used for * mmapped-buffer locks and glimpse locks that must be never converted @@ -1613,7 +1613,7 @@ enum cl_enq_flags { * * \see vvp_mmap_locks(), cl_glimpse_lock(). */ - CEF_MUST = 0x00000008, + CEF_MUST = 0x00000008, /** * tell the sub layers that never request a `real' lock. This flag is * not used currently. @@ -1624,24 +1624,24 @@ enum cl_enq_flags { * object doing IO; however, lock itself may have precise requirements * that are described by the enqueue flags. */ - CEF_NEVER = 0x00000010, + CEF_NEVER = 0x00000010, /** * for async glimpse lock. */ - CEF_AGL = 0x00000020, + CEF_AGL = 0x00000020, /** * enqueue a lock to test DLM lock existence. */ - CEF_PEEK = 0x00000040, + CEF_PEEK = 0x00000040, /** * Lock match only. Used by group lock in I/O as group lock * is known to exist. */ - CEF_LOCK_MATCH = BIT(7), + CEF_LOCK_MATCH = BIT(7), /** * mask of enq_flags. */ - CEF_MASK = 0x000000ff, + CEF_MASK = 0x000000ff, }; /** @@ -1650,8 +1650,8 @@ enum cl_enq_flags { */ struct cl_io_lock_link { /** linkage into one of cl_lockset lists. */ - struct list_head cill_linkage; - struct cl_lock cill_lock; + struct list_head cill_linkage; + struct cl_lock cill_lock; /** optional destructor */ void (*cill_fini)(const struct lu_env *env, struct cl_io_lock_link *link); @@ -1689,9 +1689,9 @@ struct cl_io_lock_link { */ struct cl_lockset { /** locks to be acquired. */ - struct list_head cls_todo; + struct list_head cls_todo; /** locks acquired. */ - struct list_head cls_done; + struct list_head cls_done; }; /** @@ -1709,21 +1709,21 @@ enum cl_io_lock_dmd { enum cl_fsync_mode { /** start writeback, do not wait for them to finish */ - CL_FSYNC_NONE = 0, + CL_FSYNC_NONE = 0, /** start writeback and wait for them to finish */ - CL_FSYNC_LOCAL = 1, + CL_FSYNC_LOCAL = 1, /** discard all of dirty pages in a specific file range */ - CL_FSYNC_DISCARD = 2, + CL_FSYNC_DISCARD = 2, /** start writeback and make sure they have reached storage before * return. OST_SYNC RPC must be issued and finished */ - CL_FSYNC_ALL = 3 + CL_FSYNC_ALL = 3 }; struct cl_io_rw_common { - loff_t crw_pos; - size_t crw_count; - int crw_nonblock; + loff_t crw_pos; + size_t crw_count; + int crw_nonblock; }; /** @@ -1739,65 +1739,65 @@ struct cl_io { /** type of this IO. Immutable after creation. */ enum cl_io_type ci_type; /** current state of cl_io state machine. */ - enum cl_io_state ci_state; + enum cl_io_state ci_state; /** main object this io is against. Immutable after creation. */ - struct cl_object *ci_obj; + struct cl_object *ci_obj; /** * Upper layer io, of which this io is a part of. Immutable after * creation. */ - struct cl_io *ci_parent; + struct cl_io *ci_parent; /** List of slices. Immutable after creation. */ - struct list_head ci_layers; + struct list_head ci_layers; /** list of locks (to be) acquired by this io. */ - struct cl_lockset ci_lockset; + struct cl_lockset ci_lockset; /** lock requirements, this is just a help info for sublayers. */ - enum cl_io_lock_dmd ci_lockreq; + enum cl_io_lock_dmd ci_lockreq; union { struct cl_rd_io { - struct cl_io_rw_common rd; + struct cl_io_rw_common rd; } ci_rd; struct cl_wr_io { - struct cl_io_rw_common wr; - int wr_append; - int wr_sync; + struct cl_io_rw_common wr; + int wr_append; + int wr_sync; } ci_wr; - struct cl_io_rw_common ci_rw; + struct cl_io_rw_common ci_rw; struct cl_setattr_io { - struct ost_lvb sa_attr; - unsigned int sa_attr_flags; - unsigned int sa_avalid; + struct ost_lvb sa_attr; + unsigned int sa_attr_flags; + unsigned int sa_avalid; unsigned int sa_xvalid; /* OP_XVALID */ - int sa_stripe_index; - struct ost_layout sa_layout; + int sa_stripe_index; + struct ost_layout sa_layout; const struct lu_fid *sa_parent_fid; } ci_setattr; struct cl_data_version_io { - u64 dv_data_version; - int dv_flags; + u64 dv_data_version; + int dv_flags; } ci_data_version; struct cl_fault_io { /** page index within file. */ - pgoff_t ft_index; + pgoff_t ft_index; /** bytes valid byte on a faulted page. */ - size_t ft_nob; + size_t ft_nob; /** writable page? for nopage() only */ - int ft_writable; + int ft_writable; /** page of an executable? */ - int ft_executable; + int ft_executable; /** page_mkwrite() */ - int ft_mkwrite; + int ft_mkwrite; /** resulting page */ - struct cl_page *ft_page; + struct cl_page *ft_page; } ci_fault; struct cl_fsync_io { - loff_t fi_start; - loff_t fi_end; + loff_t fi_start; + loff_t fi_end; /** file system level fid */ - struct lu_fid *fi_fid; - enum cl_fsync_mode fi_mode; + struct lu_fid *fi_fid; + enum cl_fsync_mode fi_mode; /* how many pages were written/discarded */ - unsigned int fi_nr_written; + unsigned int fi_nr_written; } ci_fsync; struct cl_ladvise_io { u64 li_start; @@ -1808,30 +1808,30 @@ struct cl_io { u64 li_flags; } ci_ladvise; } u; - struct cl_2queue ci_queue; - size_t ci_nob; - int ci_result; - unsigned int ci_continue:1, + struct cl_2queue ci_queue; + size_t ci_nob; + int ci_result; + unsigned int ci_continue:1, /** * This io has held grouplock, to inform sublayers that * don't do lockless i/o. */ - ci_no_srvlock:1, + ci_no_srvlock:1, /** * The whole IO need to be restarted because layout has been changed */ - ci_need_restart:1, + ci_need_restart:1, /** * to not refresh layout - the IO issuer knows that the layout won't * change(page operations, layout change causes all page to be * discarded), or it doesn't matter if it changes(sync). */ - ci_ignore_layout:1, + ci_ignore_layout:1, /** * Need MDS intervention to complete a write. This usually means the * corresponding component is not initialized for the writing extent. */ - ci_need_write_intent:1, + ci_need_write_intent:1, /** * Check if layout changed after the IO finishes. Mainly for HSM * requirement. If IO occurs to openning files, it doesn't need to @@ -1839,19 +1839,19 @@ struct cl_io { * Right now, only two operations need to verify layout: glimpse * and setattr. */ - ci_verify_layout:1, + ci_verify_layout:1, /** * file is released, restore has to be triggered by vvp layer */ - ci_restore_needed:1, + ci_restore_needed:1, /** * O_NOATIME */ - ci_noatime:1; + ci_noatime:1; /** * Number of pages owned by this IO. For invariant checking. */ - unsigned int ci_owned_nr; + unsigned int ci_owned_nr; }; /** @} cl_io */ @@ -1860,14 +1860,14 @@ struct cl_io { * Per-transfer attributes. */ struct cl_req_attr { - enum cl_req_type cra_type; - u64 cra_flags; - struct cl_page *cra_page; + enum cl_req_type cra_type; + u64 cra_flags; + struct cl_page *cra_page; /** Generic attributes for the server consumption. */ - struct obdo *cra_oa; + struct obdo *cra_oa; /** Jobid */ - char cra_jobid[LUSTRE_JOBID_SIZE]; + char cra_jobid[LUSTRE_JOBID_SIZE]; }; enum cache_stats_item { @@ -1892,8 +1892,8 @@ enum cache_stats_item { * Stats for a generic cache (similar to inode, lu_object, etc. caches). */ struct cache_stats { - const char *cs_name; - atomic_t cs_stats[CS_NR]; + const char *cs_name; + atomic_t cs_stats[CS_NR]; }; /** These are not exported so far */ @@ -1905,7 +1905,7 @@ struct cache_stats { * clients to co-exist in the single address space. */ struct cl_site { - struct lu_site cs_lu; + struct lu_site cs_lu; /** * Statistical counters. Atomics do not scale, something better like * per-cpu counters is needed. @@ -1915,8 +1915,8 @@ struct cl_site { * When interpreting keep in mind that both sub-locks (and sub-pages) * and top-locks (and top-pages) are accounted here. */ - struct cache_stats cs_pages; - atomic_t cs_pages_state[CPS_NR]; + struct cache_stats cs_pages; + atomic_t cs_pages_state[CPS_NR]; }; int cl_site_init(struct cl_site *s, struct cl_device *top); @@ -2341,13 +2341,13 @@ static inline struct cl_page *cl_page_list_first(struct cl_page_list *plist) /** * Iterate over pages in a page list. */ -#define cl_page_list_for_each(page, list) \ +#define cl_page_list_for_each(page, list) \ list_for_each_entry((page), &(list)->pl_pages, cp_batch) /** * Iterate over pages in a page list, taking possible removals into account. */ -#define cl_page_list_for_each_safe(page, temp, list) \ +#define cl_page_list_for_each_safe(page, temp, list) \ list_for_each_entry_safe((page), (temp), &(list)->pl_pages, cp_batch) void cl_page_list_init(struct cl_page_list *plist); @@ -2394,7 +2394,7 @@ struct cl_sync_io { /** barrier of destroy this structure */ atomic_t csi_barrier; /** completion to be signaled when transfer is complete. */ - wait_queue_head_t csi_waitq; + wait_queue_head_t csi_waitq; /** callback to invoke when this IO is finished */ void (*csi_end_io)(const struct lu_env *, struct cl_sync_io *); diff --git a/drivers/staging/lustre/lustre/include/lprocfs_status.h b/drivers/staging/lustre/lustre/include/lprocfs_status.h index 7649040..d69f395 100644 --- a/drivers/staging/lustre/lustre/include/lprocfs_status.h +++ b/drivers/staging/lustre/lustre/include/lprocfs_status.h @@ -49,25 +49,25 @@ #include struct lprocfs_vars { - const char *name; + const char *name; const struct file_operations *fops; - void *data; + void *data; /** * sysfs file mode. */ - umode_t proc_mode; + umode_t proc_mode; }; struct lprocfs_static_vars { - struct lprocfs_vars *obd_vars; - const struct attribute_group *sysfs_vars; + struct lprocfs_vars *obd_vars; + const struct attribute_group *sysfs_vars; }; /* if we find more consumers this could be generalized */ #define OBD_HIST_MAX 32 struct obd_histogram { - spinlock_t oh_lock; - unsigned long oh_buckets[OBD_HIST_MAX]; + spinlock_t oh_lock; + unsigned long oh_buckets[OBD_HIST_MAX]; }; enum { @@ -125,37 +125,37 @@ struct rename_stats { */ enum { - LPROCFS_CNTR_EXTERNALLOCK = 0x0001, - LPROCFS_CNTR_AVGMINMAX = 0x0002, - LPROCFS_CNTR_STDDEV = 0x0004, + LPROCFS_CNTR_EXTERNALLOCK = 0x0001, + LPROCFS_CNTR_AVGMINMAX = 0x0002, + LPROCFS_CNTR_STDDEV = 0x0004, /* counter data type */ - LPROCFS_TYPE_REGS = 0x0100, - LPROCFS_TYPE_BYTES = 0x0200, - LPROCFS_TYPE_PAGES = 0x0400, - LPROCFS_TYPE_CYCLE = 0x0800, + LPROCFS_TYPE_REGS = 0x0100, + LPROCFS_TYPE_BYTES = 0x0200, + LPROCFS_TYPE_PAGES = 0x0400, + LPROCFS_TYPE_CYCLE = 0x0800, }; #define LC_MIN_INIT ((~(u64)0) >> 1) struct lprocfs_counter_header { - unsigned int lc_config; - const char *lc_name; /* must be static */ - const char *lc_units; /* must be static */ + unsigned int lc_config; + const char *lc_name; /* must be static */ + const char *lc_units; /* must be static */ }; struct lprocfs_counter { - s64 lc_count; - s64 lc_min; - s64 lc_max; - s64 lc_sumsquare; + s64 lc_count; + s64 lc_min; + s64 lc_max; + s64 lc_sumsquare; /* * Every counter has lc_array_sum[0], while lc_array_sum[1] is only * for irq context counter, i.e. stats with * LPROCFS_STATS_FLAG_IRQ_SAFE flag, its counter need * lc_array_sum[1] */ - s64 lc_array_sum[1]; + s64 lc_array_sum[1]; }; #define lc_sum lc_array_sum[0] @@ -165,20 +165,23 @@ struct lprocfs_percpu { #ifndef __GNUC__ s64 pad; #endif - struct lprocfs_counter lp_cntr[0]; + struct lprocfs_counter lp_cntr[0]; }; enum lprocfs_stats_lock_ops { - LPROCFS_GET_NUM_CPU = 0x0001, /* number allocated per-CPU stats */ - LPROCFS_GET_SMP_ID = 0x0002, /* current stat to be updated */ + LPROCFS_GET_NUM_CPU = 0x0001, /* number allocated per-CPU + * stats + */ + LPROCFS_GET_SMP_ID = 0x0002, /* current stat to be updated + */ }; enum lprocfs_stats_flags { - LPROCFS_STATS_FLAG_NONE = 0x0000, /* per cpu counter */ - LPROCFS_STATS_FLAG_NOPERCPU = 0x0001, /* stats have no percpu - * area and need locking - */ - LPROCFS_STATS_FLAG_IRQ_SAFE = 0x0002, /* alloc need irq safe */ + LPROCFS_STATS_FLAG_NONE = 0x0000, /* per cpu counter */ + LPROCFS_STATS_FLAG_NOPERCPU = 0x0001, /* stats have no percpu + * area and need locking + */ + LPROCFS_STATS_FLAG_IRQ_SAFE = 0x0002, /* alloc need irq safe */ }; enum lprocfs_fields_flags { @@ -187,7 +190,7 @@ enum lprocfs_fields_flags { LPROCFS_FIELDS_FLAGS_MIN = 0x0003, LPROCFS_FIELDS_FLAGS_MAX = 0x0004, LPROCFS_FIELDS_FLAGS_AVG = 0x0005, - LPROCFS_FIELDS_FLAGS_SUMSQUARE = 0x0006, + LPROCFS_FIELDS_FLAGS_SUMSQUARE = 0x0006, LPROCFS_FIELDS_FLAGS_COUNT = 0x0007, }; @@ -513,12 +516,12 @@ void lprocfs_stats_collect(struct lprocfs_stats *stats, int idx, return single_open(file, name##_seq_show, inode->i_private); \ } \ static const struct file_operations name##_fops = { \ - .owner = THIS_MODULE, \ - .open = name##_single_open, \ - .read = seq_read, \ - .write = custom_seq_write, \ - .llseek = seq_lseek, \ - .release = lprocfs_single_release, \ + .owner = THIS_MODULE, \ + .open = name##_single_open, \ + .read = seq_read, \ + .write = custom_seq_write, \ + .llseek = seq_lseek, \ + .release = lprocfs_single_release, \ } #define LPROC_SEQ_FOPS_RO(name) __LPROC_SEQ_FOPS(name, NULL) diff --git a/drivers/staging/lustre/lustre/include/lu_object.h b/drivers/staging/lustre/lustre/include/lu_object.h index 3e663a9..68aa0d0 100644 --- a/drivers/staging/lustre/lustre/include/lu_object.h +++ b/drivers/staging/lustre/lustre/include/lu_object.h @@ -178,7 +178,7 @@ struct lu_object_conf { /** * Some hints for obj find and alloc. */ - enum loc_flags loc_flags; + enum loc_flags loc_flags; }; /** @@ -261,30 +261,30 @@ struct lu_device { * * \todo XXX which means that atomic_t is probably too small. */ - atomic_t ld_ref; + atomic_t ld_ref; /** * Pointer to device type. Never modified once set. */ - struct lu_device_type *ld_type; + struct lu_device_type *ld_type; /** * Operation vector for this device. */ - const struct lu_device_operations *ld_ops; + const struct lu_device_operations *ld_ops; /** * Stack this device belongs to. */ - struct lu_site *ld_site; + struct lu_site *ld_site; /** \todo XXX: temporary back pointer into obd. */ - struct obd_device *ld_obd; + struct obd_device *ld_obd; /** * A list of references to this object, for debugging. */ - struct lu_ref ld_reference; + struct lu_ref ld_reference; /** * Link the device to the site. **/ - struct list_head ld_linkage; + struct list_head ld_linkage; }; struct lu_device_type_operations; @@ -309,23 +309,23 @@ struct lu_device_type { /** * Tag bits. Taken from enum lu_device_tag. Never modified once set. */ - u32 ldt_tags; + u32 ldt_tags; /** * Name of this class. Unique system-wide. Never modified once set. */ - char *ldt_name; + char *ldt_name; /** * Operations for this type. */ - const struct lu_device_type_operations *ldt_ops; + const struct lu_device_type_operations *ldt_ops; /** * \todo XXX: temporary pointer to associated obd_type. */ - struct obd_type *ldt_obd_type; + struct obd_type *ldt_obd_type; /** * \todo XXX: temporary: context tags used by obd_*() calls. */ - u32 ldt_ctx_tags; + u32 ldt_ctx_tags; /** * Number of existing device type instances. */ @@ -427,21 +427,21 @@ struct lu_attr { /** Bit-mask of valid attributes */ enum la_valid { - LA_ATIME = 1 << 0, - LA_MTIME = 1 << 1, - LA_CTIME = 1 << 2, - LA_SIZE = 1 << 3, - LA_MODE = 1 << 4, - LA_UID = 1 << 5, - LA_GID = 1 << 6, - LA_BLOCKS = 1 << 7, - LA_TYPE = 1 << 8, - LA_FLAGS = 1 << 9, - LA_NLINK = 1 << 10, - LA_RDEV = 1 << 11, - LA_BLKSIZE = 1 << 12, - LA_KILL_SUID = 1 << 13, - LA_KILL_SGID = 1 << 14, + LA_ATIME = 1 << 0, + LA_MTIME = 1 << 1, + LA_CTIME = 1 << 2, + LA_SIZE = 1 << 3, + LA_MODE = 1 << 4, + LA_UID = 1 << 5, + LA_GID = 1 << 6, + LA_BLOCKS = 1 << 7, + LA_TYPE = 1 << 8, + LA_FLAGS = 1 << 9, + LA_NLINK = 1 << 10, + LA_RDEV = 1 << 11, + LA_BLKSIZE = 1 << 12, + LA_KILL_SUID = 1 << 13, + LA_KILL_SGID = 1 << 14, }; /** @@ -451,15 +451,15 @@ struct lu_object { /** * Header for this object. */ - struct lu_object_header *lo_header; + struct lu_object_header *lo_header; /** * Device for this layer. */ - struct lu_device *lo_dev; + struct lu_device *lo_dev; /** * Operations for this object. */ - const struct lu_object_operations *lo_ops; + const struct lu_object_operations *lo_ops; /** * Linkage into list of all layers. */ @@ -467,7 +467,7 @@ struct lu_object { /** * Link to the device, for debugging. */ - struct lu_ref_link lo_dev_ref; + struct lu_ref_link lo_dev_ref; }; enum lu_object_header_flags { @@ -484,13 +484,13 @@ enum lu_object_header_flags { }; enum lu_object_header_attr { - LOHA_EXISTS = 1 << 0, - LOHA_REMOTE = 1 << 1, + LOHA_EXISTS = 1 << 0, + LOHA_REMOTE = 1 << 1, /** * UNIX file type is stored in S_IFMT bits. */ - LOHA_FT_START = 001 << 12, /**< S_IFIFO */ - LOHA_FT_END = 017 << 12, /**< S_IFMT */ + LOHA_FT_START = 001 << 12, /**< S_IFIFO */ + LOHA_FT_END = 017 << 12, /**< S_IFMT */ }; /** @@ -513,33 +513,33 @@ struct lu_object_header { * Object flags from enum lu_object_header_flags. Set and checked * atomically. */ - unsigned long loh_flags; + unsigned long loh_flags; /** * Object reference count. Protected by lu_site::ls_guard. */ - atomic_t loh_ref; + atomic_t loh_ref; /** * Common object attributes, cached for efficiency. From enum * lu_object_header_attr. */ - u32 loh_attr; + u32 loh_attr; /** * Linkage into per-site hash table. Protected by lu_site::ls_guard. */ - struct hlist_node loh_hash; + struct hlist_node loh_hash; /** * Linkage into per-site LRU list. Protected by lu_site::ls_guard. */ - struct list_head loh_lru; + struct list_head loh_lru; /** * Linkage into list of layers. Never modified once set (except lately * during object destruction). No locking is necessary. */ - struct list_head loh_layers; + struct list_head loh_layers; /** * A list of references to this object, for debugging. */ - struct lu_ref loh_reference; + struct lu_ref loh_reference; }; struct fld; @@ -577,7 +577,7 @@ struct lu_site { /** * Top-level device for this stack. */ - struct lu_device *ls_top_dev; + struct lu_device *ls_top_dev; /** * Bottom-level device for this stack */ @@ -585,12 +585,12 @@ struct lu_site { /** * Linkage into global list of sites. */ - struct list_head ls_linkage; + struct list_head ls_linkage; /** * List for lu device for this site, protected * by ls_ld_lock. **/ - struct list_head ls_ld_linkage; + struct list_head ls_ld_linkage; spinlock_t ls_ld_lock; /** @@ -609,7 +609,7 @@ struct lu_site { /** * Number of objects in lsb_lru_lists - used for shrinking */ - struct percpu_counter ls_lru_len_counter; + struct percpu_counter ls_lru_len_counter; }; wait_queue_head_t * @@ -753,31 +753,31 @@ int lu_cdebug_printer(const struct lu_env *env, /** * Print object description followed by a user-supplied message. */ -#define LU_OBJECT_DEBUG(mask, env, object, format, ...) \ -do { \ - if (cfs_cdebug_show(mask, DEBUG_SUBSYSTEM)) { \ +#define LU_OBJECT_DEBUG(mask, env, object, format, ...) \ +do { \ + if (cfs_cdebug_show(mask, DEBUG_SUBSYSTEM)) { \ LIBCFS_DEBUG_MSG_DATA_DECL(msgdata, mask, NULL); \ lu_object_print(env, &msgdata, lu_cdebug_printer, object);\ - CDEBUG(mask, format "\n", ## __VA_ARGS__); \ - } \ + CDEBUG(mask, format "\n", ## __VA_ARGS__); \ + } \ } while (0) /** * Print short object description followed by a user-supplied message. */ #define LU_OBJECT_HEADER(mask, env, object, format, ...) \ -do { \ - if (cfs_cdebug_show(mask, DEBUG_SUBSYSTEM)) { \ +do { \ + if (cfs_cdebug_show(mask, DEBUG_SUBSYSTEM)) { \ LIBCFS_DEBUG_MSG_DATA_DECL(msgdata, mask, NULL); \ lu_object_header_print(env, &msgdata, lu_cdebug_printer,\ - (object)->lo_header); \ - lu_cdebug_printer(env, &msgdata, "\n"); \ - CDEBUG(mask, format, ## __VA_ARGS__); \ - } \ + (object)->lo_header); \ + lu_cdebug_printer(env, &msgdata, "\n"); \ + CDEBUG(mask, format, ## __VA_ARGS__); \ + } \ } while (0) -void lu_object_print (const struct lu_env *env, void *cookie, - lu_printer_t printer, const struct lu_object *o); +void lu_object_print(const struct lu_env *env, void *cookie, + lu_printer_t printer, const struct lu_object *o); void lu_object_header_print(const struct lu_env *env, void *cookie, lu_printer_t printer, const struct lu_object_header *hdr); @@ -849,15 +849,15 @@ static inline void lu_object_ref_del_at(struct lu_object *o, /** input params, should be filled out by mdt */ struct lu_rdpg { /** hash */ - u64 rp_hash; + u64 rp_hash; /** count in bytes */ - unsigned int rp_count; + unsigned int rp_count; /** number of pages */ - unsigned int rp_npages; + unsigned int rp_npages; /** requested attr */ - u32 rp_attrs; + u32 rp_attrs; /** pointers to pages */ - struct page **rp_pages; + struct page **rp_pages; }; enum lu_xattr_flags { @@ -912,24 +912,24 @@ struct lu_context { * of tags has non-empty intersection with one for key. Tags are taken * from enum lu_context_tag. */ - u32 lc_tags; - enum lu_context_state lc_state; + u32 lc_tags; + enum lu_context_state lc_state; /** * Pointer to the home service thread. NULL for other execution * contexts. */ - struct ptlrpc_thread *lc_thread; + struct ptlrpc_thread *lc_thread; /** * Pointer to an array with key values. Internal implementation * detail. */ - void **lc_value; + void **lc_value; /** * Linkage into a list of all remembered contexts. Only * `non-transient' contexts, i.e., ones created for service threads * are placed here. */ - struct list_head lc_remember; + struct list_head lc_remember; /** * Version counter used to skip calls to lu_context_refill() when no * keys were registered. @@ -949,59 +949,59 @@ enum lu_context_tag { /** * Thread on md server */ - LCT_MD_THREAD = 1 << 0, + LCT_MD_THREAD = 1 << 0, /** * Thread on dt server */ - LCT_DT_THREAD = 1 << 1, + LCT_DT_THREAD = 1 << 1, /** * Context for transaction handle */ - LCT_TX_HANDLE = 1 << 2, + LCT_TX_HANDLE = 1 << 2, /** * Thread on client */ - LCT_CL_THREAD = 1 << 3, + LCT_CL_THREAD = 1 << 3, /** * A per-request session on a server, and a per-system-call session on * a client. */ - LCT_SESSION = 1 << 4, + LCT_SESSION = 1 << 4, /** * A per-request data on OSP device */ - LCT_OSP_THREAD = 1 << 5, + LCT_OSP_THREAD = 1 << 5, /** * MGS device thread */ - LCT_MG_THREAD = 1 << 6, + LCT_MG_THREAD = 1 << 6, /** * Context for local operations */ - LCT_LOCAL = 1 << 7, + LCT_LOCAL = 1 << 7, /** * session for server thread **/ - LCT_SERVER_SESSION = BIT(8), + LCT_SERVER_SESSION = BIT(8), /** * Set when at least one of keys, having values in this context has * non-NULL lu_context_key::lct_exit() method. This is used to * optimize lu_context_exit() call. */ - LCT_HAS_EXIT = 1 << 28, + LCT_HAS_EXIT = 1 << 28, /** * Don't add references for modules creating key values in that context. * This is only for contexts used internally by lu_object framework. */ - LCT_NOREF = 1 << 29, + LCT_NOREF = 1 << 29, /** * Key is being prepared for retiring, don't create new values for it. */ - LCT_QUIESCENT = 1 << 30, + LCT_QUIESCENT = 1 << 30, /** * Context should be remembered. */ - LCT_REMEMBER = 1 << 31, + LCT_REMEMBER = 1 << 31, /** * Contexts usable in cache shrinker thread. */ @@ -1049,7 +1049,7 @@ struct lu_context_key { /** * Set of tags for which values of this key are to be instantiated. */ - u32 lct_tags; + u32 lct_tags; /** * Value constructor. This is called when new value is created for a * context. Returns pointer to new value of error pointer. @@ -1074,62 +1074,62 @@ struct lu_context_key { * Internal implementation detail: index within lu_context::lc_value[] * reserved for this key. */ - int lct_index; + int lct_index; /** * Internal implementation detail: number of values created for this * key. */ - atomic_t lct_used; + atomic_t lct_used; /** * Internal implementation detail: module for this key. */ - struct module *lct_owner; + struct module *lct_owner; /** * References to this key. For debugging. */ - struct lu_ref lct_reference; + struct lu_ref lct_reference; }; -#define LU_KEY_INIT(mod, type) \ - static void *mod##_key_init(const struct lu_context *ctx, \ - struct lu_context_key *key) \ - { \ - type *value; \ - \ - BUILD_BUG_ON(sizeof(*value) > PAGE_SIZE); \ - \ - value = kzalloc(sizeof(*value), GFP_NOFS); \ - if (!value) \ - value = ERR_PTR(-ENOMEM); \ - \ - return value; \ - } \ +#define LU_KEY_INIT(mod, type) \ + static void *mod##_key_init(const struct lu_context *ctx, \ + struct lu_context_key *key) \ + { \ + type *value; \ + \ + BUILD_BUG_ON(sizeof(*value) > PAGE_SIZE); \ + \ + value = kzalloc(sizeof(*value), GFP_NOFS); \ + if (!value) \ + value = ERR_PTR(-ENOMEM); \ + \ + return value; \ + } \ struct __##mod##__dummy_init {; } /* semicolon catcher */ -#define LU_KEY_FINI(mod, type) \ - static void mod##_key_fini(const struct lu_context *ctx, \ +#define LU_KEY_FINI(mod, type) \ + static void mod##_key_fini(const struct lu_context *ctx, \ struct lu_context_key *key, void *data) \ - { \ - type *info = data; \ - \ - kfree(info); \ - } \ + { \ + type *info = data; \ + \ + kfree(info); \ + } \ struct __##mod##__dummy_fini {; } /* semicolon catcher */ -#define LU_KEY_INIT_FINI(mod, type) \ - LU_KEY_INIT(mod, type); \ +#define LU_KEY_INIT_FINI(mod, type) \ + LU_KEY_INIT(mod, type); \ LU_KEY_FINI(mod, type) #define LU_CONTEXT_KEY_DEFINE(mod, tags) \ - struct lu_context_key mod##_thread_key = { \ - .lct_tags = tags, \ - .lct_init = mod##_key_init, \ - .lct_fini = mod##_key_fini \ + struct lu_context_key mod##_thread_key = { \ + .lct_tags = tags, \ + .lct_init = mod##_key_init, \ + .lct_fini = mod##_key_fini \ } #define LU_CONTEXT_KEY_INIT(key) \ -do { \ - (key)->lct_owner = THIS_MODULE; \ +do { \ + (key)->lct_owner = THIS_MODULE; \ } while (0) int lu_context_key_register(struct lu_context_key *key); @@ -1144,53 +1144,53 @@ void *lu_context_key_get(const struct lu_context *ctx, * owning module. */ -#define LU_KEY_INIT_GENERIC(mod) \ +#define LU_KEY_INIT_GENERIC(mod) \ static void mod##_key_init_generic(struct lu_context_key *k, ...) \ - { \ - struct lu_context_key *key = k; \ - va_list args; \ - \ - va_start(args, k); \ - do { \ - LU_CONTEXT_KEY_INIT(key); \ - key = va_arg(args, struct lu_context_key *); \ - } while (key); \ - va_end(args); \ + { \ + struct lu_context_key *key = k; \ + va_list args; \ + \ + va_start(args, k); \ + do { \ + LU_CONTEXT_KEY_INIT(key); \ + key = va_arg(args, struct lu_context_key *); \ + } while (key); \ + va_end(args); \ } -#define LU_TYPE_INIT(mod, ...) \ - LU_KEY_INIT_GENERIC(mod) \ - static int mod##_type_init(struct lu_device_type *t) \ - { \ - mod##_key_init_generic(__VA_ARGS__, NULL); \ - return lu_context_key_register_many(__VA_ARGS__, NULL); \ - } \ +#define LU_TYPE_INIT(mod, ...) \ + LU_KEY_INIT_GENERIC(mod) \ + static int mod##_type_init(struct lu_device_type *t) \ + { \ + mod##_key_init_generic(__VA_ARGS__, NULL); \ + return lu_context_key_register_many(__VA_ARGS__, NULL); \ + } \ struct __##mod##_dummy_type_init {; } -#define LU_TYPE_FINI(mod, ...) \ - static void mod##_type_fini(struct lu_device_type *t) \ - { \ +#define LU_TYPE_FINI(mod, ...) \ + static void mod##_type_fini(struct lu_device_type *t) \ + { \ lu_context_key_degister_many(__VA_ARGS__, NULL); \ - } \ + } \ struct __##mod##_dummy_type_fini {; } -#define LU_TYPE_START(mod, ...) \ - static void mod##_type_start(struct lu_device_type *t) \ - { \ - lu_context_key_revive_many(__VA_ARGS__, NULL); \ - } \ +#define LU_TYPE_START(mod, ...) \ + static void mod##_type_start(struct lu_device_type *t) \ + { \ + lu_context_key_revive_many(__VA_ARGS__, NULL); \ + } \ struct __##mod##_dummy_type_start {; } -#define LU_TYPE_STOP(mod, ...) \ - static void mod##_type_stop(struct lu_device_type *t) \ - { \ - lu_context_key_quiesce_many(__VA_ARGS__, NULL); \ - } \ +#define LU_TYPE_STOP(mod, ...) \ + static void mod##_type_stop(struct lu_device_type *t) \ + { \ + lu_context_key_quiesce_many(__VA_ARGS__, NULL); \ + } \ struct __##mod##_dummy_type_stop {; } -#define LU_TYPE_INIT_FINI(mod, ...) \ - LU_TYPE_INIT(mod, __VA_ARGS__); \ - LU_TYPE_FINI(mod, __VA_ARGS__); \ +#define LU_TYPE_INIT_FINI(mod, ...) \ + LU_TYPE_INIT(mod, __VA_ARGS__); \ + LU_TYPE_FINI(mod, __VA_ARGS__); \ LU_TYPE_START(mod, __VA_ARGS__); \ LU_TYPE_STOP(mod, __VA_ARGS__) @@ -1217,11 +1217,11 @@ struct lu_env { /** * "Local" context, used to store data instead of stack. */ - struct lu_context le_ctx; + struct lu_context le_ctx; /** * "Session" context for per-request data. */ - struct lu_context *le_ses; + struct lu_context *le_ses; }; int lu_env_init(struct lu_env *env, u32 tags); @@ -1240,8 +1240,8 @@ struct lu_env { * Common name structure to be passed around for various name related methods. */ struct lu_name { - const char *ln_name; - int ln_namelen; + const char *ln_name; + int ln_namelen; }; /** @@ -1265,8 +1265,8 @@ static inline bool lu_name_is_valid_2(const char *name, size_t name_len) * methods. */ struct lu_buf { - void *lb_buf; - size_t lb_len; + void *lb_buf; + size_t lb_len; }; /** @@ -1285,9 +1285,9 @@ struct lu_buf { void lu_global_fini(void); struct lu_kmem_descr { - struct kmem_cache **ckd_cache; - const char *ckd_name; - const size_t ckd_size; + struct kmem_cache **ckd_cache; + const char *ckd_name; + const size_t ckd_size; }; int lu_kmem_init(struct lu_kmem_descr *caches); diff --git a/drivers/staging/lustre/lustre/include/lustre_disk.h b/drivers/staging/lustre/lustre/include/lustre_disk.h index 091a09f..07c074e 100644 --- a/drivers/staging/lustre/lustre/include/lustre_disk.h +++ b/drivers/staging/lustre/lustre/include/lustre_disk.h @@ -51,13 +51,13 @@ /****************** persistent mount data *********************/ -#define LDD_F_SV_TYPE_MDT 0x0001 -#define LDD_F_SV_TYPE_OST 0x0002 -#define LDD_F_SV_TYPE_MGS 0x0004 -#define LDD_F_SV_TYPE_MASK (LDD_F_SV_TYPE_MDT | \ - LDD_F_SV_TYPE_OST | \ - LDD_F_SV_TYPE_MGS) -#define LDD_F_SV_ALL 0x0008 +#define LDD_F_SV_TYPE_MDT 0x0001 +#define LDD_F_SV_TYPE_OST 0x0002 +#define LDD_F_SV_TYPE_MGS 0x0004 +#define LDD_F_SV_TYPE_MASK (LDD_F_SV_TYPE_MDT | \ + LDD_F_SV_TYPE_OST | \ + LDD_F_SV_TYPE_MGS) +#define LDD_F_SV_ALL 0x0008 /****************** mount command *********************/ @@ -65,7 +65,7 @@ * everything as string options */ -#define LMD_MAGIC 0xbdacbd03 +#define LMD_MAGIC 0xbdacbd03 #define LMD_PARAMS_MAXLEN 4096 /* gleaned from the mount command - no persistent info here */ @@ -117,19 +117,19 @@ struct lustre_mount_data { struct kobject; struct lustre_sb_info { - int lsi_flags; - struct obd_device *lsi_mgc; /* mgc obd */ - struct lustre_mount_data *lsi_lmd; /* mount command info */ - struct ll_sb_info *lsi_llsbi; /* add'l client sbi info */ - struct dt_device *lsi_dt_dev; /* dt device to access disk fs*/ - atomic_t lsi_mounts; /* references to the srv_mnt */ - struct kobject *lsi_kobj; - char lsi_svname[MTI_NAME_MAXLEN]; - char lsi_osd_obdname[64]; - char lsi_osd_uuid[64]; - struct obd_export *lsi_osd_exp; - char lsi_osd_type[16]; - char lsi_fstype[16]; + int lsi_flags; + struct obd_device *lsi_mgc; /* mgc obd */ + struct lustre_mount_data *lsi_lmd; /* mount command info */ + struct ll_sb_info *lsi_llsbi; /* add'l client sbi info */ + struct dt_device *lsi_dt_dev; /* dt device to access disk fs */ + atomic_t lsi_mounts; /* references to the srv_mnt */ + struct kobject *lsi_kobj; + char lsi_svname[MTI_NAME_MAXLEN]; + char lsi_osd_obdname[64]; + char lsi_osd_uuid[64]; + struct obd_export *lsi_osd_exp; + char lsi_osd_type[16]; + char lsi_fstype[16]; }; #define LSI_UMOUNT_FAILOVER 0x00200000 diff --git a/drivers/staging/lustre/lustre/include/lustre_dlm.h b/drivers/staging/lustre/lustre/include/lustre_dlm.h index 7c12087..c561d61 100644 --- a/drivers/staging/lustre/lustre/include/lustre_dlm.h +++ b/drivers/staging/lustre/lustre/include/lustre_dlm.h @@ -66,17 +66,17 @@ * LDLM non-error return states */ enum ldlm_error { - ELDLM_OK = 0, - ELDLM_LOCK_MATCHED = 1, + ELDLM_OK = 0, + ELDLM_LOCK_MATCHED = 1, - ELDLM_LOCK_CHANGED = 300, - ELDLM_LOCK_ABORTED = 301, - ELDLM_LOCK_REPLACED = 302, - ELDLM_NO_LOCK_DATA = 303, - ELDLM_LOCK_WOULDBLOCK = 304, + ELDLM_LOCK_CHANGED = 300, + ELDLM_LOCK_ABORTED = 301, + ELDLM_LOCK_REPLACED = 302, + ELDLM_NO_LOCK_DATA = 303, + ELDLM_LOCK_WOULDBLOCK = 304, - ELDLM_NAMESPACE_EXISTS = 400, - ELDLM_BAD_NAMESPACE = 401 + ELDLM_NAMESPACE_EXISTS = 400, + ELDLM_BAD_NAMESPACE = 401 }; /** @@ -389,7 +389,7 @@ struct ldlm_namespace { * Position in global namespace list linking all namespaces on * the node. */ - struct list_head ns_list_chain; + struct list_head ns_list_chain; /** * List of unused locks for this namespace. This list is also called @@ -401,7 +401,7 @@ struct ldlm_namespace { * to release from the head of this list. * Locks are linked via l_lru field in \see struct ldlm_lock. */ - struct list_head ns_unused_list; + struct list_head ns_unused_list; /** Number of locks in the LRU list above */ int ns_nr_unused; @@ -437,7 +437,7 @@ struct ldlm_namespace { * Wait queue used by __ldlm_namespace_free. Gets woken up every time * a resource is removed. */ - wait_queue_head_t ns_waitq; + wait_queue_head_t ns_waitq; /** LDLM pool structure for this namespace */ struct ldlm_pool ns_pool; /** Definition of how eagerly unused locks will be released from LRU */ @@ -502,7 +502,7 @@ typedef int (*ldlm_completion_callback)(struct ldlm_lock *lock, u64 flags, /** Work list for sending GL ASTs to multiple locks. */ struct ldlm_glimpse_work { struct ldlm_lock *gl_lock; /* lock to glimpse */ - struct list_head gl_list; /* linkage to other gl work structs */ + struct list_head gl_list; /* linkage to other gl work structs */ u32 gl_flags;/* see LDLM_GL_WORK_* below */ union ldlm_gl_desc *gl_desc; /* glimpse descriptor to be packed in * glimpse callback request @@ -538,18 +538,18 @@ enum ldlm_cancel_flags { }; struct ldlm_flock { - u64 start; - u64 end; - u64 owner; - u64 blocking_owner; - struct obd_export *blocking_export; - u32 pid; + u64 start; + u64 end; + u64 owner; + u64 blocking_owner; + struct obd_export *blocking_export; + u32 pid; }; union ldlm_policy_data { - struct ldlm_extent l_extent; - struct ldlm_flock l_flock; - struct ldlm_inodebits l_inodebits; + struct ldlm_extent l_extent; + struct ldlm_flock l_flock; + struct ldlm_inodebits l_inodebits; }; void ldlm_convert_policy_to_local(struct obd_export *exp, enum ldlm_type type, @@ -589,23 +589,23 @@ struct ldlm_lock { * * Must be first in the structure. */ - struct portals_handle l_handle; + struct portals_handle l_handle; /** * Lock reference count. * This is how many users have pointers to actual structure, so that * we do not accidentally free lock structure that is in use. */ - atomic_t l_refc; + atomic_t l_refc; /** * Internal spinlock protects l_resource. We should hold this lock * first before taking res_lock. */ - spinlock_t l_lock; + spinlock_t l_lock; /** * Pointer to actual resource this lock is in. * ldlm_lock_change_resource() can change this. */ - struct ldlm_resource *l_resource; + struct ldlm_resource *l_resource; /** * List item for client side LRU list. * Protected by ns_lock in struct ldlm_namespace. @@ -620,20 +620,20 @@ struct ldlm_lock { /** * Interval-tree node for ldlm_extent. */ - struct rb_node l_rb; - u64 __subtree_last; + struct rb_node l_rb; + u64 __subtree_last; /** * Requested mode. * Protected by lr_lock. */ - enum ldlm_mode l_req_mode; + enum ldlm_mode l_req_mode; /** * Granted mode, also protected by lr_lock. */ - enum ldlm_mode l_granted_mode; + enum ldlm_mode l_granted_mode; /** Lock completion handler pointer. Called when lock is granted. */ - ldlm_completion_callback l_completion_ast; + ldlm_completion_callback l_completion_ast; /** * Lock blocking AST handler pointer. * It plays two roles: @@ -644,51 +644,51 @@ struct ldlm_lock { * and then once more when the last user went away and the lock is * cancelled (could happen recursively). */ - ldlm_blocking_callback l_blocking_ast; + ldlm_blocking_callback l_blocking_ast; /** * Lock glimpse handler. * Glimpse handler is used to obtain LVB updates from a client by * server */ - ldlm_glimpse_callback l_glimpse_ast; + ldlm_glimpse_callback l_glimpse_ast; /** * Lock export. * This is a pointer to actual client export for locks that were granted * to clients. Used server-side. */ - struct obd_export *l_export; + struct obd_export *l_export; /** * Lock connection export. * Pointer to server export on a client. */ - struct obd_export *l_conn_export; + struct obd_export *l_conn_export; /** * Remote lock handle. * If the lock is remote, this is the handle of the other side lock * (l_handle) */ - struct lustre_handle l_remote_handle; + struct lustre_handle l_remote_handle; /** * Representation of private data specific for a lock type. * Examples are: extent range for extent lock or bitmask for ibits locks */ - union ldlm_policy_data l_policy_data; + union ldlm_policy_data l_policy_data; /** * Lock state flags. Protected by lr_lock. * \see lustre_dlm_flags.h where the bits are defined. */ - u64 l_flags; + u64 l_flags; /** * Lock r/w usage counters. * Protected by lr_lock. */ - u32 l_readers; - u32 l_writers; + u32 l_readers; + u32 l_writers; /** * If the lock is granted, a process sleeps on this waitq to learn when * it's no longer in use. If the lock is not granted, a process sleeps @@ -700,31 +700,31 @@ struct ldlm_lock { * Seconds. It will be updated if there is any activity related to * the lock, e.g. enqueue the lock or send blocking AST. */ - time64_t l_last_activity; + time64_t l_last_activity; /** * Time last used by e.g. being matched by lock match. * Jiffies. Should be converted to time if needed. */ - unsigned long l_last_used; + unsigned long l_last_used; /** Originally requested extent for the extent lock. */ - struct ldlm_extent l_req_extent; + struct ldlm_extent l_req_extent; /* * Client-side-only members. */ - enum lvb_type l_lvb_type; + enum lvb_type l_lvb_type; /** * Temporary storage for a LVB received during an enqueue operation. */ - u32 l_lvb_len; - void *l_lvb_data; + u32 l_lvb_len; + void *l_lvb_data; /** Private storage for lock user. Opaque to LDLM. */ - void *l_ast_data; + void *l_ast_data; /* * Server-side-only members. @@ -735,7 +735,7 @@ struct ldlm_lock { * Used by Commit on Share (COS) code. Currently only used for * inodebits locks on MDS. */ - u64 l_client_cookie; + u64 l_client_cookie; /** * List item for locks waiting for cancellation from clients. @@ -753,10 +753,10 @@ struct ldlm_lock { * under this lock. * \see ost_rw_prolong_locks */ - unsigned long l_callback_timeout; + unsigned long l_callback_timeout; /** Local PID of process which created this lock. */ - u32 l_pid; + u32 l_pid; /** * Number of times blocking AST was sent for this lock. @@ -764,7 +764,7 @@ struct ldlm_lock { * attempt to send blocking AST more than once, an assertion would be * hit. \see ldlm_work_bl_ast_lock */ - int l_bl_ast_run; + int l_bl_ast_run; /** List item ldlm_add_ast_work_item() for case of blocking ASTs. */ struct list_head l_bl_ast; /** List item ldlm_add_ast_work_item() for case of completion ASTs. */ @@ -776,7 +776,7 @@ struct ldlm_lock { * Pointer to a conflicting lock that caused blocking AST to be sent * for this lock */ - struct ldlm_lock *l_blocking_lock; + struct ldlm_lock *l_blocking_lock; /** * Protected by lr_lock, linkages to "skip lists". @@ -786,15 +786,15 @@ struct ldlm_lock { struct list_head l_sl_policy; /** Reference tracking structure to debug leaked locks. */ - struct lu_ref l_reference; + struct lu_ref l_reference; #if LUSTRE_TRACKS_LOCK_EXP_REFS /* Debugging stuff for bug 20498, for tracking export references. */ /** number of export references taken */ - int l_exp_refs_nr; + int l_exp_refs_nr; /** link all locks referencing one export */ struct list_head l_exp_refs_link; /** referenced export object */ - struct obd_export *l_exp_refs_target; + struct obd_export *l_exp_refs_target; #endif }; @@ -810,19 +810,19 @@ struct ldlm_lock { * whether the locks are conflicting or not. */ struct ldlm_resource { - struct ldlm_ns_bucket *lr_ns_bucket; + struct ldlm_ns_bucket *lr_ns_bucket; /** * List item for list in namespace hash. * protected by ns_lock */ - struct hlist_node lr_hash; + struct hlist_node lr_hash; /** Reference count for this resource */ - atomic_t lr_refcount; + atomic_t lr_refcount; /** Spinlock to protect locks under this resource. */ - spinlock_t lr_lock; + spinlock_t lr_lock; /** * protected by lr_lock @@ -838,30 +838,30 @@ struct ldlm_resource { /** @} */ /** Resource name */ - struct ldlm_res_id lr_name; + struct ldlm_res_id lr_name; /** * Interval trees (only for extent locks) for all modes of this resource */ - struct ldlm_interval_tree *lr_itree; + struct ldlm_interval_tree *lr_itree; /** Type of locks this resource can hold. Only one type per resource. */ - enum ldlm_type lr_type; /* LDLM_{PLAIN,EXTENT,FLOCK,IBITS} */ + enum ldlm_type lr_type; /* LDLM_{PLAIN,EXTENT,FLOCK,IBITS} */ /** * Server-side-only lock value block elements. * To serialize lvbo_init. */ - int lr_lvb_len; - struct mutex lr_lvb_mutex; + int lr_lvb_len; + struct mutex lr_lvb_mutex; /** * Associated inode, used only on client side. */ - struct inode *lr_lvb_inode; + struct inode *lr_lvb_inode; /** List of references to this resource. For debugging. */ - struct lu_ref lr_reference; + struct lu_ref lr_reference; }; static inline bool ldlm_has_layout(struct ldlm_lock *lock) @@ -931,26 +931,26 @@ static inline int ldlm_lvbo_fill(struct ldlm_lock *lock, void *buf, int len) } struct ldlm_ast_work { - struct ldlm_lock *w_lock; - int w_blocking; - struct ldlm_lock_desc w_desc; - struct list_head w_list; - int w_flags; - void *w_data; - int w_datalen; + struct ldlm_lock *w_lock; + int w_blocking; + struct ldlm_lock_desc w_desc; + struct list_head w_list; + int w_flags; + void *w_data; + int w_datalen; }; /** * Common ldlm_enqueue parameters */ struct ldlm_enqueue_info { - enum ldlm_type ei_type; /** Type of the lock being enqueued. */ - enum ldlm_mode ei_mode; /** Mode of the lock being enqueued. */ - void *ei_cb_bl; /** blocking lock callback */ - void *ei_cb_cp; /** lock completion callback */ - void *ei_cb_gl; /** lock glimpse callback */ - void *ei_cbdata; /** Data to be passed into callbacks. */ - unsigned int ei_enq_slave:1; /* whether enqueue slave stripes */ + enum ldlm_type ei_type; /** Type of the lock being enqueued. */ + enum ldlm_mode ei_mode; /** Mode of the lock being enqueued. */ + void *ei_cb_bl; /** blocking lock callback */ + void *ei_cb_cp; /** lock completion callback */ + void *ei_cb_gl; /** lock glimpse callback */ + void *ei_cbdata; /** Data to be passed into callbacks. */ + unsigned int ei_enq_slave:1; /* whether enqueue slave stripes */ }; extern struct obd_ops ldlm_obd_ops; @@ -971,12 +971,12 @@ struct ldlm_enqueue_info { * \see LDLM_DEBUG */ #define ldlm_lock_debug(msgdata, mask, cdls, lock, fmt, a...) do { \ - CFS_CHECK_STACK(msgdata, mask, cdls); \ + CFS_CHECK_STACK(msgdata, mask, cdls); \ \ - if (((mask) & D_CANTMASK) != 0 || \ - ((libcfs_debug & (mask)) != 0 && \ - (libcfs_subsystem_debug & DEBUG_SUBSYSTEM) != 0)) \ - _ldlm_lock_debug(lock, msgdata, fmt, ##a); \ + if (((mask) & D_CANTMASK) != 0 || \ + ((libcfs_debug & (mask)) != 0 && \ + (libcfs_subsystem_debug & DEBUG_SUBSYSTEM) != 0)) \ + _ldlm_lock_debug(lock, msgdata, fmt, ##a); \ } while (0) void _ldlm_lock_debug(struct ldlm_lock *lock, @@ -987,9 +987,9 @@ void _ldlm_lock_debug(struct ldlm_lock *lock, /** * Rate-limited version of lock printing function. */ -#define LDLM_DEBUG_LIMIT(mask, lock, fmt, a...) do { \ - static struct cfs_debug_limit_state _ldlm_cdls; \ - LIBCFS_DEBUG_MSG_DATA_DECL(msgdata, mask, &_ldlm_cdls); \ +#define LDLM_DEBUG_LIMIT(mask, lock, fmt, a...) do { \ + static struct cfs_debug_limit_state _ldlm_cdls; \ + LIBCFS_DEBUG_MSG_DATA_DECL(msgdata, mask, &_ldlm_cdls); \ ldlm_lock_debug(&msgdata, mask, &_ldlm_cdls, lock, "### " fmt, ##a);\ } while (0) @@ -997,14 +997,14 @@ void _ldlm_lock_debug(struct ldlm_lock *lock, #define LDLM_WARN(lock, fmt, a...) LDLM_DEBUG_LIMIT(D_WARNING, lock, fmt, ## a) /** Non-rate-limited lock printing function for debugging purposes. */ -#define LDLM_DEBUG(lock, fmt, a...) do { \ - if (likely(lock)) { \ - LIBCFS_DEBUG_MSG_DATA_DECL(msgdata, D_DLMTRACE, NULL); \ - ldlm_lock_debug(&msgdata, D_DLMTRACE, NULL, lock, \ - "### " fmt, ##a); \ - } else { \ - LDLM_DEBUG_NOLOCK("no dlm lock: " fmt, ##a); \ - } \ +#define LDLM_DEBUG(lock, fmt, a...) do { \ + if (likely(lock)) { \ + LIBCFS_DEBUG_MSG_DATA_DECL(msgdata, D_DLMTRACE, NULL); \ + ldlm_lock_debug(&msgdata, D_DLMTRACE, NULL, lock, \ + "### " fmt, ##a); \ + } else { \ + LDLM_DEBUG_NOLOCK("no dlm lock: " fmt, ##a); \ + } \ } while (0) typedef int (*ldlm_processing_policy)(struct ldlm_lock *lock, u64 *flags, @@ -1040,9 +1040,9 @@ int ldlm_resource_iterate(struct ldlm_namespace *, const struct ldlm_res_id *, u64 ldlm_extent_shift_kms(struct ldlm_lock *lock, u64 old_kms); struct ldlm_callback_suite { - ldlm_completion_callback lcs_completion; - ldlm_blocking_callback lcs_blocking; - ldlm_glimpse_callback lcs_glimpse; + ldlm_completion_callback lcs_completion; + ldlm_blocking_callback lcs_blocking; + ldlm_glimpse_callback lcs_glimpse; }; /* ldlm_lockd.c */ @@ -1105,41 +1105,41 @@ static inline int ldlm_res_lvbo_update(struct ldlm_resource *res, * Release a temporary lock reference obtained by ldlm_handle2lock() or * __ldlm_handle2lock(). */ -#define LDLM_LOCK_PUT(lock) \ -do { \ - LDLM_LOCK_REF_DEL(lock); \ - /*LDLM_DEBUG((lock), "put");*/ \ - ldlm_lock_put(lock); \ +#define LDLM_LOCK_PUT(lock) \ +do { \ + LDLM_LOCK_REF_DEL(lock); \ + /*LDLM_DEBUG((lock), "put");*/ \ + ldlm_lock_put(lock); \ } while (0) /** * Release a lock reference obtained by some other means (see * LDLM_LOCK_PUT()). */ -#define LDLM_LOCK_RELEASE(lock) \ -do { \ - /*LDLM_DEBUG((lock), "put");*/ \ - ldlm_lock_put(lock); \ +#define LDLM_LOCK_RELEASE(lock) \ +do { \ + /*LDLM_DEBUG((lock), "put");*/ \ + ldlm_lock_put(lock); \ } while (0) -#define LDLM_LOCK_GET(lock) \ -({ \ - ldlm_lock_get(lock); \ - /*LDLM_DEBUG((lock), "get");*/ \ - lock; \ +#define LDLM_LOCK_GET(lock) \ +({ \ + ldlm_lock_get(lock); \ + /*LDLM_DEBUG((lock), "get");*/ \ + lock; \ }) -#define ldlm_lock_list_put(head, member, count) \ -({ \ - struct ldlm_lock *_lock, *_next; \ - int c = count; \ - list_for_each_entry_safe(_lock, _next, head, member) { \ - if (c-- == 0) \ - break; \ - list_del_init(&_lock->member); \ - LDLM_LOCK_RELEASE(_lock); \ - } \ - LASSERT(c <= 0); \ +#define ldlm_lock_list_put(head, member, count) \ +({ \ + struct ldlm_lock *_lock, *_next; \ + int c = count; \ + list_for_each_entry_safe(_lock, _next, head, member) { \ + if (c-- == 0) \ + break; \ + list_del_init(&_lock->member); \ + LDLM_LOCK_RELEASE(_lock); \ + } \ + LASSERT(c <= 0); \ }) struct ldlm_lock *ldlm_lock_get(struct ldlm_lock *lock); @@ -1198,12 +1198,12 @@ void ldlm_resource_add_lock(struct ldlm_resource *res, int ldlm_lock_change_resource(struct ldlm_namespace *, struct ldlm_lock *, const struct ldlm_res_id *); -#define LDLM_RESOURCE_ADDREF(res) do { \ - lu_ref_add_atomic(&(res)->lr_reference, __func__, current); \ +#define LDLM_RESOURCE_ADDREF(res) do { \ + lu_ref_add_atomic(&(res)->lr_reference, __func__, current); \ } while (0) -#define LDLM_RESOURCE_DELREF(res) do { \ - lu_ref_del(&(res)->lr_reference, __func__, current); \ +#define LDLM_RESOURCE_DELREF(res) do { \ + lu_ref_del(&(res)->lr_reference, __func__, current); \ } while (0) /* ldlm_request.c */ diff --git a/drivers/staging/lustre/lustre/include/lustre_dlm_flags.h b/drivers/staging/lustre/lustre/include/lustre_dlm_flags.h index 487ea17..abeb651 100644 --- a/drivers/staging/lustre/lustre/include/lustre_dlm_flags.h +++ b/drivers/staging/lustre/lustre/include/lustre_dlm_flags.h @@ -27,100 +27,100 @@ #ifndef LDLM_ALL_FLAGS_MASK /** l_flags bits marked as "all_flags" bits */ -#define LDLM_FL_ALL_FLAGS_MASK 0x00FFFFFFC08F932FULL +#define LDLM_FL_ALL_FLAGS_MASK 0x00FFFFFFC08F932FULL /** extent, mode, or resource changed */ -#define LDLM_FL_LOCK_CHANGED 0x0000000000000001ULL /* bit 0 */ -#define ldlm_is_lock_changed(_l) LDLM_TEST_FLAG((_l), 1ULL << 0) -#define ldlm_set_lock_changed(_l) LDLM_SET_FLAG((_l), 1ULL << 0) -#define ldlm_clear_lock_changed(_l) LDLM_CLEAR_FLAG((_l), 1ULL << 0) +#define LDLM_FL_LOCK_CHANGED 0x0000000000000001ULL /* bit 0 */ +#define ldlm_is_lock_changed(_l) LDLM_TEST_FLAG((_l), 1ULL << 0) +#define ldlm_set_lock_changed(_l) LDLM_SET_FLAG((_l), 1ULL << 0) +#define ldlm_clear_lock_changed(_l) LDLM_CLEAR_FLAG((_l), 1ULL << 0) /** * Server placed lock on granted list, or a recovering client wants the * lock added to the granted list, no questions asked. */ -#define LDLM_FL_BLOCK_GRANTED 0x0000000000000002ULL /* bit 1 */ -#define ldlm_is_block_granted(_l) LDLM_TEST_FLAG((_l), 1ULL << 1) -#define ldlm_set_block_granted(_l) LDLM_SET_FLAG((_l), 1ULL << 1) -#define ldlm_clear_block_granted(_l) LDLM_CLEAR_FLAG((_l), 1ULL << 1) +#define LDLM_FL_BLOCK_GRANTED 0x0000000000000002ULL /* bit 1 */ +#define ldlm_is_block_granted(_l) LDLM_TEST_FLAG((_l), 1ULL << 1) +#define ldlm_set_block_granted(_l) LDLM_SET_FLAG((_l), 1ULL << 1) +#define ldlm_clear_block_granted(_l) LDLM_CLEAR_FLAG((_l), 1ULL << 1) /** * Server placed lock on conv list, or a recovering client wants the lock * added to the conv list, no questions asked. */ -#define LDLM_FL_BLOCK_CONV 0x0000000000000004ULL /* bit 2 */ -#define ldlm_is_block_conv(_l) LDLM_TEST_FLAG((_l), 1ULL << 2) -#define ldlm_set_block_conv(_l) LDLM_SET_FLAG((_l), 1ULL << 2) -#define ldlm_clear_block_conv(_l) LDLM_CLEAR_FLAG((_l), 1ULL << 2) +#define LDLM_FL_BLOCK_CONV 0x0000000000000004ULL /* bit 2 */ +#define ldlm_is_block_conv(_l) LDLM_TEST_FLAG((_l), 1ULL << 2) +#define ldlm_set_block_conv(_l) LDLM_SET_FLAG((_l), 1ULL << 2) +#define ldlm_clear_block_conv(_l) LDLM_CLEAR_FLAG((_l), 1ULL << 2) /** * Server placed lock on wait list, or a recovering client wants the lock * added to the wait list, no questions asked. */ -#define LDLM_FL_BLOCK_WAIT 0x0000000000000008ULL /* bit 3 */ -#define ldlm_is_block_wait(_l) LDLM_TEST_FLAG((_l), 1ULL << 3) -#define ldlm_set_block_wait(_l) LDLM_SET_FLAG((_l), 1ULL << 3) -#define ldlm_clear_block_wait(_l) LDLM_CLEAR_FLAG((_l), 1ULL << 3) +#define LDLM_FL_BLOCK_WAIT 0x0000000000000008ULL /* bit 3 */ +#define ldlm_is_block_wait(_l) LDLM_TEST_FLAG((_l), 1ULL << 3) +#define ldlm_set_block_wait(_l) LDLM_SET_FLAG((_l), 1ULL << 3) +#define ldlm_clear_block_wait(_l) LDLM_CLEAR_FLAG((_l), 1ULL << 3) /** blocking or cancel packet was queued for sending. */ -#define LDLM_FL_AST_SENT 0x0000000000000020ULL /* bit 5 */ -#define ldlm_is_ast_sent(_l) LDLM_TEST_FLAG((_l), 1ULL << 5) -#define ldlm_set_ast_sent(_l) LDLM_SET_FLAG((_l), 1ULL << 5) -#define ldlm_clear_ast_sent(_l) LDLM_CLEAR_FLAG((_l), 1ULL << 5) +#define LDLM_FL_AST_SENT 0x0000000000000020ULL /* bit 5 */ +#define ldlm_is_ast_sent(_l) LDLM_TEST_FLAG((_l), 1ULL << 5) +#define ldlm_set_ast_sent(_l) LDLM_SET_FLAG((_l), 1ULL << 5) +#define ldlm_clear_ast_sent(_l) LDLM_CLEAR_FLAG((_l), 1ULL << 5) /** * Lock is being replayed. This could probably be implied by the fact that * one of BLOCK_{GRANTED,CONV,WAIT} is set, but that is pretty dangerous. */ -#define LDLM_FL_REPLAY 0x0000000000000100ULL /* bit 8 */ -#define ldlm_is_replay(_l) LDLM_TEST_FLAG((_l), 1ULL << 8) -#define ldlm_set_replay(_l) LDLM_SET_FLAG((_l), 1ULL << 8) -#define ldlm_clear_replay(_l) LDLM_CLEAR_FLAG((_l), 1ULL << 8) +#define LDLM_FL_REPLAY 0x0000000000000100ULL /* bit 8 */ +#define ldlm_is_replay(_l) LDLM_TEST_FLAG((_l), 1ULL << 8) +#define ldlm_set_replay(_l) LDLM_SET_FLAG((_l), 1ULL << 8) +#define ldlm_clear_replay(_l) LDLM_CLEAR_FLAG((_l), 1ULL << 8) /** Don't grant lock, just do intent. */ -#define LDLM_FL_INTENT_ONLY 0x0000000000000200ULL /* bit 9 */ -#define ldlm_is_intent_only(_l) LDLM_TEST_FLAG((_l), 1ULL << 9) -#define ldlm_set_intent_only(_l) LDLM_SET_FLAG((_l), 1ULL << 9) -#define ldlm_clear_intent_only(_l) LDLM_CLEAR_FLAG((_l), 1ULL << 9) +#define LDLM_FL_INTENT_ONLY 0x0000000000000200ULL /* bit 9 */ +#define ldlm_is_intent_only(_l) LDLM_TEST_FLAG((_l), 1ULL << 9) +#define ldlm_set_intent_only(_l) LDLM_SET_FLAG((_l), 1ULL << 9) +#define ldlm_clear_intent_only(_l) LDLM_CLEAR_FLAG((_l), 1ULL << 9) /** lock request has intent */ -#define LDLM_FL_HAS_INTENT 0x0000000000001000ULL /* bit 12 */ -#define ldlm_is_has_intent(_l) LDLM_TEST_FLAG((_l), 1ULL << 12) -#define ldlm_set_has_intent(_l) LDLM_SET_FLAG((_l), 1ULL << 12) -#define ldlm_clear_has_intent(_l) LDLM_CLEAR_FLAG((_l), 1ULL << 12) +#define LDLM_FL_HAS_INTENT 0x0000000000001000ULL /* bit 12 */ +#define ldlm_is_has_intent(_l) LDLM_TEST_FLAG((_l), 1ULL << 12) +#define ldlm_set_has_intent(_l) LDLM_SET_FLAG((_l), 1ULL << 12) +#define ldlm_clear_has_intent(_l) LDLM_CLEAR_FLAG((_l), 1ULL << 12) /** flock deadlock detected */ -#define LDLM_FL_FLOCK_DEADLOCK 0x0000000000008000ULL /* bit 15 */ -#define ldlm_is_flock_deadlock(_l) LDLM_TEST_FLAG((_l), 1ULL << 15) -#define ldlm_set_flock_deadlock(_l) LDLM_SET_FLAG((_l), 1ULL << 15) -#define ldlm_clear_flock_deadlock(_l) LDLM_CLEAR_FLAG((_l), 1ULL << 15) +#define LDLM_FL_FLOCK_DEADLOCK 0x0000000000008000ULL /* bit 15 */ +#define ldlm_is_flock_deadlock(_l) LDLM_TEST_FLAG((_l), 1ULL << 15) +#define ldlm_set_flock_deadlock(_l) LDLM_SET_FLAG((_l), 1ULL << 15) +#define ldlm_clear_flock_deadlock(_l) LDLM_CLEAR_FLAG((_l), 1ULL << 15) /** discard (no writeback) (PW locks) or page retention (PR locks)) on cancel */ -#define LDLM_FL_DISCARD_DATA 0x0000000000010000ULL /* bit 16 */ -#define ldlm_is_discard_data(_l) LDLM_TEST_FLAG((_l), 1ULL << 16) -#define ldlm_set_discard_data(_l) LDLM_SET_FLAG((_l), 1ULL << 16) -#define ldlm_clear_discard_data(_l) LDLM_CLEAR_FLAG((_l), 1ULL << 16) +#define LDLM_FL_DISCARD_DATA 0x0000000000010000ULL /* bit 16 */ +#define ldlm_is_discard_data(_l) LDLM_TEST_FLAG((_l), 1ULL << 16) +#define ldlm_set_discard_data(_l) LDLM_SET_FLAG((_l), 1ULL << 16) +#define ldlm_clear_discard_data(_l) LDLM_CLEAR_FLAG((_l), 1ULL << 16) /** Blocked by group lock - wait indefinitely */ -#define LDLM_FL_NO_TIMEOUT 0x0000000000020000ULL /* bit 17 */ -#define ldlm_is_no_timeout(_l) LDLM_TEST_FLAG((_l), 1ULL << 17) -#define ldlm_set_no_timeout(_l) LDLM_SET_FLAG((_l), 1ULL << 17) -#define ldlm_clear_no_timeout(_l) LDLM_CLEAR_FLAG((_l), 1ULL << 17) +#define LDLM_FL_NO_TIMEOUT 0x0000000000020000ULL /* bit 17 */ +#define ldlm_is_no_timeout(_l) LDLM_TEST_FLAG((_l), 1ULL << 17) +#define ldlm_set_no_timeout(_l) LDLM_SET_FLAG((_l), 1ULL << 17) +#define ldlm_clear_no_timeout(_l) LDLM_CLEAR_FLAG((_l), 1ULL << 17) /** * Server told not to wait if blocked. For AGL, OST will not send glimpse * callback. */ -#define LDLM_FL_BLOCK_NOWAIT 0x0000000000040000ULL /* bit 18 */ -#define ldlm_is_block_nowait(_l) LDLM_TEST_FLAG((_l), 1ULL << 18) -#define ldlm_set_block_nowait(_l) LDLM_SET_FLAG((_l), 1ULL << 18) -#define ldlm_clear_block_nowait(_l) LDLM_CLEAR_FLAG((_l), 1ULL << 18) +#define LDLM_FL_BLOCK_NOWAIT 0x0000000000040000ULL /* bit 18 */ +#define ldlm_is_block_nowait(_l) LDLM_TEST_FLAG((_l), 1ULL << 18) +#define ldlm_set_block_nowait(_l) LDLM_SET_FLAG((_l), 1ULL << 18) +#define ldlm_clear_block_nowait(_l) LDLM_CLEAR_FLAG((_l), 1ULL << 18) /** return blocking lock */ -#define LDLM_FL_TEST_LOCK 0x0000000000080000ULL /* bit 19 */ -#define ldlm_is_test_lock(_l) LDLM_TEST_FLAG((_l), 1ULL << 19) -#define ldlm_set_test_lock(_l) LDLM_SET_FLAG((_l), 1ULL << 19) -#define ldlm_clear_test_lock(_l) LDLM_CLEAR_FLAG((_l), 1ULL << 19) +#define LDLM_FL_TEST_LOCK 0x0000000000080000ULL /* bit 19 */ +#define ldlm_is_test_lock(_l) LDLM_TEST_FLAG((_l), 1ULL << 19) +#define ldlm_set_test_lock(_l) LDLM_SET_FLAG((_l), 1ULL << 19) +#define ldlm_clear_test_lock(_l) LDLM_CLEAR_FLAG((_l), 1ULL << 19) /** match lock only */ #define LDLM_FL_MATCH_LOCK 0x0000000000100000ULL /* bit 20 */ @@ -131,87 +131,87 @@ * is for clients (like liblustre) that cannot be expected to reliably * response to blocking AST. */ -#define LDLM_FL_CANCEL_ON_BLOCK 0x0000000000800000ULL /* bit 23 */ -#define ldlm_is_cancel_on_block(_l) LDLM_TEST_FLAG((_l), 1ULL << 23) -#define ldlm_set_cancel_on_block(_l) LDLM_SET_FLAG((_l), 1ULL << 23) -#define ldlm_clear_cancel_on_block(_l) LDLM_CLEAR_FLAG((_l), 1ULL << 23) +#define LDLM_FL_CANCEL_ON_BLOCK 0x0000000000800000ULL /* bit 23 */ +#define ldlm_is_cancel_on_block(_l) LDLM_TEST_FLAG((_l), 1ULL << 23) +#define ldlm_set_cancel_on_block(_l) LDLM_SET_FLAG((_l), 1ULL << 23) +#define ldlm_clear_cancel_on_block(_l) LDLM_CLEAR_FLAG((_l), 1ULL << 23) /** * measure lock contention and return -EUSERS if locking contention is high */ -#define LDLM_FL_DENY_ON_CONTENTION 0x0000000040000000ULL /* bit 30 */ -#define ldlm_is_deny_on_contention(_l) LDLM_TEST_FLAG((_l), 1ULL << 30) -#define ldlm_set_deny_on_contention(_l) LDLM_SET_FLAG((_l), 1ULL << 30) +#define LDLM_FL_DENY_ON_CONTENTION 0x0000000040000000ULL /* bit 30 */ +#define ldlm_is_deny_on_contention(_l) LDLM_TEST_FLAG((_l), 1ULL << 30) +#define ldlm_set_deny_on_contention(_l) LDLM_SET_FLAG((_l), 1ULL << 30) #define ldlm_clear_deny_on_contention(_l) LDLM_CLEAR_FLAG((_l), 1ULL << 30) /** * These are flags that are mapped into the flags and ASTs of blocking * locks Add FL_DISCARD to blocking ASTs */ -#define LDLM_FL_AST_DISCARD_DATA 0x0000000080000000ULL /* bit 31 */ -#define ldlm_is_ast_discard_data(_l) LDLM_TEST_FLAG((_l), 1ULL << 31) -#define ldlm_set_ast_discard_data(_l) LDLM_SET_FLAG((_l), 1ULL << 31) -#define ldlm_clear_ast_discard_data(_l) LDLM_CLEAR_FLAG((_l), 1ULL << 31) +#define LDLM_FL_AST_DISCARD_DATA 0x0000000080000000ULL /* bit 31 */ +#define ldlm_is_ast_discard_data(_l) LDLM_TEST_FLAG((_l), 1ULL << 31) +#define ldlm_set_ast_discard_data(_l) LDLM_SET_FLAG((_l), 1ULL << 31) +#define ldlm_clear_ast_discard_data(_l) LDLM_CLEAR_FLAG((_l), 1ULL << 31) /** * Used for marking lock as a target for -EINTR while cp_ast sleep emulation * + race with upcoming bl_ast. */ -#define LDLM_FL_FAIL_LOC 0x0000000100000000ULL /* bit 32 */ -#define ldlm_is_fail_loc(_l) LDLM_TEST_FLAG((_l), 1ULL << 32) -#define ldlm_set_fail_loc(_l) LDLM_SET_FLAG((_l), 1ULL << 32) -#define ldlm_clear_fail_loc(_l) LDLM_CLEAR_FLAG((_l), 1ULL << 32) +#define LDLM_FL_FAIL_LOC 0x0000000100000000ULL /* bit 32 */ +#define ldlm_is_fail_loc(_l) LDLM_TEST_FLAG((_l), 1ULL << 32) +#define ldlm_set_fail_loc(_l) LDLM_SET_FLAG((_l), 1ULL << 32) +#define ldlm_clear_fail_loc(_l) LDLM_CLEAR_FLAG((_l), 1ULL << 32) /** * Used while processing the unused list to know that we have already * handled this lock and decided to skip it. */ -#define LDLM_FL_SKIPPED 0x0000000200000000ULL /* bit 33 */ -#define ldlm_is_skipped(_l) LDLM_TEST_FLAG((_l), 1ULL << 33) -#define ldlm_set_skipped(_l) LDLM_SET_FLAG((_l), 1ULL << 33) -#define ldlm_clear_skipped(_l) LDLM_CLEAR_FLAG((_l), 1ULL << 33) +#define LDLM_FL_SKIPPED 0x0000000200000000ULL /* bit 33 */ +#define ldlm_is_skipped(_l) LDLM_TEST_FLAG((_l), 1ULL << 33) +#define ldlm_set_skipped(_l) LDLM_SET_FLAG((_l), 1ULL << 33) +#define ldlm_clear_skipped(_l) LDLM_CLEAR_FLAG((_l), 1ULL << 33) /** this lock is being destroyed */ -#define LDLM_FL_CBPENDING 0x0000000400000000ULL /* bit 34 */ -#define ldlm_is_cbpending(_l) LDLM_TEST_FLAG((_l), 1ULL << 34) -#define ldlm_set_cbpending(_l) LDLM_SET_FLAG((_l), 1ULL << 34) -#define ldlm_clear_cbpending(_l) LDLM_CLEAR_FLAG((_l), 1ULL << 34) +#define LDLM_FL_CBPENDING 0x0000000400000000ULL /* bit 34 */ +#define ldlm_is_cbpending(_l) LDLM_TEST_FLAG((_l), 1ULL << 34) +#define ldlm_set_cbpending(_l) LDLM_SET_FLAG((_l), 1ULL << 34) +#define ldlm_clear_cbpending(_l) LDLM_CLEAR_FLAG((_l), 1ULL << 34) /** not a real flag, not saved in lock */ -#define LDLM_FL_WAIT_NOREPROC 0x0000000800000000ULL /* bit 35 */ -#define ldlm_is_wait_noreproc(_l) LDLM_TEST_FLAG((_l), 1ULL << 35) -#define ldlm_set_wait_noreproc(_l) LDLM_SET_FLAG((_l), 1ULL << 35) -#define ldlm_clear_wait_noreproc(_l) LDLM_CLEAR_FLAG((_l), 1ULL << 35) +#define LDLM_FL_WAIT_NOREPROC 0x0000000800000000ULL /* bit 35 */ +#define ldlm_is_wait_noreproc(_l) LDLM_TEST_FLAG((_l), 1ULL << 35) +#define ldlm_set_wait_noreproc(_l) LDLM_SET_FLAG((_l), 1ULL << 35) +#define ldlm_clear_wait_noreproc(_l) LDLM_CLEAR_FLAG((_l), 1ULL << 35) /** cancellation callback already run */ -#define LDLM_FL_CANCEL 0x0000001000000000ULL /* bit 36 */ -#define ldlm_is_cancel(_l) LDLM_TEST_FLAG((_l), 1ULL << 36) -#define ldlm_set_cancel(_l) LDLM_SET_FLAG((_l), 1ULL << 36) -#define ldlm_clear_cancel(_l) LDLM_CLEAR_FLAG((_l), 1ULL << 36) +#define LDLM_FL_CANCEL 0x0000001000000000ULL /* bit 36 */ +#define ldlm_is_cancel(_l) LDLM_TEST_FLAG((_l), 1ULL << 36) +#define ldlm_set_cancel(_l) LDLM_SET_FLAG((_l), 1ULL << 36) +#define ldlm_clear_cancel(_l) LDLM_CLEAR_FLAG((_l), 1ULL << 36) /** whatever it might mean -- never transmitted? */ -#define LDLM_FL_LOCAL_ONLY 0x0000002000000000ULL /* bit 37 */ -#define ldlm_is_local_only(_l) LDLM_TEST_FLAG((_l), 1ULL << 37) -#define ldlm_set_local_only(_l) LDLM_SET_FLAG((_l), 1ULL << 37) -#define ldlm_clear_local_only(_l) LDLM_CLEAR_FLAG((_l), 1ULL << 37) +#define LDLM_FL_LOCAL_ONLY 0x0000002000000000ULL /* bit 37 */ +#define ldlm_is_local_only(_l) LDLM_TEST_FLAG((_l), 1ULL << 37) +#define ldlm_set_local_only(_l) LDLM_SET_FLAG((_l), 1ULL << 37) +#define ldlm_clear_local_only(_l) LDLM_CLEAR_FLAG((_l), 1ULL << 37) /** don't run the cancel callback under ldlm_cli_cancel_unused */ -#define LDLM_FL_FAILED 0x0000004000000000ULL /* bit 38 */ -#define ldlm_is_failed(_l) LDLM_TEST_FLAG((_l), 1ULL << 38) -#define ldlm_set_failed(_l) LDLM_SET_FLAG((_l), 1ULL << 38) -#define ldlm_clear_failed(_l) LDLM_CLEAR_FLAG((_l), 1ULL << 38) +#define LDLM_FL_FAILED 0x0000004000000000ULL /* bit 38 */ +#define ldlm_is_failed(_l) LDLM_TEST_FLAG((_l), 1ULL << 38) +#define ldlm_set_failed(_l) LDLM_SET_FLAG((_l), 1ULL << 38) +#define ldlm_clear_failed(_l) LDLM_CLEAR_FLAG((_l), 1ULL << 38) /** lock cancel has already been sent */ -#define LDLM_FL_CANCELING 0x0000008000000000ULL /* bit 39 */ -#define ldlm_is_canceling(_l) LDLM_TEST_FLAG((_l), 1ULL << 39) -#define ldlm_set_canceling(_l) LDLM_SET_FLAG((_l), 1ULL << 39) -#define ldlm_clear_canceling(_l) LDLM_CLEAR_FLAG((_l), 1ULL << 39) +#define LDLM_FL_CANCELING 0x0000008000000000ULL /* bit 39 */ +#define ldlm_is_canceling(_l) LDLM_TEST_FLAG((_l), 1ULL << 39) +#define ldlm_set_canceling(_l) LDLM_SET_FLAG((_l), 1ULL << 39) +#define ldlm_clear_canceling(_l) LDLM_CLEAR_FLAG((_l), 1ULL << 39) /** local lock (ie, no srv/cli split) */ -#define LDLM_FL_LOCAL 0x0000010000000000ULL /* bit 40 */ -#define ldlm_is_local(_l) LDLM_TEST_FLAG((_l), 1ULL << 40) -#define ldlm_set_local(_l) LDLM_SET_FLAG((_l), 1ULL << 40) -#define ldlm_clear_local(_l) LDLM_CLEAR_FLAG((_l), 1ULL << 40) +#define LDLM_FL_LOCAL 0x0000010000000000ULL /* bit 40 */ +#define ldlm_is_local(_l) LDLM_TEST_FLAG((_l), 1ULL << 40) +#define ldlm_set_local(_l) LDLM_SET_FLAG((_l), 1ULL << 40) +#define ldlm_clear_local(_l) LDLM_CLEAR_FLAG((_l), 1ULL << 40) /** * XXX FIXME: This is being added to b_size as a low-risk fix to the @@ -226,10 +226,10 @@ * That change is pretty high-risk, though, and would need a lot more * testing. */ -#define LDLM_FL_LVB_READY 0x0000020000000000ULL /* bit 41 */ -#define ldlm_is_lvb_ready(_l) LDLM_TEST_FLAG((_l), 1ULL << 41) -#define ldlm_set_lvb_ready(_l) LDLM_SET_FLAG((_l), 1ULL << 41) -#define ldlm_clear_lvb_ready(_l) LDLM_CLEAR_FLAG((_l), 1ULL << 41) +#define LDLM_FL_LVB_READY 0x0000020000000000ULL /* bit 41 */ +#define ldlm_is_lvb_ready(_l) LDLM_TEST_FLAG((_l), 1ULL << 41) +#define ldlm_set_lvb_ready(_l) LDLM_SET_FLAG((_l), 1ULL << 41) +#define ldlm_clear_lvb_ready(_l) LDLM_CLEAR_FLAG((_l), 1ULL << 41) /** * A lock contributes to the known minimum size (KMS) calculation until it @@ -239,31 +239,31 @@ * to know to exclude each other's locks from the calculation as they walk * the granted list. */ -#define LDLM_FL_KMS_IGNORE 0x0000040000000000ULL /* bit 42 */ -#define ldlm_is_kms_ignore(_l) LDLM_TEST_FLAG((_l), 1ULL << 42) -#define ldlm_set_kms_ignore(_l) LDLM_SET_FLAG((_l), 1ULL << 42) -#define ldlm_clear_kms_ignore(_l) LDLM_CLEAR_FLAG((_l), 1ULL << 42) +#define LDLM_FL_KMS_IGNORE 0x0000040000000000ULL /* bit 42 */ +#define ldlm_is_kms_ignore(_l) LDLM_TEST_FLAG((_l), 1ULL << 42) +#define ldlm_set_kms_ignore(_l) LDLM_SET_FLAG((_l), 1ULL << 42) +#define ldlm_clear_kms_ignore(_l) LDLM_CLEAR_FLAG((_l), 1ULL << 42) /** completion AST to be executed */ -#define LDLM_FL_CP_REQD 0x0000080000000000ULL /* bit 43 */ -#define ldlm_is_cp_reqd(_l) LDLM_TEST_FLAG((_l), 1ULL << 43) -#define ldlm_set_cp_reqd(_l) LDLM_SET_FLAG((_l), 1ULL << 43) -#define ldlm_clear_cp_reqd(_l) LDLM_CLEAR_FLAG((_l), 1ULL << 43) +#define LDLM_FL_CP_REQD 0x0000080000000000ULL /* bit 43 */ +#define ldlm_is_cp_reqd(_l) LDLM_TEST_FLAG((_l), 1ULL << 43) +#define ldlm_set_cp_reqd(_l) LDLM_SET_FLAG((_l), 1ULL << 43) +#define ldlm_clear_cp_reqd(_l) LDLM_CLEAR_FLAG((_l), 1ULL << 43) /** cleanup_resource has already handled the lock */ -#define LDLM_FL_CLEANED 0x0000100000000000ULL /* bit 44 */ -#define ldlm_is_cleaned(_l) LDLM_TEST_FLAG((_l), 1ULL << 44) -#define ldlm_set_cleaned(_l) LDLM_SET_FLAG((_l), 1ULL << 44) -#define ldlm_clear_cleaned(_l) LDLM_CLEAR_FLAG((_l), 1ULL << 44) +#define LDLM_FL_CLEANED 0x0000100000000000ULL /* bit 44 */ +#define ldlm_is_cleaned(_l) LDLM_TEST_FLAG((_l), 1ULL << 44) +#define ldlm_set_cleaned(_l) LDLM_SET_FLAG((_l), 1ULL << 44) +#define ldlm_clear_cleaned(_l) LDLM_CLEAR_FLAG((_l), 1ULL << 44) /** * optimization hint: LDLM can run blocking callback from current context * w/o involving separate thread. in order to decrease cs rate */ -#define LDLM_FL_ATOMIC_CB 0x0000200000000000ULL /* bit 45 */ -#define ldlm_is_atomic_cb(_l) LDLM_TEST_FLAG((_l), 1ULL << 45) -#define ldlm_set_atomic_cb(_l) LDLM_SET_FLAG((_l), 1ULL << 45) -#define ldlm_clear_atomic_cb(_l) LDLM_CLEAR_FLAG((_l), 1ULL << 45) +#define LDLM_FL_ATOMIC_CB 0x0000200000000000ULL /* bit 45 */ +#define ldlm_is_atomic_cb(_l) LDLM_TEST_FLAG((_l), 1ULL << 45) +#define ldlm_set_atomic_cb(_l) LDLM_SET_FLAG((_l), 1ULL << 45) +#define ldlm_clear_atomic_cb(_l) LDLM_CLEAR_FLAG((_l), 1ULL << 45) /** * It may happen that a client initiates two operations, e.g. unlink and @@ -273,10 +273,10 @@ * the first operation. LDLM_FL_BL_AST is set by ldlm_callback_handler() in * the lock to prevent the Early Lock Cancel (ELC) code from cancelling it. */ -#define LDLM_FL_BL_AST 0x0000400000000000ULL /* bit 46 */ -#define ldlm_is_bl_ast(_l) LDLM_TEST_FLAG((_l), 1ULL << 46) -#define ldlm_set_bl_ast(_l) LDLM_SET_FLAG((_l), 1ULL << 46) -#define ldlm_clear_bl_ast(_l) LDLM_CLEAR_FLAG((_l), 1ULL << 46) +#define LDLM_FL_BL_AST 0x0000400000000000ULL /* bit 46 */ +#define ldlm_is_bl_ast(_l) LDLM_TEST_FLAG((_l), 1ULL << 46) +#define ldlm_set_bl_ast(_l) LDLM_SET_FLAG((_l), 1ULL << 46) +#define ldlm_clear_bl_ast(_l) LDLM_CLEAR_FLAG((_l), 1ULL << 46) /** * Set by ldlm_cancel_callback() when lock cache is dropped to let @@ -284,30 +284,30 @@ * ELC RPC is already prepared and is waiting for rpc_lock, too late to * send a separate CANCEL RPC. */ -#define LDLM_FL_BL_DONE 0x0000800000000000ULL /* bit 47 */ -#define ldlm_is_bl_done(_l) LDLM_TEST_FLAG((_l), 1ULL << 47) -#define ldlm_set_bl_done(_l) LDLM_SET_FLAG((_l), 1ULL << 47) -#define ldlm_clear_bl_done(_l) LDLM_CLEAR_FLAG((_l), 1ULL << 47) +#define LDLM_FL_BL_DONE 0x0000800000000000ULL /* bit 47 */ +#define ldlm_is_bl_done(_l) LDLM_TEST_FLAG((_l), 1ULL << 47) +#define ldlm_set_bl_done(_l) LDLM_SET_FLAG((_l), 1ULL << 47) +#define ldlm_clear_bl_done(_l) LDLM_CLEAR_FLAG((_l), 1ULL << 47) /** * Don't put lock into the LRU list, so that it is not canceled due * to aging. Used by MGC locks, they are cancelled only at unmount or * by callback. */ -#define LDLM_FL_NO_LRU 0x0001000000000000ULL /* bit 48 */ -#define ldlm_is_no_lru(_l) LDLM_TEST_FLAG((_l), 1ULL << 48) -#define ldlm_set_no_lru(_l) LDLM_SET_FLAG((_l), 1ULL << 48) -#define ldlm_clear_no_lru(_l) LDLM_CLEAR_FLAG((_l), 1ULL << 48) +#define LDLM_FL_NO_LRU 0x0001000000000000ULL /* bit 48 */ +#define ldlm_is_no_lru(_l) LDLM_TEST_FLAG((_l), 1ULL << 48) +#define ldlm_set_no_lru(_l) LDLM_SET_FLAG((_l), 1ULL << 48) +#define ldlm_clear_no_lru(_l) LDLM_CLEAR_FLAG((_l), 1ULL << 48) /** * Set for locks that failed and where the server has been notified. * * Protected by lock and resource locks. */ -#define LDLM_FL_FAIL_NOTIFIED 0x0002000000000000ULL /* bit 49 */ -#define ldlm_is_fail_notified(_l) LDLM_TEST_FLAG((_l), 1ULL << 49) -#define ldlm_set_fail_notified(_l) LDLM_SET_FLAG((_l), 1ULL << 49) -#define ldlm_clear_fail_notified(_l) LDLM_CLEAR_FLAG((_l), 1ULL << 49) +#define LDLM_FL_FAIL_NOTIFIED 0x0002000000000000ULL /* bit 49 */ +#define ldlm_is_fail_notified(_l) LDLM_TEST_FLAG((_l), 1ULL << 49) +#define ldlm_set_fail_notified(_l) LDLM_SET_FLAG((_l), 1ULL << 49) +#define ldlm_clear_fail_notified(_l) LDLM_CLEAR_FLAG((_l), 1ULL << 49) /** * Set for locks that were removed from class hash table and will @@ -316,16 +316,16 @@ * * Protected by lock and resource locks. */ -#define LDLM_FL_DESTROYED 0x0004000000000000ULL /* bit 50 */ -#define ldlm_is_destroyed(_l) LDLM_TEST_FLAG((_l), 1ULL << 50) -#define ldlm_set_destroyed(_l) LDLM_SET_FLAG((_l), 1ULL << 50) -#define ldlm_clear_destroyed(_l) LDLM_CLEAR_FLAG((_l), 1ULL << 50) +#define LDLM_FL_DESTROYED 0x0004000000000000ULL /* bit 50 */ +#define ldlm_is_destroyed(_l) LDLM_TEST_FLAG((_l), 1ULL << 50) +#define ldlm_set_destroyed(_l) LDLM_SET_FLAG((_l), 1ULL << 50) +#define ldlm_clear_destroyed(_l) LDLM_CLEAR_FLAG((_l), 1ULL << 50) /** flag whether this is a server namespace lock */ -#define LDLM_FL_SERVER_LOCK 0x0008000000000000ULL /* bit 51 */ -#define ldlm_is_server_lock(_l) LDLM_TEST_FLAG((_l), 1ULL << 51) -#define ldlm_set_server_lock(_l) LDLM_SET_FLAG((_l), 1ULL << 51) -#define ldlm_clear_server_lock(_l) LDLM_CLEAR_FLAG((_l), 1ULL << 51) +#define LDLM_FL_SERVER_LOCK 0x0008000000000000ULL /* bit 51 */ +#define ldlm_is_server_lock(_l) LDLM_TEST_FLAG((_l), 1ULL << 51) +#define ldlm_set_server_lock(_l) LDLM_SET_FLAG((_l), 1ULL << 51) +#define ldlm_clear_server_lock(_l) LDLM_CLEAR_FLAG((_l), 1ULL << 51) /** * It's set in lock_res_and_lock() and unset in unlock_res_and_lock(). @@ -335,10 +335,10 @@ * because it works only for SMP so user needs to add extra macros like * LASSERT_SPIN_LOCKED for uniprocessor kernels. */ -#define LDLM_FL_RES_LOCKED 0x0010000000000000ULL /* bit 52 */ -#define ldlm_is_res_locked(_l) LDLM_TEST_FLAG((_l), 1ULL << 52) -#define ldlm_set_res_locked(_l) LDLM_SET_FLAG((_l), 1ULL << 52) -#define ldlm_clear_res_locked(_l) LDLM_CLEAR_FLAG((_l), 1ULL << 52) +#define LDLM_FL_RES_LOCKED 0x0010000000000000ULL /* bit 52 */ +#define ldlm_is_res_locked(_l) LDLM_TEST_FLAG((_l), 1ULL << 52) +#define ldlm_set_res_locked(_l) LDLM_SET_FLAG((_l), 1ULL << 52) +#define ldlm_clear_res_locked(_l) LDLM_CLEAR_FLAG((_l), 1ULL << 52) /** * It's set once we call ldlm_add_waiting_lock_res_locked() to start the @@ -346,22 +346,22 @@ * * Protected by lock and resource locks. */ -#define LDLM_FL_WAITED 0x0020000000000000ULL /* bit 53 */ -#define ldlm_is_waited(_l) LDLM_TEST_FLAG((_l), 1ULL << 53) -#define ldlm_set_waited(_l) LDLM_SET_FLAG((_l), 1ULL << 53) -#define ldlm_clear_waited(_l) LDLM_CLEAR_FLAG((_l), 1ULL << 53) +#define LDLM_FL_WAITED 0x0020000000000000ULL /* bit 53 */ +#define ldlm_is_waited(_l) LDLM_TEST_FLAG((_l), 1ULL << 53) +#define ldlm_set_waited(_l) LDLM_SET_FLAG((_l), 1ULL << 53) +#define ldlm_clear_waited(_l) LDLM_CLEAR_FLAG((_l), 1ULL << 53) /** Flag whether this is a server namespace lock. */ -#define LDLM_FL_NS_SRV 0x0040000000000000ULL /* bit 54 */ -#define ldlm_is_ns_srv(_l) LDLM_TEST_FLAG((_l), 1ULL << 54) -#define ldlm_set_ns_srv(_l) LDLM_SET_FLAG((_l), 1ULL << 54) -#define ldlm_clear_ns_srv(_l) LDLM_CLEAR_FLAG((_l), 1ULL << 54) +#define LDLM_FL_NS_SRV 0x0040000000000000ULL /* bit 54 */ +#define ldlm_is_ns_srv(_l) LDLM_TEST_FLAG((_l), 1ULL << 54) +#define ldlm_set_ns_srv(_l) LDLM_SET_FLAG((_l), 1ULL << 54) +#define ldlm_clear_ns_srv(_l) LDLM_CLEAR_FLAG((_l), 1ULL << 54) /** Flag whether this lock can be reused. Used by exclusive open. */ -#define LDLM_FL_EXCL 0x0080000000000000ULL /* bit 55 */ -#define ldlm_is_excl(_l) LDLM_TEST_FLAG((_l), 1ULL << 55) -#define ldlm_set_excl(_l) LDLM_SET_FLAG((_l), 1ULL << 55) -#define ldlm_clear_excl(_l) LDLM_CLEAR_FLAG((_l), 1ULL << 55) +#define LDLM_FL_EXCL 0x0080000000000000ULL /* bit 55 */ +#define ldlm_is_excl(_l) LDLM_TEST_FLAG((_l), 1ULL << 55) +#define ldlm_set_excl(_l) LDLM_SET_FLAG((_l), 1ULL << 55) +#define ldlm_clear_excl(_l) LDLM_CLEAR_FLAG((_l), 1ULL << 55) /** l_flags bits marked as "ast" bits */ #define LDLM_FL_AST_MASK (LDLM_FL_FLOCK_DEADLOCK |\ @@ -385,16 +385,16 @@ LDLM_FL_TEST_LOCK) /** test for ldlm_lock flag bit set */ -#define LDLM_TEST_FLAG(_l, _b) (((_l)->l_flags & (_b)) != 0) +#define LDLM_TEST_FLAG(_l, _b) (((_l)->l_flags & (_b)) != 0) /** multi-bit test: are any of mask bits set? */ #define LDLM_HAVE_MASK(_l, _m) ((_l)->l_flags & LDLM_FL_##_m##_MASK) /** set a ldlm_lock flag bit */ -#define LDLM_SET_FLAG(_l, _b) ((_l)->l_flags |= (_b)) +#define LDLM_SET_FLAG(_l, _b) ((_l)->l_flags |= (_b)) /** clear a ldlm_lock flag bit */ -#define LDLM_CLEAR_FLAG(_l, _b) ((_l)->l_flags &= ~(_b)) +#define LDLM_CLEAR_FLAG(_l, _b) ((_l)->l_flags &= ~(_b)) /** @} subgroup */ /** @} group */ -- 1.8.3.1 From jsimmons at infradead.org Thu Jan 31 17:19:22 2019 From: jsimmons at infradead.org (James Simmons) Date: Thu, 31 Jan 2019 12:19:22 -0500 Subject: [lustre-devel] [PATCH 18/26] osc: cleanup white spaces In-Reply-To: <1548955170-13456-1-git-send-email-jsimmons@infradead.org> References: <1548955170-13456-1-git-send-email-jsimmons@infradead.org> Message-ID: <1548955170-13456-19-git-send-email-jsimmons@infradead.org> The osc code is very messy and difficult to read. Remove excess white space and properly align data structures so they are easy on the eyes. Signed-off-by: James Simmons --- drivers/staging/lustre/lustre/osc/lproc_osc.c | 8 +-- drivers/staging/lustre/lustre/osc/osc_cache.c | 61 +++++++++++----------- .../staging/lustre/lustre/osc/osc_cl_internal.h | 4 +- drivers/staging/lustre/lustre/osc/osc_dev.c | 42 +++++++-------- drivers/staging/lustre/lustre/osc/osc_io.c | 32 ++++++------ drivers/staging/lustre/lustre/osc/osc_lock.c | 30 +++++------ drivers/staging/lustre/lustre/osc/osc_object.c | 28 +++++----- drivers/staging/lustre/lustre/osc/osc_page.c | 8 +-- drivers/staging/lustre/lustre/osc/osc_request.c | 10 ++-- 9 files changed, 111 insertions(+), 112 deletions(-) diff --git a/drivers/staging/lustre/lustre/osc/lproc_osc.c b/drivers/staging/lustre/lustre/osc/lproc_osc.c index 39a2a26..299a69f 100644 --- a/drivers/staging/lustre/lustre/osc/lproc_osc.c +++ b/drivers/staging/lustre/lustre/osc/lproc_osc.c @@ -501,7 +501,7 @@ static ssize_t contention_seconds_show(struct kobject *kobj, { struct obd_device *obd = container_of(kobj, struct obd_device, obd_kset.kobj); - struct osc_device *od = obd2osc_dev(obd); + struct osc_device *od = obd2osc_dev(obd); return sprintf(buf, "%u\n", od->od_contention_time); } @@ -513,7 +513,7 @@ static ssize_t contention_seconds_store(struct kobject *kobj, { struct obd_device *obd = container_of(kobj, struct obd_device, obd_kset.kobj); - struct osc_device *od = obd2osc_dev(obd); + struct osc_device *od = obd2osc_dev(obd); unsigned int val; int rc; @@ -533,7 +533,7 @@ static ssize_t lockless_truncate_show(struct kobject *kobj, { struct obd_device *obd = container_of(kobj, struct obd_device, obd_kset.kobj); - struct osc_device *od = obd2osc_dev(obd); + struct osc_device *od = obd2osc_dev(obd); return sprintf(buf, "%u\n", od->od_lockless_truncate); } @@ -545,7 +545,7 @@ static ssize_t lockless_truncate_store(struct kobject *kobj, { struct obd_device *obd = container_of(kobj, struct obd_device, obd_kset.kobj); - struct osc_device *od = obd2osc_dev(obd); + struct osc_device *od = obd2osc_dev(obd); bool val; int rc; diff --git a/drivers/staging/lustre/lustre/osc/osc_cache.c b/drivers/staging/lustre/lustre/osc/osc_cache.c index bef422c..673e139 100644 --- a/drivers/staging/lustre/lustre/osc/osc_cache.c +++ b/drivers/staging/lustre/lustre/osc/osc_cache.c @@ -1304,7 +1304,7 @@ static int osc_make_ready(const struct lu_env *env, struct osc_async_page *oap, int cmd) { struct osc_page *opg = oap2osc_page(oap); - struct cl_page *page = oap2cl_page(oap); + struct cl_page *page = oap2cl_page(oap); int result; LASSERT(cmd == OBD_BRW_WRITE); /* no cached reads */ @@ -1323,7 +1323,6 @@ static int osc_refresh_count(const struct lu_env *env, pgoff_t index = osc_index(oap2osc(oap)); struct cl_object *obj; struct cl_attr *attr = &osc_env_info(env)->oti_attr; - int result; loff_t kms; @@ -1395,21 +1394,21 @@ static int osc_completion(const struct lu_env *env, struct osc_async_page *oap, return 0; } -#define OSC_DUMP_GRANT(lvl, cli, fmt, args...) do { \ - struct client_obd *__tmp = (cli); \ +#define OSC_DUMP_GRANT(lvl, cli, fmt, args...) do { \ + struct client_obd *__tmp = (cli); \ CDEBUG(lvl, "%s: grant { dirty: %ld/%ld dirty_pages: %ld/%lu " \ "dropped: %ld avail: %ld, dirty_grant: %ld, " \ "reserved: %ld, flight: %d } lru {in list: %ld, " \ "left: %ld, waiters: %d }" fmt "\n", \ - cli_name(__tmp), \ - __tmp->cl_dirty_pages, __tmp->cl_dirty_max_pages, \ - atomic_long_read(&obd_dirty_pages), obd_max_dirty_pages, \ - __tmp->cl_lost_grant, __tmp->cl_avail_grant, \ + cli_name(__tmp), \ + __tmp->cl_dirty_pages, __tmp->cl_dirty_max_pages, \ + atomic_long_read(&obd_dirty_pages), obd_max_dirty_pages, \ + __tmp->cl_lost_grant, __tmp->cl_avail_grant, \ __tmp->cl_dirty_grant, \ - __tmp->cl_reserved_grant, __tmp->cl_w_in_flight, \ - atomic_long_read(&__tmp->cl_lru_in_list), \ - atomic_long_read(&__tmp->cl_lru_busy), \ - atomic_read(&__tmp->cl_lru_shrinkers), ##args); \ + __tmp->cl_reserved_grant, __tmp->cl_w_in_flight, \ + atomic_long_read(&__tmp->cl_lru_in_list), \ + atomic_long_read(&__tmp->cl_lru_busy), \ + atomic_read(&__tmp->cl_lru_shrinkers), ##args); \ } while (0) /* caller must hold loi_list_lock */ @@ -1471,7 +1470,7 @@ static void __osc_unreserve_grant(struct client_obd *cli, cli->cl_reserved_grant -= reserved; if (unused > reserved) { cli->cl_avail_grant += reserved; - cli->cl_lost_grant += unused - reserved; + cli->cl_lost_grant += unused - reserved; cli->cl_dirty_grant -= unused - reserved; } else { cli->cl_avail_grant += unused; @@ -1984,11 +1983,11 @@ static unsigned int get_write_extents(struct osc_object *obj, struct client_obd *cli = osc_cli(obj); struct osc_extent *ext; struct extent_rpc_data data = { - .erd_rpc_list = rpclist, - .erd_page_count = 0, - .erd_max_pages = cli->cl_max_pages_per_rpc, - .erd_max_chunks = osc_max_write_chunks(cli), - .erd_max_extents = 256, + .erd_rpc_list = rpclist, + .erd_page_count = 0, + .erd_max_pages = cli->cl_max_pages_per_rpc, + .erd_max_chunks = osc_max_write_chunks(cli), + .erd_max_extents = 256, }; assert_osc_object_is_locked(obj); @@ -2121,11 +2120,11 @@ static unsigned int get_write_extents(struct osc_object *obj, struct osc_extent *next; LIST_HEAD(rpclist); struct extent_rpc_data data = { - .erd_rpc_list = &rpclist, - .erd_page_count = 0, - .erd_max_pages = cli->cl_max_pages_per_rpc, - .erd_max_chunks = UINT_MAX, - .erd_max_extents = UINT_MAX, + .erd_rpc_list = &rpclist, + .erd_page_count = 0, + .erd_max_pages = cli->cl_max_pages_per_rpc, + .erd_max_chunks = UINT_MAX, + .erd_max_extents = UINT_MAX, }; int rc = 0; @@ -2545,7 +2544,7 @@ int osc_flush_async_page(const struct lu_env *env, struct cl_io *io, struct osc_extent *ext = NULL; struct osc_object *obj = cl2osc(ops->ops_cl.cpl_obj); struct cl_page *cp = ops->ops_cl.cpl_page; - pgoff_t index = osc_index(ops); + pgoff_t index = osc_index(ops); struct osc_async_page *oap = &ops->ops_oap; bool unplug = false; int rc = 0; @@ -3033,13 +3032,13 @@ bool osc_page_gang_lookup(const struct lu_env *env, struct cl_io *io, osc_page_gang_cbt cb, void *cbdata) { struct osc_page *ops; - void **pvec; - pgoff_t idx; - unsigned int nr; - unsigned int i; - unsigned int j; - bool res = true; - bool tree_lock = true; + void **pvec; + pgoff_t idx; + unsigned int nr; + unsigned int i; + unsigned int j; + bool res = true; + bool tree_lock = true; idx = start; pvec = osc_env_info(env)->oti_pvec; diff --git a/drivers/staging/lustre/lustre/osc/osc_cl_internal.h b/drivers/staging/lustre/lustre/osc/osc_cl_internal.h index c89c894..8bede94 100644 --- a/drivers/staging/lustre/lustre/osc/osc_cl_internal.h +++ b/drivers/staging/lustre/lustre/osc/osc_cl_internal.h @@ -407,9 +407,9 @@ void osc_io_unplug(const struct lu_env *env, struct client_obd *cli, void osc_object_set_contended(struct osc_object *obj); void osc_object_clear_contended(struct osc_object *obj); -int osc_object_is_contended(struct osc_object *obj); +int osc_object_is_contended(struct osc_object *obj); -int osc_lock_is_lockless(const struct osc_lock *olck); +int osc_lock_is_lockless(const struct osc_lock *olck); /**************************************************************************** * diff --git a/drivers/staging/lustre/lustre/osc/osc_dev.c b/drivers/staging/lustre/lustre/osc/osc_dev.c index c767a3c..997fa35 100644 --- a/drivers/staging/lustre/lustre/osc/osc_dev.c +++ b/drivers/staging/lustre/lustre/osc/osc_dev.c @@ -127,9 +127,9 @@ static void osc_key_fini(const struct lu_context *ctx, } struct lu_context_key osc_key = { - .lct_tags = LCT_CL_THREAD, - .lct_init = osc_key_init, - .lct_fini = osc_key_fini + .lct_tags = LCT_CL_THREAD, + .lct_init = osc_key_init, + .lct_fini = osc_key_fini }; static void *osc_session_init(const struct lu_context *ctx, @@ -152,9 +152,9 @@ static void osc_session_fini(const struct lu_context *ctx, } struct lu_context_key osc_session_key = { - .lct_tags = LCT_SESSION, - .lct_init = osc_session_init, - .lct_fini = osc_session_fini + .lct_tags = LCT_SESSION, + .lct_init = osc_session_init, + .lct_fini = osc_session_fini }; /* type constructor/destructor: osc_type_{init,fini,start,stop}(). */ @@ -167,9 +167,9 @@ static int osc_cl_process_config(const struct lu_env *env, } static const struct lu_device_operations osc_lu_ops = { - .ldo_object_alloc = osc_object_alloc, - .ldo_process_config = osc_cl_process_config, - .ldo_recovery_complete = NULL + .ldo_object_alloc = osc_object_alloc, + .ldo_process_config = osc_cl_process_config, + .ldo_recovery_complete = NULL }; static int osc_device_init(const struct lu_env *env, struct lu_device *d, @@ -224,24 +224,24 @@ static struct lu_device *osc_device_alloc(const struct lu_env *env, } static const struct lu_device_type_operations osc_device_type_ops = { - .ldto_init = osc_type_init, - .ldto_fini = osc_type_fini, + .ldto_init = osc_type_init, + .ldto_fini = osc_type_fini, - .ldto_start = osc_type_start, - .ldto_stop = osc_type_stop, + .ldto_start = osc_type_start, + .ldto_stop = osc_type_stop, - .ldto_device_alloc = osc_device_alloc, - .ldto_device_free = osc_device_free, + .ldto_device_alloc = osc_device_alloc, + .ldto_device_free = osc_device_free, - .ldto_device_init = osc_device_init, - .ldto_device_fini = osc_device_fini + .ldto_device_init = osc_device_init, + .ldto_device_fini = osc_device_fini }; struct lu_device_type osc_device_type = { - .ldt_tags = LU_DEVICE_CL, - .ldt_name = LUSTRE_OSC_NAME, - .ldt_ops = &osc_device_type_ops, - .ldt_ctx_tags = LCT_CL_THREAD + .ldt_tags = LU_DEVICE_CL, + .ldt_name = LUSTRE_OSC_NAME, + .ldt_ops = &osc_device_type_ops, + .ldt_ctx_tags = LCT_CL_THREAD }; /** @} osc */ diff --git a/drivers/staging/lustre/lustre/osc/osc_io.c b/drivers/staging/lustre/lustre/osc/osc_io.c index cf5b3cc..0b9ed01 100644 --- a/drivers/staging/lustre/lustre/osc/osc_io.c +++ b/drivers/staging/lustre/lustre/osc/osc_io.c @@ -935,21 +935,21 @@ static void osc_io_end(const struct lu_env *env, [CIT_READ] = { .cio_iter_init = osc_io_iter_init, .cio_iter_fini = osc_io_iter_fini, - .cio_start = osc_io_read_start, - .cio_fini = osc_io_fini + .cio_start = osc_io_read_start, + .cio_fini = osc_io_fini }, [CIT_WRITE] = { .cio_iter_init = osc_io_write_iter_init, .cio_iter_fini = osc_io_write_iter_fini, - .cio_start = osc_io_write_start, - .cio_end = osc_io_end, - .cio_fini = osc_io_fini + .cio_start = osc_io_write_start, + .cio_end = osc_io_end, + .cio_fini = osc_io_fini }, [CIT_SETATTR] = { .cio_iter_init = osc_io_iter_init, .cio_iter_fini = osc_io_iter_fini, - .cio_start = osc_io_setattr_start, - .cio_end = osc_io_setattr_end + .cio_start = osc_io_setattr_start, + .cio_end = osc_io_setattr_end }, [CIT_DATA_VERSION] = { .cio_start = osc_io_data_version_start, @@ -958,14 +958,14 @@ static void osc_io_end(const struct lu_env *env, [CIT_FAULT] = { .cio_iter_init = osc_io_iter_init, .cio_iter_fini = osc_io_iter_fini, - .cio_start = osc_io_fault_start, - .cio_end = osc_io_end, - .cio_fini = osc_io_fini + .cio_start = osc_io_fault_start, + .cio_end = osc_io_end, + .cio_fini = osc_io_fini }, [CIT_FSYNC] = { - .cio_start = osc_io_fsync_start, - .cio_end = osc_io_fsync_end, - .cio_fini = osc_io_fini + .cio_start = osc_io_fsync_start, + .cio_end = osc_io_fsync_end, + .cio_fini = osc_io_fini }, [CIT_LADVISE] = { .cio_start = osc_io_ladvise_start, @@ -973,12 +973,12 @@ static void osc_io_end(const struct lu_env *env, .cio_fini = osc_io_fini }, [CIT_MISC] = { - .cio_fini = osc_io_fini + .cio_fini = osc_io_fini } }, .cio_read_ahead = osc_io_read_ahead, - .cio_submit = osc_io_submit, - .cio_commit_async = osc_io_commit_async + .cio_submit = osc_io_submit, + .cio_commit_async = osc_io_commit_async }; /***************************************************************************** diff --git a/drivers/staging/lustre/lustre/osc/osc_lock.c b/drivers/staging/lustre/lustre/osc/osc_lock.c index 06d813e..5a1717c 100644 --- a/drivers/staging/lustre/lustre/osc/osc_lock.c +++ b/drivers/staging/lustre/lustre/osc/osc_lock.c @@ -676,11 +676,11 @@ static unsigned long osc_lock_weight(const struct lu_env *env, */ unsigned long osc_ldlm_weigh_ast(struct ldlm_lock *dlmlock) { - struct lu_env *env; - struct osc_object *obj; - struct osc_lock *oscl; - unsigned long weight; - bool found = false; + struct lu_env *env; + struct osc_object *obj; + struct osc_lock *oscl; + unsigned long weight; + bool found = false; u16 refcheck; might_sleep(); @@ -739,9 +739,9 @@ static void osc_lock_build_einfo(const struct lu_env *env, struct ldlm_enqueue_info *einfo) { einfo->ei_type = LDLM_EXTENT; - einfo->ei_mode = osc_cl_lock2ldlm(lock->cll_descr.cld_mode); + einfo->ei_mode = osc_cl_lock2ldlm(lock->cll_descr.cld_mode); einfo->ei_cb_bl = osc_ldlm_blocking_ast; - einfo->ei_cb_cp = ldlm_completion_ast; + einfo->ei_cb_cp = ldlm_completion_ast; einfo->ei_cb_gl = osc_ldlm_glimpse_ast; einfo->ei_cbdata = osc; /* value to be put into ->l_ast_data */ } @@ -814,9 +814,9 @@ static bool osc_lock_compatible(const struct osc_lock *qing, if (qed->ols_state < OLS_GRANTED) return true; - if (qed_descr->cld_mode >= qing_descr->cld_mode && + if (qed_descr->cld_mode >= qing_descr->cld_mode && qed_descr->cld_start <= qing_descr->cld_start && - qed_descr->cld_end >= qing_descr->cld_end) + qed_descr->cld_end >= qing_descr->cld_end) return true; return false; @@ -865,7 +865,7 @@ static int osc_lock_enqueue_wait(const struct lu_env *env, descr = &tmp_oscl->ols_cl.cls_lock->cll_descr; if (descr->cld_start > need->cld_end || - descr->cld_end < need->cld_start) + descr->cld_end < need->cld_start) continue; /* We're not supposed to give up group lock */ @@ -1053,7 +1053,7 @@ static void osc_lock_detach(const struct lu_env *env, struct osc_lock *olck) static void osc_lock_cancel(const struct lu_env *env, const struct cl_lock_slice *slice) { - struct osc_object *obj = cl2osc(slice->cls_obj); + struct osc_object *obj = cl2osc(slice->cls_obj); struct osc_lock *oscl = cl2osc_lock(slice); LINVRNT(osc_lock_invariant(oscl)); @@ -1078,10 +1078,10 @@ static int osc_lock_print(const struct lu_env *env, void *cookie, } static const struct cl_lock_operations osc_lock_ops = { - .clo_fini = osc_lock_fini, - .clo_enqueue = osc_lock_enqueue, - .clo_cancel = osc_lock_cancel, - .clo_print = osc_lock_print, + .clo_fini = osc_lock_fini, + .clo_enqueue = osc_lock_enqueue, + .clo_cancel = osc_lock_cancel, + .clo_print = osc_lock_print, }; static void osc_lock_lockless_cancel(const struct lu_env *env, diff --git a/drivers/staging/lustre/lustre/osc/osc_object.c b/drivers/staging/lustre/lustre/osc/osc_object.c index 1097380..98a0b6c 100644 --- a/drivers/staging/lustre/lustre/osc/osc_object.c +++ b/drivers/staging/lustre/lustre/osc/osc_object.c @@ -198,8 +198,8 @@ static int osc_object_ast_clear(struct ldlm_lock *lock, void *data) static int osc_object_prune(const struct lu_env *env, struct cl_object *obj) { - struct osc_object *osc = cl2osc(obj); - struct ldlm_res_id *resname = &osc_env_info(env)->oti_resname; + struct osc_object *osc = cl2osc(obj); + struct ldlm_res_id *resname = &osc_env_info(env)->oti_resname; /* DLM locks don't hold a reference of osc_object so we have to * clear it before the object is being destroyed. @@ -413,23 +413,23 @@ static void osc_req_attr_set(const struct lu_env *env, struct cl_object *obj, } static const struct cl_object_operations osc_ops = { - .coo_page_init = osc_page_init, - .coo_lock_init = osc_lock_init, - .coo_io_init = osc_io_init, - .coo_attr_get = osc_attr_get, - .coo_attr_update = osc_attr_update, - .coo_glimpse = osc_object_glimpse, - .coo_prune = osc_object_prune, + .coo_page_init = osc_page_init, + .coo_lock_init = osc_lock_init, + .coo_io_init = osc_io_init, + .coo_attr_get = osc_attr_get, + .coo_attr_update = osc_attr_update, + .coo_glimpse = osc_object_glimpse, + .coo_prune = osc_object_prune, .coo_fiemap = osc_object_fiemap, .coo_req_attr_set = osc_req_attr_set }; static const struct lu_object_operations osc_lu_obj_ops = { - .loo_object_init = osc_object_init, - .loo_object_release = NULL, - .loo_object_free = osc_object_free, - .loo_object_print = osc_object_print, - .loo_object_invariant = NULL + .loo_object_init = osc_object_init, + .loo_object_release = NULL, + .loo_object_free = osc_object_free, + .loo_object_print = osc_object_print, + .loo_object_invariant = NULL }; struct lu_object *osc_object_alloc(const struct lu_env *env, diff --git a/drivers/staging/lustre/lustre/osc/osc_page.c b/drivers/staging/lustre/lustre/osc/osc_page.c index e0187fa..71f5485 100644 --- a/drivers/staging/lustre/lustre/osc/osc_page.c +++ b/drivers/staging/lustre/lustre/osc/osc_page.c @@ -227,10 +227,10 @@ static int osc_page_flush(const struct lu_env *env, } static const struct cl_page_operations osc_page_ops = { - .cpo_print = osc_page_print, + .cpo_print = osc_page_print, .cpo_delete = osc_page_delete, - .cpo_clip = osc_page_clip, - .cpo_flush = osc_page_flush + .cpo_clip = osc_page_clip, + .cpo_flush = osc_page_flush }; int osc_page_init(const struct lu_env *env, struct cl_object *obj, @@ -931,7 +931,7 @@ void osc_dec_unstable_pages(struct ptlrpc_request *req) */ void osc_inc_unstable_pages(struct ptlrpc_request *req) { - struct client_obd *cli = &req->rq_import->imp_obd->u.cli; + struct client_obd *cli = &req->rq_import->imp_obd->u.cli; struct ptlrpc_bulk_desc *desc = req->rq_bulk; long page_count = desc->bd_iov_count; diff --git a/drivers/staging/lustre/lustre/osc/osc_request.c b/drivers/staging/lustre/lustre/osc/osc_request.c index e92c8ac..86f9de6 100644 --- a/drivers/staging/lustre/lustre/osc/osc_request.c +++ b/drivers/staging/lustre/lustre/osc/osc_request.c @@ -162,7 +162,7 @@ static int osc_getattr(const struct lu_env *env, struct obd_export *exp, oa->o_blksize = cli_brw_size(exp->exp_obd); oa->o_valid |= OBD_MD_FLBLKSZ; - out: +out: ptlrpc_req_finished(req); return rc; } @@ -1322,7 +1322,7 @@ static int osc_brw_prep_request(int cmd, struct client_obd *cli, return 0; - out: +out: ptlrpc_req_finished(req); return rc; } @@ -1753,7 +1753,7 @@ static int brw_interpret(const struct lu_env *env, if (rc == 0) { struct obdo *oa = aa->aa_oa; - struct cl_attr *attr = &osc_env_info(env)->oti_attr; + struct cl_attr *attr = &osc_env_info(env)->oti_attr; unsigned long valid = 0; struct cl_object *obj; struct osc_async_page *last; @@ -2260,7 +2260,7 @@ int osc_enqueue_base(struct obd_export *exp, struct ldlm_res_id *res_id, lustre_handle_copy(&aa->oa_lockh, &lockh); aa->oa_upcall = upcall; aa->oa_cookie = cookie; - aa->oa_agl = !!agl; + aa->oa_agl = !!agl; if (!agl) { aa->oa_flags = flags; aa->oa_lvb = lvb; @@ -2474,7 +2474,7 @@ static int osc_statfs(const struct lu_env *env, struct obd_export *exp, *osfs = *msfs; - out: +out: ptlrpc_req_finished(req); return rc; } -- 1.8.3.1 From jsimmons at infradead.org Thu Jan 31 17:19:13 2019 From: jsimmons at infradead.org (James Simmons) Date: Thu, 31 Jan 2019 12:19:13 -0500 Subject: [lustre-devel] [PATCH 09/26] lustre: cleanup white spaces in fid and fld layer In-Reply-To: <1548955170-13456-1-git-send-email-jsimmons@infradead.org> References: <1548955170-13456-1-git-send-email-jsimmons@infradead.org> Message-ID: <1548955170-13456-10-git-send-email-jsimmons@infradead.org> The lustre code is very messy and difficult to read. Remove excess white space and properly align data structures so they are easy on the eyes. Signed-off-by: James Simmons --- drivers/staging/lustre/lustre/fid/fid_request.c | 10 +++++----- drivers/staging/lustre/lustre/fid/lproc_fid.c | 2 +- drivers/staging/lustre/lustre/fld/fld_cache.c | 14 +++++++------- drivers/staging/lustre/lustre/fld/fld_internal.h | 24 ++++++++++++------------ drivers/staging/lustre/lustre/fld/fld_request.c | 8 ++++---- 5 files changed, 29 insertions(+), 29 deletions(-) diff --git a/drivers/staging/lustre/lustre/fid/fid_request.c b/drivers/staging/lustre/lustre/fid/fid_request.c index 3f79f22..45dd275 100644 --- a/drivers/staging/lustre/lustre/fid/fid_request.c +++ b/drivers/staging/lustre/lustre/fid/fid_request.c @@ -55,12 +55,12 @@ static int seq_client_rpc(struct lu_client_seq *seq, struct lu_seq_range *output, u32 opc, const char *opcname) { - struct obd_export *exp = seq->lcs_exp; + struct obd_export *exp = seq->lcs_exp; struct ptlrpc_request *req; - struct lu_seq_range *out, *in; - u32 *op; - unsigned int debug_mask; - int rc; + struct lu_seq_range *out, *in; + u32 *op; + unsigned int debug_mask; + int rc; LASSERT(exp && !IS_ERR(exp)); req = ptlrpc_request_alloc_pack(class_exp2cliimp(exp), &RQF_SEQ_QUERY, diff --git a/drivers/staging/lustre/lustre/fid/lproc_fid.c b/drivers/staging/lustre/lustre/fid/lproc_fid.c index d583778..d7d23b4 100644 --- a/drivers/staging/lustre/lustre/fid/lproc_fid.c +++ b/drivers/staging/lustre/lustre/fid/lproc_fid.c @@ -143,7 +143,7 @@ size_t count, loff_t *off) { struct lu_client_seq *seq; - u64 max; + u64 max; int rc, val; seq = ((struct seq_file *)file->private_data)->private; diff --git a/drivers/staging/lustre/lustre/fld/fld_cache.c b/drivers/staging/lustre/lustre/fld/fld_cache.c index 749d33b..b4baa53 100644 --- a/drivers/staging/lustre/lustre/fld/fld_cache.c +++ b/drivers/staging/lustre/lustre/fld/fld_cache.c @@ -255,8 +255,8 @@ static void fld_cache_punch_hole(struct fld_cache *cache, struct fld_cache_entry *f_new) { const struct lu_seq_range *range = &f_new->fce_range; - const u64 new_start = range->lsr_start; - const u64 new_end = range->lsr_end; + const u64 new_start = range->lsr_start; + const u64 new_end = range->lsr_end; struct fld_cache_entry *fldt; fldt = kzalloc(sizeof(*fldt), GFP_ATOMIC); @@ -294,8 +294,8 @@ static void fld_cache_overlap_handle(struct fld_cache *cache, struct fld_cache_entry *f_new) { const struct lu_seq_range *range = &f_new->fce_range; - const u64 new_start = range->lsr_start; - const u64 new_end = range->lsr_end; + const u64 new_start = range->lsr_start; + const u64 new_end = range->lsr_end; const u32 mdt = range->lsr_index; /* this is overlap case, these case are checking overlapping with @@ -381,8 +381,8 @@ static int fld_cache_insert_nolock(struct fld_cache *cache, struct fld_cache_entry *n; struct list_head *head; struct list_head *prev = NULL; - const u64 new_start = f_new->fce_range.lsr_start; - const u64 new_end = f_new->fce_range.lsr_end; + const u64 new_start = f_new->fce_range.lsr_start; + const u64 new_end = f_new->fce_range.lsr_end; u32 new_flags = f_new->fce_range.lsr_flags; /* @@ -425,7 +425,7 @@ static int fld_cache_insert_nolock(struct fld_cache *cache, int fld_cache_insert(struct fld_cache *cache, const struct lu_seq_range *range) { - struct fld_cache_entry *flde; + struct fld_cache_entry *flde; int rc; flde = fld_cache_entry_create(range); diff --git a/drivers/staging/lustre/lustre/fld/fld_internal.h b/drivers/staging/lustre/lustre/fld/fld_internal.h index 66a0fb6..76666a4 100644 --- a/drivers/staging/lustre/lustre/fld/fld_internal.h +++ b/drivers/staging/lustre/lustre/fld/fld_internal.h @@ -75,10 +75,10 @@ struct lu_fld_hash { }; struct fld_cache_entry { - struct list_head fce_lru; - struct list_head fce_list; + struct list_head fce_lru; + struct list_head fce_list; /** fld cache entries are sorted on range->lsr_start field. */ - struct lu_seq_range fce_range; + struct lu_seq_range fce_range; }; struct fld_cache { @@ -86,29 +86,29 @@ struct fld_cache { * Cache guard, protects fci_hash mostly because others immutable after * init is finished. */ - rwlock_t fci_lock; + rwlock_t fci_lock; /** Cache shrink threshold */ - int fci_threshold; + int fci_threshold; /** Preferred number of cached entries */ - int fci_cache_size; + int fci_cache_size; /** Current number of cached entries. Protected by \a fci_lock */ - int fci_cache_count; + int fci_cache_count; /** LRU list fld entries. */ - struct list_head fci_lru; + struct list_head fci_lru; /** sorted fld entries. */ - struct list_head fci_entries_head; + struct list_head fci_entries_head; /** Cache statistics. */ - struct fld_stats fci_stat; + struct fld_stats fci_stat; /** Cache name used for debug and messages. */ - char fci_name[LUSTRE_MDT_MAXNAMELEN]; - unsigned int fci_no_shrink:1; + char fci_name[LUSTRE_MDT_MAXNAMELEN]; + unsigned int fci_no_shrink:1; }; enum { diff --git a/drivers/staging/lustre/lustre/fld/fld_request.c b/drivers/staging/lustre/lustre/fld/fld_request.c index 8a915b9..248fffa 100644 --- a/drivers/staging/lustre/lustre/fld/fld_request.c +++ b/drivers/staging/lustre/lustre/fld/fld_request.c @@ -307,10 +307,10 @@ int fld_client_rpc(struct obd_export *exp, struct ptlrpc_request **reqp) { struct ptlrpc_request *req = NULL; - struct lu_seq_range *prange; - u32 *op; - int rc = 0; - struct obd_import *imp; + struct lu_seq_range *prange; + u32 *op; + int rc = 0; + struct obd_import *imp; LASSERT(exp); -- 1.8.3.1 From jsimmons at infradead.org Thu Jan 31 17:19:15 2019 From: jsimmons at infradead.org (James Simmons) Date: Thu, 31 Jan 2019 12:19:15 -0500 Subject: [lustre-devel] [PATCH 11/26] llite: cleanup white spaces In-Reply-To: <1548955170-13456-1-git-send-email-jsimmons@infradead.org> References: <1548955170-13456-1-git-send-email-jsimmons@infradead.org> Message-ID: <1548955170-13456-12-git-send-email-jsimmons@infradead.org> The llite code is very messy and difficult to read. Remove excess white space and properly align data structures so they are easy on the eyes. Signed-off-by: James Simmons --- drivers/staging/lustre/lustre/llite/dir.c | 114 ++++++------- drivers/staging/lustre/lustre/llite/file.c | 180 ++++++++++----------- drivers/staging/lustre/lustre/llite/glimpse.c | 18 +-- drivers/staging/lustre/lustre/llite/lcommon_cl.c | 24 +-- drivers/staging/lustre/lustre/llite/llite_lib.c | 52 +++--- drivers/staging/lustre/lustre/llite/llite_mmap.c | 52 +++--- drivers/staging/lustre/lustre/llite/llite_nfs.c | 42 ++--- drivers/staging/lustre/lustre/llite/lproc_llite.c | 80 ++++----- drivers/staging/lustre/lustre/llite/namei.c | 49 +++--- drivers/staging/lustre/lustre/llite/rw.c | 2 +- drivers/staging/lustre/lustre/llite/rw26.c | 57 ++++--- drivers/staging/lustre/lustre/llite/statahead.c | 133 +++++++-------- drivers/staging/lustre/lustre/llite/super25.c | 16 +- drivers/staging/lustre/lustre/llite/vvp_dev.c | 104 ++++++------ drivers/staging/lustre/lustre/llite/vvp_internal.h | 56 +++---- drivers/staging/lustre/lustre/llite/vvp_io.c | 169 ++++++++++--------- drivers/staging/lustre/lustre/llite/vvp_object.c | 30 ++-- drivers/staging/lustre/lustre/llite/vvp_page.c | 88 +++++----- drivers/staging/lustre/lustre/llite/xattr.c | 48 +++--- 19 files changed, 658 insertions(+), 656 deletions(-) diff --git a/drivers/staging/lustre/lustre/llite/dir.c b/drivers/staging/lustre/lustre/llite/dir.c index 4520344..fd1af4a 100644 --- a/drivers/staging/lustre/lustre/llite/dir.c +++ b/drivers/staging/lustre/lustre/llite/dir.c @@ -200,13 +200,13 @@ static u16 ll_dirent_type_get(struct lu_dirent *ent) int ll_dir_read(struct inode *inode, u64 *ppos, struct md_op_data *op_data, struct dir_context *ctx) { - struct ll_sb_info *sbi = ll_i2sbi(inode); - u64 pos = *ppos; + struct ll_sb_info *sbi = ll_i2sbi(inode); + u64 pos = *ppos; bool is_api32 = ll_need_32bit_api(sbi); - int is_hash64 = sbi->ll_flags & LL_SBI_64BIT_HASH; - struct page *page; - bool done = false; - int rc = 0; + int is_hash64 = sbi->ll_flags & LL_SBI_64BIT_HASH; + struct page *page; + bool done = false; + int rc = 0; page = ll_get_dir_page(inode, op_data, pos); @@ -225,11 +225,11 @@ int ll_dir_read(struct inode *inode, u64 *ppos, struct md_op_data *op_data, dp = page_address(page); for (ent = lu_dirent_start(dp); ent && !done; ent = lu_dirent_next(ent)) { - u16 type; - int namelen; - struct lu_fid fid; - u64 lhash; - u64 ino; + u16 type; + int namelen; + struct lu_fid fid; + u64 lhash; + u64 ino; hash = le64_to_cpu(ent->lde_hash); if (hash < pos) @@ -291,14 +291,14 @@ int ll_dir_read(struct inode *inode, u64 *ppos, struct md_op_data *op_data, static int ll_readdir(struct file *filp, struct dir_context *ctx) { - struct inode *inode = file_inode(filp); - struct ll_file_data *lfd = LUSTRE_FPRIVATE(filp); - struct ll_sb_info *sbi = ll_i2sbi(inode); + struct inode *inode = file_inode(filp); + struct ll_file_data *lfd = LUSTRE_FPRIVATE(filp); + struct ll_sb_info *sbi = ll_i2sbi(inode); u64 pos = lfd ? lfd->lfd_pos : 0; - int hash64 = sbi->ll_flags & LL_SBI_64BIT_HASH; + int hash64 = sbi->ll_flags & LL_SBI_64BIT_HASH; bool api32 = ll_need_32bit_api(sbi); struct md_op_data *op_data; - int rc; + int rc; CDEBUG(D_VFSTRACE, "VFS Op:inode=" DFID "(%p) pos/size %lu/%llu 32bit_api %d\n", @@ -626,7 +626,7 @@ int ll_dir_getstripe(struct inode *inode, void **plmm, int *plmm_size, struct ptlrpc_request **request, u64 valid) { struct ll_sb_info *sbi = ll_i2sbi(inode); - struct mdt_body *body; + struct mdt_body *body; struct lov_mds_md *lmm = NULL; struct ptlrpc_request *req = NULL; int rc, lmmsize; @@ -744,8 +744,8 @@ int ll_get_mdt_idx(struct inode *inode) */ static int ll_ioc_copy_start(struct super_block *sb, struct hsm_copy *copy) { - struct ll_sb_info *sbi = ll_s2sbi(sb); - struct hsm_progress_kernel hpk; + struct ll_sb_info *sbi = ll_s2sbi(sb); + struct hsm_progress_kernel hpk; int rc2, rc = 0; /* Forge a hsm_progress based on data from copy. */ @@ -759,8 +759,8 @@ static int ll_ioc_copy_start(struct super_block *sb, struct hsm_copy *copy) /* For archive request, we need to read the current file version. */ if (copy->hc_hai.hai_action == HSMA_ARCHIVE) { - struct inode *inode; - u64 data_version = 0; + struct inode *inode; + u64 data_version = 0; /* Get inode for this fid */ inode = search_inode_for_lustre(sb, ©->hc_hai.hai_fid); @@ -819,8 +819,8 @@ static int ll_ioc_copy_start(struct super_block *sb, struct hsm_copy *copy) */ static int ll_ioc_copy_end(struct super_block *sb, struct hsm_copy *copy) { - struct ll_sb_info *sbi = ll_s2sbi(sb); - struct hsm_progress_kernel hpk; + struct ll_sb_info *sbi = ll_s2sbi(sb); + struct hsm_progress_kernel hpk; int rc2, rc = 0; /* If you modify the logic here, also check llapi_hsm_copy_end(). */ @@ -844,8 +844,8 @@ static int ll_ioc_copy_end(struct super_block *sb, struct hsm_copy *copy) if (((copy->hc_hai.hai_action == HSMA_ARCHIVE) || (copy->hc_hai.hai_action == HSMA_RESTORE)) && (copy->hc_errval == 0)) { - struct inode *inode; - u64 data_version = 0; + struct inode *inode; + u64 data_version = 0; /* Get lsm for this fid */ inode = search_inode_for_lustre(sb, ©->hc_hai.hai_fid); @@ -1160,13 +1160,13 @@ static long ll_dir_ioctl(struct file *file, unsigned int cmd, unsigned long arg) } case LL_IOC_LMV_SETSTRIPE: { struct lmv_user_md *lum; - char *buf = NULL; - char *filename; - int namelen = 0; - int lumlen = 0; + char *buf = NULL; + char *filename; + int namelen = 0; + int lumlen = 0; umode_t mode; - int len; - int rc; + int len; + int rc; rc = obd_ioctl_getdata(&buf, &len, (void __user *)arg); if (rc) @@ -1428,21 +1428,21 @@ static long ll_dir_ioctl(struct file *file, unsigned int cmd, unsigned long arg) struct lov_user_mds_data __user *lmdp; lstat_t st = { 0 }; - st.st_dev = inode->i_sb->s_dev; - st.st_mode = body->mbo_mode; - st.st_nlink = body->mbo_nlink; - st.st_uid = body->mbo_uid; - st.st_gid = body->mbo_gid; - st.st_rdev = body->mbo_rdev; - st.st_size = body->mbo_size; + st.st_dev = inode->i_sb->s_dev; + st.st_mode = body->mbo_mode; + st.st_nlink = body->mbo_nlink; + st.st_uid = body->mbo_uid; + st.st_gid = body->mbo_gid; + st.st_rdev = body->mbo_rdev; + st.st_size = body->mbo_size; st.st_blksize = PAGE_SIZE; - st.st_blocks = body->mbo_blocks; - st.st_atime = body->mbo_atime; - st.st_mtime = body->mbo_mtime; - st.st_ctime = body->mbo_ctime; - st.st_ino = cl_fid_build_ino(&body->mbo_fid1, - sbi->ll_flags & - LL_SBI_32BIT_API); + st.st_blocks = body->mbo_blocks; + st.st_atime = body->mbo_atime; + st.st_mtime = body->mbo_mtime; + st.st_ctime = body->mbo_ctime; + st.st_ino = cl_fid_build_ino(&body->mbo_fid1, + sbi->ll_flags & + LL_SBI_32BIT_API); lmdp = (struct lov_user_mds_data __user *)arg; if (copy_to_user(&lmdp->lmd_st, &st, sizeof(st))) { @@ -1538,7 +1538,7 @@ static long ll_dir_ioctl(struct file *file, unsigned int cmd, unsigned long arg) } case LL_IOC_HSM_REQUEST: { struct hsm_user_request *hur; - ssize_t totalsize; + ssize_t totalsize; hur = memdup_user((void __user *)arg, sizeof(*hur)); if (IS_ERR(hur)) @@ -1592,8 +1592,8 @@ static long ll_dir_ioctl(struct file *file, unsigned int cmd, unsigned long arg) return rc; } case LL_IOC_HSM_PROGRESS: { - struct hsm_progress_kernel hpk; - struct hsm_progress hp; + struct hsm_progress_kernel hpk; + struct hsm_progress hp; if (copy_from_user(&hp, (void __user *)arg, sizeof(hp))) return -EFAULT; @@ -1622,7 +1622,7 @@ static long ll_dir_ioctl(struct file *file, unsigned int cmd, unsigned long arg) case LL_IOC_HSM_COPY_START: { struct hsm_copy *copy; - int rc; + int rc; copy = memdup_user((char __user *)arg, sizeof(*copy)); if (IS_ERR(copy)) @@ -1637,7 +1637,7 @@ static long ll_dir_ioctl(struct file *file, unsigned int cmd, unsigned long arg) } case LL_IOC_HSM_COPY_END: { struct hsm_copy *copy; - int rc; + int rc; copy = memdup_user((char __user *)arg, sizeof(*copy)); if (IS_ERR(copy)) @@ -1756,11 +1756,11 @@ static int ll_dir_release(struct inode *inode, struct file *file) } const struct file_operations ll_dir_operations = { - .llseek = ll_dir_seek, - .open = ll_dir_open, - .release = ll_dir_release, - .read = generic_read_dir, - .iterate_shared = ll_readdir, - .unlocked_ioctl = ll_dir_ioctl, - .fsync = ll_fsync, + .llseek = ll_dir_seek, + .open = ll_dir_open, + .release = ll_dir_release, + .read = generic_read_dir, + .iterate_shared = ll_readdir, + .unlocked_ioctl = ll_dir_ioctl, + .fsync = ll_fsync, }; diff --git a/drivers/staging/lustre/lustre/llite/file.c b/drivers/staging/lustre/lustre/llite/file.c index f71e273..6afaa90 100644 --- a/drivers/staging/lustre/lustre/llite/file.c +++ b/drivers/staging/lustre/lustre/llite/file.c @@ -1119,7 +1119,7 @@ static void ll_io_init(struct cl_io *io, const struct file *file, int write) file->f_flags & O_DIRECT || IS_SYNC(inode); } - io->ci_obj = ll_i2info(inode)->lli_clob; + io->ci_obj = ll_i2info(inode)->lli_clob; io->ci_lockreq = CILR_MAYBE; if (ll_file_nolock(file)) { io->ci_lockreq = CILR_NEVER; @@ -1137,10 +1137,10 @@ static void ll_io_init(struct cl_io *io, const struct file *file, int write) loff_t *ppos, size_t count) { struct ll_inode_info *lli = ll_i2info(file_inode(file)); - struct ll_file_data *fd = LUSTRE_FPRIVATE(file); + struct ll_file_data *fd = LUSTRE_FPRIVATE(file); struct vvp_io *vio = vvp_env_io(env); struct range_lock range; - struct cl_io *io; + struct cl_io *io; ssize_t result = 0; int rc = 0; @@ -1311,9 +1311,9 @@ static void ll_io_init(struct cl_io *io, const struct file *file, int write) static ssize_t ll_file_read_iter(struct kiocb *iocb, struct iov_iter *to) { - struct lu_env *env; + struct lu_env *env; struct vvp_io_args *args; - ssize_t result; + ssize_t result; u16 refcheck; ssize_t rc2; @@ -1346,9 +1346,9 @@ static ssize_t ll_file_read_iter(struct kiocb *iocb, struct iov_iter *to) */ static ssize_t ll_file_write_iter(struct kiocb *iocb, struct iov_iter *from) { - struct lu_env *env; + struct lu_env *env; struct vvp_io_args *args; - ssize_t result; + ssize_t result; u16 refcheck; env = cl_env_get(&refcheck); @@ -1393,7 +1393,7 @@ int ll_lov_getstripe_ea_info(struct inode *inode, const char *filename, struct ptlrpc_request **request) { struct ll_sb_info *sbi = ll_i2sbi(inode); - struct mdt_body *body; + struct mdt_body *body; struct lov_mds_md *lmm = NULL; struct ptlrpc_request *req = NULL; struct md_op_data *op_data; @@ -1439,7 +1439,7 @@ int ll_lov_getstripe_ea_info(struct inode *inode, const char *filename, /* * This is coming from the MDS, so is probably in - * little endian. We convert it to host endian before + * little endian. We convert it to host endian before * passing it to userspace. */ if (cpu_to_le32(LOV_MAGIC) != LOV_MAGIC) { @@ -1483,11 +1483,11 @@ int ll_lov_getstripe_ea_info(struct inode *inode, const char *filename, static int ll_lov_setea(struct inode *inode, struct file *file, void __user *arg) { - u64 flags = MDS_OPEN_HAS_OBJS | FMODE_WRITE; - struct lov_user_md *lump; - int lum_size = sizeof(struct lov_user_md) + - sizeof(struct lov_user_ost_data); - int rc; + u64 flags = MDS_OPEN_HAS_OBJS | FMODE_WRITE; + struct lov_user_md *lump; + int lum_size = sizeof(struct lov_user_md) + + sizeof(struct lov_user_ost_data); + int rc; if (!capable(CAP_SYS_ADMIN)) return -EPERM; @@ -1562,11 +1562,11 @@ static int ll_lov_setstripe(struct inode *inode, struct file *file, static int ll_get_grouplock(struct inode *inode, struct file *file, unsigned long arg) { - struct ll_inode_info *lli = ll_i2info(inode); - struct ll_file_data *fd = LUSTRE_FPRIVATE(file); + struct ll_inode_info *lli = ll_i2info(inode); + struct ll_file_data *fd = LUSTRE_FPRIVATE(file); struct cl_object *obj = lli->lli_clob; - struct ll_grouplock grouplock; - int rc; + struct ll_grouplock grouplock; + int rc; if (arg == 0) { CWARN("group id for group lock must not be 0\n"); @@ -1635,9 +1635,9 @@ static int ll_lov_setstripe(struct inode *inode, struct file *file, static int ll_put_grouplock(struct inode *inode, struct file *file, unsigned long arg) { - struct ll_inode_info *lli = ll_i2info(inode); - struct ll_file_data *fd = LUSTRE_FPRIVATE(file); - struct ll_grouplock grouplock; + struct ll_inode_info *lli = ll_i2info(inode); + struct ll_file_data *fd = LUSTRE_FPRIVATE(file); + struct ll_grouplock grouplock; spin_lock(&lli->lli_lock); if (!(fd->fd_flags & LL_FILE_GROUP_LOCKED)) { @@ -1931,12 +1931,12 @@ struct ll_swap_stack { static int ll_swap_layouts(struct file *file1, struct file *file2, struct lustre_swap_layouts *lsl) { - struct mdc_swap_layouts msl; - struct md_op_data *op_data; - u32 gid; - u64 dv; - struct ll_swap_stack *llss = NULL; - int rc; + struct mdc_swap_layouts msl; + struct md_op_data *op_data; + u32 gid; + u64 dv; + struct ll_swap_stack *llss = NULL; + int rc; llss = kzalloc(sizeof(*llss), GFP_KERNEL); if (!llss) @@ -2041,8 +2041,8 @@ static int ll_swap_layouts(struct file *file1, struct file *file2, int ll_hsm_state_set(struct inode *inode, struct hsm_state_set *hss) { - struct md_op_data *op_data; - int rc; + struct md_op_data *op_data; + int rc; /* Detect out-of range masks */ if ((hss->hss_setmask | hss->hss_clearmask) & ~HSM_FLAGS_MASK) @@ -2076,9 +2076,9 @@ int ll_hsm_state_set(struct inode *inode, struct hsm_state_set *hss) static int ll_hsm_import(struct inode *inode, struct file *file, struct hsm_user_import *hui) { - struct hsm_state_set *hss = NULL; - struct iattr *attr = NULL; - int rc; + struct hsm_state_set *hss = NULL; + struct iattr *attr = NULL; + int rc; if (!S_ISREG(inode->i_mode)) return -EINVAL; @@ -2303,9 +2303,9 @@ int ll_ioctl_fssetxattr(struct inode *inode, unsigned int cmd, static long ll_file_ioctl(struct file *file, unsigned int cmd, unsigned long arg) { - struct inode *inode = file_inode(file); - struct ll_file_data *fd = LUSTRE_FPRIVATE(file); - int flags, rc; + struct inode *inode = file_inode(file); + struct ll_file_data *fd = LUSTRE_FPRIVATE(file); + int flags, rc; CDEBUG(D_VFSTRACE, "VFS Op:inode=" DFID "(%p),cmd=%x\n", PFID(ll_inode2fid(inode)), inode, cmd); @@ -2434,7 +2434,7 @@ int ll_ioctl_fssetxattr(struct inode *inode, unsigned int cmd, return ll_fid2path(inode, (void __user *)arg); case LL_IOC_DATA_VERSION: { struct ioc_data_version idv; - int rc; + int rc; if (copy_from_user(&idv, (char __user *)arg, sizeof(idv))) return -EFAULT; @@ -2464,9 +2464,9 @@ int ll_ioctl_fssetxattr(struct inode *inode, unsigned int cmd, case OBD_IOC_GETMDNAME: return ll_get_obd_name(inode, cmd, arg); case LL_IOC_HSM_STATE_GET: { - struct md_op_data *op_data; - struct hsm_user_state *hus; - int rc; + struct md_op_data *op_data; + struct hsm_user_state *hus; + int rc; hus = kzalloc(sizeof(*hus), GFP_KERNEL); if (!hus) @@ -2490,8 +2490,8 @@ int ll_ioctl_fssetxattr(struct inode *inode, unsigned int cmd, return rc; } case LL_IOC_HSM_STATE_SET: { - struct hsm_state_set *hss; - int rc; + struct hsm_state_set *hss; + int rc; hss = memdup_user((char __user *)arg, sizeof(*hss)); if (IS_ERR(hss)) @@ -2503,9 +2503,9 @@ int ll_ioctl_fssetxattr(struct inode *inode, unsigned int cmd, return rc; } case LL_IOC_HSM_ACTION: { - struct md_op_data *op_data; - struct hsm_current_action *hca; - int rc; + struct md_op_data *op_data; + struct hsm_current_action *hca; + int rc; hca = kzalloc(sizeof(*hca), GFP_KERNEL); if (!hca) @@ -3564,56 +3564,56 @@ int ll_inode_permission(struct inode *inode, int mask) /* -o localflock - only provides locally consistent flock locks */ const struct file_operations ll_file_operations = { - .read_iter = ll_file_read_iter, - .write_iter = ll_file_write_iter, - .unlocked_ioctl = ll_file_ioctl, - .open = ll_file_open, - .release = ll_file_release, - .mmap = ll_file_mmap, - .llseek = ll_file_seek, - .splice_read = generic_file_splice_read, - .fsync = ll_fsync, - .flush = ll_flush + .read_iter = ll_file_read_iter, + .write_iter = ll_file_write_iter, + .unlocked_ioctl = ll_file_ioctl, + .open = ll_file_open, + .release = ll_file_release, + .mmap = ll_file_mmap, + .llseek = ll_file_seek, + .splice_read = generic_file_splice_read, + .fsync = ll_fsync, + .flush = ll_flush }; const struct file_operations ll_file_operations_flock = { - .read_iter = ll_file_read_iter, - .write_iter = ll_file_write_iter, - .unlocked_ioctl = ll_file_ioctl, - .open = ll_file_open, - .release = ll_file_release, - .mmap = ll_file_mmap, - .llseek = ll_file_seek, - .splice_read = generic_file_splice_read, - .fsync = ll_fsync, - .flush = ll_flush, - .flock = ll_file_flock, - .lock = ll_file_flock + .read_iter = ll_file_read_iter, + .write_iter = ll_file_write_iter, + .unlocked_ioctl = ll_file_ioctl, + .open = ll_file_open, + .release = ll_file_release, + .mmap = ll_file_mmap, + .llseek = ll_file_seek, + .splice_read = generic_file_splice_read, + .fsync = ll_fsync, + .flush = ll_flush, + .flock = ll_file_flock, + .lock = ll_file_flock }; /* These are for -o noflock - to return ENOSYS on flock calls */ const struct file_operations ll_file_operations_noflock = { - .read_iter = ll_file_read_iter, - .write_iter = ll_file_write_iter, - .unlocked_ioctl = ll_file_ioctl, - .open = ll_file_open, - .release = ll_file_release, - .mmap = ll_file_mmap, - .llseek = ll_file_seek, - .splice_read = generic_file_splice_read, - .fsync = ll_fsync, - .flush = ll_flush, - .flock = ll_file_noflock, - .lock = ll_file_noflock + .read_iter = ll_file_read_iter, + .write_iter = ll_file_write_iter, + .unlocked_ioctl = ll_file_ioctl, + .open = ll_file_open, + .release = ll_file_release, + .mmap = ll_file_mmap, + .llseek = ll_file_seek, + .splice_read = generic_file_splice_read, + .fsync = ll_fsync, + .flush = ll_flush, + .flock = ll_file_noflock, + .lock = ll_file_noflock }; const struct inode_operations ll_file_inode_operations = { - .setattr = ll_setattr, - .getattr = ll_getattr, - .permission = ll_inode_permission, - .listxattr = ll_listxattr, - .fiemap = ll_fiemap, - .get_acl = ll_get_acl, + .setattr = ll_setattr, + .getattr = ll_getattr, + .permission = ll_inode_permission, + .listxattr = ll_listxattr, + .fiemap = ll_fiemap, + .get_acl = ll_get_acl, }; int ll_layout_conf(struct inode *inode, const struct cl_object_conf *conf) @@ -3746,7 +3746,7 @@ static int ll_layout_lock_set(struct lustre_handle *lockh, enum ldlm_mode mode, struct inode *inode) { struct ll_inode_info *lli = ll_i2info(inode); - struct ll_sb_info *sbi = ll_i2sbi(inode); + struct ll_sb_info *sbi = ll_i2sbi(inode); struct ldlm_lock *lock; struct cl_object_conf conf; int rc = 0; @@ -3834,10 +3834,10 @@ static int ll_layout_lock_set(struct lustre_handle *lockh, enum ldlm_mode mode, */ static int ll_layout_intent(struct inode *inode, struct layout_intent *intent) { - struct ll_inode_info *lli = ll_i2info(inode); - struct ll_sb_info *sbi = ll_i2sbi(inode); - struct md_op_data *op_data; - struct lookup_intent it; + struct ll_inode_info *lli = ll_i2info(inode); + struct ll_sb_info *sbi = ll_i2sbi(inode); + struct md_op_data *op_data; + struct lookup_intent it; struct ptlrpc_request *req; int rc; @@ -3966,7 +3966,7 @@ int ll_layout_write_intent(struct inode *inode, u64 start, u64 end) int ll_layout_restore(struct inode *inode, loff_t offset, u64 length) { struct hsm_user_request *hur; - int len, rc; + int len, rc; len = sizeof(struct hsm_user_request) + sizeof(struct hsm_user_item); diff --git a/drivers/staging/lustre/lustre/llite/glimpse.c b/drivers/staging/lustre/lustre/llite/glimpse.c index d8712a3..27c233d 100644 --- a/drivers/staging/lustre/lustre/llite/glimpse.c +++ b/drivers/staging/lustre/lustre/llite/glimpse.c @@ -65,7 +65,7 @@ blkcnt_t dirty_cnt(struct inode *inode) { blkcnt_t cnt = 0; struct vvp_object *vob = cl_inode2vvp(inode); - void *results[1]; + void *results[1]; if (inode->i_mapping) cnt += radix_tree_gang_lookup_tag(&inode->i_mapping->i_pages, @@ -80,7 +80,7 @@ blkcnt_t dirty_cnt(struct inode *inode) int cl_glimpse_lock(const struct lu_env *env, struct cl_io *io, struct inode *inode, struct cl_object *clob, int agl) { - const struct lu_fid *fid = lu_object_fid(&clob->co_lu); + const struct lu_fid *fid = lu_object_fid(&clob->co_lu); struct cl_lock *lock = vvp_env_lock(env); struct cl_lock_descr *descr = &lock->cll_descr; int result = 0; @@ -140,10 +140,10 @@ int cl_glimpse_lock(const struct lu_env *env, struct cl_io *io, static int cl_io_get(struct inode *inode, struct lu_env **envout, struct cl_io **ioout, u16 *refcheck) { - struct lu_env *env; - struct cl_io *io; - struct ll_inode_info *lli = ll_i2info(inode); - struct cl_object *clob = lli->lli_clob; + struct lu_env *env; + struct cl_io *io; + struct ll_inode_info *lli = ll_i2info(inode); + struct cl_object *clob = lli->lli_clob; int result; if (S_ISREG(inode->i_mode)) { @@ -175,9 +175,9 @@ int __cl_glimpse_size(struct inode *inode, int agl) * cl_glimpse_size(), which doesn't make sense: glimpse locks are not * blocking anyway. */ - struct lu_env *env = NULL; - struct cl_io *io = NULL; - int result; + struct lu_env *env = NULL; + struct cl_io *io = NULL; + int result; u16 refcheck; result = cl_io_get(inode, &env, &io, &refcheck); diff --git a/drivers/staging/lustre/lustre/llite/lcommon_cl.c b/drivers/staging/lustre/lustre/llite/lcommon_cl.c index ade3b12..afcaa5e 100644 --- a/drivers/staging/lustre/lustre/llite/lcommon_cl.c +++ b/drivers/staging/lustre/lustre/llite/lcommon_cl.c @@ -83,8 +83,8 @@ int cl_setattr_ost(struct cl_object *obj, const struct iattr *attr, enum op_xvalid xvalid, unsigned int attr_flags) { struct lu_env *env; - struct cl_io *io; - int result; + struct cl_io *io; + int result; u16 refcheck; env = cl_env_get(&refcheck); @@ -137,11 +137,11 @@ int cl_setattr_ost(struct cl_object *obj, const struct iattr *attr, */ int cl_file_inode_init(struct inode *inode, struct lustre_md *md) { - struct lu_env *env; + struct lu_env *env; struct ll_inode_info *lli; - struct cl_object *clob; - struct lu_site *site; - struct lu_fid *fid; + struct cl_object *clob; + struct lu_site *site; + struct lu_fid *fid; struct cl_object_conf conf = { .coc_inode = inode, .u = { @@ -159,8 +159,8 @@ int cl_file_inode_init(struct inode *inode, struct lustre_md *md) return PTR_ERR(env); site = ll_i2sbi(inode)->ll_site; - lli = ll_i2info(inode); - fid = &lli->lli_fid; + lli = ll_i2info(inode); + fid = &lli->lli_fid; LASSERT(fid_is_sane(fid)); if (!lli->lli_clob) { @@ -207,7 +207,7 @@ int cl_file_inode_init(struct inode *inode, struct lustre_md *md) static void cl_object_put_last(struct lu_env *env, struct cl_object *obj) { struct lu_object_header *header = obj->co_lu.lo_header; - wait_queue_entry_t waiter; + wait_queue_entry_t waiter; if (unlikely(atomic_read(&header->loh_ref) != 1)) { struct lu_site *site = obj->co_lu.lo_dev->ld_site; @@ -234,9 +234,9 @@ static void cl_object_put_last(struct lu_env *env, struct cl_object *obj) void cl_inode_fini(struct inode *inode) { - struct lu_env *env; - struct ll_inode_info *lli = ll_i2info(inode); - struct cl_object *clob = lli->lli_clob; + struct lu_env *env; + struct ll_inode_info *lli = ll_i2info(inode); + struct cl_object *clob = lli->lli_clob; u16 refcheck; int emergency; diff --git a/drivers/staging/lustre/lustre/llite/llite_lib.c b/drivers/staging/lustre/lustre/llite/llite_lib.c index 88b08dd..8e09fdd7 100644 --- a/drivers/staging/lustre/lustre/llite/llite_lib.c +++ b/drivers/staging/lustre/lustre/llite/llite_lib.c @@ -185,25 +185,25 @@ static int client_common_fill_super(struct super_block *sb, char *md, char *dt) data->ocd_grant_blkbits = PAGE_SHIFT; /* indicate the features supported by this client */ - data->ocd_connect_flags = OBD_CONNECT_IBITS | OBD_CONNECT_NODEVOH | - OBD_CONNECT_ATTRFID | - OBD_CONNECT_VERSION | OBD_CONNECT_BRW_SIZE | - OBD_CONNECT_CANCELSET | OBD_CONNECT_FID | - OBD_CONNECT_AT | OBD_CONNECT_LOV_V3 | - OBD_CONNECT_VBR | OBD_CONNECT_FULL20 | + data->ocd_connect_flags = OBD_CONNECT_IBITS | OBD_CONNECT_NODEVOH | + OBD_CONNECT_ATTRFID | + OBD_CONNECT_VERSION | OBD_CONNECT_BRW_SIZE | + OBD_CONNECT_CANCELSET | OBD_CONNECT_FID | + OBD_CONNECT_AT | OBD_CONNECT_LOV_V3 | + OBD_CONNECT_VBR | OBD_CONNECT_FULL20 | OBD_CONNECT_64BITHASH | OBD_CONNECT_EINPROGRESS | - OBD_CONNECT_JOBSTATS | OBD_CONNECT_LVB_TYPE | - OBD_CONNECT_LAYOUTLOCK | - OBD_CONNECT_PINGLESS | - OBD_CONNECT_MAX_EASIZE | - OBD_CONNECT_FLOCK_DEAD | + OBD_CONNECT_JOBSTATS | OBD_CONNECT_LVB_TYPE | + OBD_CONNECT_LAYOUTLOCK | + OBD_CONNECT_PINGLESS | + OBD_CONNECT_MAX_EASIZE | + OBD_CONNECT_FLOCK_DEAD | OBD_CONNECT_DISP_STRIPE | OBD_CONNECT_LFSCK | OBD_CONNECT_OPEN_BY_FID | - OBD_CONNECT_DIR_STRIPE | - OBD_CONNECT_BULK_MBITS | - OBD_CONNECT_SUBTREE | - OBD_CONNECT_FLAGS2 | OBD_CONNECT_MULTIMODRPCS; + OBD_CONNECT_DIR_STRIPE | + OBD_CONNECT_BULK_MBITS | + OBD_CONNECT_SUBTREE | + OBD_CONNECT_FLAGS2 | OBD_CONNECT_MULTIMODRPCS; data->ocd_connect_flags2 = 0; @@ -382,9 +382,9 @@ static int client_common_fill_super(struct super_block *sb, char *md, char *dt) OBD_CONNECT_VBR | OBD_CONNECT_FULL20 | OBD_CONNECT_64BITHASH | OBD_CONNECT_MAXBYTES | OBD_CONNECT_EINPROGRESS | - OBD_CONNECT_JOBSTATS | OBD_CONNECT_LVB_TYPE | - OBD_CONNECT_LAYOUTLOCK | - OBD_CONNECT_PINGLESS | OBD_CONNECT_LFSCK | + OBD_CONNECT_JOBSTATS | OBD_CONNECT_LVB_TYPE | + OBD_CONNECT_LAYOUTLOCK | + OBD_CONNECT_PINGLESS | OBD_CONNECT_LFSCK | OBD_CONNECT_BULK_MBITS; data->ocd_connect_flags2 = 0; @@ -913,13 +913,13 @@ int ll_fill_super(struct super_block *sb) struct lustre_profile *lprof = NULL; struct lustre_sb_info *lsi = s2lsi(sb); struct ll_sb_info *sbi; - char *dt = NULL, *md = NULL; - char *profilenm = get_profile_name(sb); + char *dt = NULL, *md = NULL; + char *profilenm = get_profile_name(sb); struct config_llog_instance *cfg; char name[MAX_STRING_SIZE]; char *ptr; int len; - int err; + int err; static atomic_t ll_bdi_num = ATOMIC_INIT(0); CDEBUG(D_VFSTRACE, "VFS Op: sb %p\n", sb); @@ -2073,7 +2073,7 @@ int ll_iocontrol(struct inode *inode, struct file *file, int ll_flush_ctx(struct inode *inode) { - struct ll_sb_info *sbi = ll_i2sbi(inode); + struct ll_sb_info *sbi = ll_i2sbi(inode); CDEBUG(D_SEC, "flush context for user %d\n", from_kuid(&init_user_ns, current_uid())); @@ -2186,10 +2186,10 @@ int ll_remount_fs(struct super_block *sb, int *flags, char *data) */ void ll_open_cleanup(struct super_block *sb, struct ptlrpc_request *open_req) { - struct mdt_body *body; - struct md_op_data *op_data; - struct ptlrpc_request *close_req = NULL; - struct obd_export *exp = ll_s2sbi(sb)->ll_md_exp; + struct mdt_body *body; + struct md_op_data *op_data; + struct ptlrpc_request *close_req = NULL; + struct obd_export *exp = ll_s2sbi(sb)->ll_md_exp; body = req_capsule_server_get(&open_req->rq_pill, &RMF_MDT_BODY); op_data = kzalloc(sizeof(*op_data), GFP_NOFS); diff --git a/drivers/staging/lustre/lustre/llite/llite_mmap.c b/drivers/staging/lustre/lustre/llite/llite_mmap.c index c6e9f10..f5aaaf7 100644 --- a/drivers/staging/lustre/lustre/llite/llite_mmap.c +++ b/drivers/staging/lustre/lustre/llite/llite_mmap.c @@ -90,11 +90,11 @@ struct vm_area_struct *our_vma(struct mm_struct *mm, unsigned long addr, ll_fault_io_init(struct lu_env *env, struct vm_area_struct *vma, pgoff_t index, unsigned long *ra_flags) { - struct file *file = vma->vm_file; - struct inode *inode = file_inode(file); - struct cl_io *io; - struct cl_fault_io *fio; - int rc; + struct file *file = vma->vm_file; + struct inode *inode = file_inode(file); + struct cl_io *io; + struct cl_fault_io *fio; + int rc; if (ll_file_nolock(file)) return ERR_PTR(-EOPNOTSUPP); @@ -105,7 +105,7 @@ struct vm_area_struct *our_vma(struct mm_struct *mm, unsigned long addr, LASSERT(io->ci_obj); fio = &io->u.ci_fault; - fio->ft_index = index; + fio->ft_index = index; fio->ft_executable = vma->vm_flags & VM_EXEC; /* @@ -146,14 +146,14 @@ struct vm_area_struct *our_vma(struct mm_struct *mm, unsigned long addr, static int __ll_page_mkwrite(struct vm_area_struct *vma, struct page *vmpage, bool *retry) { - struct lu_env *env; - struct cl_io *io; - struct vvp_io *vio; - int result; + struct lu_env *env; + struct cl_io *io; + struct vvp_io *vio; + int result; u16 refcheck; - sigset_t old, new; - struct inode *inode; - struct ll_inode_info *lli; + sigset_t old, new; + struct inode *inode; + struct ll_inode_info *lli; env = cl_env_get(&refcheck); if (IS_ERR(env)) @@ -173,7 +173,7 @@ static int __ll_page_mkwrite(struct vm_area_struct *vma, struct page *vmpage, io->u.ci_fault.ft_writable = 1; vio = vvp_env_io(env); - vio->u.fault.ft_vma = vma; + vio->u.fault.ft_vma = vma; vio->u.fault.ft_vmpage = vmpage; siginitsetinv(&new, sigmask(SIGKILL) | sigmask(SIGTERM)); @@ -263,13 +263,13 @@ static inline vm_fault_t to_fault_error(int result) */ static vm_fault_t __ll_fault(struct vm_area_struct *vma, struct vm_fault *vmf) { - struct lu_env *env; - struct cl_io *io; - struct vvp_io *vio = NULL; - struct page *vmpage; - unsigned long ra_flags; - int result = 0; - vm_fault_t fault_ret = 0; + struct lu_env *env; + struct cl_io *io; + struct vvp_io *vio = NULL; + struct page *vmpage; + unsigned long ra_flags; + int result = 0; + vm_fault_t fault_ret = 0; u16 refcheck; env = cl_env_get(&refcheck); @@ -307,8 +307,8 @@ static vm_fault_t __ll_fault(struct vm_area_struct *vma, struct vm_fault *vmf) result = io->ci_result; if (result == 0) { vio = vvp_env_io(env); - vio->u.fault.ft_vma = vma; - vio->u.fault.ft_vmpage = NULL; + vio->u.fault.ft_vma = vma; + vio->u.fault.ft_vmpage = NULL; vio->u.fault.ft_vmf = vmf; vio->u.fault.ft_flags = 0; vio->u.fault.ft_flags_valid = false; @@ -444,7 +444,7 @@ static vm_fault_t ll_page_mkwrite(struct vm_fault *vmf) */ static void ll_vm_open(struct vm_area_struct *vma) { - struct inode *inode = file_inode(vma->vm_file); + struct inode *inode = file_inode(vma->vm_file); struct vvp_object *vob = cl_inode2vvp(inode); LASSERT(atomic_read(&vob->vob_mmap_cnt) >= 0); @@ -456,8 +456,8 @@ static void ll_vm_open(struct vm_area_struct *vma) */ static void ll_vm_close(struct vm_area_struct *vma) { - struct inode *inode = file_inode(vma->vm_file); - struct vvp_object *vob = cl_inode2vvp(inode); + struct inode *inode = file_inode(vma->vm_file); + struct vvp_object *vob = cl_inode2vvp(inode); atomic_dec(&vob->vob_mmap_cnt); LASSERT(atomic_read(&vob->vob_mmap_cnt) >= 0); diff --git a/drivers/staging/lustre/lustre/llite/llite_nfs.c b/drivers/staging/lustre/lustre/llite/llite_nfs.c index 7c5c9b8..3f34073 100644 --- a/drivers/staging/lustre/lustre/llite/llite_nfs.c +++ b/drivers/staging/lustre/lustre/llite/llite_nfs.c @@ -76,14 +76,14 @@ void get_uuid2fsid(const char *name, int len, __kernel_fsid_t *fsid) struct inode *search_inode_for_lustre(struct super_block *sb, const struct lu_fid *fid) { - struct ll_sb_info *sbi = ll_s2sbi(sb); + struct ll_sb_info *sbi = ll_s2sbi(sb); struct ptlrpc_request *req = NULL; - struct inode *inode = NULL; - int eadatalen = 0; - unsigned long hash = cl_fid_build_ino(fid, - ll_need_32bit_api(sbi)); - struct md_op_data *op_data; - int rc; + struct inode *inode = NULL; + int eadatalen = 0; + unsigned long hash = cl_fid_build_ino(fid, + ll_need_32bit_api(sbi)); + struct md_op_data *op_data; + int rc; CDEBUG(D_INFO, "searching inode for:(%lu," DFID ")\n", hash, PFID(fid)); @@ -123,15 +123,15 @@ struct inode *search_inode_for_lustre(struct super_block *sb, } struct lustre_nfs_fid { - struct lu_fid lnf_child; - struct lu_fid lnf_parent; + struct lu_fid lnf_child; + struct lu_fid lnf_parent; }; static struct dentry * ll_iget_for_nfs(struct super_block *sb, struct lu_fid *fid, struct lu_fid *parent) { - struct inode *inode; + struct inode *inode; struct dentry *result; if (!fid_is_sane(fid)) @@ -179,7 +179,7 @@ struct lustre_nfs_fid { /** * \a connectable - is nfsd will connect himself or this should be done - * at lustre + * at lustre * * The return value is file handle type: * 1 -- contains child file handle; @@ -297,12 +297,12 @@ static struct dentry *ll_fh_to_parent(struct super_block *sb, struct fid *fid, int ll_dir_get_parent_fid(struct inode *dir, struct lu_fid *parent_fid) { struct ptlrpc_request *req = NULL; - struct ll_sb_info *sbi; - struct mdt_body *body; + struct ll_sb_info *sbi; + struct mdt_body *body; static const char dotdot[] = ".."; - struct md_op_data *op_data; - int rc; - int lmmsize; + struct md_op_data *op_data; + int rc; + int lmmsize; LASSERT(dir && S_ISDIR(dir->i_mode)); @@ -361,9 +361,9 @@ static struct dentry *ll_get_parent(struct dentry *dchild) } const struct export_operations lustre_export_operations = { - .get_parent = ll_get_parent, - .encode_fh = ll_encode_fh, - .get_name = ll_get_name, - .fh_to_dentry = ll_fh_to_dentry, - .fh_to_parent = ll_fh_to_parent, + .get_parent = ll_get_parent, + .encode_fh = ll_encode_fh, + .get_name = ll_get_name, + .fh_to_dentry = ll_fh_to_dentry, + .fh_to_parent = ll_fh_to_parent, }; diff --git a/drivers/staging/lustre/lustre/llite/lproc_llite.c b/drivers/staging/lustre/lustre/llite/lproc_llite.c index 672de81..001bed9 100644 --- a/drivers/staging/lustre/lustre/llite/lproc_llite.c +++ b/drivers/staging/lustre/lustre/llite/lproc_llite.c @@ -452,8 +452,8 @@ static ssize_t max_read_ahead_whole_mb_store(struct kobject *kobj, static int ll_max_cached_mb_seq_show(struct seq_file *m, void *v) { - struct super_block *sb = m->private; - struct ll_sb_info *sbi = ll_s2sbi(sb); + struct super_block *sb = m->private; + struct ll_sb_info *sbi = ll_s2sbi(sb); struct cl_client_cache *cache = sbi->ll_cache; int shift = 20 - PAGE_SHIFT; long max_cached_mb; @@ -1050,8 +1050,8 @@ static ssize_t fast_read_store(struct kobject *kobj, static int ll_unstable_stats_seq_show(struct seq_file *m, void *v) { - struct super_block *sb = m->private; - struct ll_sb_info *sbi = ll_s2sbi(sb); + struct super_block *sb = m->private; + struct ll_sb_info *sbi = ll_s2sbi(sb); struct cl_client_cache *cache = sbi->ll_cache; long pages; int mb; @@ -1232,9 +1232,9 @@ static void llite_kobj_release(struct kobject *kobj) }; static const struct llite_file_opcode { - u32 opcode; - u32 type; - const char *opname; + u32 opcode; + u32 type; + const char *opname; } llite_opcode_table[LPROC_LL_FILE_OPCODES] = { /* file operation */ { LPROC_LL_DIRTY_HITS, LPROCFS_TYPE_REGS, "dirty_pages_hits" }, @@ -1247,31 +1247,31 @@ static void llite_kobj_release(struct kobject *kobj) "brw_read" }, { LPROC_LL_BRW_WRITE, LPROCFS_CNTR_AVGMINMAX | LPROCFS_TYPE_PAGES, "brw_write" }, - { LPROC_LL_IOCTL, LPROCFS_TYPE_REGS, "ioctl" }, + { LPROC_LL_IOCTL, LPROCFS_TYPE_REGS, "ioctl" }, { LPROC_LL_OPEN, LPROCFS_TYPE_REGS, "open" }, - { LPROC_LL_RELEASE, LPROCFS_TYPE_REGS, "close" }, - { LPROC_LL_MAP, LPROCFS_TYPE_REGS, "mmap" }, - { LPROC_LL_FAULT, LPROCFS_TYPE_REGS, "page_fault" }, - { LPROC_LL_MKWRITE, LPROCFS_TYPE_REGS, "page_mkwrite" }, - { LPROC_LL_LLSEEK, LPROCFS_TYPE_REGS, "seek" }, - { LPROC_LL_FSYNC, LPROCFS_TYPE_REGS, "fsync" }, - { LPROC_LL_READDIR, LPROCFS_TYPE_REGS, "readdir" }, + { LPROC_LL_RELEASE, LPROCFS_TYPE_REGS, "close" }, + { LPROC_LL_MAP, LPROCFS_TYPE_REGS, "mmap" }, + { LPROC_LL_FAULT, LPROCFS_TYPE_REGS, "page_fault" }, + { LPROC_LL_MKWRITE, LPROCFS_TYPE_REGS, "page_mkwrite" }, + { LPROC_LL_LLSEEK, LPROCFS_TYPE_REGS, "seek" }, + { LPROC_LL_FSYNC, LPROCFS_TYPE_REGS, "fsync" }, + { LPROC_LL_READDIR, LPROCFS_TYPE_REGS, "readdir" }, /* inode operation */ - { LPROC_LL_SETATTR, LPROCFS_TYPE_REGS, "setattr" }, - { LPROC_LL_TRUNC, LPROCFS_TYPE_REGS, "truncate" }, - { LPROC_LL_FLOCK, LPROCFS_TYPE_REGS, "flock" }, - { LPROC_LL_GETATTR, LPROCFS_TYPE_REGS, "getattr" }, + { LPROC_LL_SETATTR, LPROCFS_TYPE_REGS, "setattr" }, + { LPROC_LL_TRUNC, LPROCFS_TYPE_REGS, "truncate" }, + { LPROC_LL_FLOCK, LPROCFS_TYPE_REGS, "flock" }, + { LPROC_LL_GETATTR, LPROCFS_TYPE_REGS, "getattr" }, /* dir inode operation */ - { LPROC_LL_CREATE, LPROCFS_TYPE_REGS, "create" }, + { LPROC_LL_CREATE, LPROCFS_TYPE_REGS, "create" }, { LPROC_LL_LINK, LPROCFS_TYPE_REGS, "link" }, - { LPROC_LL_UNLINK, LPROCFS_TYPE_REGS, "unlink" }, - { LPROC_LL_SYMLINK, LPROCFS_TYPE_REGS, "symlink" }, - { LPROC_LL_MKDIR, LPROCFS_TYPE_REGS, "mkdir" }, - { LPROC_LL_RMDIR, LPROCFS_TYPE_REGS, "rmdir" }, - { LPROC_LL_MKNOD, LPROCFS_TYPE_REGS, "mknod" }, - { LPROC_LL_RENAME, LPROCFS_TYPE_REGS, "rename" }, + { LPROC_LL_UNLINK, LPROCFS_TYPE_REGS, "unlink" }, + { LPROC_LL_SYMLINK, LPROCFS_TYPE_REGS, "symlink" }, + { LPROC_LL_MKDIR, LPROCFS_TYPE_REGS, "mkdir" }, + { LPROC_LL_RMDIR, LPROCFS_TYPE_REGS, "rmdir" }, + { LPROC_LL_MKNOD, LPROCFS_TYPE_REGS, "mknod" }, + { LPROC_LL_RENAME, LPROCFS_TYPE_REGS, "rename" }, /* special inode operation */ - { LPROC_LL_STAFS, LPROCFS_TYPE_REGS, "statfs" }, + { LPROC_LL_STAFS, LPROCFS_TYPE_REGS, "statfs" }, { LPROC_LL_ALLOC_INODE, LPROCFS_TYPE_REGS, "alloc_inode" }, { LPROC_LL_SETXATTR, LPROCFS_TYPE_REGS, "setxattr" }, { LPROC_LL_GETXATTR, LPROCFS_TYPE_REGS, "getxattr" }, @@ -1301,19 +1301,19 @@ void ll_stats_ops_tally(struct ll_sb_info *sbi, int op, int count) EXPORT_SYMBOL(ll_stats_ops_tally); static const char *ra_stat_string[] = { - [RA_STAT_HIT] = "hits", - [RA_STAT_MISS] = "misses", - [RA_STAT_DISTANT_READPAGE] = "readpage not consecutive", - [RA_STAT_MISS_IN_WINDOW] = "miss inside window", - [RA_STAT_FAILED_GRAB_PAGE] = "failed grab_cache_page", - [RA_STAT_FAILED_MATCH] = "failed lock match", - [RA_STAT_DISCARDED] = "read but discarded", - [RA_STAT_ZERO_LEN] = "zero length file", - [RA_STAT_ZERO_WINDOW] = "zero size window", - [RA_STAT_EOF] = "read-ahead to EOF", - [RA_STAT_MAX_IN_FLIGHT] = "hit max r-a issue", - [RA_STAT_WRONG_GRAB_PAGE] = "wrong page from grab_cache_page", - [RA_STAT_FAILED_REACH_END] = "failed to reach end" + [RA_STAT_HIT] = "hits", + [RA_STAT_MISS] = "misses", + [RA_STAT_DISTANT_READPAGE] = "readpage not consecutive", + [RA_STAT_MISS_IN_WINDOW] = "miss inside window", + [RA_STAT_FAILED_GRAB_PAGE] = "failed grab_cache_page", + [RA_STAT_FAILED_MATCH] = "failed lock match", + [RA_STAT_DISCARDED] = "read but discarded", + [RA_STAT_ZERO_LEN] = "zero length file", + [RA_STAT_ZERO_WINDOW] = "zero size window", + [RA_STAT_EOF] = "read-ahead to EOF", + [RA_STAT_MAX_IN_FLIGHT] = "hit max r-a issue", + [RA_STAT_WRONG_GRAB_PAGE] = "wrong page from grab_cache_page", + [RA_STAT_FAILED_REACH_END] = "failed to reach end" }; int ll_debugfs_register_super(struct super_block *sb, const char *name) diff --git a/drivers/staging/lustre/lustre/llite/namei.c b/drivers/staging/lustre/lustre/llite/namei.c index 8bdf947..a87c8a2 100644 --- a/drivers/staging/lustre/lustre/llite/namei.c +++ b/drivers/staging/lustre/lustre/llite/namei.c @@ -53,7 +53,7 @@ static int ll_create_it(struct inode *dir, struct dentry *dentry, static int ll_test_inode(struct inode *inode, void *opaque) { struct ll_inode_info *lli = ll_i2info(inode); - struct lustre_md *md = opaque; + struct lustre_md *md = opaque; if (unlikely(!(md->body->mbo_valid & OBD_MD_FLID))) { CERROR("MDS body missing FID\n"); @@ -102,7 +102,7 @@ static int ll_set_inode(struct inode *inode, void *opaque) struct inode *ll_iget(struct super_block *sb, ino_t hash, struct lustre_md *md) { - struct inode *inode; + struct inode *inode; int rc = 0; LASSERT(hash != 0); @@ -499,8 +499,9 @@ static int ll_lookup_it_finish(struct ptlrpc_request *request, */ /* Check that parent has UPDATE lock. */ struct lookup_intent parent_it = { - .it_op = IT_GETATTR, - .it_lock_handle = 0 }; + .it_op = IT_GETATTR, + .it_lock_handle = 0 + }; struct lu_fid fid = ll_i2info(parent)->lli_fid; /* If it is striped directory, get the real stripe parent */ @@ -1255,28 +1256,28 @@ static int ll_rename(struct inode *src, struct dentry *src_dchild, } const struct inode_operations ll_dir_inode_operations = { - .mknod = ll_mknod, - .atomic_open = ll_atomic_open, - .lookup = ll_lookup_nd, - .create = ll_create_nd, + .mknod = ll_mknod, + .atomic_open = ll_atomic_open, + .lookup = ll_lookup_nd, + .create = ll_create_nd, /* We need all these non-raw things for NFSD, to not patch it. */ - .unlink = ll_unlink, - .mkdir = ll_mkdir, - .rmdir = ll_rmdir, - .symlink = ll_symlink, - .link = ll_link, - .rename = ll_rename, - .setattr = ll_setattr, - .getattr = ll_getattr, - .permission = ll_inode_permission, - .listxattr = ll_listxattr, - .get_acl = ll_get_acl, + .unlink = ll_unlink, + .mkdir = ll_mkdir, + .rmdir = ll_rmdir, + .symlink = ll_symlink, + .link = ll_link, + .rename = ll_rename, + .setattr = ll_setattr, + .getattr = ll_getattr, + .permission = ll_inode_permission, + .listxattr = ll_listxattr, + .get_acl = ll_get_acl, }; const struct inode_operations ll_special_inode_operations = { - .setattr = ll_setattr, - .getattr = ll_getattr, - .permission = ll_inode_permission, - .listxattr = ll_listxattr, - .get_acl = ll_get_acl, + .setattr = ll_setattr, + .getattr = ll_getattr, + .permission = ll_inode_permission, + .listxattr = ll_listxattr, + .get_acl = ll_get_acl, }; diff --git a/drivers/staging/lustre/lustre/llite/rw.c b/drivers/staging/lustre/lustre/llite/rw.c index e207d7c..af983ee 100644 --- a/drivers/staging/lustre/lustre/llite/rw.c +++ b/drivers/staging/lustre/lustre/llite/rw.c @@ -309,7 +309,7 @@ static inline int stride_io_mode(struct ll_readahead_state *ras) static int ria_page_count(struct ra_io_arg *ria) { u64 length = ria->ria_end >= ria->ria_start ? - ria->ria_end - ria->ria_start + 1 : 0; + ria->ria_end - ria->ria_start + 1 : 0; return stride_pg_count(ria->ria_stoff, ria->ria_length, ria->ria_pages, ria->ria_start, diff --git a/drivers/staging/lustre/lustre/llite/rw26.c b/drivers/staging/lustre/lustre/llite/rw26.c index 9843c9e..e4ce3b6 100644 --- a/drivers/staging/lustre/lustre/llite/rw26.c +++ b/drivers/staging/lustre/lustre/llite/rw26.c @@ -67,9 +67,9 @@ static void ll_invalidatepage(struct page *vmpage, unsigned int offset, unsigned int length) { - struct inode *inode; - struct lu_env *env; - struct cl_page *page; + struct inode *inode; + struct lu_env *env; + struct cl_page *page; struct cl_object *obj; LASSERT(PageLocked(vmpage)); @@ -101,9 +101,9 @@ static void ll_invalidatepage(struct page *vmpage, unsigned int offset, static int ll_releasepage(struct page *vmpage, gfp_t gfp_mask) { - struct lu_env *env; - struct cl_object *obj; - struct cl_page *page; + struct lu_env *env; + struct cl_object *obj; + struct cl_page *page; struct address_space *mapping; int result = 0; @@ -177,9 +177,9 @@ static ssize_t ll_direct_IO_seg(const struct lu_env *env, struct cl_io *io, loff_t file_offset, struct page **pages, int page_count) { - struct cl_page *clp; - struct cl_2queue *queue; - struct cl_object *obj = io->ci_obj; + struct cl_page *clp; + struct cl_2queue *queue; + struct cl_object *obj = io->ci_obj; int i; ssize_t rc = 0; size_t page_size = cl_page_size(obj); @@ -214,8 +214,8 @@ static ssize_t ll_direct_IO_seg(const struct lu_env *env, struct cl_io *io, struct page *vmpage = cl_page_vmpage(clp); struct page *src_page; struct page *dst_page; - void *src; - void *dst; + void *src; + void *dst; src_page = (rw == WRITE) ? pages[i] : vmpage; dst_page = (rw == WRITE) ? vmpage : pages[i]; @@ -386,11 +386,11 @@ static ssize_t ll_direct_IO(struct kiocb *iocb, struct iov_iter *iter) static int ll_prepare_partial_page(const struct lu_env *env, struct cl_io *io, struct cl_page *pg) { - struct cl_attr *attr = vvp_env_thread_attr(env); - struct cl_object *obj = io->ci_obj; - struct vvp_page *vpg = cl_object_page_slice(obj, pg); - loff_t offset = cl_offset(obj, vvp_index(vpg)); - int result; + struct cl_attr *attr = vvp_env_thread_attr(env); + struct cl_object *obj = io->ci_obj; + struct vvp_page *vpg = cl_object_page_slice(obj, pg); + loff_t offset = cl_offset(obj, vvp_index(vpg)); + int result; cl_object_attr_lock(obj); result = cl_object_attr_get(env, obj, attr); @@ -421,7 +421,7 @@ static int ll_write_begin(struct file *file, struct address_space *mapping, { struct ll_cl_context *lcc; const struct lu_env *env = NULL; - struct cl_io *io; + struct cl_io *io; struct cl_page *page = NULL; struct cl_object *clob = ll_i2info(mapping->host)->lli_clob; pgoff_t index = pos >> PAGE_SHIFT; @@ -594,8 +594,7 @@ static int ll_write_end(struct file *file, struct address_space *mapping, #ifdef CONFIG_MIGRATION static int ll_migratepage(struct address_space *mapping, struct page *newpage, struct page *page, - enum migrate_mode mode - ) + enum migrate_mode mode) { /* Always fail page migration until we have a proper implementation */ return -EIO; @@ -603,16 +602,16 @@ static int ll_migratepage(struct address_space *mapping, #endif const struct address_space_operations ll_aops = { - .readpage = ll_readpage, - .direct_IO = ll_direct_IO, - .writepage = ll_writepage, - .writepages = ll_writepages, - .set_page_dirty = __set_page_dirty_nobuffers, - .write_begin = ll_write_begin, - .write_end = ll_write_end, - .invalidatepage = ll_invalidatepage, - .releasepage = (void *)ll_releasepage, + .readpage = ll_readpage, + .direct_IO = ll_direct_IO, + .writepage = ll_writepage, + .writepages = ll_writepages, + .set_page_dirty = __set_page_dirty_nobuffers, + .write_begin = ll_write_begin, + .write_end = ll_write_end, + .invalidatepage = ll_invalidatepage, + .releasepage = (void *)ll_releasepage, #ifdef CONFIG_MIGRATION - .migratepage = ll_migratepage, + .migratepage = ll_migratepage, #endif }; diff --git a/drivers/staging/lustre/lustre/llite/statahead.c b/drivers/staging/lustre/lustre/llite/statahead.c index 6f5c7ab..0c305ba 100644 --- a/drivers/staging/lustre/lustre/llite/statahead.c +++ b/drivers/staging/lustre/lustre/llite/statahead.c @@ -61,25 +61,25 @@ enum se_stat { */ struct sa_entry { /* link into sai_interim_entries or sai_entries */ - struct list_head se_list; + struct list_head se_list; /* link into sai hash table locally */ - struct list_head se_hash; + struct list_head se_hash; /* entry index in the sai */ - u64 se_index; + u64 se_index; /* low layer ldlm lock handle */ - u64 se_handle; + u64 se_handle; /* entry status */ enum se_stat se_state; /* entry size, contains name */ - int se_size; + int se_size; /* pointer to async getattr enqueue info */ - struct md_enqueue_info *se_minfo; + struct md_enqueue_info *se_minfo; /* pointer to the async getattr request */ - struct ptlrpc_request *se_req; + struct ptlrpc_request *se_req; /* pointer to the target inode */ - struct inode *se_inode; + struct inode *se_inode; /* entry name */ - struct qstr se_qstr; + struct qstr se_qstr; /* entry fid */ struct lu_fid se_fid; }; @@ -175,9 +175,9 @@ static inline int is_omitted_entry(struct ll_statahead_info *sai, u64 index) const char *name, int len, const struct lu_fid *fid) { struct ll_inode_info *lli; - struct sa_entry *entry; - int entry_size; - char *dname; + struct sa_entry *entry; + int entry_size; + char *dname; entry_size = sizeof(struct sa_entry) + (len & ~3) + 4; entry = kzalloc(entry_size, GFP_NOFS); @@ -368,9 +368,9 @@ static void sa_free(struct ll_statahead_info *sai, struct sa_entry *entry) static void ll_agl_add(struct ll_statahead_info *sai, struct inode *inode, int index) { - struct ll_inode_info *child = ll_i2info(inode); + struct ll_inode_info *child = ll_i2info(inode); struct ll_inode_info *parent = ll_i2info(sai->sai_dentry->d_inode); - int added = 0; + int added = 0; spin_lock(&child->lli_agl_lock); if (child->lli_agl_index == 0) { @@ -398,7 +398,7 @@ static struct ll_statahead_info *ll_sai_alloc(struct dentry *dentry) { struct ll_inode_info *lli = ll_i2info(dentry->d_inode); struct ll_statahead_info *sai; - int i; + int i; sai = kzalloc(sizeof(*sai), GFP_NOFS); if (!sai) @@ -491,9 +491,9 @@ static void ll_sai_put(struct ll_statahead_info *sai) /* Do NOT forget to drop inode refcount when into sai_agls. */ static void ll_agl_trigger(struct inode *inode, struct ll_statahead_info *sai) { - struct ll_inode_info *lli = ll_i2info(inode); - u64 index = lli->lli_agl_index; - int rc; + struct ll_inode_info *lli = ll_i2info(inode); + u64 index = lli->lli_agl_index; + int rc; LASSERT(list_empty(&lli->lli_agl_list)); @@ -569,12 +569,12 @@ static void sa_instantiate(struct ll_statahead_info *sai, struct sa_entry *entry) { struct inode *dir = sai->sai_dentry->d_inode; - struct inode *child; + struct inode *child; struct md_enqueue_info *minfo; - struct lookup_intent *it; - struct ptlrpc_request *req; + struct lookup_intent *it; + struct ptlrpc_request *req; struct mdt_body *body; - int rc = 0; + int rc = 0; LASSERT(entry->se_handle != 0); @@ -660,9 +660,9 @@ static void sa_handle_callback(struct ll_statahead_info *sai) static int ll_statahead_interpret(struct ptlrpc_request *req, struct md_enqueue_info *minfo, int rc) { - struct lookup_intent *it = &minfo->mi_it; - struct inode *dir = minfo->mi_dir; - struct ll_inode_info *lli = ll_i2info(dir); + struct lookup_intent *it = &minfo->mi_it; + struct inode *dir = minfo->mi_dir; + struct ll_inode_info *lli = ll_i2info(dir); struct ll_statahead_info *sai = lli->lli_sai; struct sa_entry *entry = (struct sa_entry *)minfo->mi_cbdata; u64 handle = 0; @@ -738,9 +738,9 @@ static void sa_fini_data(struct md_enqueue_info *minfo) static struct md_enqueue_info * sa_prep_data(struct inode *dir, struct inode *child, struct sa_entry *entry) { - struct md_enqueue_info *minfo; + struct md_enqueue_info *minfo; struct ldlm_enqueue_info *einfo; - struct md_op_data *op_data; + struct md_op_data *op_data; minfo = kzalloc(sizeof(*minfo), GFP_NOFS); if (!minfo) @@ -762,11 +762,11 @@ static void sa_fini_data(struct md_enqueue_info *minfo) minfo->mi_cbdata = entry; einfo = &minfo->mi_einfo; - einfo->ei_type = LDLM_IBITS; - einfo->ei_mode = it_to_lock_mode(&minfo->mi_it); - einfo->ei_cb_bl = ll_md_blocking_ast; - einfo->ei_cb_cp = ldlm_completion_ast; - einfo->ei_cb_gl = NULL; + einfo->ei_type = LDLM_IBITS; + einfo->ei_mode = it_to_lock_mode(&minfo->mi_it); + einfo->ei_cb_bl = ll_md_blocking_ast; + einfo->ei_cb_cp = ldlm_completion_ast; + einfo->ei_cb_gl = NULL; einfo->ei_cbdata = NULL; return minfo; @@ -775,8 +775,8 @@ static void sa_fini_data(struct md_enqueue_info *minfo) /* async stat for file not found in dcache */ static int sa_lookup(struct inode *dir, struct sa_entry *entry) { - struct md_enqueue_info *minfo; - int rc; + struct md_enqueue_info *minfo; + int rc; minfo = sa_prep_data(dir, NULL, entry); if (IS_ERR(minfo)) @@ -799,10 +799,12 @@ static int sa_lookup(struct inode *dir, struct sa_entry *entry) static int sa_revalidate(struct inode *dir, struct sa_entry *entry, struct dentry *dentry) { - struct inode *inode = d_inode(dentry); - struct lookup_intent it = { .it_op = IT_GETATTR, - .it_lock_handle = 0 }; - struct md_enqueue_info *minfo; + struct inode *inode = d_inode(dentry); + struct lookup_intent it = { + .it_op = IT_GETATTR, + .it_lock_handle = 0 + }; + struct md_enqueue_info *minfo; int rc; if (unlikely(!inode)) @@ -841,12 +843,12 @@ static int sa_revalidate(struct inode *dir, struct sa_entry *entry, static void sa_statahead(struct dentry *parent, const char *name, int len, const struct lu_fid *fid) { - struct inode *dir = d_inode(parent); - struct ll_inode_info *lli = ll_i2info(dir); - struct ll_statahead_info *sai = lli->lli_sai; - struct dentry *dentry = NULL; + struct inode *dir = d_inode(parent); + struct ll_inode_info *lli = ll_i2info(dir); + struct ll_statahead_info *sai = lli->lli_sai; + struct dentry *dentry = NULL; struct sa_entry *entry; - int rc; + int rc; entry = sa_alloc(parent, sai, sai->sai_index, name, len, fid); if (IS_ERR(entry)) @@ -875,10 +877,10 @@ static void sa_statahead(struct dentry *parent, const char *name, int len, /* async glimpse (agl) thread main function */ static int ll_agl_thread(void *arg) { - struct dentry *parent = arg; - struct inode *dir = d_inode(parent); - struct ll_inode_info *plli = ll_i2info(dir); - struct ll_inode_info *clli; + struct dentry *parent = arg; + struct inode *dir = d_inode(parent); + struct ll_inode_info *plli = ll_i2info(dir); + struct ll_inode_info *clli; /* We already own this reference, so it is safe to take it without a lock. */ struct ll_statahead_info *sai = plli->lli_sai; @@ -929,7 +931,7 @@ static int ll_agl_thread(void *arg) /* start agl thread */ static void ll_start_agl(struct dentry *parent, struct ll_statahead_info *sai) { - struct ll_inode_info *plli; + struct ll_inode_info *plli; struct task_struct *task; CDEBUG(D_READA, "start agl thread: sai %p, parent %pd\n", @@ -957,15 +959,15 @@ static void ll_start_agl(struct dentry *parent, struct ll_statahead_info *sai) /* statahead thread main function */ static int ll_statahead_thread(void *arg) { - struct dentry *parent = arg; - struct inode *dir = d_inode(parent); - struct ll_inode_info *lli = ll_i2info(dir); - struct ll_sb_info *sbi = ll_i2sbi(dir); + struct dentry *parent = arg; + struct inode *dir = d_inode(parent); + struct ll_inode_info *lli = ll_i2info(dir); + struct ll_sb_info *sbi = ll_i2sbi(dir); struct ll_statahead_info *sai = lli->lli_sai; - struct page *page = NULL; - u64 pos = 0; - int first = 0; - int rc = 0; + struct page *page = NULL; + u64 pos = 0; + int first = 0; + int rc = 0; struct md_op_data *op_data; CDEBUG(D_READA, "statahead thread starting: sai %p, parent %pd\n", @@ -980,7 +982,7 @@ static int ll_statahead_thread(void *arg) while (pos != MDS_DIR_END_OFF && sai->sai_task) { struct lu_dirpage *dp; - struct lu_dirent *ent; + struct lu_dirent *ent; sai->sai_in_readpage = 1; page = ll_get_dir_page(dir, op_data, pos); @@ -1225,11 +1227,11 @@ enum { /* file is first dirent under @dir */ static int is_first_dirent(struct inode *dir, struct dentry *dentry) { - const struct qstr *target = &dentry->d_name; + const struct qstr *target = &dentry->d_name; struct md_op_data *op_data; - struct page *page; - u64 pos = 0; - int dot_de; + struct page *page; + u64 pos = 0; + int dot_de; int rc = LS_NOT_FIRST_DE; op_data = ll_prep_md_op_data(NULL, dir, dir, NULL, 0, 0, @@ -1243,7 +1245,7 @@ static int is_first_dirent(struct inode *dir, struct dentry *dentry) while (1) { struct lu_dirpage *dp; - struct lu_dirent *ent; + struct lu_dirent *ent; if (IS_ERR(page)) { struct ll_inode_info *lli = ll_i2info(dir); @@ -1423,8 +1425,10 @@ static int revalidate_statahead_dentry(struct inode *dir, if (smp_load_acquire(&entry->se_state) == SA_ENTRY_SUCC && entry->se_inode) { struct inode *inode = entry->se_inode; - struct lookup_intent it = { .it_op = IT_GETATTR, - .it_lock_handle = entry->se_handle }; + struct lookup_intent it = { + .it_op = IT_GETATTR, + .it_lock_handle = entry->se_handle + }; u64 bits; rc = md_revalidate_lock(ll_i2mdexp(dir), &it, @@ -1517,7 +1521,6 @@ static int start_statahead_thread(struct inode *dir, struct dentry *dentry) goto out; } - sai = ll_sai_alloc(parent); if (!sai) { rc = -ENOMEM; diff --git a/drivers/staging/lustre/lustre/llite/super25.c b/drivers/staging/lustre/lustre/llite/super25.c index 3ad0b11..c2b1668 100644 --- a/drivers/staging/lustre/lustre/llite/super25.c +++ b/drivers/staging/lustre/lustre/llite/super25.c @@ -73,14 +73,14 @@ static void ll_destroy_inode(struct inode *inode) /* exported operations */ struct super_operations lustre_super_operations = { - .alloc_inode = ll_alloc_inode, - .destroy_inode = ll_destroy_inode, - .evict_inode = ll_delete_inode, - .put_super = ll_put_super, - .statfs = ll_statfs, - .umount_begin = ll_umount_begin, - .remount_fs = ll_remount_fs, - .show_options = ll_show_options, + .alloc_inode = ll_alloc_inode, + .destroy_inode = ll_destroy_inode, + .evict_inode = ll_delete_inode, + .put_super = ll_put_super, + .statfs = ll_statfs, + .umount_begin = ll_umount_begin, + .remount_fs = ll_remount_fs, + .show_options = ll_show_options, }; /** This is the entry point for the mount call into Lustre. diff --git a/drivers/staging/lustre/lustre/llite/vvp_dev.c b/drivers/staging/lustre/lustre/llite/vvp_dev.c index 4e55599..c10ca6e 100644 --- a/drivers/staging/lustre/lustre/llite/vvp_dev.c +++ b/drivers/staging/lustre/lustre/llite/vvp_dev.c @@ -111,9 +111,9 @@ static void ll_thread_key_fini(const struct lu_context *ctx, } struct lu_context_key ll_thread_key = { - .lct_tags = LCT_CL_THREAD, - .lct_init = ll_thread_key_init, - .lct_fini = ll_thread_key_fini + .lct_tags = LCT_CL_THREAD, + .lct_init = ll_thread_key_init, + .lct_fini = ll_thread_key_fini }; static void *vvp_session_key_init(const struct lu_context *ctx, @@ -136,9 +136,9 @@ static void vvp_session_key_fini(const struct lu_context *ctx, } struct lu_context_key vvp_session_key = { - .lct_tags = LCT_SESSION, - .lct_init = vvp_session_key_init, - .lct_fini = vvp_session_key_fini + .lct_tags = LCT_SESSION, + .lct_init = vvp_session_key_init, + .lct_fini = vvp_session_key_fini }; static void *vvp_thread_key_init(const struct lu_context *ctx, @@ -161,24 +161,24 @@ static void vvp_thread_key_fini(const struct lu_context *ctx, } struct lu_context_key vvp_thread_key = { - .lct_tags = LCT_CL_THREAD, - .lct_init = vvp_thread_key_init, - .lct_fini = vvp_thread_key_fini + .lct_tags = LCT_CL_THREAD, + .lct_init = vvp_thread_key_init, + .lct_fini = vvp_thread_key_fini }; /* type constructor/destructor: vvp_type_{init,fini,start,stop}(). */ LU_TYPE_INIT_FINI(vvp, &vvp_thread_key, &ll_thread_key, &vvp_session_key); static const struct lu_device_operations vvp_lu_ops = { - .ldo_object_alloc = vvp_object_alloc + .ldo_object_alloc = vvp_object_alloc }; static struct lu_device *vvp_device_free(const struct lu_env *env, struct lu_device *d) { - struct vvp_device *vdv = lu2vvp_dev(d); - struct cl_site *site = lu2cl_site(d->ld_site); - struct lu_device *next = cl2lu_dev(vdv->vdv_next); + struct vvp_device *vdv = lu2vvp_dev(d); + struct cl_site *site = lu2cl_site(d->ld_site); + struct lu_device *next = cl2lu_dev(vdv->vdv_next); if (d->ld_site) { cl_site_fini(site); @@ -194,8 +194,8 @@ static struct lu_device *vvp_device_alloc(const struct lu_env *env, struct lustre_cfg *cfg) { struct vvp_device *vdv; - struct lu_device *lud; - struct cl_site *site; + struct lu_device *lud; + struct cl_site *site; int rc; vdv = kzalloc(sizeof(*vdv), GFP_NOFS); @@ -229,7 +229,7 @@ static struct lu_device *vvp_device_alloc(const struct lu_env *env, static int vvp_device_init(const struct lu_env *env, struct lu_device *d, const char *name, struct lu_device *next) { - struct vvp_device *vdv; + struct vvp_device *vdv; int rc; vdv = lu2vvp_dev(d); @@ -254,23 +254,23 @@ static struct lu_device *vvp_device_fini(const struct lu_env *env, } static const struct lu_device_type_operations vvp_device_type_ops = { - .ldto_init = vvp_type_init, - .ldto_fini = vvp_type_fini, + .ldto_init = vvp_type_init, + .ldto_fini = vvp_type_fini, - .ldto_start = vvp_type_start, - .ldto_stop = vvp_type_stop, + .ldto_start = vvp_type_start, + .ldto_stop = vvp_type_stop, - .ldto_device_alloc = vvp_device_alloc, + .ldto_device_alloc = vvp_device_alloc, .ldto_device_free = vvp_device_free, .ldto_device_init = vvp_device_init, .ldto_device_fini = vvp_device_fini, }; struct lu_device_type vvp_device_type = { - .ldt_tags = LU_DEVICE_CL, - .ldt_name = LUSTRE_VVP_NAME, - .ldt_ops = &vvp_device_type_ops, - .ldt_ctx_tags = LCT_CL_THREAD + .ldt_tags = LU_DEVICE_CL, + .ldt_name = LUSTRE_VVP_NAME, + .ldt_ops = &vvp_device_type_ops, + .ldt_ctx_tags = LCT_CL_THREAD }; /** @@ -312,8 +312,8 @@ void vvp_global_fini(void) int cl_sb_init(struct super_block *sb) { struct ll_sb_info *sbi; - struct cl_device *cl; - struct lu_env *env; + struct cl_device *cl; + struct lu_env *env; int rc = 0; u16 refcheck; @@ -336,10 +336,10 @@ int cl_sb_init(struct super_block *sb) int cl_sb_fini(struct super_block *sb) { struct ll_sb_info *sbi; - struct lu_env *env; - struct cl_device *cld; + struct lu_env *env; + struct cl_device *cld; u16 refcheck; - int result; + int result; sbi = ll_s2sbi(sb); env = cl_env_get(&refcheck); @@ -378,20 +378,20 @@ struct vvp_pgcache_id { struct vvp_seq_private { struct ll_sb_info *vsp_sbi; struct lu_env *vsp_env; - u16 vsp_refcheck; + u16 vsp_refcheck; struct cl_object *vsp_clob; - struct vvp_pgcache_id vsp_id; + struct vvp_pgcache_id vsp_id; /* * prev_pos is the 'pos' of the last object returned * by ->start of ->next. */ - loff_t vsp_prev_pos; + loff_t vsp_prev_pos; }; static int vvp_pgcache_obj_get(struct cfs_hash *hs, struct cfs_hash_bd *bd, struct hlist_node *hnode, void *data) { - struct vvp_pgcache_id *id = data; + struct vvp_pgcache_id *id = data; struct lu_object_header *hdr = cfs_hash_object(hs, hnode); if (lu_object_is_dying(hdr)) @@ -411,7 +411,7 @@ static struct cl_object *vvp_pgcache_obj(const struct lu_env *env, { LASSERT(lu_device_is_cl(dev)); - id->vpi_obj = NULL; + id->vpi_obj = NULL; id->vpi_curdep = id->vpi_depth; cfs_hash_hlist_for_each(dev->ld_site->ls_obj_hash, id->vpi_bucket, @@ -464,19 +464,19 @@ static struct page *vvp_pgcache_current(struct vvp_seq_private *priv) } } -#define seq_page_flag(seq, page, flag, has_flags) do { \ - if (test_bit(PG_##flag, &(page)->flags)) { \ +#define seq_page_flag(seq, page, flag, has_flags) do { \ + if (test_bit(PG_##flag, &(page)->flags)) { \ seq_printf(seq, "%s"#flag, has_flags ? "|" : ""); \ - has_flags = 1; \ - } \ + has_flags = 1; \ + } \ } while (0) static void vvp_pgcache_page_show(const struct lu_env *env, struct seq_file *seq, struct cl_page *page) { struct vvp_page *vpg; - struct page *vmpage; - int has_flags; + struct page *vmpage; + int has_flags; vpg = cl2vvp_page(cl_page_at(page, &vvp_device_type)); vmpage = vpg->vpg_page; @@ -502,8 +502,8 @@ static void vvp_pgcache_page_show(const struct lu_env *env, static int vvp_pgcache_show(struct seq_file *f, void *v) { struct vvp_seq_private *priv = f->private; - struct page *vmpage = v; - struct cl_page *page; + struct page *vmpage = v; + struct cl_page *page; seq_printf(f, "%8lx@" DFID ": ", vmpage->index, PFID(lu_object_fid(&priv->vsp_clob->co_lu))); @@ -575,10 +575,10 @@ static void vvp_pgcache_stop(struct seq_file *f, void *v) } static const struct seq_operations vvp_pgcache_ops = { - .start = vvp_pgcache_start, - .next = vvp_pgcache_next, - .stop = vvp_pgcache_stop, - .show = vvp_pgcache_show + .start = vvp_pgcache_start, + .next = vvp_pgcache_next, + .stop = vvp_pgcache_stop, + .show = vvp_pgcache_show }; static int vvp_dump_pgcache_seq_open(struct inode *inode, struct file *filp) @@ -617,9 +617,9 @@ static int vvp_dump_pgcache_seq_release(struct inode *inode, struct file *file) } const struct file_operations vvp_dump_pgcache_file_ops = { - .owner = THIS_MODULE, - .open = vvp_dump_pgcache_seq_open, - .read = seq_read, - .llseek = seq_lseek, - .release = vvp_dump_pgcache_seq_release, + .owner = THIS_MODULE, + .open = vvp_dump_pgcache_seq_open, + .read = seq_read, + .llseek = seq_lseek, + .release = vvp_dump_pgcache_seq_release, }; diff --git a/drivers/staging/lustre/lustre/llite/vvp_internal.h b/drivers/staging/lustre/lustre/llite/vvp_internal.h index e8712d8..102d143 100644 --- a/drivers/staging/lustre/lustre/llite/vvp_internal.h +++ b/drivers/staging/lustre/lustre/llite/vvp_internal.h @@ -53,12 +53,12 @@ */ struct vvp_io { /** super class */ - struct cl_io_slice vui_cl; - struct cl_io_lock_link vui_link; + struct cl_io_slice vui_cl; + struct cl_io_lock_link vui_link; /** * I/O vector information to or from which read/write is going. */ - struct iov_iter *vui_iter; + struct iov_iter *vui_iter; /** * Total size for the left IO. */ @@ -70,30 +70,30 @@ struct vvp_io { * Inode modification time that is checked across DLM * lock request. */ - time64_t ft_mtime; - struct vm_area_struct *ft_vma; + time64_t ft_mtime; + struct vm_area_struct *ft_vma; /** * locked page returned from vvp_io */ - struct page *ft_vmpage; + struct page *ft_vmpage; /** * kernel fault info */ - struct vm_fault *ft_vmf; + struct vm_fault *ft_vmf; /** * fault API used bitflags for return code. */ - unsigned int ft_flags; + unsigned int ft_flags; /** * check that flags are from filemap_fault */ - bool ft_flags_valid; + bool ft_flags_valid; } fault; struct { - struct cl_page_list vui_queue; - unsigned long vui_written; - int vui_from; - int vui_to; + struct cl_page_list vui_queue; + unsigned long vui_written; + int vui_from; + int vui_to; } write; } u; @@ -108,10 +108,10 @@ struct vvp_io { struct kiocb *vui_iocb; /* Readahead state. */ - pgoff_t vui_ra_start; - pgoff_t vui_ra_count; + pgoff_t vui_ra_start; + pgoff_t vui_ra_count; /* Set when vui_ra_{start,count} have been initialized. */ - bool vui_ra_valid; + bool vui_ra_valid; }; extern struct lu_device_type vvp_device_type; @@ -131,7 +131,7 @@ struct vvp_thread_info { static inline struct vvp_thread_info *vvp_env_info(const struct lu_env *env) { - struct vvp_thread_info *vti; + struct vvp_thread_info *vti; vti = lu_context_key_get(&env->le_ctx, &vvp_thread_key); LASSERT(vti); @@ -166,7 +166,7 @@ static inline struct cl_io *vvp_env_thread_io(const struct lu_env *env) } struct vvp_session { - struct vvp_io cs_ios; + struct vvp_io cs_ios; }; static inline struct vvp_session *vvp_env_session(const struct lu_env *env) @@ -189,8 +189,8 @@ static inline struct vvp_io *vvp_env_io(const struct lu_env *env) */ struct vvp_object { struct cl_object_header vob_header; - struct cl_object vob_cl; - struct inode *vob_inode; + struct cl_object vob_cl; + struct inode *vob_inode; /** * Number of transient pages. This is no longer protected by i_sem, @@ -223,12 +223,12 @@ struct vvp_object { * VVP-private page state. */ struct vvp_page { - struct cl_page_slice vpg_cl; - unsigned int vpg_defer_uptodate:1, - vpg_ra_updated:1, - vpg_ra_used:1; + struct cl_page_slice vpg_cl; + unsigned int vpg_defer_uptodate:1, + vpg_ra_updated:1, + vpg_ra_used:1; /** VM page */ - struct page *vpg_page; + struct page *vpg_page; }; static inline struct vvp_page *cl2vvp_page(const struct cl_page_slice *slice) @@ -242,12 +242,12 @@ static inline pgoff_t vvp_index(struct vvp_page *vvp) } struct vvp_device { - struct cl_device vdv_cl; - struct cl_device *vdv_next; + struct cl_device vdv_cl; + struct cl_device *vdv_next; }; struct vvp_lock { - struct cl_lock_slice vlk_cl; + struct cl_lock_slice vlk_cl; }; void *ccc_key_init(const struct lu_context *ctx, diff --git a/drivers/staging/lustre/lustre/llite/vvp_io.c b/drivers/staging/lustre/lustre/llite/vvp_io.c index 26a7897..593b10c 100644 --- a/drivers/staging/lustre/lustre/llite/vvp_io.c +++ b/drivers/staging/lustre/lustre/llite/vvp_io.c @@ -63,8 +63,8 @@ static struct vvp_io *cl2vvp_io(const struct lu_env *env, static bool can_populate_pages(const struct lu_env *env, struct cl_io *io, struct inode *inode) { - struct ll_inode_info *lli = ll_i2info(inode); - struct vvp_io *vio = vvp_env_io(env); + struct ll_inode_info *lli = ll_i2info(inode); + struct vvp_io *vio = vvp_env_io(env); bool rc = true; switch (io->ci_type) { @@ -120,9 +120,9 @@ static int vvp_prep_size(const struct lu_env *env, struct cl_object *obj, struct cl_io *io, loff_t start, size_t count, int *exceed) { - struct cl_attr *attr = vvp_env_thread_attr(env); - struct inode *inode = vvp_object_inode(obj); - loff_t pos = start + count - 1; + struct cl_attr *attr = vvp_env_thread_attr(env); + struct inode *inode = vvp_object_inode(obj); + loff_t pos = start + count - 1; loff_t kms; int result; @@ -205,11 +205,11 @@ static int vvp_prep_size(const struct lu_env *env, struct cl_object *obj, static int vvp_io_one_lock_index(const struct lu_env *env, struct cl_io *io, u32 enqflags, enum cl_lock_mode mode, - pgoff_t start, pgoff_t end) + pgoff_t start, pgoff_t end) { - struct vvp_io *vio = vvp_env_io(env); - struct cl_lock_descr *descr = &vio->vui_link.cill_descr; - struct cl_object *obj = io->ci_obj; + struct vvp_io *vio = vvp_env_io(env); + struct cl_lock_descr *descr = &vio->vui_link.cill_descr; + struct cl_object *obj = io->ci_obj; CLOBINVRNT(env, obj, vvp_object_invariant(obj)); @@ -222,11 +222,11 @@ static int vvp_io_one_lock_index(const struct lu_env *env, struct cl_io *io, descr->cld_gid = vio->vui_fd->fd_grouplock.lg_gid; enqflags |= CEF_LOCK_MATCH; } else { - descr->cld_mode = mode; + descr->cld_mode = mode; } - descr->cld_obj = obj; + descr->cld_obj = obj; descr->cld_start = start; - descr->cld_end = end; + descr->cld_end = end; descr->cld_enq_flags = enqflags; cl_io_lock_add(env, io, &vio->vui_link); @@ -267,8 +267,8 @@ static void vvp_io_write_iter_fini(const struct lu_env *env, static int vvp_io_fault_iter_init(const struct lu_env *env, const struct cl_io_slice *ios) { - struct vvp_io *vio = cl2vvp_io(env, ios); - struct inode *inode = vvp_object_inode(ios->cis_obj); + struct vvp_io *vio = cl2vvp_io(env, ios); + struct inode *inode = vvp_object_inode(ios->cis_obj); LASSERT(inode == file_inode(vio->vui_fd->fd_file)); vio->u.fault.ft_mtime = inode->i_mtime.tv_sec; @@ -277,9 +277,9 @@ static int vvp_io_fault_iter_init(const struct lu_env *env, static void vvp_io_fini(const struct lu_env *env, const struct cl_io_slice *ios) { - struct cl_io *io = ios->cis_io; + struct cl_io *io = ios->cis_io; struct cl_object *obj = io->ci_obj; - struct vvp_io *vio = cl2vvp_io(env, ios); + struct vvp_io *vio = cl2vvp_io(env, ios); struct inode *inode = vvp_object_inode(obj); int rc; @@ -376,7 +376,7 @@ static void vvp_io_fini(const struct lu_env *env, const struct cl_io_slice *ios) static void vvp_io_fault_fini(const struct lu_env *env, const struct cl_io_slice *ios) { - struct cl_io *io = ios->cis_io; + struct cl_io *io = ios->cis_io; struct cl_page *page = io->u.ci_fault.ft_page; CLOBINVRNT(env, io->ci_obj, vvp_object_invariant(io->ci_obj)); @@ -405,13 +405,13 @@ static int vvp_mmap_locks(const struct lu_env *env, struct vvp_io *vio, struct cl_io *io) { struct vvp_thread_info *cti = vvp_env_info(env); - struct mm_struct *mm = current->mm; + struct mm_struct *mm = current->mm; struct vm_area_struct *vma; - struct cl_lock_descr *descr = &cti->vti_descr; + struct cl_lock_descr *descr = &cti->vti_descr; union ldlm_policy_data policy; - unsigned long addr; - ssize_t count; - int result = 0; + unsigned long addr; + ssize_t count; + int result = 0; struct iov_iter i; struct iovec iov; @@ -492,7 +492,7 @@ static void vvp_io_advance(const struct lu_env *env, size_t nob) { struct cl_object *obj = ios->cis_io->ci_obj; - struct vvp_io *vio = cl2vvp_io(env, ios); + struct vvp_io *vio = cl2vvp_io(env, ios); CLOBINVRNT(env, obj, vvp_object_invariant(obj)); @@ -533,7 +533,7 @@ static int vvp_io_rw_lock(const struct lu_env *env, struct cl_io *io, static int vvp_io_read_lock(const struct lu_env *env, const struct cl_io_slice *ios) { - struct cl_io *io = ios->cis_io; + struct cl_io *io = ios->cis_io; struct cl_io_rw_common *rd = &io->u.ci_rd.rd; int result; @@ -546,7 +546,7 @@ static int vvp_io_read_lock(const struct lu_env *env, static int vvp_io_fault_lock(const struct lu_env *env, const struct cl_io_slice *ios) { - struct cl_io *io = ios->cis_io; + struct cl_io *io = ios->cis_io; struct vvp_io *vio = cl2vvp_io(env, ios); /* * XXX LDLM_FL_CBPENDING @@ -567,10 +567,10 @@ static int vvp_io_write_lock(const struct lu_env *env, if (io->u.ci_wr.wr_append) { start = 0; - end = OBD_OBJECT_EOF; + end = OBD_OBJECT_EOF; } else { start = io->u.ci_wr.wr.crw_pos; - end = start + io->u.ci_wr.wr.crw_count - 1; + end = start + io->u.ci_wr.wr.crw_count - 1; } return vvp_io_rw_lock(env, io, CLM_WRITE, start, end); } @@ -589,7 +589,7 @@ static int vvp_io_setattr_iter_init(const struct lu_env *env, static int vvp_io_setattr_lock(const struct lu_env *env, const struct cl_io_slice *ios) { - struct cl_io *io = ios->cis_io; + struct cl_io *io = ios->cis_io; u64 new_size; u32 enqflags = 0; @@ -619,7 +619,7 @@ static int vvp_io_setattr_lock(const struct lu_env *env, static int vvp_do_vmtruncate(struct inode *inode, size_t size) { - int result; + int result; /* * Only ll_inode_size_lock is taken at this level. */ @@ -637,9 +637,9 @@ static int vvp_do_vmtruncate(struct inode *inode, size_t size) static int vvp_io_setattr_time(const struct lu_env *env, const struct cl_io_slice *ios) { - struct cl_io *io = ios->cis_io; - struct cl_object *obj = io->ci_obj; - struct cl_attr *attr = vvp_env_thread_attr(env); + struct cl_io *io = ios->cis_io; + struct cl_object *obj = io->ci_obj; + struct cl_attr *attr = vvp_env_thread_attr(env); int result; unsigned valid = CAT_CTIME; @@ -662,8 +662,8 @@ static int vvp_io_setattr_time(const struct lu_env *env, static int vvp_io_setattr_start(const struct lu_env *env, const struct cl_io_slice *ios) { - struct cl_io *io = ios->cis_io; - struct inode *inode = vvp_object_inode(io->ci_obj); + struct cl_io *io = ios->cis_io; + struct inode *inode = vvp_object_inode(io->ci_obj); struct ll_inode_info *lli = ll_i2info(inode); if (cl_io_is_trunc(io)) { @@ -683,7 +683,7 @@ static int vvp_io_setattr_start(const struct lu_env *env, static void vvp_io_setattr_end(const struct lu_env *env, const struct cl_io_slice *ios) { - struct cl_io *io = ios->cis_io; + struct cl_io *io = ios->cis_io; struct inode *inode = vvp_object_inode(io->ci_obj); struct ll_inode_info *lli = ll_i2info(inode); @@ -716,18 +716,17 @@ static void vvp_io_setattr_fini(const struct lu_env *env, static int vvp_io_read_start(const struct lu_env *env, const struct cl_io_slice *ios) { - struct vvp_io *vio = cl2vvp_io(env, ios); - struct cl_io *io = ios->cis_io; - struct cl_object *obj = io->ci_obj; - struct inode *inode = vvp_object_inode(obj); + struct vvp_io *vio = cl2vvp_io(env, ios); + struct cl_io *io = ios->cis_io; + struct cl_object *obj = io->ci_obj; + struct inode *inode = vvp_object_inode(obj); struct ll_inode_info *lli = ll_i2info(inode); - struct file *file = vio->vui_fd->fd_file; - - int result; - loff_t pos = io->u.ci_rd.rd.crw_pos; - long cnt = io->u.ci_rd.rd.crw_count; - long tot = vio->vui_tot_count; - int exceed = 0; + struct file *file = vio->vui_fd->fd_file; + int result; + loff_t pos = io->u.ci_rd.rd.crw_pos; + long cnt = io->u.ci_rd.rd.crw_count; + long tot = vio->vui_tot_count; + int exceed = 0; CLOBINVRNT(env, obj, vvp_object_invariant(obj)); @@ -956,10 +955,10 @@ int vvp_io_write_commit(const struct lu_env *env, struct cl_io *io) static int vvp_io_write_start(const struct lu_env *env, const struct cl_io_slice *ios) { - struct vvp_io *vio = cl2vvp_io(env, ios); - struct cl_io *io = ios->cis_io; - struct cl_object *obj = io->ci_obj; - struct inode *inode = vvp_object_inode(obj); + struct vvp_io *vio = cl2vvp_io(env, ios); + struct cl_io *io = ios->cis_io; + struct cl_object *obj = io->ci_obj; + struct inode *inode = vvp_object_inode(obj); struct ll_inode_info *lli = ll_i2info(inode); bool lock_inode = !inode_is_locked(inode) && !IS_NOSEC(inode); loff_t pos = io->u.ci_wr.wr.crw_pos; @@ -1111,19 +1110,19 @@ static void mkwrite_commit_callback(const struct lu_env *env, struct cl_io *io, static int vvp_io_fault_start(const struct lu_env *env, const struct cl_io_slice *ios) { - struct vvp_io *vio = cl2vvp_io(env, ios); - struct cl_io *io = ios->cis_io; - struct cl_object *obj = io->ci_obj; - struct inode *inode = vvp_object_inode(obj); + struct vvp_io *vio = cl2vvp_io(env, ios); + struct cl_io *io = ios->cis_io; + struct cl_object *obj = io->ci_obj; + struct inode *inode = vvp_object_inode(obj); struct ll_inode_info *lli = ll_i2info(inode); - struct cl_fault_io *fio = &io->u.ci_fault; - struct vvp_fault_io *cfio = &vio->u.fault; - loff_t offset; - int result = 0; - struct page *vmpage = NULL; - struct cl_page *page; - loff_t size; - pgoff_t last_index; + struct cl_fault_io *fio = &io->u.ci_fault; + struct vvp_fault_io *cfio = &vio->u.fault; + loff_t offset; + int result = 0; + struct page *vmpage = NULL; + struct cl_page *page; + loff_t size; + pgoff_t last_index; down_read(&lli->lli_trunc_sem); @@ -1318,40 +1317,40 @@ static int vvp_io_read_ahead(const struct lu_env *env, .op = { [CIT_READ] = { .cio_fini = vvp_io_fini, - .cio_lock = vvp_io_read_lock, - .cio_start = vvp_io_read_start, + .cio_lock = vvp_io_read_lock, + .cio_start = vvp_io_read_start, .cio_end = vvp_io_rw_end, .cio_advance = vvp_io_advance, }, [CIT_WRITE] = { - .cio_fini = vvp_io_fini, - .cio_iter_init = vvp_io_write_iter_init, - .cio_iter_fini = vvp_io_write_iter_fini, - .cio_lock = vvp_io_write_lock, - .cio_start = vvp_io_write_start, + .cio_fini = vvp_io_fini, + .cio_iter_init = vvp_io_write_iter_init, + .cio_iter_fini = vvp_io_write_iter_fini, + .cio_lock = vvp_io_write_lock, + .cio_start = vvp_io_write_start, .cio_end = vvp_io_rw_end, - .cio_advance = vvp_io_advance, + .cio_advance = vvp_io_advance, }, [CIT_SETATTR] = { - .cio_fini = vvp_io_setattr_fini, - .cio_iter_init = vvp_io_setattr_iter_init, - .cio_lock = vvp_io_setattr_lock, - .cio_start = vvp_io_setattr_start, + .cio_fini = vvp_io_setattr_fini, + .cio_iter_init = vvp_io_setattr_iter_init, + .cio_lock = vvp_io_setattr_lock, + .cio_start = vvp_io_setattr_start, .cio_end = vvp_io_setattr_end }, [CIT_FAULT] = { - .cio_fini = vvp_io_fault_fini, - .cio_iter_init = vvp_io_fault_iter_init, - .cio_lock = vvp_io_fault_lock, - .cio_start = vvp_io_fault_start, - .cio_end = vvp_io_fault_end, + .cio_fini = vvp_io_fault_fini, + .cio_iter_init = vvp_io_fault_iter_init, + .cio_lock = vvp_io_fault_lock, + .cio_start = vvp_io_fault_start, + .cio_end = vvp_io_fault_end, }, [CIT_FSYNC] = { - .cio_start = vvp_io_fsync_start, - .cio_fini = vvp_io_fini + .cio_start = vvp_io_fsync_start, + .cio_fini = vvp_io_fini }, [CIT_MISC] = { - .cio_fini = vvp_io_fini + .cio_fini = vvp_io_fini }, [CIT_LADVISE] = { .cio_fini = vvp_io_fini @@ -1363,9 +1362,9 @@ static int vvp_io_read_ahead(const struct lu_env *env, int vvp_io_init(const struct lu_env *env, struct cl_object *obj, struct cl_io *io) { - struct vvp_io *vio = vvp_env_io(env); - struct inode *inode = vvp_object_inode(obj); - int result; + struct vvp_io *vio = vvp_env_io(env); + struct inode *inode = vvp_object_inode(obj); + int result; CLOBINVRNT(env, obj, vvp_object_invariant(obj)); diff --git a/drivers/staging/lustre/lustre/llite/vvp_object.c b/drivers/staging/lustre/lustre/llite/vvp_object.c index 86e077b..1637972 100644 --- a/drivers/staging/lustre/lustre/llite/vvp_object.c +++ b/drivers/staging/lustre/lustre/llite/vvp_object.c @@ -50,7 +50,7 @@ int vvp_object_invariant(const struct cl_object *obj) { - struct inode *inode = vvp_object_inode(obj); + struct inode *inode = vvp_object_inode(obj); struct ll_inode_info *lli = ll_i2info(inode); return (S_ISREG(inode->i_mode) || inode->i_mode == 0) && @@ -60,8 +60,8 @@ int vvp_object_invariant(const struct cl_object *obj) static int vvp_object_print(const struct lu_env *env, void *cookie, lu_printer_t p, const struct lu_object *o) { - struct vvp_object *obj = lu2vvp(o); - struct inode *inode = obj->vob_inode; + struct vvp_object *obj = lu2vvp(o); + struct inode *inode = obj->vob_inode; struct ll_inode_info *lli; (*p)(env, cookie, "(%d %d) inode: %p ", @@ -209,13 +209,13 @@ static void vvp_req_attr_set(const struct lu_env *env, struct cl_object *obj, } static const struct cl_object_operations vvp_ops = { - .coo_page_init = vvp_page_init, - .coo_lock_init = vvp_lock_init, - .coo_io_init = vvp_io_init, - .coo_attr_get = vvp_attr_get, - .coo_attr_update = vvp_attr_update, - .coo_conf_set = vvp_conf_set, - .coo_prune = vvp_prune, + .coo_page_init = vvp_page_init, + .coo_lock_init = vvp_lock_init, + .coo_io_init = vvp_io_init, + .coo_attr_get = vvp_attr_get, + .coo_attr_update = vvp_attr_update, + .coo_conf_set = vvp_conf_set, + .coo_prune = vvp_prune, .coo_glimpse = vvp_object_glimpse, .coo_req_attr_set = vvp_req_attr_set }; @@ -235,8 +235,8 @@ static int vvp_object_init(const struct lu_env *env, struct lu_object *obj, { struct vvp_device *dev = lu2vvp_dev(obj->lo_dev); struct vvp_object *vob = lu2vvp(obj); - struct lu_object *below; - struct lu_device *under; + struct lu_object *below; + struct lu_device *under; int result; under = &dev->vdv_next->cd_lu_dev; @@ -272,8 +272,8 @@ static void vvp_object_free(const struct lu_env *env, struct lu_object *obj) struct vvp_object *cl_inode2vvp(struct inode *inode) { struct ll_inode_info *lli = ll_i2info(inode); - struct cl_object *obj = lli->lli_clob; - struct lu_object *lu; + struct cl_object *obj = lli->lli_clob; + struct lu_object *lu; lu = lu_object_locate(obj->co_lu.lo_header, &vvp_device_type); LASSERT(lu); @@ -285,7 +285,7 @@ struct lu_object *vvp_object_alloc(const struct lu_env *env, struct lu_device *dev) { struct vvp_object *vob; - struct lu_object *obj; + struct lu_object *obj; vob = kmem_cache_zalloc(vvp_object_kmem, GFP_NOFS); if (vob) { diff --git a/drivers/staging/lustre/lustre/llite/vvp_page.c b/drivers/staging/lustre/lustre/llite/vvp_page.c index dcc4d8f..77bf923 100644 --- a/drivers/staging/lustre/lustre/llite/vvp_page.c +++ b/drivers/staging/lustre/lustre/llite/vvp_page.c @@ -65,8 +65,8 @@ static void vvp_page_fini_common(struct vvp_page *vpg) static void vvp_page_fini(const struct lu_env *env, struct cl_page_slice *slice) { - struct vvp_page *vpg = cl2vvp_page(slice); - struct page *vmpage = vpg->vpg_page; + struct vvp_page *vpg = cl2vvp_page(slice); + struct page *vmpage = vpg->vpg_page; /* * vmpage->private was already cleared when page was moved into @@ -80,8 +80,8 @@ static int vvp_page_own(const struct lu_env *env, const struct cl_page_slice *slice, struct cl_io *io, int nonblock) { - struct vvp_page *vpg = cl2vvp_page(slice); - struct page *vmpage = vpg->vpg_page; + struct vvp_page *vpg = cl2vvp_page(slice); + struct page *vmpage = vpg->vpg_page; LASSERT(vmpage); if (nonblock) { @@ -138,8 +138,8 @@ static void vvp_page_discard(const struct lu_env *env, const struct cl_page_slice *slice, struct cl_io *unused) { - struct page *vmpage = cl2vm_page(slice); - struct vvp_page *vpg = cl2vvp_page(slice); + struct page *vmpage = cl2vm_page(slice); + struct vvp_page *vpg = cl2vvp_page(slice); LASSERT(vmpage); LASSERT(PageLocked(vmpage)); @@ -153,10 +153,10 @@ static void vvp_page_discard(const struct lu_env *env, static void vvp_page_delete(const struct lu_env *env, const struct cl_page_slice *slice) { - struct page *vmpage = cl2vm_page(slice); - struct inode *inode = vmpage->mapping->host; - struct cl_object *obj = slice->cpl_obj; - struct cl_page *page = slice->cpl_page; + struct page *vmpage = cl2vm_page(slice); + struct inode *inode = vmpage->mapping->host; + struct cl_object *obj = slice->cpl_obj; + struct cl_page *page = slice->cpl_page; int refc; LASSERT(PageLocked(vmpage)); @@ -252,10 +252,10 @@ static void vvp_page_completion_read(const struct lu_env *env, const struct cl_page_slice *slice, int ioret) { - struct vvp_page *vpg = cl2vvp_page(slice); - struct page *vmpage = vpg->vpg_page; - struct cl_page *page = slice->cpl_page; - struct inode *inode = vvp_object_inode(page->cp_obj); + struct vvp_page *vpg = cl2vvp_page(slice); + struct page *vmpage = vpg->vpg_page; + struct cl_page *page = slice->cpl_page; + struct inode *inode = vvp_object_inode(page->cp_obj); LASSERT(PageLocked(vmpage)); CL_PAGE_HEADER(D_PAGE, env, page, "completing READ with %d\n", ioret); @@ -278,9 +278,9 @@ static void vvp_page_completion_write(const struct lu_env *env, const struct cl_page_slice *slice, int ioret) { - struct vvp_page *vpg = cl2vvp_page(slice); - struct cl_page *pg = slice->cpl_page; - struct page *vmpage = vpg->vpg_page; + struct vvp_page *vpg = cl2vvp_page(slice); + struct cl_page *pg = slice->cpl_page; + struct page *vmpage = vpg->vpg_page; CL_PAGE_HEADER(D_PAGE, env, pg, "completing WRITE with %d\n", ioret); @@ -345,7 +345,7 @@ static int vvp_page_print(const struct lu_env *env, void *cookie, lu_printer_t printer) { struct vvp_page *vpg = cl2vvp_page(slice); - struct page *vmpage = vpg->vpg_page; + struct page *vmpage = vpg->vpg_page; (*printer)(env, cookie, LUSTRE_VVP_NAME "-page@%p(%d:%d) vm@%p ", vpg, vpg->vpg_defer_uptodate, vpg->vpg_ra_used, vmpage); @@ -374,26 +374,26 @@ static int vvp_page_fail(const struct lu_env *env, } static const struct cl_page_operations vvp_page_ops = { - .cpo_own = vvp_page_own, - .cpo_assume = vvp_page_assume, - .cpo_unassume = vvp_page_unassume, - .cpo_disown = vvp_page_disown, - .cpo_discard = vvp_page_discard, - .cpo_delete = vvp_page_delete, - .cpo_export = vvp_page_export, - .cpo_is_vmlocked = vvp_page_is_vmlocked, - .cpo_fini = vvp_page_fini, - .cpo_print = vvp_page_print, + .cpo_own = vvp_page_own, + .cpo_assume = vvp_page_assume, + .cpo_unassume = vvp_page_unassume, + .cpo_disown = vvp_page_disown, + .cpo_discard = vvp_page_discard, + .cpo_delete = vvp_page_delete, + .cpo_export = vvp_page_export, + .cpo_is_vmlocked = vvp_page_is_vmlocked, + .cpo_fini = vvp_page_fini, + .cpo_print = vvp_page_print, .io = { [CRT_READ] = { .cpo_prep = vvp_page_prep_read, - .cpo_completion = vvp_page_completion_read, + .cpo_completion = vvp_page_completion_read, .cpo_make_ready = vvp_page_fail, }, [CRT_WRITE] = { .cpo_prep = vvp_page_prep_write, - .cpo_completion = vvp_page_completion_write, - .cpo_make_ready = vvp_page_make_ready, + .cpo_completion = vvp_page_completion_write, + .cpo_make_ready = vvp_page_make_ready, }, }, }; @@ -446,8 +446,8 @@ static void vvp_transient_page_discard(const struct lu_env *env, static int vvp_transient_page_is_vmlocked(const struct lu_env *env, const struct cl_page_slice *slice) { - struct inode *inode = vvp_object_inode(slice->cpl_obj); - int locked; + struct inode *inode = vvp_object_inode(slice->cpl_obj); + int locked; locked = !inode_trylock(inode); if (!locked) @@ -474,22 +474,22 @@ static void vvp_transient_page_fini(const struct lu_env *env, } static const struct cl_page_operations vvp_transient_page_ops = { - .cpo_own = vvp_transient_page_own, - .cpo_assume = vvp_transient_page_assume, - .cpo_unassume = vvp_transient_page_unassume, - .cpo_disown = vvp_transient_page_disown, - .cpo_discard = vvp_transient_page_discard, - .cpo_fini = vvp_transient_page_fini, - .cpo_is_vmlocked = vvp_transient_page_is_vmlocked, - .cpo_print = vvp_page_print, + .cpo_own = vvp_transient_page_own, + .cpo_assume = vvp_transient_page_assume, + .cpo_unassume = vvp_transient_page_unassume, + .cpo_disown = vvp_transient_page_disown, + .cpo_discard = vvp_transient_page_discard, + .cpo_fini = vvp_transient_page_fini, + .cpo_is_vmlocked = vvp_transient_page_is_vmlocked, + .cpo_print = vvp_page_print, .io = { [CRT_READ] = { .cpo_prep = vvp_transient_page_prep, - .cpo_completion = vvp_transient_page_completion, + .cpo_completion = vvp_transient_page_completion, }, [CRT_WRITE] = { .cpo_prep = vvp_transient_page_prep, - .cpo_completion = vvp_transient_page_completion, + .cpo_completion = vvp_transient_page_completion, } } }; @@ -498,7 +498,7 @@ int vvp_page_init(const struct lu_env *env, struct cl_object *obj, struct cl_page *page, pgoff_t index) { struct vvp_page *vpg = cl_object_page_slice(obj, page); - struct page *vmpage = page->cp_vmpage; + struct page *vmpage = page->cp_vmpage; CLOBINVRNT(env, obj, vvp_object_invariant(obj)); diff --git a/drivers/staging/lustre/lustre/llite/xattr.c b/drivers/staging/lustre/lustre/llite/xattr.c index 0670ed3..22f178a 100644 --- a/drivers/staging/lustre/lustre/llite/xattr.c +++ b/drivers/staging/lustre/lustre/llite/xattr.c @@ -631,45 +631,45 @@ ssize_t ll_listxattr(struct dentry *dentry, char *buffer, size_t size) } static const struct xattr_handler ll_user_xattr_handler = { - .prefix = XATTR_USER_PREFIX, - .flags = XATTR_USER_T, - .get = ll_xattr_get_common, - .set = ll_xattr_set_common, + .prefix = XATTR_USER_PREFIX, + .flags = XATTR_USER_T, + .get = ll_xattr_get_common, + .set = ll_xattr_set_common, }; static const struct xattr_handler ll_trusted_xattr_handler = { - .prefix = XATTR_TRUSTED_PREFIX, - .flags = XATTR_TRUSTED_T, - .get = ll_xattr_get, - .set = ll_xattr_set, + .prefix = XATTR_TRUSTED_PREFIX, + .flags = XATTR_TRUSTED_T, + .get = ll_xattr_get, + .set = ll_xattr_set, }; static const struct xattr_handler ll_security_xattr_handler = { - .prefix = XATTR_SECURITY_PREFIX, - .flags = XATTR_SECURITY_T, - .get = ll_xattr_get_common, - .set = ll_xattr_set_common, + .prefix = XATTR_SECURITY_PREFIX, + .flags = XATTR_SECURITY_T, + .get = ll_xattr_get_common, + .set = ll_xattr_set_common, }; static const struct xattr_handler ll_acl_access_xattr_handler = { - .name = XATTR_NAME_POSIX_ACL_ACCESS, - .flags = XATTR_ACL_ACCESS_T, - .get = ll_xattr_get_common, - .set = ll_xattr_set_common, + .name = XATTR_NAME_POSIX_ACL_ACCESS, + .flags = XATTR_ACL_ACCESS_T, + .get = ll_xattr_get_common, + .set = ll_xattr_set_common, }; static const struct xattr_handler ll_acl_default_xattr_handler = { - .name = XATTR_NAME_POSIX_ACL_DEFAULT, - .flags = XATTR_ACL_DEFAULT_T, - .get = ll_xattr_get_common, - .set = ll_xattr_set_common, + .name = XATTR_NAME_POSIX_ACL_DEFAULT, + .flags = XATTR_ACL_DEFAULT_T, + .get = ll_xattr_get_common, + .set = ll_xattr_set_common, }; static const struct xattr_handler ll_lustre_xattr_handler = { - .prefix = XATTR_LUSTRE_PREFIX, - .flags = XATTR_LUSTRE_T, - .get = ll_xattr_get, - .set = ll_xattr_set, + .prefix = XATTR_LUSTRE_PREFIX, + .flags = XATTR_LUSTRE_T, + .get = ll_xattr_get, + .set = ll_xattr_set, }; const struct xattr_handler *ll_xattr_handlers[] = { -- 1.8.3.1 From jsimmons at infradead.org Thu Jan 31 17:19:18 2019 From: jsimmons at infradead.org (James Simmons) Date: Thu, 31 Jan 2019 12:19:18 -0500 Subject: [lustre-devel] [PATCH 14/26] mdc: cleanup white spaces In-Reply-To: <1548955170-13456-1-git-send-email-jsimmons@infradead.org> References: <1548955170-13456-1-git-send-email-jsimmons@infradead.org> Message-ID: <1548955170-13456-15-git-send-email-jsimmons@infradead.org> The mdc code is very messy and difficult to read. Remove excess white space and properly align data structures so they are easy on the eyes. Signed-off-by: James Simmons --- drivers/staging/lustre/lustre/mdc/mdc_lib.c | 126 ++++++------- drivers/staging/lustre/lustre/mdc/mdc_locks.c | 80 ++++----- drivers/staging/lustre/lustre/mdc/mdc_reint.c | 2 +- drivers/staging/lustre/lustre/mdc/mdc_request.c | 228 ++++++++++++------------ 4 files changed, 218 insertions(+), 218 deletions(-) diff --git a/drivers/staging/lustre/lustre/mdc/mdc_lib.c b/drivers/staging/lustre/lustre/mdc/mdc_lib.c index 3dfc863..55d2ea1 100644 --- a/drivers/staging/lustre/lustre/mdc/mdc_lib.c +++ b/drivers/staging/lustre/lustre/mdc/mdc_lib.c @@ -153,30 +153,30 @@ void mdc_create_pack(struct ptlrpc_request *req, struct md_op_data *op_data, uid_t uid, gid_t gid, kernel_cap_t cap_effective, u64 rdev) { - struct mdt_rec_create *rec; - char *tmp; - u64 flags; + struct mdt_rec_create *rec; + char *tmp; + u64 flags; BUILD_BUG_ON(sizeof(struct mdt_rec_reint) != sizeof(struct mdt_rec_create)); rec = req_capsule_client_get(&req->rq_pill, &RMF_REC_REINT); - rec->cr_opcode = REINT_CREATE; - rec->cr_fsuid = uid; - rec->cr_fsgid = gid; - rec->cr_cap = cap_effective.cap[0]; - rec->cr_fid1 = op_data->op_fid1; - rec->cr_fid2 = op_data->op_fid2; - rec->cr_mode = mode; - rec->cr_rdev = rdev; - rec->cr_time = op_data->op_mod_time; + rec->cr_opcode = REINT_CREATE; + rec->cr_fsuid = uid; + rec->cr_fsgid = gid; + rec->cr_cap = cap_effective.cap[0]; + rec->cr_fid1 = op_data->op_fid1; + rec->cr_fid2 = op_data->op_fid2; + rec->cr_mode = mode; + rec->cr_rdev = rdev; + rec->cr_time = op_data->op_mod_time; rec->cr_suppgid1 = op_data->op_suppgids[0]; rec->cr_suppgid2 = op_data->op_suppgids[1]; flags = 0; if (op_data->op_bias & MDS_CREATE_VOLATILE) flags |= MDS_OPEN_VOLATILE; set_mrc_cr_flags(rec, flags); - rec->cr_bias = op_data->op_bias; - rec->cr_umask = current_umask(); + rec->cr_bias = op_data->op_bias; + rec->cr_umask = current_umask(); mdc_pack_name(req, &RMF_NAME, op_data->op_name, op_data->op_namelen); if (data) { @@ -229,21 +229,21 @@ void mdc_open_pack(struct ptlrpc_request *req, struct md_op_data *op_data, rec = req_capsule_client_get(&req->rq_pill, &RMF_REC_REINT); /* XXX do something about time, uid, gid */ - rec->cr_opcode = REINT_OPEN; - rec->cr_fsuid = from_kuid(&init_user_ns, current_fsuid()); - rec->cr_fsgid = from_kgid(&init_user_ns, current_fsgid()); - rec->cr_cap = current_cap().cap[0]; + rec->cr_opcode = REINT_OPEN; + rec->cr_fsuid = from_kuid(&init_user_ns, current_fsuid()); + rec->cr_fsgid = from_kgid(&init_user_ns, current_fsgid()); + rec->cr_cap = current_cap().cap[0]; rec->cr_fid1 = op_data->op_fid1; rec->cr_fid2 = op_data->op_fid2; - rec->cr_mode = mode; + rec->cr_mode = mode; cr_flags = mds_pack_open_flags(flags); - rec->cr_rdev = rdev; - rec->cr_time = op_data->op_mod_time; + rec->cr_rdev = rdev; + rec->cr_time = op_data->op_mod_time; rec->cr_suppgid1 = op_data->op_suppgids[0]; rec->cr_suppgid2 = op_data->op_suppgids[1]; - rec->cr_bias = op_data->op_bias; - rec->cr_umask = current_umask(); + rec->cr_bias = op_data->op_bias; + rec->cr_umask = current_umask(); rec->cr_old_handle = op_data->op_handle; if (op_data->op_name) { @@ -313,24 +313,24 @@ static inline u64 attr_pack(unsigned int ia_valid, enum op_xvalid ia_xvalid) static void mdc_setattr_pack_rec(struct mdt_rec_setattr *rec, struct md_op_data *op_data) { - rec->sa_opcode = REINT_SETATTR; - rec->sa_fsuid = from_kuid(&init_user_ns, current_fsuid()); - rec->sa_fsgid = from_kgid(&init_user_ns, current_fsgid()); - rec->sa_cap = current_cap().cap[0]; + rec->sa_opcode = REINT_SETATTR; + rec->sa_fsuid = from_kuid(&init_user_ns, current_fsuid()); + rec->sa_fsgid = from_kgid(&init_user_ns, current_fsgid()); + rec->sa_cap = current_cap().cap[0]; rec->sa_suppgid = -1; - rec->sa_fid = op_data->op_fid1; + rec->sa_fid = op_data->op_fid1; rec->sa_valid = attr_pack(op_data->op_attr.ia_valid, op_data->op_xvalid); - rec->sa_mode = op_data->op_attr.ia_mode; - rec->sa_uid = from_kuid(&init_user_ns, op_data->op_attr.ia_uid); - rec->sa_gid = from_kgid(&init_user_ns, op_data->op_attr.ia_gid); + rec->sa_mode = op_data->op_attr.ia_mode; + rec->sa_uid = from_kuid(&init_user_ns, op_data->op_attr.ia_uid); + rec->sa_gid = from_kgid(&init_user_ns, op_data->op_attr.ia_gid); rec->sa_projid = op_data->op_projid; - rec->sa_size = op_data->op_attr.ia_size; + rec->sa_size = op_data->op_attr.ia_size; rec->sa_blocks = op_data->op_attr_blocks; - rec->sa_atime = op_data->op_attr.ia_atime.tv_sec; - rec->sa_mtime = op_data->op_attr.ia_mtime.tv_sec; - rec->sa_ctime = op_data->op_attr.ia_ctime.tv_sec; + rec->sa_atime = op_data->op_attr.ia_atime.tv_sec; + rec->sa_mtime = op_data->op_attr.ia_mtime.tv_sec; + rec->sa_ctime = op_data->op_attr.ia_ctime.tv_sec; rec->sa_attr_flags = op_data->op_attr_flags; if ((op_data->op_attr.ia_valid & ATTR_GID) && in_group_p(op_data->op_attr.ia_gid)) @@ -383,18 +383,18 @@ void mdc_unlink_pack(struct ptlrpc_request *req, struct md_op_data *op_data) BUILD_BUG_ON(sizeof(struct mdt_rec_reint) != sizeof(struct mdt_rec_unlink)); rec = req_capsule_client_get(&req->rq_pill, &RMF_REC_REINT); - rec->ul_opcode = op_data->op_cli_flags & CLI_RM_ENTRY ? - REINT_RMENTRY : REINT_UNLINK; - rec->ul_fsuid = op_data->op_fsuid; - rec->ul_fsgid = op_data->op_fsgid; - rec->ul_cap = op_data->op_cap.cap[0]; - rec->ul_mode = op_data->op_mode; + rec->ul_opcode = op_data->op_cli_flags & CLI_RM_ENTRY ? + REINT_RMENTRY : REINT_UNLINK; + rec->ul_fsuid = op_data->op_fsuid; + rec->ul_fsgid = op_data->op_fsgid; + rec->ul_cap = op_data->op_cap.cap[0]; + rec->ul_mode = op_data->op_mode; rec->ul_suppgid1 = op_data->op_suppgids[0]; rec->ul_suppgid2 = -1; - rec->ul_fid1 = op_data->op_fid1; - rec->ul_fid2 = op_data->op_fid2; - rec->ul_time = op_data->op_mod_time; - rec->ul_bias = op_data->op_bias; + rec->ul_fid1 = op_data->op_fid1; + rec->ul_fid2 = op_data->op_fid2; + rec->ul_time = op_data->op_mod_time; + rec->ul_bias = op_data->op_bias; mdc_pack_name(req, &RMF_NAME, op_data->op_name, op_data->op_namelen); } @@ -406,16 +406,16 @@ void mdc_link_pack(struct ptlrpc_request *req, struct md_op_data *op_data) BUILD_BUG_ON(sizeof(struct mdt_rec_reint) != sizeof(struct mdt_rec_link)); rec = req_capsule_client_get(&req->rq_pill, &RMF_REC_REINT); - rec->lk_opcode = REINT_LINK; - rec->lk_fsuid = op_data->op_fsuid; /* current->fsuid; */ - rec->lk_fsgid = op_data->op_fsgid; /* current->fsgid; */ - rec->lk_cap = op_data->op_cap.cap[0]; /* current->cap_effective; */ + rec->lk_opcode = REINT_LINK; + rec->lk_fsuid = op_data->op_fsuid; /* current->fsuid; */ + rec->lk_fsgid = op_data->op_fsgid; /* current->fsgid; */ + rec->lk_cap = op_data->op_cap.cap[0]; /* current->cap_effective; */ rec->lk_suppgid1 = op_data->op_suppgids[0]; rec->lk_suppgid2 = op_data->op_suppgids[1]; - rec->lk_fid1 = op_data->op_fid1; - rec->lk_fid2 = op_data->op_fid2; - rec->lk_time = op_data->op_mod_time; - rec->lk_bias = op_data->op_bias; + rec->lk_fid1 = op_data->op_fid1; + rec->lk_fid2 = op_data->op_fid2; + rec->lk_time = op_data->op_mod_time; + rec->lk_bias = op_data->op_bias; mdc_pack_name(req, &RMF_NAME, op_data->op_name, op_data->op_namelen); } @@ -455,18 +455,18 @@ void mdc_rename_pack(struct ptlrpc_request *req, struct md_op_data *op_data, rec = req_capsule_client_get(&req->rq_pill, &RMF_REC_REINT); /* XXX do something about time, uid, gid */ - rec->rn_opcode = op_data->op_cli_flags & CLI_MIGRATE ? - REINT_MIGRATE : REINT_RENAME; - rec->rn_fsuid = op_data->op_fsuid; - rec->rn_fsgid = op_data->op_fsgid; - rec->rn_cap = op_data->op_cap.cap[0]; + rec->rn_opcode = op_data->op_cli_flags & CLI_MIGRATE ? + REINT_MIGRATE : REINT_RENAME; + rec->rn_fsuid = op_data->op_fsuid; + rec->rn_fsgid = op_data->op_fsgid; + rec->rn_cap = op_data->op_cap.cap[0]; rec->rn_suppgid1 = op_data->op_suppgids[0]; rec->rn_suppgid2 = op_data->op_suppgids[1]; - rec->rn_fid1 = op_data->op_fid1; - rec->rn_fid2 = op_data->op_fid2; - rec->rn_time = op_data->op_mod_time; - rec->rn_mode = op_data->op_mode; - rec->rn_bias = op_data->op_bias; + rec->rn_fid1 = op_data->op_fid1; + rec->rn_fid2 = op_data->op_fid2; + rec->rn_time = op_data->op_mod_time; + rec->rn_mode = op_data->op_mode; + rec->rn_bias = op_data->op_bias; mdc_pack_name(req, &RMF_NAME, old, oldlen); diff --git a/drivers/staging/lustre/lustre/mdc/mdc_locks.c b/drivers/staging/lustre/lustre/mdc/mdc_locks.c index e16dce6..430c422 100644 --- a/drivers/staging/lustre/lustre/mdc/mdc_locks.c +++ b/drivers/staging/lustre/lustre/mdc/mdc_locks.c @@ -203,7 +203,7 @@ static inline void mdc_clear_replay_flag(struct ptlrpc_request *req, int rc) } /* Save a large LOV EA into the request buffer so that it is available - * for replay. We don't do this in the initial request because the + * for replay. We don't do this in the initial request because the * original request doesn't need this buffer (at most it sends just the * lov_mds_md) and it is a waste of RAM/bandwidth to send the empty * buffer and may also be difficult to allocate and save a very large @@ -247,14 +247,14 @@ static int mdc_save_lovea(struct ptlrpc_request *req, struct md_op_data *op_data) { struct ptlrpc_request *req; - struct obd_device *obddev = class_exp2obd(exp); - struct ldlm_intent *lit; + struct obd_device *obddev = class_exp2obd(exp); + struct ldlm_intent *lit; const void *lmm = op_data->op_data; u32 lmmsize = op_data->op_data_size; LIST_HEAD(cancels); - int count = 0; - int mode; - int rc; + int count = 0; + int mode; + int rc; it->it_create_mode = (it->it_create_mode & ~S_IFMT) | S_IFREG; @@ -344,8 +344,8 @@ static int mdc_save_lovea(struct ptlrpc_request *req, struct md_op_data *op_data) { u32 ea_vals_buf_size = GA_DEFAULT_EA_VAL_LEN * GA_DEFAULT_EA_NUM; - struct ptlrpc_request *req; - struct ldlm_intent *lit; + struct ptlrpc_request *req; + struct ldlm_intent *lit; int rc, count = 0; LIST_HEAD(cancels); @@ -403,9 +403,9 @@ static struct ptlrpc_request *mdc_intent_unlink_pack(struct obd_export *exp, struct md_op_data *op_data) { struct ptlrpc_request *req; - struct obd_device *obddev = class_exp2obd(exp); - struct ldlm_intent *lit; - int rc; + struct obd_device *obddev = class_exp2obd(exp); + struct ldlm_intent *lit; + int rc; req = ptlrpc_request_alloc(class_exp2cliimp(exp), &RQF_LDLM_INTENT_UNLINK); @@ -439,12 +439,12 @@ static struct ptlrpc_request *mdc_intent_getattr_pack(struct obd_export *exp, struct md_op_data *op_data) { struct ptlrpc_request *req; - struct obd_device *obddev = class_exp2obd(exp); - u64 valid = OBD_MD_FLGETATTR | OBD_MD_FLEASIZE | - OBD_MD_FLMODEASIZE | OBD_MD_FLDIREA | - OBD_MD_MEA | OBD_MD_FLACL; - struct ldlm_intent *lit; - int rc; + struct obd_device *obddev = class_exp2obd(exp); + u64 valid = OBD_MD_FLGETATTR | OBD_MD_FLEASIZE | + OBD_MD_FLMODEASIZE | OBD_MD_FLDIREA | + OBD_MD_MEA | OBD_MD_FLACL; + struct ldlm_intent *lit; + int rc; u32 easize; req = ptlrpc_request_alloc(class_exp2cliimp(exp), @@ -484,10 +484,10 @@ static struct ptlrpc_request *mdc_intent_layout_pack(struct obd_export *exp, struct lookup_intent *it, struct md_op_data *op_data) { - struct obd_device *obd = class_exp2obd(exp); + struct obd_device *obd = class_exp2obd(exp); struct ptlrpc_request *req; - struct ldlm_intent *lit; - struct layout_intent *layout; + struct ldlm_intent *lit; + struct layout_intent *layout; int rc; req = ptlrpc_request_alloc(class_exp2cliimp(exp), @@ -546,11 +546,11 @@ static int mdc_finish_enqueue(struct obd_export *exp, struct lustre_handle *lockh, int rc) { - struct req_capsule *pill = &req->rq_pill; + struct req_capsule *pill = &req->rq_pill; struct ldlm_request *lockreq; - struct ldlm_reply *lockrep; - struct ldlm_lock *lock; - void *lvb_data = NULL; + struct ldlm_reply *lockrep; + struct ldlm_lock *lock; + void *lvb_data = NULL; u32 lvb_len = 0; LASSERT(rc >= 0); @@ -985,7 +985,7 @@ static int mdc_finish_intent_lock(struct obd_export *exp, matching_lock: /* If we already have a matching lock, then cancel the new - * one. We have to set the data here instead of in + * one. We have to set the data here instead of in * mdc_enqueue, because we need to use the child's inode as * the l_ast_data to match, and that's not available until * intent_finish has performed the iget().) @@ -1185,16 +1185,16 @@ static int mdc_intent_getattr_async_interpret(const struct lu_env *env, void *args, int rc) { struct mdc_getattr_args *ga = args; - struct obd_export *exp = ga->ga_exp; - struct md_enqueue_info *minfo = ga->ga_minfo; + struct obd_export *exp = ga->ga_exp; + struct md_enqueue_info *minfo = ga->ga_minfo; struct ldlm_enqueue_info *einfo = &minfo->mi_einfo; - struct lookup_intent *it; - struct lustre_handle *lockh; - struct obd_device *obddev; - struct ldlm_reply *lockrep; - u64 flags = LDLM_FL_HAS_INTENT; + struct lookup_intent *it; + struct lustre_handle *lockh; + struct obd_device *obddev; + struct ldlm_reply *lockrep; + u64 flags = LDLM_FL_HAS_INTENT; - it = &minfo->mi_it; + it = &minfo->mi_it; lockh = &minfo->mi_lockh; obddev = class_exp2obd(exp); @@ -1230,17 +1230,17 @@ static int mdc_intent_getattr_async_interpret(const struct lu_env *env, int mdc_intent_getattr_async(struct obd_export *exp, struct md_enqueue_info *minfo) { - struct md_op_data *op_data = &minfo->mi_data; - struct lookup_intent *it = &minfo->mi_it; - struct ptlrpc_request *req; + struct md_op_data *op_data = &minfo->mi_data; + struct lookup_intent *it = &minfo->mi_it; + struct ptlrpc_request *req; struct mdc_getattr_args *ga; - struct obd_device *obddev = class_exp2obd(exp); - struct ldlm_res_id res_id; + struct obd_device *obddev = class_exp2obd(exp); + struct ldlm_res_id res_id; union ldlm_policy_data policy = { .l_inodebits = { MDS_INODELOCK_LOOKUP | MDS_INODELOCK_UPDATE } }; - int rc = 0; - u64 flags = LDLM_FL_HAS_INTENT; + int rc = 0; + u64 flags = LDLM_FL_HAS_INTENT; CDEBUG(D_DLMTRACE, "name: %.*s in inode " DFID ", intent: %s flags %#Lo\n", diff --git a/drivers/staging/lustre/lustre/mdc/mdc_reint.c b/drivers/staging/lustre/lustre/mdc/mdc_reint.c index 765c908..e0e7b00 100644 --- a/drivers/staging/lustre/lustre/mdc/mdc_reint.c +++ b/drivers/staging/lustre/lustre/mdc/mdc_reint.c @@ -223,7 +223,7 @@ int mdc_create(struct obd_export *exp, struct md_op_data *op_data, req->rq_sent = ktime_get_real_seconds() + resends; } level = LUSTRE_IMP_FULL; - resend: +resend: rc = mdc_reint(req, level); /* Resend if we were told to. */ diff --git a/drivers/staging/lustre/lustre/mdc/mdc_request.c b/drivers/staging/lustre/lustre/mdc/mdc_request.c index 1aee1c5..3eb89ec 100644 --- a/drivers/staging/lustre/lustre/mdc/mdc_request.c +++ b/drivers/staging/lustre/lustre/mdc/mdc_request.c @@ -33,12 +33,12 @@ #define DEBUG_SUBSYSTEM S_MDC -# include -# include -# include -# include -# include -# include +#include +#include +#include +#include +#include +#include #include #include @@ -96,8 +96,8 @@ static int mdc_get_root(struct obd_export *exp, const char *fileset, struct lu_fid *rootfid) { struct ptlrpc_request *req; - struct mdt_body *body; - int rc; + struct mdt_body *body; + int rc; if (fileset && !(exp_connect_flags(exp) & OBD_CONNECT_SUBTREE)) return -ENOTSUPP; @@ -160,9 +160,9 @@ static int mdc_getattr_common(struct obd_export *exp, struct ptlrpc_request *req) { struct req_capsule *pill = &req->rq_pill; - struct mdt_body *body; - void *eadata; - int rc; + struct mdt_body *body; + void *eadata; + int rc; /* Request message already built. */ rc = ptlrpc_queue_wait(req); @@ -191,7 +191,7 @@ static int mdc_getattr(struct obd_export *exp, struct md_op_data *op_data, struct ptlrpc_request **request) { struct ptlrpc_request *req; - int rc; + int rc; /* Single MDS without an LMV case */ if (op_data->op_flags & MF_GET_MDT_IDX) { @@ -230,7 +230,7 @@ static int mdc_getattr_name(struct obd_export *exp, struct md_op_data *op_data, struct ptlrpc_request **request) { struct ptlrpc_request *req; - int rc; + int rc; *request = NULL; req = ptlrpc_request_alloc(class_exp2cliimp(exp), @@ -281,9 +281,9 @@ static int mdc_xattr_common(struct obd_export *exp, u32 suppgid, struct ptlrpc_request **request) { struct ptlrpc_request *req; - int xattr_namelen = 0; + int xattr_namelen = 0; char *tmp; - int rc; + int rc; *request = NULL; req = ptlrpc_request_alloc(class_exp2cliimp(exp), fmt); @@ -333,19 +333,19 @@ static int mdc_xattr_common(struct obd_export *exp, struct mdt_rec_setxattr *rec; BUILD_BUG_ON(sizeof(struct mdt_rec_setxattr) != - sizeof(struct mdt_rec_reint)); + sizeof(struct mdt_rec_reint)); rec = req_capsule_client_get(&req->rq_pill, &RMF_REC_REINT); rec->sx_opcode = REINT_SETXATTR; - rec->sx_fsuid = from_kuid(&init_user_ns, current_fsuid()); - rec->sx_fsgid = from_kgid(&init_user_ns, current_fsgid()); - rec->sx_cap = current_cap().cap[0]; + rec->sx_fsuid = from_kuid(&init_user_ns, current_fsuid()); + rec->sx_fsgid = from_kgid(&init_user_ns, current_fsgid()); + rec->sx_cap = current_cap().cap[0]; rec->sx_suppgid1 = suppgid; rec->sx_suppgid2 = -1; - rec->sx_fid = *fid; - rec->sx_valid = valid | OBD_MD_FLCTIME; - rec->sx_time = ktime_get_real_seconds(); - rec->sx_size = output_size; - rec->sx_flags = flags; + rec->sx_fid = *fid; + rec->sx_valid = valid | OBD_MD_FLCTIME; + rec->sx_time = ktime_get_real_seconds(); + rec->sx_size = output_size; + rec->sx_flags = flags; } else { mdc_pack_body(req, fid, valid, output_size, suppgid, flags); @@ -411,11 +411,11 @@ static int mdc_getxattr(struct obd_export *exp, const struct lu_fid *fid, #ifdef CONFIG_FS_POSIX_ACL static int mdc_unpack_acl(struct ptlrpc_request *req, struct lustre_md *md) { - struct req_capsule *pill = &req->rq_pill; + struct req_capsule *pill = &req->rq_pill; struct mdt_body *body = md->body; - struct posix_acl *acl; - void *buf; - int rc; + struct posix_acl *acl; + void *buf; + int rc; if (!body->mbo_aclsize) return 0; @@ -643,11 +643,11 @@ int mdc_set_open_replay_data(struct obd_export *exp, struct obd_client_handle *och, struct lookup_intent *it) { - struct md_open_data *mod; + struct md_open_data *mod; struct mdt_rec_create *rec; - struct mdt_body *body; + struct mdt_body *body; struct ptlrpc_request *open_req = it->it_request; - struct obd_import *imp = open_req->rq_import; + struct obd_import *imp = open_req->rq_import; if (!open_req->rq_replay) return 0; @@ -758,11 +758,11 @@ static int mdc_clear_open_replay_data(struct obd_export *exp, static int mdc_close(struct obd_export *exp, struct md_op_data *op_data, struct md_open_data *mod, struct ptlrpc_request **request) { - struct obd_device *obd = class_exp2obd(exp); + struct obd_device *obd = class_exp2obd(exp); struct ptlrpc_request *req; - struct req_format *req_fmt; - int rc; - int saved_rc = 0; + struct req_format *req_fmt; + int rc; + int saved_rc = 0; if (op_data->op_bias & MDS_HSM_RELEASE) { req_fmt = &RQF_MDS_INTENT_CLOSE; @@ -1056,7 +1056,7 @@ static struct page *mdc_page_locate(struct address_space *mapping, u64 *hash, * * A lu_dirpage is laid out as follows, where s = ldp_hash_start, * e = ldp_hash_end, f = ldp_flags, p = padding, and each "ent" is a - * struct lu_dirent. It has size up to LU_PAGE_SIZE. The ldp_hash_end + * struct lu_dirent. It has size up to LU_PAGE_SIZE. The ldp_hash_end * value is used as a cookie to request the next lu_dirpage in a * directory listing that spans multiple pages (two in this example): * ________ @@ -1420,11 +1420,11 @@ static int mdc_statfs(const struct lu_env *env, struct obd_export *exp, struct obd_statfs *osfs, u64 max_age, u32 flags) { - struct obd_device *obd = class_exp2obd(exp); + struct obd_device *obd = class_exp2obd(exp); struct ptlrpc_request *req; - struct obd_statfs *msfs; - struct obd_import *imp = NULL; - int rc; + struct obd_statfs *msfs; + struct obd_import *imp = NULL; + int rc; /* * Since the request might also come from lprocfs, so we need @@ -1487,7 +1487,7 @@ static int mdc_ioc_fid2path(struct obd_export *exp, struct getinfo_fid2path *gf) /* Key is KEY_FID2PATH + getinfo_fid2path description */ keylen = cfs_size_round(sizeof(KEY_FID2PATH)) + sizeof(*gf) + - sizeof(struct lu_fid); + sizeof(struct lu_fid); key = kzalloc(keylen, GFP_NOFS); if (!key) return -ENOMEM; @@ -1533,10 +1533,10 @@ static int mdc_ioc_fid2path(struct obd_export *exp, struct getinfo_fid2path *gf) static int mdc_ioc_hsm_progress(struct obd_export *exp, struct hsm_progress_kernel *hpk) { - struct obd_import *imp = class_exp2cliimp(exp); - struct hsm_progress_kernel *req_hpk; - struct ptlrpc_request *req; - int rc; + struct obd_import *imp = class_exp2cliimp(exp); + struct hsm_progress_kernel *req_hpk; + struct ptlrpc_request *req; + int rc; req = ptlrpc_request_alloc_pack(imp, &RQF_MDS_HSM_PROGRESS, LUSTRE_MDS_VERSION, MDS_HSM_PROGRESS); @@ -1569,9 +1569,9 @@ static int mdc_ioc_hsm_progress(struct obd_export *exp, static int mdc_ioc_hsm_ct_register(struct obd_import *imp, u32 archives) { - u32 *archive_mask; - struct ptlrpc_request *req; - int rc; + u32 *archive_mask; + struct ptlrpc_request *req; + int rc; req = ptlrpc_request_alloc_pack(imp, &RQF_MDS_HSM_CT_REGISTER, LUSTRE_MDS_VERSION, @@ -1604,10 +1604,10 @@ static int mdc_ioc_hsm_ct_register(struct obd_import *imp, u32 archives) static int mdc_ioc_hsm_current_action(struct obd_export *exp, struct md_op_data *op_data) { - struct hsm_current_action *hca = op_data->op_data; - struct hsm_current_action *req_hca; - struct ptlrpc_request *req; - int rc; + struct hsm_current_action *hca = op_data->op_data; + struct hsm_current_action *req_hca; + struct ptlrpc_request *req; + int rc; req = ptlrpc_request_alloc(class_exp2cliimp(exp), &RQF_MDS_HSM_ACTION); @@ -1645,8 +1645,8 @@ static int mdc_ioc_hsm_current_action(struct obd_export *exp, static int mdc_ioc_hsm_ct_unregister(struct obd_import *imp) { - struct ptlrpc_request *req; - int rc; + struct ptlrpc_request *req; + int rc; req = ptlrpc_request_alloc_pack(imp, &RQF_MDS_HSM_CT_UNREGISTER, LUSTRE_MDS_VERSION, @@ -1669,10 +1669,10 @@ static int mdc_ioc_hsm_ct_unregister(struct obd_import *imp) static int mdc_ioc_hsm_state_get(struct obd_export *exp, struct md_op_data *op_data) { - struct hsm_user_state *hus = op_data->op_data; - struct hsm_user_state *req_hus; - struct ptlrpc_request *req; - int rc; + struct hsm_user_state *hus = op_data->op_data; + struct hsm_user_state *req_hus; + struct ptlrpc_request *req; + int rc; req = ptlrpc_request_alloc(class_exp2cliimp(exp), &RQF_MDS_HSM_STATE_GET); @@ -1710,10 +1710,10 @@ static int mdc_ioc_hsm_state_get(struct obd_export *exp, static int mdc_ioc_hsm_state_set(struct obd_export *exp, struct md_op_data *op_data) { - struct hsm_state_set *hss = op_data->op_data; - struct hsm_state_set *req_hss; - struct ptlrpc_request *req; - int rc; + struct hsm_state_set *hss = op_data->op_data; + struct hsm_state_set *req_hss; + struct ptlrpc_request *req; + int rc; req = ptlrpc_request_alloc(class_exp2cliimp(exp), &RQF_MDS_HSM_STATE_SET); @@ -1750,12 +1750,12 @@ static int mdc_ioc_hsm_state_set(struct obd_export *exp, static int mdc_ioc_hsm_request(struct obd_export *exp, struct hsm_user_request *hur) { - struct obd_import *imp = class_exp2cliimp(exp); - struct ptlrpc_request *req; - struct hsm_request *req_hr; - struct hsm_user_item *req_hui; - char *req_opaque; - int rc; + struct obd_import *imp = class_exp2cliimp(exp); + struct ptlrpc_request *req; + struct hsm_request *req_hr; + struct hsm_user_item *req_hui; + char *req_opaque; + int rc; req = ptlrpc_request_alloc(imp, &RQF_MDS_HSM_REQUEST); if (!req) { @@ -1818,9 +1818,9 @@ static int mdc_ioc_hsm_ct_start(struct obd_export *exp, static int mdc_quotactl(struct obd_device *unused, struct obd_export *exp, struct obd_quotactl *oqctl) { - struct ptlrpc_request *req; - struct obd_quotactl *oqc; - int rc; + struct ptlrpc_request *req; + struct obd_quotactl *oqc; + int rc; req = ptlrpc_request_alloc_pack(class_exp2cliimp(exp), &RQF_MDS_QUOTACTL, LUSTRE_MDS_VERSION, @@ -1860,8 +1860,8 @@ static int mdc_ioc_swap_layouts(struct obd_export *exp, struct md_op_data *op_data) { LIST_HEAD(cancels); - struct ptlrpc_request *req; - int rc, count; + struct ptlrpc_request *req; + int rc, count; struct mdc_swap_layouts *msl, *payload; msl = op_data->op_data; @@ -1965,7 +1965,7 @@ static int mdc_iocontrol(unsigned int cmd, struct obd_export *exp, int len, * bz20731, LU-592. */ case IOC_OBD_STATFS: { - struct obd_statfs stat_buf = {0}; + struct obd_statfs stat_buf = { 0 }; if (*((u32 *)data->ioc_inlbuf2) != 0) { rc = -ENODEV; @@ -2044,10 +2044,10 @@ static int mdc_get_info_rpc(struct obd_export *exp, u32 keylen, void *key, int vallen, void *val) { - struct obd_import *imp = class_exp2cliimp(exp); - struct ptlrpc_request *req; - char *tmp; - int rc = -EINVAL; + struct obd_import *imp = class_exp2cliimp(exp); + struct ptlrpc_request *req; + char *tmp; + int rc = -EINVAL; req = ptlrpc_request_alloc(imp, &RQF_MDS_GET_INFO); if (!req) @@ -2104,7 +2104,7 @@ static void lustre_swab_hai(struct hsm_action_item *h) static void lustre_swab_hal(struct hsm_action_list *h) { - struct hsm_action_item *hai; + struct hsm_action_item *hai; u32 i; __swab32s(&h->hal_version); @@ -2127,9 +2127,9 @@ static void lustre_swab_kuch(struct kuc_hdr *l) static int mdc_ioc_hsm_ct_start(struct obd_export *exp, struct lustre_kernelcomm *lk) { - struct obd_import *imp = class_exp2cliimp(exp); - u32 archive = lk->lk_data; - int rc = 0; + struct obd_import *imp = class_exp2cliimp(exp); + u32 archive = lk->lk_data; + int rc = 0; if (lk->lk_group != KUC_GRP_HSM) { CERROR("Bad copytool group %d\n", lk->lk_group); @@ -2156,8 +2156,8 @@ static int mdc_ioc_hsm_ct_start(struct obd_export *exp, */ static int mdc_hsm_copytool_send(size_t len, void *val) { - struct kuc_hdr *lh = (struct kuc_hdr *)val; - struct hsm_action_list *hal = (struct hsm_action_list *)(lh + 1); + struct kuc_hdr *lh = (struct kuc_hdr *)val; + struct hsm_action_list *hal = (struct hsm_action_list *)(lh + 1); if (len < sizeof(*lh) + sizeof(*hal)) { CERROR("Short HSM message %zu < %zu\n", len, @@ -2189,9 +2189,9 @@ static int mdc_hsm_copytool_send(size_t len, void *val) */ static int mdc_hsm_ct_reregister(void *data, void *cb_arg) { - struct kkuc_ct_data *kcd = data; - struct obd_import *imp = (struct obd_import *)cb_arg; - int rc; + struct kkuc_ct_data *kcd = data; + struct obd_import *imp = (struct obd_import *)cb_arg; + int rc; if (!kcd || kcd->kcd_magic != KKUC_CT_DATA_MAGIC) return -EPROTO; @@ -2213,8 +2213,8 @@ static int mdc_set_info_async(const struct lu_env *env, u32 vallen, void *val, struct ptlrpc_request_set *set) { - struct obd_import *imp = class_exp2cliimp(exp); - int rc; + struct obd_import *imp = class_exp2cliimp(exp); + int rc; if (KEY_IS(KEY_READ_ONLY)) { if (vallen != sizeof(int)) @@ -2310,7 +2310,7 @@ static int mdc_fsync(struct obd_export *exp, const struct lu_fid *fid, struct ptlrpc_request **request) { struct ptlrpc_request *req; - int rc; + int rc; *request = NULL; req = ptlrpc_request_alloc(class_exp2cliimp(exp), &RQF_MDS_SYNC); @@ -2437,14 +2437,14 @@ static int mdc_resource_inode_free(struct ldlm_resource *res) } static struct ldlm_valblock_ops inode_lvbo = { - .lvbo_free = mdc_resource_inode_free, + .lvbo_free = mdc_resource_inode_free, }; static int mdc_llog_init(struct obd_device *obd) { - struct obd_llog_group *olg = &obd->obd_olg; - struct llog_ctxt *ctxt; - int rc; + struct obd_llog_group *olg = &obd->obd_olg; + struct llog_ctxt *ctxt; + int rc; rc = llog_setup(NULL, obd, olg, LLOG_CHANGELOG_REPL_CTXT, obd, &llog_client_ops); @@ -2570,25 +2570,25 @@ static int mdc_process_config(struct obd_device *obd, u32 len, void *buf) } static struct obd_ops mdc_obd_ops = { - .owner = THIS_MODULE, - .setup = mdc_setup, - .precleanup = mdc_precleanup, - .cleanup = mdc_cleanup, - .add_conn = client_import_add_conn, - .del_conn = client_import_del_conn, - .connect = client_connect_import, - .disconnect = client_disconnect_export, - .iocontrol = mdc_iocontrol, - .set_info_async = mdc_set_info_async, - .statfs = mdc_statfs, - .fid_init = client_fid_init, - .fid_fini = client_fid_fini, - .fid_alloc = mdc_fid_alloc, - .import_event = mdc_import_event, - .get_info = mdc_get_info, - .process_config = mdc_process_config, - .get_uuid = mdc_get_uuid, - .quotactl = mdc_quotactl, + .owner = THIS_MODULE, + .setup = mdc_setup, + .precleanup = mdc_precleanup, + .cleanup = mdc_cleanup, + .add_conn = client_import_add_conn, + .del_conn = client_import_del_conn, + .connect = client_connect_import, + .disconnect = client_disconnect_export, + .iocontrol = mdc_iocontrol, + .set_info_async = mdc_set_info_async, + .statfs = mdc_statfs, + .fid_init = client_fid_init, + .fid_fini = client_fid_fini, + .fid_alloc = mdc_fid_alloc, + .import_event = mdc_import_event, + .get_info = mdc_get_info, + .process_config = mdc_process_config, + .get_uuid = mdc_get_uuid, + .quotactl = mdc_quotactl, }; static struct md_ops mdc_md_ops = { @@ -2629,7 +2629,7 @@ static int __init mdc_init(void) return rc; return class_register_type(&mdc_obd_ops, &mdc_md_ops, - LUSTRE_MDC_NAME, NULL); + LUSTRE_MDC_NAME, NULL); } static void /*__exit*/ mdc_exit(void) -- 1.8.3.1 From jsimmons at infradead.org Thu Jan 31 17:19:19 2019 From: jsimmons at infradead.org (James Simmons) Date: Thu, 31 Jan 2019 12:19:19 -0500 Subject: [lustre-devel] [PATCH 15/26] mgc: cleanup white spaces In-Reply-To: <1548955170-13456-1-git-send-email-jsimmons@infradead.org> References: <1548955170-13456-1-git-send-email-jsimmons@infradead.org> Message-ID: <1548955170-13456-16-git-send-email-jsimmons@infradead.org> The mgc code is very messy and difficult to read. Remove excess white space and properly align data structures so they are easy on the eyes. Signed-off-by: James Simmons --- drivers/staging/lustre/lustre/mgc/mgc_request.c | 85 +++++++++++++------------ 1 file changed, 43 insertions(+), 42 deletions(-) diff --git a/drivers/staging/lustre/lustre/mgc/mgc_request.c b/drivers/staging/lustre/lustre/mgc/mgc_request.c index dc80081..a4dfdc0 100644 --- a/drivers/staging/lustre/lustre/mgc/mgc_request.c +++ b/drivers/staging/lustre/lustre/mgc/mgc_request.c @@ -193,7 +193,7 @@ struct config_llog_data *do_config_log_add(struct obd_device *obd, struct super_block *sb) { struct config_llog_data *cld; - int rc; + int rc; CDEBUG(D_MGC, "do adding config log %s:%p\n", logname, cfg ? cfg->cfg_instance : NULL); @@ -267,8 +267,8 @@ struct config_llog_data *do_config_log_add(struct obd_device *obd, struct super_block *sb, int type, struct config_llog_instance *cfg) { - struct config_llog_instance lcfg = *cfg; - struct config_llog_data *cld; + struct config_llog_instance lcfg = *cfg; + struct config_llog_data *cld; lcfg.cfg_instance = sb ? (void *)sb : (void *)obd; @@ -296,9 +296,9 @@ struct config_llog_data *do_config_log_add(struct obd_device *obd, struct config_llog_data *sptlrpc_cld = NULL; struct config_llog_data *params_cld = NULL; struct config_llog_data *recover_cld = NULL; - char seclogname[32]; - char *ptr; - int rc; + char seclogname[32]; + char *ptr; + int rc; CDEBUG(D_MGC, "adding config log %s:%p\n", logname, cfg->cfg_instance); @@ -459,8 +459,8 @@ static int config_log_end(char *logname, struct config_llog_instance *cfg) int lprocfs_mgc_rd_ir_state(struct seq_file *m, void *data) { - struct obd_device *obd = data; - struct obd_import *imp; + struct obd_device *obd = data; + struct obd_import *imp; struct obd_connect_data *ocd; struct config_llog_data *cld; int rc; @@ -491,13 +491,14 @@ int lprocfs_mgc_rd_ir_state(struct seq_file *m, void *data) } /* reenqueue any lost locks */ -#define RQ_RUNNING 0x1 -#define RQ_NOW 0x2 -#define RQ_LATER 0x4 -#define RQ_STOP 0x8 -#define RQ_PRECLEANUP 0x10 +#define RQ_RUNNING 0x01 +#define RQ_NOW 0x02 +#define RQ_LATER 0x04 +#define RQ_STOP 0x08 +#define RQ_PRECLEANUP 0x10 + static int rq_state; -static wait_queue_head_t rq_waitq; +static wait_queue_head_t rq_waitq; static DECLARE_COMPLETION(rq_exit); static DECLARE_COMPLETION(rq_start); @@ -620,7 +621,7 @@ static int mgc_requeue_thread(void *data) return 0; } -/* Add a cld to the list to requeue. Start the requeue thread if needed. +/* Add a cld to the list to requeue. Start the requeue thread if needed. * We are responsible for dropping the config log reference from here on out. */ static void mgc_requeue_add(struct config_llog_data *cld) @@ -647,8 +648,8 @@ static void mgc_requeue_add(struct config_llog_data *cld) static int mgc_llog_init(const struct lu_env *env, struct obd_device *obd) { - struct llog_ctxt *ctxt; - int rc; + struct llog_ctxt *ctxt; + int rc; /* setup only remote ctxt, the local disk context is switched per each * filesystem during mgc_fs_setup() @@ -941,9 +942,9 @@ static void mgc_notify_active(struct obd_device *unused) static int mgc_target_register(struct obd_export *exp, struct mgs_target_info *mti) { - struct ptlrpc_request *req; + struct ptlrpc_request *req; struct mgs_target_info *req_mti, *rep_mti; - int rc; + int rc; req = ptlrpc_request_alloc_pack(class_exp2cliimp(exp), &RQF_MGS_TARGET_REG, LUSTRE_MGS_VERSION, @@ -1009,8 +1010,8 @@ static int mgc_set_info_async(const struct lu_env *env, struct obd_export *exp, return rc; } if (KEY_IS(KEY_MGSSEC)) { - struct client_obd *cli = &exp->exp_obd->u.cli; - struct sptlrpc_flavor flvr; + struct client_obd *cli = &exp->exp_obd->u.cli; + struct sptlrpc_flavor flvr; /* * empty string means using current flavor, if which haven't @@ -1040,7 +1041,7 @@ static int mgc_set_info_async(const struct lu_env *env, struct obd_export *exp, cli->cl_flvr_mgc = flvr; } else if (memcmp(&cli->cl_flvr_mgc, &flvr, sizeof(flvr)) != 0) { - char str[20]; + char str[20]; sptlrpc_flavor2name(&cli->cl_flvr_mgc, str, sizeof(str)); @@ -1125,15 +1126,15 @@ static int mgc_apply_recover_logs(struct obd_device *mgc, { struct config_llog_instance *cfg = &cld->cld_cfg; struct mgs_nidtbl_entry *entry; - struct lustre_cfg *lcfg; - struct lustre_cfg_bufs bufs; - u64 prev_version = 0; + struct lustre_cfg *lcfg; + struct lustre_cfg_bufs bufs; + u64 prev_version = 0; char *inst; char *buf; - int bufsz; - int pos; - int rc = 0; - int off = 0; + int bufsz; + int pos; + int rc = 0; + int off = 0; LASSERT(cfg->cfg_instance); LASSERT(cfg->cfg_sb == cfg->cfg_instance); @@ -1149,11 +1150,11 @@ static int mgc_apply_recover_logs(struct obd_device *mgc, } ++pos; - buf = inst + pos; + buf = inst + pos; bufsz = PAGE_SIZE - pos; while (datalen > 0) { - int entry_len = sizeof(*entry); + int entry_len = sizeof(*entry); int is_ost, i; struct obd_device *obd; char *obdname; @@ -1191,7 +1192,7 @@ static int mgc_apply_recover_logs(struct obd_device *mgc, if (entry->mne_length < entry_len) break; - off += entry->mne_length; + off += entry->mne_length; datalen -= entry->mne_length; if (datalen < 0) break; @@ -1323,7 +1324,7 @@ static int mgc_process_recover_log(struct obd_device *obd, struct ptlrpc_request *req = NULL; struct config_llog_instance *cfg = &cld->cld_cfg; struct mgs_config_body *body; - struct mgs_config_res *res; + struct mgs_config_res *res; struct ptlrpc_bulk_desc *desc; struct page **pages; int nrpages; @@ -1380,9 +1381,9 @@ static int mgc_process_recover_log(struct obd_device *obd, goto out; } body->mcb_offset = cfg->cfg_last_idx + 1; - body->mcb_type = cld->cld_type; - body->mcb_bits = PAGE_SHIFT; - body->mcb_units = nrpages; + body->mcb_type = cld->cld_type; + body->mcb_bits = PAGE_SHIFT; + body->mcb_units = nrpages; /* allocate bulk transfer descriptor */ desc = ptlrpc_prep_bulk_imp(req, nrpages, 1, @@ -1483,11 +1484,11 @@ static int mgc_process_recover_log(struct obd_device *obd, static int mgc_process_cfg_log(struct obd_device *mgc, struct config_llog_data *cld, int local_only) { - struct llog_ctxt *ctxt; - struct lustre_sb_info *lsi = NULL; - int rc = 0; - bool sptlrpc_started = false; - struct lu_env *env; + struct llog_ctxt *ctxt; + struct lustre_sb_info *lsi = NULL; + int rc = 0; + bool sptlrpc_started = false; + struct lu_env *env; LASSERT(cld); LASSERT(mutex_is_locked(&cld->cld_lock)); @@ -1570,7 +1571,7 @@ static bool mgc_import_in_recovery(struct obd_import *imp) * Get a configuration log from the MGS and process it. * * This function is called for both clients and servers to process the - * configuration log from the MGS. The MGC enqueues a DLM lock on the + * configuration log from the MGS. The MGC enqueues a DLM lock on the * log from the MGS, and if the lock gets revoked the MGC will be notified * by the lock cancellation callback that the config log has changed, * and will enqueue another MGS lock on it, and then continue processing -- 1.8.3.1 From jsimmons at infradead.org Thu Jan 31 17:19:23 2019 From: jsimmons at infradead.org (James Simmons) Date: Thu, 31 Jan 2019 12:19:23 -0500 Subject: [lustre-devel] [PATCH 19/26] ptlrpc: cleanup white spaces In-Reply-To: <1548955170-13456-1-git-send-email-jsimmons@infradead.org> References: <1548955170-13456-1-git-send-email-jsimmons@infradead.org> Message-ID: <1548955170-13456-20-git-send-email-jsimmons@infradead.org> The ptlrpc code is very messy and difficult to read. Remove excess white space and properly align data structures so they are easy on the eyes. Signed-off-by: James Simmons --- drivers/staging/lustre/lustre/ptlrpc/client.c | 45 ++-- drivers/staging/lustre/lustre/ptlrpc/import.c | 2 +- drivers/staging/lustre/lustre/ptlrpc/layout.c | 3 - .../staging/lustre/lustre/ptlrpc/lproc_ptlrpc.c | 278 ++++++++++----------- drivers/staging/lustre/lustre/ptlrpc/niobuf.c | 7 +- drivers/staging/lustre/lustre/ptlrpc/nrs.c | 1 - .../staging/lustre/lustre/ptlrpc/ptlrpc_internal.h | 14 +- drivers/staging/lustre/lustre/ptlrpc/ptlrpcd.c | 20 +- drivers/staging/lustre/lustre/ptlrpc/recover.c | 1 + drivers/staging/lustre/lustre/ptlrpc/sec.c | 4 +- drivers/staging/lustre/lustre/ptlrpc/sec_bulk.c | 74 +++--- drivers/staging/lustre/lustre/ptlrpc/sec_config.c | 22 +- drivers/staging/lustre/lustre/ptlrpc/sec_null.c | 34 +-- drivers/staging/lustre/lustre/ptlrpc/sec_plain.c | 68 ++--- drivers/staging/lustre/lustre/ptlrpc/service.c | 20 +- 15 files changed, 293 insertions(+), 300 deletions(-) diff --git a/drivers/staging/lustre/lustre/ptlrpc/client.c b/drivers/staging/lustre/lustre/ptlrpc/client.c index f4b3875..0831810 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/client.c +++ b/drivers/staging/lustre/lustre/ptlrpc/client.c @@ -49,14 +49,14 @@ #include "ptlrpc_internal.h" const struct ptlrpc_bulk_frag_ops ptlrpc_bulk_kiov_pin_ops = { - .add_kiov_frag = ptlrpc_prep_bulk_page_pin, - .release_frags = ptlrpc_release_bulk_page_pin, + .add_kiov_frag = ptlrpc_prep_bulk_page_pin, + .release_frags = ptlrpc_release_bulk_page_pin, }; EXPORT_SYMBOL(ptlrpc_bulk_kiov_pin_ops); const struct ptlrpc_bulk_frag_ops ptlrpc_bulk_kiov_nopin_ops = { - .add_kiov_frag = ptlrpc_prep_bulk_page_nopin, - .release_frags = NULL, + .add_kiov_frag = ptlrpc_prep_bulk_page_nopin, + .release_frags = NULL, }; EXPORT_SYMBOL(ptlrpc_bulk_kiov_nopin_ops); @@ -658,15 +658,14 @@ static void __ptlrpc_free_req_to_pool(struct ptlrpc_request *request) void ptlrpc_add_unreplied(struct ptlrpc_request *req) { - struct obd_import *imp = req->rq_import; - struct ptlrpc_request *iter; + struct obd_import *imp = req->rq_import; + struct ptlrpc_request *iter; assert_spin_locked(&imp->imp_lock); LASSERT(list_empty(&req->rq_unreplied_list)); /* unreplied list is sorted by xid in ascending order */ list_for_each_entry_reverse(iter, &imp->imp_unreplied_list, rq_unreplied_list) { - LASSERT(req->rq_xid != iter->rq_xid); if (req->rq_xid < iter->rq_xid) continue; @@ -1318,10 +1317,10 @@ static int after_reply(struct ptlrpc_request *req) * reply). NB: no need to round up because alloc_repbuf will * round it up */ - req->rq_replen = req->rq_nob_received; + req->rq_replen = req->rq_nob_received; req->rq_nob_received = 0; spin_lock(&req->rq_lock); - req->rq_resend = 1; + req->rq_resend = 1; spin_unlock(&req->rq_lock); return 0; } @@ -1359,7 +1358,7 @@ static int after_reply(struct ptlrpc_request *req) spin_unlock(&req->rq_lock); req->rq_nr_resend++; - /* Readjust the timeout for current conditions */ + /* Read just the timeout for current conditions */ ptlrpc_at_set_req_timeout(req); /* * delay resend to give a chance to the server to get ready. @@ -1620,7 +1619,7 @@ static inline int ptlrpc_set_producer(struct ptlrpc_request_set *set) rc = set->set_producer(set, set->set_producer_arg); if (rc == -ENOENT) { /* no more RPC to produce */ - set->set_producer = NULL; + set->set_producer = NULL; set->set_producer_arg = NULL; return 0; } @@ -1654,7 +1653,7 @@ int ptlrpc_check_set(const struct lu_env *env, struct ptlrpc_request_set *set) /* * This schedule point is mainly for the ptlrpcd caller of this - * function. Most ptlrpc sets are not long-lived and unbounded + * function. Most ptlrpc sets are not long-lived and unbounded * in length, but at the least the set used by the ptlrpcd is. * Since the processing time is unbounded, we need to insert an * explicit schedule point to make the thread well-behaved. @@ -2130,7 +2129,6 @@ void ptlrpc_expired_set(struct ptlrpc_request_set *set) /* A timeout expired. See which reqs it applies to... */ list_for_each_entry(req, &set->set_requests, rq_set_chain) { - /* don't expire request waiting for context */ if (req->rq_wait_ctx) continue; @@ -2185,7 +2183,6 @@ int ptlrpc_set_next_timeout(struct ptlrpc_request_set *set) time64_t deadline; list_for_each_entry(req, &set->set_requests, rq_set_chain) { - /* Request in-flight? */ if (!(((req->rq_phase == RQ_PHASE_RPC) && !req->rq_waiting) || (req->rq_phase == RQ_PHASE_BULK) || @@ -2568,7 +2565,7 @@ static void ptlrpc_free_request(struct ptlrpc_request *req) */ void ptlrpc_request_committed(struct ptlrpc_request *req, int force) { - struct obd_import *imp = req->rq_import; + struct obd_import *imp = req->rq_import; spin_lock(&imp->imp_lock); if (list_empty(&req->rq_replay_list)) { @@ -2896,7 +2893,7 @@ static int ptlrpc_replay_interpret(const struct lu_env *env, /* continue with recovery */ rc = ptlrpc_import_recovery_state_machine(imp); - out: +out: req->rq_send_state = aa->praa_old_state; if (rc != 0) @@ -3031,7 +3028,7 @@ void ptlrpc_abort_set(struct ptlrpc_request_set *set) /** * Initialize the XID for the node. This is common among all requests on * this node, and only requires the property that it is monotonically - * increasing. It does not need to be sequential. Since this is also used + * increasing. It does not need to be sequential. Since this is also used * as the RDMA match bits, it is important that a single client NOT have * the same match bits for two different in-flight requests, hence we do * NOT want to have an XID per target or similar. @@ -3198,12 +3195,12 @@ struct ptlrpc_work_async_args { static void ptlrpcd_add_work_req(struct ptlrpc_request *req) { /* re-initialize the req */ - req->rq_timeout = obd_timeout; - req->rq_sent = ktime_get_real_seconds(); - req->rq_deadline = req->rq_sent + req->rq_timeout; - req->rq_phase = RQ_PHASE_INTERPRET; - req->rq_next_phase = RQ_PHASE_COMPLETE; - req->rq_xid = ptlrpc_next_xid(); + req->rq_timeout = obd_timeout; + req->rq_sent = ktime_get_real_seconds(); + req->rq_deadline = req->rq_sent + req->rq_timeout; + req->rq_phase = RQ_PHASE_INTERPRET; + req->rq_next_phase = RQ_PHASE_COMPLETE; + req->rq_xid = ptlrpc_next_xid(); req->rq_import_generation = req->rq_import->imp_generation; ptlrpcd_add_req(req); @@ -3241,7 +3238,7 @@ static int ptlrpcd_check_work(struct ptlrpc_request *req) void *ptlrpcd_alloc_work(struct obd_import *imp, int (*cb)(const struct lu_env *, void *), void *cbdata) { - struct ptlrpc_request *req = NULL; + struct ptlrpc_request *req = NULL; struct ptlrpc_work_async_args *args; might_sleep(); diff --git a/drivers/staging/lustre/lustre/ptlrpc/import.c b/drivers/staging/lustre/lustre/ptlrpc/import.c index 56a0b76..7bb2e06 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/import.c +++ b/drivers/staging/lustre/lustre/ptlrpc/import.c @@ -51,7 +51,7 @@ #include "ptlrpc_internal.h" struct ptlrpc_connect_async_args { - u64 pcaa_peer_committed; + u64 pcaa_peer_committed; int pcaa_initial_connect; }; diff --git a/drivers/staging/lustre/lustre/ptlrpc/layout.c b/drivers/staging/lustre/lustre/ptlrpc/layout.c index 2848f2f..f1f7d70 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/layout.c +++ b/drivers/staging/lustre/lustre/ptlrpc/layout.c @@ -1907,9 +1907,7 @@ static void *__req_capsule_get(struct req_capsule *pill, void *value; u32 len; u32 offset; - void *(*getter)(struct lustre_msg *m, u32 n, u32 minlen); - static const char *rcl_names[RCL_NR] = { [RCL_CLIENT] = "client", [RCL_SERVER] = "server" @@ -2176,7 +2174,6 @@ void req_capsule_extend(struct req_capsule *pill, const struct req_format *fmt) { int i; size_t j; - const struct req_format *old; LASSERT(pill->rc_fmt); diff --git a/drivers/staging/lustre/lustre/ptlrpc/lproc_ptlrpc.c b/drivers/staging/lustre/lustre/ptlrpc/lproc_ptlrpc.c index 92e3e0f..25858b8 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/lproc_ptlrpc.c +++ b/drivers/staging/lustre/lustre/ptlrpc/lproc_ptlrpc.c @@ -42,115 +42,115 @@ #include "ptlrpc_internal.h" static struct ll_rpc_opcode { - u32 opcode; - const char *opname; + u32 opcode; + const char *opname; } ll_rpc_opcode_table[LUSTRE_MAX_OPCODES] = { - { OST_REPLY, "ost_reply" }, - { OST_GETATTR, "ost_getattr" }, - { OST_SETATTR, "ost_setattr" }, - { OST_READ, "ost_read" }, - { OST_WRITE, "ost_write" }, - { OST_CREATE, "ost_create" }, - { OST_DESTROY, "ost_destroy" }, - { OST_GET_INFO, "ost_get_info" }, - { OST_CONNECT, "ost_connect" }, - { OST_DISCONNECT, "ost_disconnect" }, - { OST_PUNCH, "ost_punch" }, - { OST_OPEN, "ost_open" }, - { OST_CLOSE, "ost_close" }, - { OST_STATFS, "ost_statfs" }, - { 14, NULL }, /* formerly OST_SAN_READ */ - { 15, NULL }, /* formerly OST_SAN_WRITE */ - { OST_SYNC, "ost_sync" }, - { OST_SET_INFO, "ost_set_info" }, - { OST_QUOTACHECK, "ost_quotacheck" }, - { OST_QUOTACTL, "ost_quotactl" }, - { OST_QUOTA_ADJUST_QUNIT, "ost_quota_adjust_qunit" }, - { OST_LADVISE, "ost_ladvise" }, - { MDS_GETATTR, "mds_getattr" }, - { MDS_GETATTR_NAME, "mds_getattr_lock" }, - { MDS_CLOSE, "mds_close" }, - { MDS_REINT, "mds_reint" }, - { MDS_READPAGE, "mds_readpage" }, - { MDS_CONNECT, "mds_connect" }, - { MDS_DISCONNECT, "mds_disconnect" }, - { MDS_GET_ROOT, "mds_get_root" }, - { MDS_STATFS, "mds_statfs" }, - { MDS_PIN, "mds_pin" }, - { MDS_UNPIN, "mds_unpin" }, - { MDS_SYNC, "mds_sync" }, - { MDS_DONE_WRITING, "mds_done_writing" }, - { MDS_SET_INFO, "mds_set_info" }, - { MDS_QUOTACHECK, "mds_quotacheck" }, - { MDS_QUOTACTL, "mds_quotactl" }, - { MDS_GETXATTR, "mds_getxattr" }, - { MDS_SETXATTR, "mds_setxattr" }, - { MDS_WRITEPAGE, "mds_writepage" }, - { MDS_IS_SUBDIR, "mds_is_subdir" }, - { MDS_GET_INFO, "mds_get_info" }, - { MDS_HSM_STATE_GET, "mds_hsm_state_get" }, - { MDS_HSM_STATE_SET, "mds_hsm_state_set" }, - { MDS_HSM_ACTION, "mds_hsm_action" }, - { MDS_HSM_PROGRESS, "mds_hsm_progress" }, - { MDS_HSM_REQUEST, "mds_hsm_request" }, - { MDS_HSM_CT_REGISTER, "mds_hsm_ct_register" }, - { MDS_HSM_CT_UNREGISTER, "mds_hsm_ct_unregister" }, - { MDS_SWAP_LAYOUTS, "mds_swap_layouts" }, - { LDLM_ENQUEUE, "ldlm_enqueue" }, - { LDLM_CONVERT, "ldlm_convert" }, - { LDLM_CANCEL, "ldlm_cancel" }, - { LDLM_BL_CALLBACK, "ldlm_bl_callback" }, - { LDLM_CP_CALLBACK, "ldlm_cp_callback" }, - { LDLM_GL_CALLBACK, "ldlm_gl_callback" }, - { LDLM_SET_INFO, "ldlm_set_info" }, - { MGS_CONNECT, "mgs_connect" }, - { MGS_DISCONNECT, "mgs_disconnect" }, - { MGS_EXCEPTION, "mgs_exception" }, - { MGS_TARGET_REG, "mgs_target_reg" }, - { MGS_TARGET_DEL, "mgs_target_del" }, - { MGS_SET_INFO, "mgs_set_info" }, - { MGS_CONFIG_READ, "mgs_config_read" }, - { OBD_PING, "obd_ping" }, - { OBD_LOG_CANCEL, "llog_cancel" }, - { OBD_QC_CALLBACK, "obd_quota_callback" }, - { OBD_IDX_READ, "dt_index_read" }, - { LLOG_ORIGIN_HANDLE_CREATE, "llog_origin_handle_open" }, - { LLOG_ORIGIN_HANDLE_NEXT_BLOCK, "llog_origin_handle_next_block" }, - { LLOG_ORIGIN_HANDLE_READ_HEADER, "llog_origin_handle_read_header" }, - { LLOG_ORIGIN_HANDLE_WRITE_REC, "llog_origin_handle_write_rec" }, - { LLOG_ORIGIN_HANDLE_CLOSE, "llog_origin_handle_close" }, - { LLOG_ORIGIN_CONNECT, "llog_origin_connect" }, - { LLOG_CATINFO, "llog_catinfo" }, - { LLOG_ORIGIN_HANDLE_PREV_BLOCK, "llog_origin_handle_prev_block" }, - { LLOG_ORIGIN_HANDLE_DESTROY, "llog_origin_handle_destroy" }, - { QUOTA_DQACQ, "quota_acquire" }, - { QUOTA_DQREL, "quota_release" }, - { SEQ_QUERY, "seq_query" }, - { SEC_CTX_INIT, "sec_ctx_init" }, - { SEC_CTX_INIT_CONT, "sec_ctx_init_cont" }, - { SEC_CTX_FINI, "sec_ctx_fini" }, - { FLD_QUERY, "fld_query" }, - { FLD_READ, "fld_read" }, + { OST_REPLY, "ost_reply" }, + { OST_GETATTR, "ost_getattr" }, + { OST_SETATTR, "ost_setattr" }, + { OST_READ, "ost_read" }, + { OST_WRITE, "ost_write" }, + { OST_CREATE, "ost_create" }, + { OST_DESTROY, "ost_destroy" }, + { OST_GET_INFO, "ost_get_info" }, + { OST_CONNECT, "ost_connect" }, + { OST_DISCONNECT, "ost_disconnect" }, + { OST_PUNCH, "ost_punch" }, + { OST_OPEN, "ost_open" }, + { OST_CLOSE, "ost_close" }, + { OST_STATFS, "ost_statfs" }, + { 14, NULL }, /* formerly OST_SAN_READ */ + { 15, NULL }, /* formerly OST_SAN_WRITE */ + { OST_SYNC, "ost_sync" }, + { OST_SET_INFO, "ost_set_info" }, + { OST_QUOTACHECK, "ost_quotacheck" }, + { OST_QUOTACTL, "ost_quotactl" }, + { OST_QUOTA_ADJUST_QUNIT, "ost_quota_adjust_qunit" }, + { OST_LADVISE, "ost_ladvise" }, + { MDS_GETATTR, "mds_getattr" }, + { MDS_GETATTR_NAME, "mds_getattr_lock" }, + { MDS_CLOSE, "mds_close" }, + { MDS_REINT, "mds_reint" }, + { MDS_READPAGE, "mds_readpage" }, + { MDS_CONNECT, "mds_connect" }, + { MDS_DISCONNECT, "mds_disconnect" }, + { MDS_GET_ROOT, "mds_get_root" }, + { MDS_STATFS, "mds_statfs" }, + { MDS_PIN, "mds_pin" }, + { MDS_UNPIN, "mds_unpin" }, + { MDS_SYNC, "mds_sync" }, + { MDS_DONE_WRITING, "mds_done_writing" }, + { MDS_SET_INFO, "mds_set_info" }, + { MDS_QUOTACHECK, "mds_quotacheck" }, + { MDS_QUOTACTL, "mds_quotactl" }, + { MDS_GETXATTR, "mds_getxattr" }, + { MDS_SETXATTR, "mds_setxattr" }, + { MDS_WRITEPAGE, "mds_writepage" }, + { MDS_IS_SUBDIR, "mds_is_subdir" }, + { MDS_GET_INFO, "mds_get_info" }, + { MDS_HSM_STATE_GET, "mds_hsm_state_get" }, + { MDS_HSM_STATE_SET, "mds_hsm_state_set" }, + { MDS_HSM_ACTION, "mds_hsm_action" }, + { MDS_HSM_PROGRESS, "mds_hsm_progress" }, + { MDS_HSM_REQUEST, "mds_hsm_request" }, + { MDS_HSM_CT_REGISTER, "mds_hsm_ct_register" }, + { MDS_HSM_CT_UNREGISTER, "mds_hsm_ct_unregister" }, + { MDS_SWAP_LAYOUTS, "mds_swap_layouts" }, + { LDLM_ENQUEUE, "ldlm_enqueue" }, + { LDLM_CONVERT, "ldlm_convert" }, + { LDLM_CANCEL, "ldlm_cancel" }, + { LDLM_BL_CALLBACK, "ldlm_bl_callback" }, + { LDLM_CP_CALLBACK, "ldlm_cp_callback" }, + { LDLM_GL_CALLBACK, "ldlm_gl_callback" }, + { LDLM_SET_INFO, "ldlm_set_info" }, + { MGS_CONNECT, "mgs_connect" }, + { MGS_DISCONNECT, "mgs_disconnect" }, + { MGS_EXCEPTION, "mgs_exception" }, + { MGS_TARGET_REG, "mgs_target_reg" }, + { MGS_TARGET_DEL, "mgs_target_del" }, + { MGS_SET_INFO, "mgs_set_info" }, + { MGS_CONFIG_READ, "mgs_config_read" }, + { OBD_PING, "obd_ping" }, + { OBD_LOG_CANCEL, "llog_cancel" }, + { OBD_QC_CALLBACK, "obd_quota_callback" }, + { OBD_IDX_READ, "dt_index_read" }, + { LLOG_ORIGIN_HANDLE_CREATE, "llog_origin_handle_open" }, + { LLOG_ORIGIN_HANDLE_NEXT_BLOCK, "llog_origin_handle_next_block" }, + { LLOG_ORIGIN_HANDLE_READ_HEADER, "llog_origin_handle_read_header" }, + { LLOG_ORIGIN_HANDLE_WRITE_REC, "llog_origin_handle_write_rec" }, + { LLOG_ORIGIN_HANDLE_CLOSE, "llog_origin_handle_close" }, + { LLOG_ORIGIN_CONNECT, "llog_origin_connect" }, + { LLOG_CATINFO, "llog_catinfo" }, + { LLOG_ORIGIN_HANDLE_PREV_BLOCK, "llog_origin_handle_prev_block" }, + { LLOG_ORIGIN_HANDLE_DESTROY, "llog_origin_handle_destroy" }, + { QUOTA_DQACQ, "quota_acquire" }, + { QUOTA_DQREL, "quota_release" }, + { SEQ_QUERY, "seq_query" }, + { SEC_CTX_INIT, "sec_ctx_init" }, + { SEC_CTX_INIT_CONT, "sec_ctx_init_cont" }, + { SEC_CTX_FINI, "sec_ctx_fini" }, + { FLD_QUERY, "fld_query" }, + { FLD_READ, "fld_read" }, }; static struct ll_eopcode { - u32 opcode; - const char *opname; + u32 opcode; + const char *opname; } ll_eopcode_table[EXTRA_LAST_OPC] = { - { LDLM_GLIMPSE_ENQUEUE, "ldlm_glimpse_enqueue" }, - { LDLM_PLAIN_ENQUEUE, "ldlm_plain_enqueue" }, - { LDLM_EXTENT_ENQUEUE, "ldlm_extent_enqueue" }, - { LDLM_FLOCK_ENQUEUE, "ldlm_flock_enqueue" }, - { LDLM_IBITS_ENQUEUE, "ldlm_ibits_enqueue" }, - { MDS_REINT_SETATTR, "mds_reint_setattr" }, - { MDS_REINT_CREATE, "mds_reint_create" }, - { MDS_REINT_LINK, "mds_reint_link" }, - { MDS_REINT_UNLINK, "mds_reint_unlink" }, - { MDS_REINT_RENAME, "mds_reint_rename" }, - { MDS_REINT_OPEN, "mds_reint_open" }, - { MDS_REINT_SETXATTR, "mds_reint_setxattr" }, - { BRW_READ_BYTES, "read_bytes" }, - { BRW_WRITE_BYTES, "write_bytes" }, + { LDLM_GLIMPSE_ENQUEUE, "ldlm_glimpse_enqueue" }, + { LDLM_PLAIN_ENQUEUE, "ldlm_plain_enqueue" }, + { LDLM_EXTENT_ENQUEUE, "ldlm_extent_enqueue" }, + { LDLM_FLOCK_ENQUEUE, "ldlm_flock_enqueue" }, + { LDLM_IBITS_ENQUEUE, "ldlm_ibits_enqueue" }, + { MDS_REINT_SETATTR, "mds_reint_setattr" }, + { MDS_REINT_CREATE, "mds_reint_create" }, + { MDS_REINT_LINK, "mds_reint_link" }, + { MDS_REINT_UNLINK, "mds_reint_unlink" }, + { MDS_REINT_RENAME, "mds_reint_rename" }, + { MDS_REINT_OPEN, "mds_reint_open" }, + { MDS_REINT_SETXATTR, "mds_reint_setxattr" }, + { BRW_READ_BYTES, "read_bytes" }, + { BRW_WRITE_BYTES, "write_bytes" }, }; const char *ll_opcode2str(u32 opcode) @@ -450,13 +450,13 @@ static void nrs_policy_get_info_locked(struct ptlrpc_nrs_policy *policy, memcpy(info->pi_name, policy->pol_desc->pd_name, NRS_POL_NAME_MAX); - info->pi_fallback = !!(policy->pol_flags & PTLRPC_NRS_FL_FALLBACK); - info->pi_state = policy->pol_state; + info->pi_fallback = !!(policy->pol_flags & PTLRPC_NRS_FL_FALLBACK); + info->pi_state = policy->pol_state; /** * XXX: These are accessed without holding * ptlrpc_service_part::scp_req_lock. */ - info->pi_req_queued = policy->pol_req_queued; + info->pi_req_queued = policy->pol_req_queued; info->pi_req_started = policy->pol_req_started; } @@ -788,18 +788,18 @@ struct ptlrpc_srh_iterator { /* convert position to sequence */ #define PTLRPC_REQ_POS2SEQ(svc, pos) \ ((svc)->srv_cpt_bits == 0 ? (pos) : \ - ((u64)(pos) << (svc)->srv_cpt_bits) | \ + ((u64)(pos) << (svc)->srv_cpt_bits) | \ ((u64)(pos) >> (64 - (svc)->srv_cpt_bits))) static void * ptlrpc_lprocfs_svc_req_history_start(struct seq_file *s, loff_t *pos) { - struct ptlrpc_service *svc = s->private; - struct ptlrpc_service_part *svcpt; - struct ptlrpc_srh_iterator *srhi; - unsigned int cpt; - int rc; - int i; + struct ptlrpc_service *svc = s->private; + struct ptlrpc_service_part *svcpt; + struct ptlrpc_srh_iterator *srhi; + unsigned int cpt; + int rc; + int i; if (sizeof(loff_t) != sizeof(u64)) { /* can't support */ CWARN("Failed to read request history because size of loff_t %d can't match size of u64\n", @@ -940,10 +940,10 @@ static int ptlrpc_lprocfs_svc_req_history_show(struct seq_file *s, void *iter) ptlrpc_lprocfs_svc_req_history_open(struct inode *inode, struct file *file) { static const struct seq_operations sops = { - .start = ptlrpc_lprocfs_svc_req_history_start, - .stop = ptlrpc_lprocfs_svc_req_history_stop, - .next = ptlrpc_lprocfs_svc_req_history_next, - .show = ptlrpc_lprocfs_svc_req_history_show, + .start = ptlrpc_lprocfs_svc_req_history_start, + .stop = ptlrpc_lprocfs_svc_req_history_stop, + .next = ptlrpc_lprocfs_svc_req_history_next, + .show = ptlrpc_lprocfs_svc_req_history_show, }; struct seq_file *seqf; int rc; @@ -975,9 +975,9 @@ static int ptlrpc_lprocfs_timeouts_seq_show(struct seq_file *m, void *n) } ptlrpc_service_for_each_part(svcpt, i, svc) { - cur = at_get(&svcpt->scp_at_estimate); - worst = svcpt->scp_at_estimate.at_worst_ever; - worstt = svcpt->scp_at_estimate.at_worst_time; + cur = at_get(&svcpt->scp_at_estimate); + worst = svcpt->scp_at_estimate.at_worst_ever; + worstt = svcpt->scp_at_estimate.at_worst_time; s2dhms(&ts, ktime_get_real_seconds() - worstt); seq_printf(m, "%10s : cur %3u worst %3u (at %lld, " @@ -1074,26 +1074,26 @@ void ptlrpc_ldebugfs_register_service(struct dentry *entry, struct ptlrpc_service *svc) { struct lprocfs_vars lproc_vars[] = { - {.name = "req_buffer_history_len", - .fops = &ptlrpc_lprocfs_req_history_len_fops, - .data = svc}, - {.name = "req_buffer_history_max", - .fops = &ptlrpc_lprocfs_req_history_max_fops, - .data = svc}, - {.name = "timeouts", - .fops = &ptlrpc_lprocfs_timeouts_fops, - .data = svc}, - {.name = "nrs_policies", - .fops = &ptlrpc_lprocfs_nrs_fops, - .data = svc}, - {NULL} + { .name = "req_buffer_history_len", + .fops = &ptlrpc_lprocfs_req_history_len_fops, + .data = svc }, + { .name = "req_buffer_history_max", + .fops = &ptlrpc_lprocfs_req_history_max_fops, + .data = svc }, + { .name = "timeouts", + .fops = &ptlrpc_lprocfs_timeouts_fops, + .data = svc }, + { .name = "nrs_policies", + .fops = &ptlrpc_lprocfs_nrs_fops, + .data = svc }, + { NULL } }; static const struct file_operations req_history_fops = { - .owner = THIS_MODULE, - .open = ptlrpc_lprocfs_svc_req_history_open, - .read = seq_read, - .llseek = seq_lseek, - .release = lprocfs_seq_release, + .owner = THIS_MODULE, + .open = ptlrpc_lprocfs_svc_req_history_open, + .read = seq_read, + .llseek = seq_lseek, + .release = lprocfs_seq_release, }; ptlrpc_ldebugfs_register(entry, svc->srv_name, diff --git a/drivers/staging/lustre/lustre/ptlrpc/niobuf.c b/drivers/staging/lustre/lustre/ptlrpc/niobuf.c index d3044a7..ea7a7f9 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/niobuf.c +++ b/drivers/staging/lustre/lustre/ptlrpc/niobuf.c @@ -280,6 +280,7 @@ int ptlrpc_unregister_bulk(struct ptlrpc_request *req, int async) * timeout lets us CWARN for visibility of sluggish LNDs */ int cnt = 0; + while (cnt < LONG_UNLINK && (rc = wait_event_idle_timeout(*wq, !ptlrpc_client_bulk_active(req), @@ -685,7 +686,7 @@ int ptl_send_rpc(struct ptlrpc_request *request, int noreply) * add the network latency for our local timeout. */ request->rq_deadline = request->rq_sent + request->rq_timeout + - ptlrpc_at_get_net_latency(request); + ptlrpc_at_get_net_latency(request); ptlrpc_pinger_sending_on_import(imp); @@ -705,7 +706,7 @@ int ptl_send_rpc(struct ptlrpc_request *request, int noreply) if (noreply) goto out; - cleanup_me: +cleanup_me: /* MEUnlink is safe; the PUT didn't even get off the ground, and * nobody apart from the PUT's target has the right nid+XID to * access the reply buffer. @@ -715,7 +716,7 @@ int ptl_send_rpc(struct ptlrpc_request *request, int noreply) /* UNLINKED callback called synchronously */ LASSERT(!request->rq_receiving_reply); - cleanup_bulk: +cleanup_bulk: /* We do sync unlink here as there was no real transfer here so * the chance to have long unlink to sluggish net is smaller here. */ diff --git a/drivers/staging/lustre/lustre/ptlrpc/nrs.c b/drivers/staging/lustre/lustre/ptlrpc/nrs.c index 248ba04..ef7dd5d 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/nrs.c +++ b/drivers/staging/lustre/lustre/ptlrpc/nrs.c @@ -118,7 +118,6 @@ static int nrs_policy_stop_locked(struct ptlrpc_nrs_policy *policy) /* Immediately make it invisible */ if (nrs->nrs_policy_primary == policy) { nrs->nrs_policy_primary = NULL; - } else { LASSERT(nrs->nrs_policy_fallback == policy); nrs->nrs_policy_fallback = NULL; diff --git a/drivers/staging/lustre/lustre/ptlrpc/ptlrpc_internal.h b/drivers/staging/lustre/lustre/ptlrpc/ptlrpc_internal.h index 10c2520..5383b68 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/ptlrpc_internal.h +++ b/drivers/staging/lustre/lustre/ptlrpc/ptlrpc_internal.h @@ -111,12 +111,12 @@ struct nrs_core { * Protects nrs_core::nrs_policies, serializes external policy * registration/unregistration, and NRS core lprocfs operations. */ - struct mutex nrs_mutex; + struct mutex nrs_mutex; /** * List of all policy descriptors registered with NRS core; protected * by nrs_core::nrs_mutex. */ - struct list_head nrs_policies; + struct list_head nrs_policies; }; @@ -251,15 +251,15 @@ struct ptlrpc_reply_state * void ptlrpc_pinger_wake_up(void); /* sec_null.c */ -int sptlrpc_null_init(void); +int sptlrpc_null_init(void); void sptlrpc_null_fini(void); /* sec_plain.c */ -int sptlrpc_plain_init(void); +int sptlrpc_plain_init(void); void sptlrpc_plain_fini(void); /* sec_bulk.c */ -int sptlrpc_enc_pool_init(void); +int sptlrpc_enc_pool_init(void); void sptlrpc_enc_pool_fini(void); int sptlrpc_proc_enc_pool_seq_show(struct seq_file *m, void *v); @@ -277,11 +277,11 @@ void sptlrpc_conf_choose_flavor(enum lustre_sec_part from, struct obd_uuid *target, lnet_nid_t nid, struct sptlrpc_flavor *sf); -int sptlrpc_conf_init(void); +int sptlrpc_conf_init(void); void sptlrpc_conf_fini(void); /* sec.c */ -int sptlrpc_init(void); +int sptlrpc_init(void); void sptlrpc_fini(void); /* layout.c */ diff --git a/drivers/staging/lustre/lustre/ptlrpc/ptlrpcd.c b/drivers/staging/lustre/lustre/ptlrpc/ptlrpcd.c index e39c38a..f0ac296 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/ptlrpcd.c +++ b/drivers/staging/lustre/lustre/ptlrpc/ptlrpcd.c @@ -69,13 +69,13 @@ /* One of these per CPT. */ struct ptlrpcd { - int pd_size; - int pd_index; - int pd_cpt; - int pd_cursor; - int pd_nthreads; - int pd_groupsize; - struct ptlrpcd_ctl pd_threads[0]; + int pd_size; + int pd_index; + int pd_cpt; + int pd_cursor; + int pd_nthreads; + int pd_groupsize; + struct ptlrpcd_ctl pd_threads[0]; }; /* @@ -171,9 +171,9 @@ void ptlrpcd_wake(struct ptlrpc_request *req) static struct ptlrpcd_ctl * ptlrpcd_select_pc(struct ptlrpc_request *req) { - struct ptlrpcd *pd; - int cpt; - int idx; + struct ptlrpcd *pd; + int cpt; + int idx; if (req && req->rq_send_state != LUSTRE_IMP_FULL) return &ptlrpcd_rcv; diff --git a/drivers/staging/lustre/lustre/ptlrpc/recover.c b/drivers/staging/lustre/lustre/ptlrpc/recover.c index ed769a4..af672ab 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/recover.c +++ b/drivers/staging/lustre/lustre/ptlrpc/recover.c @@ -119,6 +119,7 @@ int ptlrpc_replay_next(struct obd_import *imp, int *inflight) */ if (!req) { struct ptlrpc_request *tmp; + list_for_each_entry_safe(tmp, pos, &imp->imp_replay_list, rq_replay_list) { if (tmp->rq_transno > last_transno) { diff --git a/drivers/staging/lustre/lustre/ptlrpc/sec.c b/drivers/staging/lustre/lustre/ptlrpc/sec.c index 165082a..6dc7731 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/sec.c +++ b/drivers/staging/lustre/lustre/ptlrpc/sec.c @@ -171,7 +171,7 @@ u32 sptlrpc_name2flavor_base(const char *name) const char *sptlrpc_flavor2name_base(u32 flvr) { - u32 base = SPTLRPC_FLVR_BASE(flvr); + u32 base = SPTLRPC_FLVR_BASE(flvr); if (base == SPTLRPC_FLVR_BASE(SPTLRPC_FLVR_NULL)) return "null"; @@ -365,7 +365,7 @@ int sptlrpc_req_get_ctx(struct ptlrpc_request *req) { struct obd_import *imp = req->rq_import; struct ptlrpc_sec *sec; - int rc; + int rc; LASSERT(!req->rq_cli_ctx); LASSERT(imp); diff --git a/drivers/staging/lustre/lustre/ptlrpc/sec_bulk.c b/drivers/staging/lustre/lustre/ptlrpc/sec_bulk.c index 93dcb6d..74cfdd8 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/sec_bulk.c +++ b/drivers/staging/lustre/lustre/ptlrpc/sec_bulk.c @@ -57,8 +57,8 @@ #define POINTERS_PER_PAGE (PAGE_SIZE / sizeof(void *)) #define PAGES_PER_POOL (POINTERS_PER_PAGE) -#define IDLE_IDX_MAX (100) -#define IDLE_IDX_WEIGHT (3) +#define IDLE_IDX_MAX (100) +#define IDLE_IDX_WEIGHT (3) #define CACHE_QUIESCENT_PERIOD (20) @@ -66,16 +66,16 @@ /* * constants */ - unsigned long epp_max_pages; /* maximum pages can hold, const */ - unsigned int epp_max_pools; /* number of pools, const */ + unsigned long epp_max_pages; /* maximum pages can hold, const */ + unsigned int epp_max_pools; /* number of pools, const */ /* * wait queue in case of not enough free pages. */ - wait_queue_head_t epp_waitq; /* waiting threads */ - unsigned int epp_waitqlen; /* wait queue length */ - unsigned long epp_pages_short; /* # of pages wanted of in-q users */ - unsigned int epp_growing:1; /* during adding pages */ + wait_queue_head_t epp_waitq; /* waiting threads */ + unsigned int epp_waitqlen; /* wait queue length */ + unsigned long epp_pages_short; /* # of pages wanted of in-q users */ + unsigned int epp_growing:1; /* during adding pages */ /* * indicating how idle the pools are, from 0 to MAX_IDLE_IDX @@ -84,36 +84,36 @@ * is idled for a while but the idle_idx might still be low if no * activities happened in the pools. */ - unsigned long epp_idle_idx; + unsigned long epp_idle_idx; /* last shrink time due to mem tight */ - time64_t epp_last_shrink; - time64_t epp_last_access; + time64_t epp_last_shrink; + time64_t epp_last_access; /* * in-pool pages bookkeeping */ - spinlock_t epp_lock; /* protect following fields */ - unsigned long epp_total_pages; /* total pages in pools */ - unsigned long epp_free_pages; /* current pages available */ + spinlock_t epp_lock; /* protect following fields */ + unsigned long epp_total_pages; /* total pages in pools */ + unsigned long epp_free_pages; /* current pages available */ /* * statistics */ - unsigned long epp_st_max_pages; /* # of pages ever reached */ - unsigned int epp_st_grows; /* # of grows */ - unsigned int epp_st_grow_fails; /* # of add pages failures */ - unsigned int epp_st_shrinks; /* # of shrinks */ - unsigned long epp_st_access; /* # of access */ - unsigned long epp_st_missings; /* # of cache missing */ - unsigned long epp_st_lowfree; /* lowest free pages reached */ - unsigned int epp_st_max_wqlen; /* highest waitqueue length */ - unsigned long epp_st_max_wait; /* in jiffies */ - unsigned long epp_st_outofmem; /* # of out of mem requests */ + unsigned long epp_st_max_pages; /* # of pages ever reached */ + unsigned int epp_st_grows; /* # of grows */ + unsigned int epp_st_grow_fails; /* # of add pages failures */ + unsigned int epp_st_shrinks; /* # of shrinks */ + unsigned long epp_st_access; /* # of access */ + unsigned long epp_st_missings; /* # of cache missing */ + unsigned long epp_st_lowfree; /* lowest free pages reached */ + unsigned int epp_st_max_wqlen; /* highest waitqueue length */ + unsigned long epp_st_max_wait; /* in jiffies */ + unsigned long epp_st_outofmem; /* # of out of mem requests */ /* * pointers to pools */ - struct page ***epp_pools; + struct page ***epp_pools; } page_pools; /* @@ -394,9 +394,9 @@ static inline void enc_pools_free(void) } static struct shrinker pools_shrinker = { - .count_objects = enc_pools_shrink_count, - .scan_objects = enc_pools_shrink_scan, - .seeks = DEFAULT_SEEKS, + .count_objects = enc_pools_shrink_count, + .scan_objects = enc_pools_shrink_scan, + .seeks = DEFAULT_SEEKS, }; int sptlrpc_enc_pool_init(void) @@ -475,14 +475,14 @@ void sptlrpc_enc_pool_fini(void) } static int cfs_hash_alg_id[] = { - [BULK_HASH_ALG_NULL] = CFS_HASH_ALG_NULL, - [BULK_HASH_ALG_ADLER32] = CFS_HASH_ALG_ADLER32, - [BULK_HASH_ALG_CRC32] = CFS_HASH_ALG_CRC32, - [BULK_HASH_ALG_MD5] = CFS_HASH_ALG_MD5, - [BULK_HASH_ALG_SHA1] = CFS_HASH_ALG_SHA1, - [BULK_HASH_ALG_SHA256] = CFS_HASH_ALG_SHA256, - [BULK_HASH_ALG_SHA384] = CFS_HASH_ALG_SHA384, - [BULK_HASH_ALG_SHA512] = CFS_HASH_ALG_SHA512, + [BULK_HASH_ALG_NULL] = CFS_HASH_ALG_NULL, + [BULK_HASH_ALG_ADLER32] = CFS_HASH_ALG_ADLER32, + [BULK_HASH_ALG_CRC32] = CFS_HASH_ALG_CRC32, + [BULK_HASH_ALG_MD5] = CFS_HASH_ALG_MD5, + [BULK_HASH_ALG_SHA1] = CFS_HASH_ALG_SHA1, + [BULK_HASH_ALG_SHA256] = CFS_HASH_ALG_SHA256, + [BULK_HASH_ALG_SHA384] = CFS_HASH_ALG_SHA384, + [BULK_HASH_ALG_SHA512] = CFS_HASH_ALG_SHA512, }; const char *sptlrpc_get_hash_name(u8 hash_alg) @@ -498,7 +498,7 @@ u8 sptlrpc_get_hash_alg(const char *algname) int bulk_sec_desc_unpack(struct lustre_msg *msg, int offset, int swabbed) { struct ptlrpc_bulk_sec_desc *bsd; - int size = msg->lm_buflens[offset]; + int size = msg->lm_buflens[offset]; bsd = lustre_msg_buf(msg, offset, sizeof(*bsd)); if (!bsd) { diff --git a/drivers/staging/lustre/lustre/ptlrpc/sec_config.c b/drivers/staging/lustre/lustre/ptlrpc/sec_config.c index 1844ada..54130ae 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/sec_config.c +++ b/drivers/staging/lustre/lustre/ptlrpc/sec_config.c @@ -408,19 +408,19 @@ static int sptlrpc_rule_set_choose(struct sptlrpc_rule_set *rset, **********************************/ struct sptlrpc_conf_tgt { - struct list_head sct_list; - char sct_name[MAX_OBD_NAME]; - struct sptlrpc_rule_set sct_rset; + struct list_head sct_list; + char sct_name[MAX_OBD_NAME]; + struct sptlrpc_rule_set sct_rset; }; struct sptlrpc_conf { - struct list_head sc_list; - char sc_fsname[MTI_NAME_MAXLEN]; - unsigned int sc_modified; /* modified during updating */ - unsigned int sc_updated:1, /* updated copy from MGS */ - sc_local:1; /* local copy from target */ - struct sptlrpc_rule_set sc_rset; /* fs general rules */ - struct list_head sc_tgts; /* target-specific rules */ + struct list_head sc_list; + char sc_fsname[MTI_NAME_MAXLEN]; + unsigned int sc_modified; /* modified during updating */ + unsigned int sc_updated:1, /* updated copy from MGS */ + sc_local:1; /* local copy from target */ + struct sptlrpc_rule_set sc_rset; /* fs general rules */ + struct list_head sc_tgts; /* target-specific rules */ }; static struct mutex sptlrpc_conf_lock; @@ -801,7 +801,7 @@ void sptlrpc_conf_choose_flavor(enum lustre_sec_part from, flavor_set_flags(sf, from, to, 1); } -#define SEC_ADAPT_DELAY (10) +#define SEC_ADAPT_DELAY (10) /** * called by client devices, notify the sptlrpc config has changed and diff --git a/drivers/staging/lustre/lustre/ptlrpc/sec_null.c b/drivers/staging/lustre/lustre/ptlrpc/sec_null.c index 6933a53..df6ef4f 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/sec_null.c +++ b/drivers/staging/lustre/lustre/ptlrpc/sec_null.c @@ -277,8 +277,8 @@ int null_enlarge_reqbuf(struct ptlrpc_sec *sec, } static struct ptlrpc_svc_ctx null_svc_ctx = { - .sc_refcount = ATOMIC_INIT(1), - .sc_policy = &null_policy, + .sc_refcount = ATOMIC_INIT(1), + .sc_policy = &null_policy, }; static @@ -373,33 +373,33 @@ int null_authorize(struct ptlrpc_request *req) static struct ptlrpc_ctx_ops null_ctx_ops = { .refresh = null_ctx_refresh, - .sign = null_ctx_sign, - .verify = null_ctx_verify, + .sign = null_ctx_sign, + .verify = null_ctx_verify, }; static struct ptlrpc_sec_cops null_sec_cops = { - .create_sec = null_create_sec, - .destroy_sec = null_destroy_sec, - .lookup_ctx = null_lookup_ctx, + .create_sec = null_create_sec, + .destroy_sec = null_destroy_sec, + .lookup_ctx = null_lookup_ctx, .flush_ctx_cache = null_flush_ctx_cache, - .alloc_reqbuf = null_alloc_reqbuf, - .alloc_repbuf = null_alloc_repbuf, - .free_reqbuf = null_free_reqbuf, - .free_repbuf = null_free_repbuf, - .enlarge_reqbuf = null_enlarge_reqbuf, + .alloc_reqbuf = null_alloc_reqbuf, + .alloc_repbuf = null_alloc_repbuf, + .free_reqbuf = null_free_reqbuf, + .free_repbuf = null_free_repbuf, + .enlarge_reqbuf = null_enlarge_reqbuf, }; static struct ptlrpc_sec_sops null_sec_sops = { - .accept = null_accept, - .alloc_rs = null_alloc_rs, - .authorize = null_authorize, + .accept = null_accept, + .alloc_rs = null_alloc_rs, + .authorize = null_authorize, .free_rs = null_free_rs, }; static struct ptlrpc_sec_policy null_policy = { - .sp_owner = THIS_MODULE, + .sp_owner = THIS_MODULE, .sp_name = "sec.null", - .sp_policy = SPTLRPC_POLICY_NULL, + .sp_policy = SPTLRPC_POLICY_NULL, .sp_cops = &null_sec_cops, .sp_sops = &null_sec_sops, }; diff --git a/drivers/staging/lustre/lustre/ptlrpc/sec_plain.c b/drivers/staging/lustre/lustre/ptlrpc/sec_plain.c index 0a31ff4..021bf7f 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/sec_plain.c +++ b/drivers/staging/lustre/lustre/ptlrpc/sec_plain.c @@ -46,9 +46,9 @@ #include "ptlrpc_internal.h" struct plain_sec { - struct ptlrpc_sec pls_base; - rwlock_t pls_lock; - struct ptlrpc_cli_ctx *pls_ctx; + struct ptlrpc_sec pls_base; + rwlock_t pls_lock; + struct ptlrpc_cli_ctx *pls_ctx; }; static inline struct plain_sec *sec2plsec(struct ptlrpc_sec *sec) @@ -65,15 +65,15 @@ static inline struct plain_sec *sec2plsec(struct ptlrpc_sec *sec) /* * for simplicity, plain policy rpc use fixed layout. */ -#define PLAIN_PACK_SEGMENTS (4) +#define PLAIN_PACK_SEGMENTS (4) -#define PLAIN_PACK_HDR_OFF (0) -#define PLAIN_PACK_MSG_OFF (1) -#define PLAIN_PACK_USER_OFF (2) -#define PLAIN_PACK_BULK_OFF (3) +#define PLAIN_PACK_HDR_OFF (0) +#define PLAIN_PACK_MSG_OFF (1) +#define PLAIN_PACK_USER_OFF (2) +#define PLAIN_PACK_BULK_OFF (3) -#define PLAIN_FL_USER (0x01) -#define PLAIN_FL_BULK (0x02) +#define PLAIN_FL_USER (0x01) +#define PLAIN_FL_BULK (0x02) struct plain_header { u8 ph_ver; /* 0 */ @@ -711,8 +711,8 @@ int plain_enlarge_reqbuf(struct ptlrpc_sec *sec, ****************************************/ static struct ptlrpc_svc_ctx plain_svc_ctx = { - .sc_refcount = ATOMIC_INIT(1), - .sc_policy = &plain_policy, + .sc_refcount = ATOMIC_INIT(1), + .sc_policy = &plain_policy, }; static @@ -961,40 +961,40 @@ int plain_svc_wrap_bulk(struct ptlrpc_request *req, static struct ptlrpc_ctx_ops plain_ctx_ops = { .refresh = plain_ctx_refresh, - .validate = plain_ctx_validate, - .sign = plain_ctx_sign, - .verify = plain_ctx_verify, - .wrap_bulk = plain_cli_wrap_bulk, - .unwrap_bulk = plain_cli_unwrap_bulk, + .validate = plain_ctx_validate, + .sign = plain_ctx_sign, + .verify = plain_ctx_verify, + .wrap_bulk = plain_cli_wrap_bulk, + .unwrap_bulk = plain_cli_unwrap_bulk, }; static struct ptlrpc_sec_cops plain_sec_cops = { - .create_sec = plain_create_sec, - .destroy_sec = plain_destroy_sec, - .kill_sec = plain_kill_sec, - .lookup_ctx = plain_lookup_ctx, - .release_ctx = plain_release_ctx, + .create_sec = plain_create_sec, + .destroy_sec = plain_destroy_sec, + .kill_sec = plain_kill_sec, + .lookup_ctx = plain_lookup_ctx, + .release_ctx = plain_release_ctx, .flush_ctx_cache = plain_flush_ctx_cache, - .alloc_reqbuf = plain_alloc_reqbuf, - .free_reqbuf = plain_free_reqbuf, - .alloc_repbuf = plain_alloc_repbuf, - .free_repbuf = plain_free_repbuf, - .enlarge_reqbuf = plain_enlarge_reqbuf, + .alloc_reqbuf = plain_alloc_reqbuf, + .free_reqbuf = plain_free_reqbuf, + .alloc_repbuf = plain_alloc_repbuf, + .free_repbuf = plain_free_repbuf, + .enlarge_reqbuf = plain_enlarge_reqbuf, }; static struct ptlrpc_sec_sops plain_sec_sops = { - .accept = plain_accept, - .alloc_rs = plain_alloc_rs, - .authorize = plain_authorize, + .accept = plain_accept, + .alloc_rs = plain_alloc_rs, + .authorize = plain_authorize, .free_rs = plain_free_rs, - .unwrap_bulk = plain_svc_unwrap_bulk, - .wrap_bulk = plain_svc_wrap_bulk, + .unwrap_bulk = plain_svc_unwrap_bulk, + .wrap_bulk = plain_svc_wrap_bulk, }; static struct ptlrpc_sec_policy plain_policy = { - .sp_owner = THIS_MODULE, + .sp_owner = THIS_MODULE, .sp_name = "plain", - .sp_policy = SPTLRPC_POLICY_PLAIN, + .sp_policy = SPTLRPC_POLICY_PLAIN, .sp_cops = &plain_sec_cops, .sp_sops = &plain_sec_sops, }; diff --git a/drivers/staging/lustre/lustre/ptlrpc/service.c b/drivers/staging/lustre/lustre/ptlrpc/service.c index 1030f65..5b97f2a 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/service.c +++ b/drivers/staging/lustre/lustre/ptlrpc/service.c @@ -173,7 +173,7 @@ svc->srv_name, i, svc->srv_buf_size, svcpt->scp_nrqbds_posted, svcpt->scp_nrqbds_total, rc); - try_post: +try_post: if (post && rc == 0) rc = ptlrpc_server_post_idle_rqbds(svcpt); @@ -185,8 +185,8 @@ struct ptlrpc_hr_thread { int hrt_id; /* thread ID */ spinlock_t hrt_lock; - wait_queue_head_t hrt_waitq; - struct list_head hrt_queue; /* RS queue */ + wait_queue_head_t hrt_waitq; + struct list_head hrt_queue; /* RS queue */ struct ptlrpc_hr_partition *hrt_partition; }; @@ -212,7 +212,7 @@ struct ptlrpc_hr_service { /* CPU partition table, it's just cfs_cpt_tab for now */ struct cfs_cpt_table *hr_cpt_table; /** controller sleep waitq */ - wait_queue_head_t hr_waitq; + wait_queue_head_t hr_waitq; unsigned int hr_stopping; /** roundrobin rotor for non-affinity service */ unsigned int hr_rotor; @@ -236,7 +236,6 @@ struct ptlrpc_hr_service { svcpt->scp_service->srv_cptable == ptlrpc_hr.hr_cpt_table) { /* directly match partition */ hrp = ptlrpc_hr.hr_partitions[svcpt->scp_cpt]; - } else { rotor = ptlrpc_hr.hr_rotor++; rotor %= cfs_cpt_number(ptlrpc_hr.hr_cpt_table); @@ -440,7 +439,7 @@ static void ptlrpc_at_timer(struct timer_list *t) nthrs = max(tc->tc_nthrs_base, tc->tc_nthrs_max / svc->srv_ncpts); } - out: +out: nthrs = max(nthrs, tc->tc_nthrs_init); svc->srv_nthrs_cpt_limit = nthrs; svc->srv_nthrs_cpt_init = init; @@ -459,7 +458,7 @@ static void ptlrpc_at_timer(struct timer_list *t) ptlrpc_service_part_init(struct ptlrpc_service *svc, struct ptlrpc_service_part *svcpt, int cpt) { - struct ptlrpc_at_array *array; + struct ptlrpc_at_array *array; int size; int index; int rc; @@ -1125,7 +1124,6 @@ static int ptlrpc_at_send_early_reply(struct ptlrpc_request *req) goto out_put; rc = ptlrpc_send_reply(reqcopy, PTLRPC_REPLY_EARLY); - if (!rc) { /* Adjust our own deadline to what we told the client */ req->rq_deadline = newdl; @@ -1316,7 +1314,7 @@ static void ptlrpc_server_hpreq_fini(struct ptlrpc_request *req) static int ptlrpc_server_request_add(struct ptlrpc_service_part *svcpt, struct ptlrpc_request *req) { - int rc; + int rc; rc = ptlrpc_server_hpreq_init(svcpt, req); if (rc < 0) @@ -2412,7 +2410,7 @@ int ptlrpc_start_threads(struct ptlrpc_service *svc) } return 0; - failed: +failed: CERROR("cannot start %s thread #%d_%d: rc %d\n", svc->srv_thread_name, i, j, rc); ptlrpc_stop_all_threads(svc); @@ -2432,7 +2430,7 @@ int ptlrpc_start_thread(struct ptlrpc_service_part *svcpt, int wait) svc->srv_name, svcpt->scp_cpt, svcpt->scp_nthrs_running, svc->srv_nthrs_cpt_init, svc->srv_nthrs_cpt_limit); - again: +again: if (unlikely(svc->srv_is_stopping)) return -ESRCH; -- 1.8.3.1 From jsimmons at infradead.org Thu Jan 31 17:19:27 2019 From: jsimmons at infradead.org (James Simmons) Date: Thu, 31 Jan 2019 12:19:27 -0500 Subject: [lustre-devel] [PATCH 23/26] libcfs: cleanup white spaces In-Reply-To: <1548955170-13456-1-git-send-email-jsimmons@infradead.org> References: <1548955170-13456-1-git-send-email-jsimmons@infradead.org> Message-ID: <1548955170-13456-24-git-send-email-jsimmons@infradead.org> The libcfs code is very messy and difficult to read. Remove excess white space and properly align data structures so they are easy on the eyes. Signed-off-by: James Simmons --- .../lustre/include/linux/libcfs/libcfs_debug.h | 74 ++++++------ .../lustre/include/linux/libcfs/libcfs_fail.h | 8 +- .../lustre/include/linux/libcfs/libcfs_private.h | 56 ++++----- .../lustre/include/linux/libcfs/libcfs_string.h | 10 +- drivers/staging/lustre/lnet/libcfs/debug.c | 22 ++-- drivers/staging/lustre/lnet/libcfs/libcfs_cpu.c | 8 +- drivers/staging/lustre/lnet/libcfs/libcfs_string.c | 4 +- .../lustre/lnet/libcfs/linux-crypto-adler.c | 2 +- drivers/staging/lustre/lnet/libcfs/linux-crypto.c | 1 - drivers/staging/lustre/lnet/libcfs/module.c | 128 ++++++++++----------- drivers/staging/lustre/lnet/libcfs/tracefile.c | 5 +- drivers/staging/lustre/lnet/libcfs/tracefile.h | 12 +- 12 files changed, 164 insertions(+), 166 deletions(-) diff --git a/drivers/staging/lustre/include/linux/libcfs/libcfs_debug.h b/drivers/staging/lustre/include/linux/libcfs/libcfs_debug.h index 27a3b12..3fd6ad7 100644 --- a/drivers/staging/lustre/include/linux/libcfs/libcfs_debug.h +++ b/drivers/staging/lustre/include/linux/libcfs/libcfs_debug.h @@ -67,28 +67,28 @@ /* Enable debug-checks on stack size - except on x86_64 */ #if !defined(__x86_64__) # ifdef __ia64__ -# define CDEBUG_STACK() (THREAD_SIZE - \ +# define CDEBUG_STACK() (THREAD_SIZE - \ ((unsigned long)__builtin_dwarf_cfa() & \ (THREAD_SIZE - 1))) # else -# define CDEBUG_STACK() (THREAD_SIZE - \ +# define CDEBUG_STACK() (THREAD_SIZE - \ ((unsigned long)__builtin_frame_address(0) & \ (THREAD_SIZE - 1))) # endif /* __ia64__ */ -#define __CHECK_STACK(msgdata, mask, cdls) \ -do { \ - if (unlikely(CDEBUG_STACK() > libcfs_stack)) { \ +#define __CHECK_STACK(msgdata, mask, cdls) \ +do { \ + if (unlikely(CDEBUG_STACK() > libcfs_stack)) { \ LIBCFS_DEBUG_MSG_DATA_INIT(msgdata, D_WARNING, NULL); \ - libcfs_stack = CDEBUG_STACK(); \ - libcfs_debug_msg(msgdata, \ - "maximum lustre stack %lu\n", \ - CDEBUG_STACK()); \ - (msgdata)->msg_mask = mask; \ - (msgdata)->msg_cdls = cdls; \ - dump_stack(); \ + libcfs_stack = CDEBUG_STACK(); \ + libcfs_debug_msg(msgdata, \ + "maximum lustre stack %lu\n", \ + CDEBUG_STACK()); \ + (msgdata)->msg_mask = mask; \ + (msgdata)->msg_cdls = cdls; \ + dump_stack(); \ /*panic("LBUG");*/ \ - } \ + } \ } while (0) #define CFS_CHECK_STACK(msgdata, mask, cdls) __CHECK_STACK(msgdata, mask, cdls) #else /* __x86_64__ */ @@ -104,37 +104,37 @@ #define CDEBUG_DEFAULT_MIN_DELAY ((HZ + 1) / 2) /* jiffies */ #define CDEBUG_DEFAULT_BACKOFF 2 struct cfs_debug_limit_state { - unsigned long cdls_next; - unsigned int cdls_delay; - int cdls_count; + unsigned long cdls_next; + unsigned int cdls_delay; + int cdls_count; }; struct libcfs_debug_msg_data { - const char *msg_file; - const char *msg_fn; - int msg_subsys; - int msg_line; - int msg_mask; - struct cfs_debug_limit_state *msg_cdls; + const char *msg_file; + const char *msg_fn; + int msg_subsys; + int msg_line; + int msg_mask; + struct cfs_debug_limit_state *msg_cdls; }; -#define LIBCFS_DEBUG_MSG_DATA_INIT(data, mask, cdls) \ -do { \ - (data)->msg_subsys = DEBUG_SUBSYSTEM; \ - (data)->msg_file = __FILE__; \ - (data)->msg_fn = __func__; \ - (data)->msg_line = __LINE__; \ - (data)->msg_cdls = (cdls); \ - (data)->msg_mask = (mask); \ +#define LIBCFS_DEBUG_MSG_DATA_INIT(data, mask, cdls) \ +do { \ + (data)->msg_subsys = DEBUG_SUBSYSTEM; \ + (data)->msg_file = __FILE__; \ + (data)->msg_fn = __func__; \ + (data)->msg_line = __LINE__; \ + (data)->msg_cdls = (cdls); \ + (data)->msg_mask = (mask); \ } while (0) -#define LIBCFS_DEBUG_MSG_DATA_DECL(dataname, mask, cdls) \ - static struct libcfs_debug_msg_data dataname = { \ - .msg_subsys = DEBUG_SUBSYSTEM, \ - .msg_file = __FILE__, \ - .msg_fn = __func__, \ - .msg_line = __LINE__, \ - .msg_cdls = (cdls) }; \ +#define LIBCFS_DEBUG_MSG_DATA_DECL(dataname, mask, cdls) \ + static struct libcfs_debug_msg_data dataname = { \ + .msg_subsys = DEBUG_SUBSYSTEM, \ + .msg_file = __FILE__, \ + .msg_fn = __func__, \ + .msg_line = __LINE__, \ + .msg_cdls = (cdls) }; \ dataname.msg_mask = (mask) /** diff --git a/drivers/staging/lustre/include/linux/libcfs/libcfs_fail.h b/drivers/staging/lustre/include/linux/libcfs/libcfs_fail.h index 8074e39..4a41978 100644 --- a/drivers/staging/lustre/include/linux/libcfs/libcfs_fail.h +++ b/drivers/staging/lustre/include/linux/libcfs/libcfs_fail.h @@ -54,14 +54,14 @@ enum { }; /* Failure injection control */ -#define CFS_FAIL_MASK_SYS 0x0000FF00 -#define CFS_FAIL_MASK_LOC (0x000000FF | CFS_FAIL_MASK_SYS) +#define CFS_FAIL_MASK_SYS 0x0000FF00 +#define CFS_FAIL_MASK_LOC (0x000000FF | CFS_FAIL_MASK_SYS) -#define CFS_FAILED_BIT 30 +#define CFS_FAILED_BIT 30 /* CFS_FAILED is 0x40000000 */ #define CFS_FAILED BIT(CFS_FAILED_BIT) -#define CFS_FAIL_ONCE_BIT 31 +#define CFS_FAIL_ONCE_BIT 31 /* CFS_FAIL_ONCE is 0x80000000 */ #define CFS_FAIL_ONCE BIT(CFS_FAIL_ONCE_BIT) diff --git a/drivers/staging/lustre/include/linux/libcfs/libcfs_private.h b/drivers/staging/lustre/include/linux/libcfs/libcfs_private.h index 491d597..d525e4f 100644 --- a/drivers/staging/lustre/include/linux/libcfs/libcfs_private.h +++ b/drivers/staging/lustre/include/linux/libcfs/libcfs_private.h @@ -69,9 +69,9 @@ void __noreturn lbug_with_loc(struct libcfs_debug_msg_data *msg); -#define LBUG() \ -do { \ - LIBCFS_DEBUG_MSG_DATA_DECL(msgdata, D_EMERG, NULL); \ +#define LBUG() \ +do { \ + LIBCFS_DEBUG_MSG_DATA_DECL(msgdata, D_EMERG, NULL); \ lbug_with_loc(&msgdata); \ } while (0) @@ -86,7 +86,7 @@ kmalloc_node(size, flags | __GFP_ZERO, \ cfs_cpt_spread_node(lnet_cpt_table(), cpt)) -#define kvmalloc_cpt(size, flags, cpt) \ +#define kvmalloc_cpt(size, flags, cpt) \ kvmalloc_node(size, flags, \ cfs_cpt_spread_node(lnet_cpt_table(), cpt)) @@ -138,50 +138,50 @@ LASSERTF(atomic_read(a) >= v, "value: %d\n", atomic_read((a))) /** assert value of @a is great than @v1 and little than @v2 */ -#define LASSERT_ATOMIC_GT_LT(a, v1, v2) \ -do { \ - int __v = atomic_read(a); \ +#define LASSERT_ATOMIC_GT_LT(a, v1, v2) \ +do { \ + int __v = atomic_read(a); \ LASSERTF(__v > v1 && __v < v2, "value: %d\n", __v); \ } while (0) /** assert value of @a is great than @v1 and little/equal to @v2 */ -#define LASSERT_ATOMIC_GT_LE(a, v1, v2) \ -do { \ - int __v = atomic_read(a); \ +#define LASSERT_ATOMIC_GT_LE(a, v1, v2) \ +do { \ + int __v = atomic_read(a); \ LASSERTF(__v > v1 && __v <= v2, "value: %d\n", __v); \ } while (0) /** assert value of @a is great/equal to @v1 and little than @v2 */ -#define LASSERT_ATOMIC_GE_LT(a, v1, v2) \ -do { \ - int __v = atomic_read(a); \ +#define LASSERT_ATOMIC_GE_LT(a, v1, v2) \ +do { \ + int __v = atomic_read(a); \ LASSERTF(__v >= v1 && __v < v2, "value: %d\n", __v); \ } while (0) /** assert value of @a is great/equal to @v1 and little/equal to @v2 */ -#define LASSERT_ATOMIC_GE_LE(a, v1, v2) \ -do { \ - int __v = atomic_read(a); \ +#define LASSERT_ATOMIC_GE_LE(a, v1, v2) \ +do { \ + int __v = atomic_read(a); \ LASSERTF(__v >= v1 && __v <= v2, "value: %d\n", __v); \ } while (0) #else /* !LASSERT_ATOMIC_ENABLED */ -#define LASSERT_ATOMIC_EQ(a, v) do {} while (0) -#define LASSERT_ATOMIC_NE(a, v) do {} while (0) -#define LASSERT_ATOMIC_LT(a, v) do {} while (0) -#define LASSERT_ATOMIC_LE(a, v) do {} while (0) -#define LASSERT_ATOMIC_GT(a, v) do {} while (0) -#define LASSERT_ATOMIC_GE(a, v) do {} while (0) -#define LASSERT_ATOMIC_GT_LT(a, v1, v2) do {} while (0) -#define LASSERT_ATOMIC_GT_LE(a, v1, v2) do {} while (0) -#define LASSERT_ATOMIC_GE_LT(a, v1, v2) do {} while (0) -#define LASSERT_ATOMIC_GE_LE(a, v1, v2) do {} while (0) +#define LASSERT_ATOMIC_EQ(a, v) do {} while (0) +#define LASSERT_ATOMIC_NE(a, v) do {} while (0) +#define LASSERT_ATOMIC_LT(a, v) do {} while (0) +#define LASSERT_ATOMIC_LE(a, v) do {} while (0) +#define LASSERT_ATOMIC_GT(a, v) do {} while (0) +#define LASSERT_ATOMIC_GE(a, v) do {} while (0) +#define LASSERT_ATOMIC_GT_LT(a, v1, v2) do {} while (0) +#define LASSERT_ATOMIC_GT_LE(a, v1, v2) do {} while (0) +#define LASSERT_ATOMIC_GE_LT(a, v1, v2) do {} while (0) +#define LASSERT_ATOMIC_GE_LE(a, v1, v2) do {} while (0) #endif /* LASSERT_ATOMIC_ENABLED */ -#define LASSERT_ATOMIC_ZERO(a) LASSERT_ATOMIC_EQ(a, 0) -#define LASSERT_ATOMIC_POS(a) LASSERT_ATOMIC_GT(a, 0) +#define LASSERT_ATOMIC_ZERO(a) LASSERT_ATOMIC_EQ(a, 0) +#define LASSERT_ATOMIC_POS(a) LASSERT_ATOMIC_GT(a, 0) /* implication */ #define ergo(a, b) (!(a) || (b)) diff --git a/drivers/staging/lustre/include/linux/libcfs/libcfs_string.h b/drivers/staging/lustre/include/linux/libcfs/libcfs_string.h index 3117708..f2ac9dc 100644 --- a/drivers/staging/lustre/include/linux/libcfs/libcfs_string.h +++ b/drivers/staging/lustre/include/linux/libcfs/libcfs_string.h @@ -53,8 +53,8 @@ int cfs_str2mask(const char *str, const char *(*bit2str)(int bit), * Structure to represent NULL-less strings. */ struct cfs_lstr { - char *ls_str; - int ls_len; + char *ls_str; + int ls_len; }; /* @@ -65,9 +65,9 @@ struct cfs_range_expr { * Link to cfs_expr_list::el_exprs. */ struct list_head re_link; - u32 re_lo; - u32 re_hi; - u32 re_stride; + u32 re_lo; + u32 re_hi; + u32 re_stride; }; struct cfs_expr_list { diff --git a/drivers/staging/lustre/lnet/libcfs/debug.c b/drivers/staging/lustre/lnet/libcfs/debug.c index f954436..b7f0c73 100644 --- a/drivers/staging/lustre/lnet/libcfs/debug.c +++ b/drivers/staging/lustre/lnet/libcfs/debug.c @@ -85,8 +85,8 @@ static int libcfs_param_debug_mb_set(const char *val, * debug_mb parameter type with corresponding methods to handle this case */ static const struct kernel_param_ops param_ops_debug_mb = { - .set = libcfs_param_debug_mb_set, - .get = param_get_uint, + .set = libcfs_param_debug_mb_set, + .get = param_get_uint, }; #define param_check_debug_mb(name, p) \ @@ -143,8 +143,8 @@ static int param_set_console_max_delay(const char *val, } static const struct kernel_param_ops param_ops_console_max_delay = { - .set = param_set_console_max_delay, - .get = param_get_delay, + .set = param_set_console_max_delay, + .get = param_get_delay, }; #define param_check_console_max_delay(name, p) \ @@ -161,8 +161,8 @@ static int param_set_console_min_delay(const char *val, } static const struct kernel_param_ops param_ops_console_min_delay = { - .set = param_set_console_min_delay, - .get = param_get_delay, + .set = param_set_console_min_delay, + .get = param_get_delay, }; #define param_check_console_min_delay(name, p) \ @@ -195,8 +195,8 @@ static int param_set_uintpos(const char *val, const struct kernel_param *kp) } static const struct kernel_param_ops param_ops_uintpos = { - .set = param_set_uintpos, - .get = param_get_uint, + .set = param_set_uintpos, + .get = param_get_uint, }; #define param_check_uintpos(name, p) \ @@ -499,9 +499,9 @@ static int panic_notifier(struct notifier_block *self, unsigned long unused1, } static struct notifier_block libcfs_panic_notifier = { - .notifier_call = panic_notifier, - .next = NULL, - .priority = 10000, + .notifier_call = panic_notifier, + .next = NULL, + .priority = 10000, }; static void libcfs_register_panic_notifier(void) diff --git a/drivers/staging/lustre/lnet/libcfs/libcfs_cpu.c b/drivers/staging/lustre/lnet/libcfs/libcfs_cpu.c index a384a73..262469f 100644 --- a/drivers/staging/lustre/lnet/libcfs/libcfs_cpu.c +++ b/drivers/staging/lustre/lnet/libcfs/libcfs_cpu.c @@ -76,7 +76,7 @@ struct cfs_cpt_table { }; /** Global CPU partition table */ -struct cfs_cpt_table *cfs_cpt_tab __read_mostly; +struct cfs_cpt_table *cfs_cpt_tab __read_mostly; EXPORT_SYMBOL(cfs_cpt_tab); /** @@ -86,7 +86,7 @@ struct cfs_cpt_table { * 1 : disable multiple partitions * >1 : specify number of partitions */ -static int cpu_npartitions; +static int cpu_npartitions; module_param(cpu_npartitions, int, 0444); MODULE_PARM_DESC(cpu_npartitions, "# of CPU partitions"); @@ -103,7 +103,7 @@ struct cfs_cpt_table { * * NB: If user specified cpu_pattern, cpu_npartitions will be ignored */ -static char *cpu_pattern = "N"; +static char *cpu_pattern = "N"; module_param(cpu_pattern, charp, 0444); MODULE_PARM_DESC(cpu_pattern, "CPU partitions pattern"); @@ -167,7 +167,7 @@ struct cfs_cpt_table *cfs_cpt_table_alloc(unsigned int ncpt) GFP_KERNEL); if (!part->cpt_distance) { kfree(part->cpt_nodemask); - failed_setting_one_part: +failed_setting_one_part: free_cpumask_var(part->cpt_cpumask); goto failed_setting_ctb_parts; } diff --git a/drivers/staging/lustre/lnet/libcfs/libcfs_string.c b/drivers/staging/lustre/lnet/libcfs/libcfs_string.c index e1fb126..5fb8524 100644 --- a/drivers/staging/lustre/lnet/libcfs/libcfs_string.c +++ b/drivers/staging/lustre/lnet/libcfs/libcfs_string.c @@ -314,11 +314,11 @@ char *cfs_firststr(char *str, size_t size) } } - out: +out: *expr = re; return 0; - failed: +failed: kfree(re); return -EINVAL; } diff --git a/drivers/staging/lustre/lnet/libcfs/linux-crypto-adler.c b/drivers/staging/lustre/lnet/libcfs/linux-crypto-adler.c index db81ed52..d3da7a22 100644 --- a/drivers/staging/lustre/lnet/libcfs/linux-crypto-adler.c +++ b/drivers/staging/lustre/lnet/libcfs/linux-crypto-adler.c @@ -104,7 +104,7 @@ static int adler32_digest(struct shash_desc *desc, const u8 *data, unsigned int len, u8 *out) { return __adler32_finup(crypto_shash_ctx(desc->tfm), data, len, - out); + out); } static struct shash_alg alg = { diff --git a/drivers/staging/lustre/lnet/libcfs/linux-crypto.c b/drivers/staging/lustre/lnet/libcfs/linux-crypto.c index b206e3c..a0b1377 100644 --- a/drivers/staging/lustre/lnet/libcfs/linux-crypto.c +++ b/drivers/staging/lustre/lnet/libcfs/linux-crypto.c @@ -205,7 +205,6 @@ struct ahash_request * const struct cfs_crypto_hash_type *type; err = cfs_crypto_hash_alloc(hash_alg, &type, &req, key, key_len); - if (err) return ERR_PTR(err); return req; diff --git a/drivers/staging/lustre/lnet/libcfs/module.c b/drivers/staging/lustre/lnet/libcfs/module.c index 1de83b1..dd9a953 100644 --- a/drivers/staging/lustre/lnet/libcfs/module.c +++ b/drivers/staging/lustre/lnet/libcfs/module.c @@ -60,8 +60,8 @@ #include "tracefile.h" struct lnet_debugfs_symlink_def { - const char *name; - const char *target; + const char *name; + const char *target; }; static struct dentry *lnet_debugfs_root; @@ -281,14 +281,14 @@ static int libcfs_ioctl(unsigned long cmd, void __user *uparam) } static const struct file_operations libcfs_fops = { - .owner = THIS_MODULE, - .unlocked_ioctl = libcfs_psdev_ioctl, + .owner = THIS_MODULE, + .unlocked_ioctl = libcfs_psdev_ioctl, }; static struct miscdevice libcfs_dev = { - .minor = MISC_DYNAMIC_MINOR, - .name = "lnet", - .fops = &libcfs_fops, + .minor = MISC_DYNAMIC_MINOR, + .name = "lnet", + .fops = &libcfs_fops, }; static int libcfs_dev_registered; @@ -423,7 +423,7 @@ static int proc_cpt_table(struct ctl_table *table, int write, } rc = cfs_trace_copyout_string(buffer, nob, buf + pos, NULL); - out: +out: kfree(buf); return rc; } @@ -472,84 +472,84 @@ static int proc_cpt_distance(struct ctl_table *table, int write, static struct ctl_table lnet_table[] = { { - .procname = "debug", - .data = &libcfs_debug, - .maxlen = sizeof(int), - .mode = 0644, - .proc_handler = &proc_dobitmasks, + .procname = "debug", + .data = &libcfs_debug, + .maxlen = sizeof(int), + .mode = 0644, + .proc_handler = &proc_dobitmasks, }, { - .procname = "subsystem_debug", - .data = &libcfs_subsystem_debug, - .maxlen = sizeof(int), - .mode = 0644, - .proc_handler = &proc_dobitmasks, + .procname = "subsystem_debug", + .data = &libcfs_subsystem_debug, + .maxlen = sizeof(int), + .mode = 0644, + .proc_handler = &proc_dobitmasks, }, { - .procname = "printk", - .data = &libcfs_printk, - .maxlen = sizeof(int), - .mode = 0644, - .proc_handler = &proc_dobitmasks, + .procname = "printk", + .data = &libcfs_printk, + .maxlen = sizeof(int), + .mode = 0644, + .proc_handler = &proc_dobitmasks, }, { - .procname = "cpu_partition_table", - .maxlen = 128, - .mode = 0444, - .proc_handler = &proc_cpt_table, + .procname = "cpu_partition_table", + .maxlen = 128, + .mode = 0444, + .proc_handler = &proc_cpt_table, }, { - .procname = "cpu_partition_distance", - .maxlen = 128, - .mode = 0444, - .proc_handler = &proc_cpt_distance, + .procname = "cpu_partition_distance", + .maxlen = 128, + .mode = 0444, + .proc_handler = &proc_cpt_distance, }, { - .procname = "debug_log_upcall", - .data = lnet_debug_log_upcall, - .maxlen = sizeof(lnet_debug_log_upcall), - .mode = 0644, - .proc_handler = &proc_dostring, + .procname = "debug_log_upcall", + .data = lnet_debug_log_upcall, + .maxlen = sizeof(lnet_debug_log_upcall), + .mode = 0644, + .proc_handler = &proc_dostring, }, { - .procname = "catastrophe", - .data = &libcfs_catastrophe, - .maxlen = sizeof(int), - .mode = 0444, - .proc_handler = &proc_dointvec, + .procname = "catastrophe", + .data = &libcfs_catastrophe, + .maxlen = sizeof(int), + .mode = 0444, + .proc_handler = &proc_dointvec, }, { - .procname = "dump_kernel", - .maxlen = 256, - .mode = 0200, - .proc_handler = &proc_dump_kernel, + .procname = "dump_kernel", + .maxlen = 256, + .mode = 0200, + .proc_handler = &proc_dump_kernel, }, { - .procname = "daemon_file", - .mode = 0644, - .maxlen = 256, - .proc_handler = &proc_daemon_file, + .procname = "daemon_file", + .mode = 0644, + .maxlen = 256, + .proc_handler = &proc_daemon_file, }, { - .procname = "force_lbug", - .data = NULL, - .maxlen = 0, - .mode = 0200, - .proc_handler = &libcfs_force_lbug + .procname = "force_lbug", + .data = NULL, + .maxlen = 0, + .mode = 0200, + .proc_handler = &libcfs_force_lbug }, { - .procname = "fail_loc", - .data = &cfs_fail_loc, - .maxlen = sizeof(cfs_fail_loc), - .mode = 0644, - .proc_handler = &proc_fail_loc + .procname = "fail_loc", + .data = &cfs_fail_loc, + .maxlen = sizeof(cfs_fail_loc), + .mode = 0644, + .proc_handler = &proc_fail_loc }, { - .procname = "fail_val", - .data = &cfs_fail_val, - .maxlen = sizeof(int), - .mode = 0644, - .proc_handler = &proc_dointvec + .procname = "fail_val", + .data = &cfs_fail_val, + .maxlen = sizeof(int), + .mode = 0644, + .proc_handler = &proc_dointvec }, { .procname = "fail_err", diff --git a/drivers/staging/lustre/lnet/libcfs/tracefile.c b/drivers/staging/lustre/lnet/libcfs/tracefile.c index 22b1dd0..40440ce 100644 --- a/drivers/staging/lustre/lnet/libcfs/tracefile.c +++ b/drivers/staging/lustre/lnet/libcfs/tracefile.c @@ -331,7 +331,6 @@ static struct cfs_trace_page *cfs_trace_get_tage(struct cfs_trace_cpu_data *tcd, * XXX nikita: do NOT call portals_debug_msg() (CDEBUG/ENTRY/EXIT) * from here: this will lead to infinite recursion. */ - if (len > PAGE_SIZE) { pr_err("cowardly refusing to write %lu bytes in a page\n", len); return NULL; @@ -489,7 +488,7 @@ int libcfs_debug_vmsg2(struct libcfs_debug_msg_data *msgdata, } string_buf = (char *)page_address(tage->page) + - tage->used + known_size; + tage->used + known_size; max_nob = PAGE_SIZE - tage->used - known_size; if (max_nob <= 0) { @@ -746,7 +745,7 @@ static void put_pages_back(struct page_collection *pc) put_pages_back_on_all_cpus(pc); } -/* Add pages to a per-cpu debug daemon ringbuffer. This buffer makes sure that +/* Add pages to a per-cpu debug daemon ringbuffer. This buffer makes sure that * we have a good amount of data at all times for dumping during an LBUG, even * if we have been steadily writing (and otherwise discarding) pages via the * debug daemon. diff --git a/drivers/staging/lustre/lnet/libcfs/tracefile.h b/drivers/staging/lustre/lnet/libcfs/tracefile.h index 2134549..71a031d1 100644 --- a/drivers/staging/lustre/lnet/libcfs/tracefile.h +++ b/drivers/staging/lustre/lnet/libcfs/tracefile.h @@ -165,12 +165,12 @@ void cfs_trace_assertion_failed(const char *str, } \ } while (0) -#define __LASSERT_TAGE_INVARIANT(tage) \ -do { \ - __LASSERT(tage); \ - __LASSERT(tage->page); \ - __LASSERT(tage->used <= PAGE_SIZE); \ - __LASSERT(page_count(tage->page) > 0); \ +#define __LASSERT_TAGE_INVARIANT(tage) \ +do { \ + __LASSERT(tage); \ + __LASSERT(tage->page); \ + __LASSERT(tage->used <= PAGE_SIZE); \ + __LASSERT(page_count(tage->page) > 0); \ } while (0) #endif /* __LIBCFS_TRACEFILE_H__ */ -- 1.8.3.1 From jsimmons at infradead.org Thu Jan 31 17:19:28 2019 From: jsimmons at infradead.org (James Simmons) Date: Thu, 31 Jan 2019 12:19:28 -0500 Subject: [lustre-devel] [PATCH 24/26] lnet: cleanup white spaces In-Reply-To: <1548955170-13456-1-git-send-email-jsimmons@infradead.org> References: <1548955170-13456-1-git-send-email-jsimmons@infradead.org> Message-ID: <1548955170-13456-25-git-send-email-jsimmons@infradead.org> The LNet core code is very messy and difficult to read. Remove excess white space and properly align data structures so they are easy on the eyes. Signed-off-by: James Simmons --- drivers/staging/lustre/include/linux/lnet/api.h | 32 ++-- .../staging/lustre/include/linux/lnet/lib-lnet.h | 3 +- .../staging/lustre/include/linux/lnet/lib-types.h | 192 ++++++++++----------- drivers/staging/lustre/lnet/lnet/acceptor.c | 16 +- drivers/staging/lustre/lnet/lnet/api-ni.c | 89 +++++----- drivers/staging/lustre/lnet/lnet/config.c | 38 ++-- drivers/staging/lustre/lnet/lnet/lib-eq.c | 2 +- drivers/staging/lustre/lnet/lnet/lib-move.c | 84 +++++---- drivers/staging/lustre/lnet/lnet/lib-msg.c | 72 ++++---- drivers/staging/lustre/lnet/lnet/lib-ptl.c | 22 +-- drivers/staging/lustre/lnet/lnet/lib-socket.c | 11 +- drivers/staging/lustre/lnet/lnet/module.c | 3 +- drivers/staging/lustre/lnet/lnet/net_fault.c | 1 - drivers/staging/lustre/lnet/lnet/nidstrings.c | 40 ++--- drivers/staging/lustre/lnet/lnet/peer.c | 37 ++-- drivers/staging/lustre/lnet/lnet/router.c | 26 +-- drivers/staging/lustre/lnet/lnet/router_proc.c | 61 ++++--- 17 files changed, 361 insertions(+), 368 deletions(-) diff --git a/drivers/staging/lustre/include/linux/lnet/api.h b/drivers/staging/lustre/include/linux/lnet/api.h index 7c30475..8d37509 100644 --- a/drivers/staging/lustre/include/linux/lnet/api.h +++ b/drivers/staging/lustre/include/linux/lnet/api.h @@ -94,18 +94,18 @@ * and LNetMEInsert(), and removed from its list by LNetMEUnlink(). * @{ */ -int LNetMEAttach(unsigned int portal, +int LNetMEAttach(unsigned int portal, struct lnet_process_id match_id_in, - u64 match_bits_in, - u64 ignore_bits_in, + u64 match_bits_in, + u64 ignore_bits_in, enum lnet_unlink unlink_in, enum lnet_ins_pos pos_in, struct lnet_handle_me *handle_out); int LNetMEInsert(struct lnet_handle_me current_in, struct lnet_process_id match_id_in, - u64 match_bits_in, - u64 ignore_bits_in, + u64 match_bits_in, + u64 ignore_bits_in, enum lnet_unlink unlink_in, enum lnet_ins_pos position_in, struct lnet_handle_me *handle_out); @@ -161,18 +161,18 @@ int LNetMDBind(struct lnet_md md_in, * on multiple EQs. * @{ */ -int LNetEQAlloc(unsigned int count_in, +int LNetEQAlloc(unsigned int count_in, lnet_eq_handler_t handler, struct lnet_handle_eq *handle_out); int LNetEQFree(struct lnet_handle_eq eventq_in); int LNetEQPoll(struct lnet_handle_eq *eventqs_in, - int neq_in, - signed long timeout, - int interruptible, + int neq_in, + signed long timeout, + int interruptible, struct lnet_event *event_out, - int *which_eq_out); + int *which_eq_out); /** @} lnet_eq */ /** \defgroup lnet_data Data movement operations @@ -181,21 +181,21 @@ int LNetEQPoll(struct lnet_handle_eq *eventqs_in, * and LNetGet(). * @{ */ -int LNetPut(lnet_nid_t self, +int LNetPut(lnet_nid_t self, struct lnet_handle_md md_in, enum lnet_ack_req ack_req_in, struct lnet_process_id target_in, - unsigned int portal_in, + unsigned int portal_in, u64 match_bits_in, - unsigned int offset_in, + unsigned int offset_in, u64 hdr_data_in); -int LNetGet(lnet_nid_t self, +int LNetGet(lnet_nid_t self, struct lnet_handle_md md_in, struct lnet_process_id target_in, - unsigned int portal_in, + unsigned int portal_in, u64 match_bits_in, - unsigned int offset_in); + unsigned int offset_in); /** @} lnet_data */ /** \defgroup lnet_misc Miscellaneous operations. diff --git a/drivers/staging/lustre/include/linux/lnet/lib-lnet.h b/drivers/staging/lustre/include/linux/lnet/lib-lnet.h index 5c3f5e3..fb5d074 100644 --- a/drivers/staging/lustre/include/linux/lnet/lib-lnet.h +++ b/drivers/staging/lustre/include/linux/lnet/lib-lnet.h @@ -205,7 +205,6 @@ static inline int lnet_md_unlinkable(struct lnet_libmd *md) } md = kzalloc(size, GFP_NOFS); - if (md) { /* Set here in case of early free */ md->md_options = umd->options; @@ -467,7 +466,7 @@ int lnet_get_peer_list(u32 *countp, u32 *sizep, void lnet_router_debugfs_init(void); void lnet_router_debugfs_fini(void); -int lnet_rtrpools_alloc(int im_a_router); +int lnet_rtrpools_alloc(int im_a_router); void lnet_destroy_rtrbuf(struct lnet_rtrbuf *rb, int npages); int lnet_rtrpools_adjust(int tiny, int small, int large); int lnet_rtrpools_enable(void); diff --git a/drivers/staging/lustre/include/linux/lnet/lib-types.h b/drivers/staging/lustre/include/linux/lnet/lib-types.h index 0646f07..33c7aaf 100644 --- a/drivers/staging/lustre/include/linux/lnet/lib-types.h +++ b/drivers/staging/lustre/include/linux/lnet/lib-types.h @@ -88,18 +88,18 @@ struct lnet_msg { /* ready for pending on RX delay list */ unsigned int msg_rx_ready_delay:1; - unsigned int msg_vmflush:1; /* VM trying to free memory */ - unsigned int msg_target_is_router:1; /* sending to a router */ - unsigned int msg_routing:1; /* being forwarded */ - unsigned int msg_ack:1; /* ack on finalize (PUT) */ - unsigned int msg_sending:1; /* outgoing message */ - unsigned int msg_receiving:1; /* being received */ - unsigned int msg_txcredit:1; /* taken an NI send credit */ - unsigned int msg_peertxcredit:1; /* taken a peer send credit */ - unsigned int msg_rtrcredit:1; /* taken a global router credit */ - unsigned int msg_peerrtrcredit:1; /* taken a peer router credit */ - unsigned int msg_onactivelist:1; /* on the activelist */ - unsigned int msg_rdma_get:1; + unsigned int msg_vmflush:1; /* VM trying to free memory */ + unsigned int msg_target_is_router:1; /* sending to a router */ + unsigned int msg_routing:1; /* being forwarded */ + unsigned int msg_ack:1; /* ack on finalize (PUT) */ + unsigned int msg_sending:1; /* outgoing message */ + unsigned int msg_receiving:1; /* being received */ + unsigned int msg_txcredit:1; /* taken an NI send credit */ + unsigned int msg_peertxcredit:1; /* taken a peer send credit */ + unsigned int msg_rtrcredit:1; /* taken a global router credit */ + unsigned int msg_peerrtrcredit:1; /* taken a peer router credit */ + unsigned int msg_onactivelist:1; /* on the activelist */ + unsigned int msg_rdma_get:1; struct lnet_peer_ni *msg_txpeer; /* peer I'm sending to */ struct lnet_peer_ni *msg_rxpeer; /* peer I received from */ @@ -130,14 +130,14 @@ struct lnet_libhandle { ((type *)((char *)(ptr) - (char *)(&((type *)0)->member))) struct lnet_eq { - struct list_head eq_list; - struct lnet_libhandle eq_lh; - unsigned long eq_enq_seq; - unsigned long eq_deq_seq; - unsigned int eq_size; - lnet_eq_handler_t eq_callback; - struct lnet_event *eq_events; - int **eq_refs; /* percpt refcount for EQ */ + struct list_head eq_list; + struct lnet_libhandle eq_lh; + unsigned long eq_enq_seq; + unsigned long eq_deq_seq; + unsigned int eq_size; + lnet_eq_handler_t eq_callback; + struct lnet_event *eq_events; + int **eq_refs; /* percpt refcount for EQ */ }; struct lnet_me { @@ -218,7 +218,7 @@ struct lnet_lnd { */ /* - * Start sending a preformatted message. 'private' is NULL for PUT and + * Start sending a preformatted message.x 'private' is NULL for PUT and * GET messages; otherwise this is a response to an incoming message * and 'private' is the 'private' passed to lnet_parse(). Return * non-zero for immediate failure, otherwise complete later with @@ -267,7 +267,7 @@ struct lnet_tx_queue { enum lnet_ni_state { /* set when NI block is allocated */ - LNET_NI_STATE_INIT = 0, + LNET_NI_STATE_INIT = 0, /* set when NI is started successfully */ LNET_NI_STATE_ACTIVE, /* set when LND notifies NI failed */ @@ -279,23 +279,23 @@ enum lnet_ni_state { }; enum lnet_stats_type { - LNET_STATS_TYPE_SEND = 0, + LNET_STATS_TYPE_SEND = 0, LNET_STATS_TYPE_RECV, LNET_STATS_TYPE_DROP }; struct lnet_comm_count { - atomic_t co_get_count; - atomic_t co_put_count; - atomic_t co_reply_count; - atomic_t co_ack_count; - atomic_t co_hello_count; + atomic_t co_get_count; + atomic_t co_put_count; + atomic_t co_reply_count; + atomic_t co_ack_count; + atomic_t co_hello_count; }; struct lnet_element_stats { - struct lnet_comm_count el_send_stats; - struct lnet_comm_count el_recv_stats; - struct lnet_comm_count el_drop_stats; + struct lnet_comm_count el_send_stats; + struct lnet_comm_count el_recv_stats; + struct lnet_comm_count el_drop_stats; }; struct lnet_net { @@ -376,7 +376,7 @@ struct lnet_ni { struct lnet_lnd_tunables ni_lnd_tunables; /* lnd tunables set explicitly */ - bool ni_lnd_tunables_set; + bool ni_lnd_tunables_set; /* NI statistics */ struct lnet_element_stats ni_stats; @@ -391,9 +391,9 @@ struct lnet_ni { * equivalent interfaces to use * This is an array because socklnd bonding can still be configured */ - char *ni_interfaces[LNET_INTERFACES_NUM]; + char *ni_interfaces[LNET_INTERFACES_NUM]; /* original net namespace */ - struct net *ni_net_ns; + struct net *ni_net_ns; }; #define LNET_PROTO_PING_MATCHBITS 0x8000000000000000LL @@ -434,9 +434,9 @@ struct lnet_rc_data { struct lnet_peer_ni { /* chain on lpn_peer_nis */ - struct list_head lpni_peer_nis; + struct list_head lpni_peer_nis; /* chain on remote peer list */ - struct list_head lpni_on_remote_peer_ni_list; + struct list_head lpni_on_remote_peer_ni_list; /* chain on peer hash */ struct list_head lpni_hashlist; /* messages blocking for tx credits */ @@ -448,7 +448,7 @@ struct lnet_peer_ni { /* statistics kept on each peer NI */ struct lnet_element_stats lpni_stats; /* spin lock protecting credits and lpni_txq / lpni_rtrq */ - spinlock_t lpni_lock; + spinlock_t lpni_lock; /* # tx credits available */ int lpni_txcredits; struct lnet_peer_net *lpni_peer_net; @@ -491,26 +491,26 @@ struct lnet_peer_ni { /* CPT this peer attached on */ int lpni_cpt; /* state flags -- protected by lpni_lock */ - unsigned int lpni_state; + unsigned int lpni_state; /* # refs from lnet_route::lr_gateway */ int lpni_rtr_refcount; /* sequence number used to round robin over peer nis within a net */ - u32 lpni_seq; + u32 lpni_seq; /* sequence number used to round robin over gateways */ - u32 lpni_gw_seq; + u32 lpni_gw_seq; /* health flag */ - bool lpni_healthy; + bool lpni_healthy; /* returned RC ping features. Protected with lpni_lock */ unsigned int lpni_ping_feats; /* routers on this peer */ struct list_head lpni_routes; /* preferred local nids: if only one, use lpni_pref.nid */ union lpni_pref { - lnet_nid_t nid; + lnet_nid_t nid; lnet_nid_t *nids; } lpni_pref; /* number of preferred NIDs in lnpi_pref_nids */ - u32 lpni_pref_nnids; + u32 lpni_pref_nnids; /* router checker state */ struct lnet_rc_data *lpni_rcd; }; @@ -676,9 +676,9 @@ struct lnet_peer_table { /* # peers extant */ atomic_t pt_number; /* peers */ - struct list_head pt_peer_list; + struct list_head pt_peer_list; /* # peers */ - int pt_peers; + int pt_peers; /* # zombies to go to deathrow (and not there yet) */ int pt_zombies; /* zombie peers_ni */ @@ -704,7 +704,7 @@ struct lnet_route { /* chain on gateway */ struct list_head lr_gwlist; /* router node */ - struct lnet_peer_ni *lr_gateway; + struct lnet_peer_ni *lr_gateway; /* remote network number */ u32 lr_net; /* sequence for round-robin */ @@ -754,9 +754,9 @@ struct lnet_rtrbufpool { }; struct lnet_rtrbuf { - struct list_head rb_list; /* chain on rbp_bufs */ - struct lnet_rtrbufpool *rb_pool; /* owning pool */ - struct bio_vec rb_kiov[0]; /* the buffer space */ + struct list_head rb_list; /* chain on rbp_bufs */ + struct lnet_rtrbufpool *rb_pool; /* owning pool */ + struct bio_vec rb_kiov[0]; /* the buffer space */ }; #define LNET_PEER_HASHSIZE 503 /* prime! */ @@ -904,58 +904,58 @@ enum lnet_state { struct lnet { /* CPU partition table of LNet */ - struct cfs_cpt_table *ln_cpt_table; + struct cfs_cpt_table *ln_cpt_table; /* number of CPTs in ln_cpt_table */ - unsigned int ln_cpt_number; - unsigned int ln_cpt_bits; + unsigned int ln_cpt_number; + unsigned int ln_cpt_bits; /* protect LNet resources (ME/MD/EQ) */ - struct cfs_percpt_lock *ln_res_lock; + struct cfs_percpt_lock *ln_res_lock; /* # portals */ - int ln_nportals; + int ln_nportals; /* the vector of portals */ - struct lnet_portal **ln_portals; + struct lnet_portal **ln_portals; /* percpt ME containers */ - struct lnet_res_container **ln_me_containers; + struct lnet_res_container **ln_me_containers; /* percpt MD container */ - struct lnet_res_container **ln_md_containers; + struct lnet_res_container **ln_md_containers; /* Event Queue container */ - struct lnet_res_container ln_eq_container; - wait_queue_head_t ln_eq_waitq; - spinlock_t ln_eq_wait_lock; - unsigned int ln_remote_nets_hbits; + struct lnet_res_container ln_eq_container; + wait_queue_head_t ln_eq_waitq; + spinlock_t ln_eq_wait_lock; + unsigned int ln_remote_nets_hbits; /* protect NI, peer table, credits, routers, rtrbuf... */ - struct cfs_percpt_lock *ln_net_lock; + struct cfs_percpt_lock *ln_net_lock; /* percpt message containers for active/finalizing/freed message */ - struct lnet_msg_container **ln_msg_containers; - struct lnet_counters **ln_counters; - struct lnet_peer_table **ln_peer_tables; + struct lnet_msg_container **ln_msg_containers; + struct lnet_counters **ln_counters; + struct lnet_peer_table **ln_peer_tables; /* list of peer nis not on a local network */ struct list_head ln_remote_peer_ni_list; /* failure simulation */ - struct list_head ln_test_peers; - struct list_head ln_drop_rules; - struct list_head ln_delay_rules; + struct list_head ln_test_peers; + struct list_head ln_drop_rules; + struct list_head ln_delay_rules; /* LND instances */ struct list_head ln_nets; /* network zombie list */ struct list_head ln_net_zombie; /* the loopback NI */ - struct lnet_ni *ln_loni; + struct lnet_ni *ln_loni; /* remote networks with routes to them */ - struct list_head *ln_remote_nets_hash; + struct list_head *ln_remote_nets_hash; /* validity stamp */ - u64 ln_remote_nets_version; + u64 ln_remote_nets_version; /* list of all known routers */ - struct list_head ln_routers; + struct list_head ln_routers; /* validity stamp */ - u64 ln_routers_version; + u64 ln_routers_version; /* percpt router buffer pools */ - struct lnet_rtrbufpool **ln_rtrpools; + struct lnet_rtrbufpool **ln_rtrpools; /* * Ping target / Push source @@ -964,9 +964,9 @@ struct lnet { * ln_ping_target is protected against concurrent updates by * ln_api_mutex. */ - struct lnet_handle_md ln_ping_target_md; - struct lnet_handle_eq ln_ping_target_eq; - struct lnet_ping_buffer *ln_ping_target; + struct lnet_handle_md ln_ping_target_md; + struct lnet_handle_eq ln_ping_target_eq; + struct lnet_ping_buffer *ln_ping_target; atomic_t ln_ping_target_seqno; /* @@ -979,7 +979,7 @@ struct lnet { */ struct lnet_handle_eq ln_push_target_eq; struct lnet_handle_md ln_push_target_md; - struct lnet_ping_buffer *ln_push_target; + struct lnet_ping_buffer *ln_push_target; int ln_push_target_nnis; /* discovery event queue handle */ @@ -996,35 +996,35 @@ struct lnet { int ln_dc_state; /* router checker startup/shutdown state */ - enum lnet_rc_state ln_rc_state; + enum lnet_rc_state ln_rc_state; /* router checker's event queue */ - struct lnet_handle_eq ln_rc_eqh; + struct lnet_handle_eq ln_rc_eqh; /* rcd still pending on net */ - struct list_head ln_rcd_deathrow; + struct list_head ln_rcd_deathrow; /* rcd ready for free */ - struct list_head ln_rcd_zombie; + struct list_head ln_rcd_zombie; /* serialise startup/shutdown */ - struct completion ln_rc_signal; + struct completion ln_rc_signal; - struct mutex ln_api_mutex; - struct mutex ln_lnd_mutex; - struct mutex ln_delay_mutex; + struct mutex ln_api_mutex; + struct mutex ln_lnd_mutex; + struct mutex ln_delay_mutex; /* Have I called LNetNIInit myself? */ - int ln_niinit_self; + int ln_niinit_self; /* LNetNIInit/LNetNIFini counter */ - int ln_refcount; + int ln_refcount; /* SHUTDOWN/RUNNING/STOPPING */ - enum lnet_state ln_state; + enum lnet_state ln_state; - int ln_routing; /* am I a router? */ - lnet_pid_t ln_pid; /* requested pid */ + int ln_routing; /* am I a router? */ + lnet_pid_t ln_pid; /* requested pid */ /* uniquely identifies this ni in this epoch */ - u64 ln_interface_cookie; + u64 ln_interface_cookie; /* registered LNDs */ - struct list_head ln_lnds; + struct list_head ln_lnds; /* test protocol compatibility flags */ - int ln_testprotocompat; + int ln_testprotocompat; /* * 0 - load the NIs from the mod params @@ -1032,14 +1032,14 @@ struct lnet { * Reverse logic to ensure that other calls to LNetNIInit * need no change */ - bool ln_nis_from_mod_params; + bool ln_nis_from_mod_params; /* * waitq for router checker. As long as there are no routes in * the list, the router checker will sleep on this queue. when * routes are added the thread will wake up */ - wait_queue_head_t ln_rc_waitq; + wait_queue_head_t ln_rc_waitq; }; diff --git a/drivers/staging/lustre/lnet/lnet/acceptor.c b/drivers/staging/lustre/lnet/lnet/acceptor.c index aa28a9f..83ab3b1 100644 --- a/drivers/staging/lustre/lnet/lnet/acceptor.c +++ b/drivers/staging/lustre/lnet/lnet/acceptor.c @@ -36,9 +36,9 @@ #include #include -static int accept_port = 988; -static int accept_backlog = 127; -static int accept_timeout = 5; +static int accept_port = 988; +static int accept_backlog = 127; +static int accept_timeout = 5; static struct { int pta_shutdown; @@ -167,9 +167,9 @@ BUILD_BUG_ON(LNET_PROTO_ACCEPTOR_VERSION != 1); - cr.acr_magic = LNET_PROTO_ACCEPTOR_MAGIC; + cr.acr_magic = LNET_PROTO_ACCEPTOR_MAGIC; cr.acr_version = LNET_PROTO_ACCEPTOR_VERSION; - cr.acr_nid = peer_nid; + cr.acr_nid = peer_nid; if (the_lnet.ln_testprotocompat) { /* single-shot proto check */ @@ -196,9 +196,9 @@ rc = -EADDRINUSE; goto failed; - failed_sock: +failed_sock: sock_release(sock); - failed: +failed: lnet_connect_console_error(rc, peer_nid, peer_ip, peer_port); return rc; } @@ -297,7 +297,7 @@ __swab64s(&cr.acr_nid); ni = lnet_nid2ni_addref(cr.acr_nid); - if (!ni || /* no matching net */ + if (!ni || /* no matching net */ ni->ni_nid != cr.acr_nid) { /* right NET, wrong NID! */ if (ni) lnet_ni_decref(ni); diff --git a/drivers/staging/lustre/lnet/lnet/api-ni.c b/drivers/staging/lustre/lnet/lnet/api-ni.c index be77e10..64b8bef9 100644 --- a/drivers/staging/lustre/lnet/lnet/api-ni.c +++ b/drivers/staging/lustre/lnet/lnet/api-ni.c @@ -47,7 +47,7 @@ * before module init completes. The mutex needs to be ready for use then. */ struct lnet the_lnet = { - .ln_api_mutex = __MUTEX_INITIALIZER(the_lnet.ln_api_mutex), + .ln_api_mutex = __MUTEX_INITIALIZER(the_lnet.ln_api_mutex), }; /* THE state of the network */ EXPORT_SYMBOL(the_lnet); @@ -281,7 +281,7 @@ static int lnet_discover(struct lnet_process_id id, u32 force, return 0; - failed: +failed: lnet_destroy_locks(); return -ENOMEM; } @@ -476,17 +476,17 @@ static void lnet_assert_wire_constants(void) lnet_net_lock(LNET_LOCK_EX); cfs_percpt_for_each(ctr, i, the_lnet.ln_counters) { - counters->msgs_max += ctr->msgs_max; - counters->msgs_alloc += ctr->msgs_alloc; - counters->errors += ctr->errors; - counters->send_count += ctr->send_count; - counters->recv_count += ctr->recv_count; - counters->route_count += ctr->route_count; - counters->drop_count += ctr->drop_count; - counters->send_length += ctr->send_length; - counters->recv_length += ctr->recv_length; + counters->msgs_max += ctr->msgs_max; + counters->msgs_alloc += ctr->msgs_alloc; + counters->errors += ctr->errors; + counters->send_count += ctr->send_count; + counters->recv_count += ctr->recv_count; + counters->route_count += ctr->route_count; + counters->drop_count += ctr->drop_count; + counters->send_length += ctr->send_length; + counters->recv_length += ctr->recv_length; counters->route_length += ctr->route_length; - counters->drop_length += ctr->drop_length; + counters->drop_length += ctr->drop_length; } lnet_net_unlock(LNET_LOCK_EX); } @@ -755,7 +755,7 @@ struct lnet_libhandle * return 0; - failed: +failed: lnet_unprepare(); return rc; } @@ -942,7 +942,7 @@ struct lnet_net * return false; } -struct lnet_ni * +struct lnet_ni * lnet_nid2ni_locked(lnet_nid_t nid, int cpt) { struct lnet_net *net; @@ -1146,8 +1146,10 @@ struct lnet_ping_buffer * struct lnet_handle_md *ping_mdh, int ni_count, bool set_eq) { - struct lnet_process_id id = { .nid = LNET_NID_ANY, - .pid = LNET_PID_ANY }; + struct lnet_process_id id = { + .nid = LNET_NID_ANY, + .pid = LNET_PID_ANY + }; struct lnet_handle_me me_handle; struct lnet_md md = { NULL }; int rc, rc2; @@ -1244,7 +1246,7 @@ struct lnet_ping_buffer * lnet_ni_lock(ni); ns->ns_status = ni->ni_status ? - ni->ni_status->ns_status : + ni->ni_status->ns_status : LNET_NI_STATUS_UP; ni->ni_status = ns; lnet_ni_unlock(ni); @@ -1322,7 +1324,10 @@ struct lnet_ping_buffer * /* Resize the push target. */ int lnet_push_target_resize(void) { - struct lnet_process_id id = { LNET_NID_ANY, LNET_PID_ANY }; + struct lnet_process_id id = { + .nid = LNET_NID_ANY, + .pid = LNET_PID_ANY + }; struct lnet_md md = { NULL }; struct lnet_handle_me meh; struct lnet_handle_md mdh; @@ -1353,13 +1358,13 @@ int lnet_push_target_resize(void) } /* initialize md content */ - md.start = &pbuf->pb_info; - md.length = LNET_PING_INFO_SIZE(nnis); + md.start = &pbuf->pb_info; + md.length = LNET_PING_INFO_SIZE(nnis); md.threshold = LNET_MD_THRESH_INF; - md.max_size = 0; - md.options = LNET_MD_OP_PUT | LNET_MD_TRUNCATE | - LNET_MD_MANAGE_REMOTE; - md.user_ptr = pbuf; + md.max_size = 0; + md.options = LNET_MD_OP_PUT | LNET_MD_TRUNCATE | + LNET_MD_MANAGE_REMOTE; + md.user_ptr = pbuf; md.eq_handle = the_lnet.ln_push_target_eq; rc = LNetMDAttach(meh, md, LNET_RETAIN, &mdh); @@ -1428,7 +1433,6 @@ static int lnet_push_target_init(void) the_lnet.ln_push_target_nnis = LNET_INTERFACES_MIN; rc = lnet_push_target_resize(); - if (rc) { LNetEQFree(the_lnet.ln_push_target_eq); LNetInvalidateEQHandle(&the_lnet.ln_push_target_eq); @@ -1723,10 +1727,10 @@ static void lnet_push_target_fini(void) CDEBUG(D_LNI, "Added LNI %s [%d/%d/%d/%d]\n", libcfs_nid2str(ni->ni_nid), - ni->ni_net->net_tunables.lct_peer_tx_credits, + ni->ni_net->net_tunables.lct_peer_tx_credits, lnet_ni_tq_credits(ni) * LNET_CPT_NUMBER, ni->ni_net->net_tunables.lct_peer_rtr_credits, - ni->ni_net->net_tunables.lct_peer_timeout); + ni->ni_net->net_tunables.lct_peer_timeout); return 0; failed0: @@ -1932,7 +1936,6 @@ static void lnet_push_target_fini(void) list_del_init(&net->net_list); rc = lnet_startup_lndnet(net, NULL); - if (rc < 0) goto failed; @@ -1963,8 +1966,8 @@ int lnet_lib_init(void) lnet_assert_wire_constants(); /* refer to global cfs_cpt_tab for now */ - the_lnet.ln_cpt_table = cfs_cpt_tab; - the_lnet.ln_cpt_number = cfs_cpt_number(cfs_cpt_tab); + the_lnet.ln_cpt_table = cfs_cpt_tab; + the_lnet.ln_cpt_number = cfs_cpt_number(cfs_cpt_tab); LASSERT(the_lnet.ln_cpt_number > 0); if (the_lnet.ln_cpt_number > LNET_CPT_MAX) { @@ -2409,7 +2412,7 @@ struct lnet_ni * if (!prev) { if (!net) net = list_entry(the_lnet.ln_nets.next, struct lnet_net, - net_list); + net_list); ni = list_entry(net->net_ni_list.next, struct lnet_ni, ni_netlist); @@ -2455,7 +2458,6 @@ struct lnet_ni * cpt = lnet_net_lock_current(); ni = lnet_get_ni_idx_locked(idx); - if (ni) { rc = 0; lnet_ni_lock(ni); @@ -2483,7 +2485,6 @@ struct lnet_ni * cpt = lnet_net_lock_current(); ni = lnet_get_ni_idx_locked(cfg_ni->lic_idx); - if (ni) { rc = 0; lnet_ni_lock(ni); @@ -2705,7 +2706,7 @@ int lnet_dyn_del_ni(struct lnet_ioctl_config_ni *conf) struct lnet_ni *ni; u32 net_id = LNET_NIDNET(conf->lic_nid); struct lnet_ping_buffer *pbuf; - struct lnet_handle_md ping_mdh; + struct lnet_handle_md ping_mdh; int rc; int net_count; u32 addr; @@ -2912,7 +2913,7 @@ u32 lnet_get_dlc_seq_locked(void) { struct libcfs_ioctl_data *data = arg; struct lnet_ioctl_config_data *config; - struct lnet_process_id id = {0}; + struct lnet_process_id id = { 0 }; struct lnet_ni *ni; int rc; @@ -3357,7 +3358,7 @@ static int lnet_ping(struct lnet_process_id id, signed long timeout, int which; int unlinked = 0; int replied = 0; - const signed long a_long_time = 60*HZ; + const signed long a_long_time = 60 * HZ; struct lnet_ping_buffer *pbuf; struct lnet_process_id tmpid; int i; @@ -3384,12 +3385,12 @@ static int lnet_ping(struct lnet_process_id id, signed long timeout, } /* initialize md content */ - md.start = &pbuf->pb_info; - md.length = LNET_PING_INFO_SIZE(n_ids); + md.start = &pbuf->pb_info; + md.length = LNET_PING_INFO_SIZE(n_ids); md.threshold = 2; /* GET/REPLY */ - md.max_size = 0; - md.options = LNET_MD_TRUNCATE; - md.user_ptr = NULL; + md.max_size = 0; + md.options = LNET_MD_TRUNCATE; + md.user_ptr = NULL; md.eq_handle = eqh; rc = LNetMDBind(md, LNET_UNLINK, &mdh); @@ -3401,7 +3402,6 @@ static int lnet_ping(struct lnet_process_id id, signed long timeout, rc = LNetGet(LNET_NID_ANY, mdh, id, LNET_RESERVED_PORTAL, LNET_PROTO_PING_MATCHBITS, 0); - if (rc) { /* Don't CERROR; this could be deliberate! */ rc2 = LNetMDUnlink(mdh); @@ -3414,7 +3414,6 @@ static int lnet_ping(struct lnet_process_id id, signed long timeout, do { /* MUST block for unlink to complete */ - rc2 = LNetEQPoll(&eqh, 1, timeout, !unlinked, &event, &which); @@ -3510,13 +3509,13 @@ static int lnet_ping(struct lnet_process_id id, signed long timeout, } rc = pbuf->pb_info.pi_nnis; - fail_free_eq: +fail_free_eq: rc2 = LNetEQFree(eqh); if (rc2) CERROR("rc2 %d\n", rc2); LASSERT(!rc2); - fail_ping_buffer_decref: +fail_ping_buffer_decref: lnet_ping_buffer_decref(pbuf); return rc; } diff --git a/drivers/staging/lustre/lnet/lnet/config.c b/drivers/staging/lustre/lnet/lnet/config.c index 16c42bf..ecf656b 100644 --- a/drivers/staging/lustre/lnet/lnet/config.c +++ b/drivers/staging/lustre/lnet/lnet/config.c @@ -38,15 +38,15 @@ #include #include -struct lnet_text_buf { /* tmp struct for parsing routes */ - struct list_head ltb_list; /* stash on lists */ - int ltb_size; /* allocated size */ - char ltb_text[0]; /* text buffer */ +struct lnet_text_buf { /* tmp struct for parsing routes */ + struct list_head ltb_list; /* stash on lists */ + int ltb_size; /* allocated size */ + char ltb_text[0]; /* text buffer */ }; -static int lnet_tbnob; /* track text buf allocation */ -#define LNET_MAX_TEXTBUF_NOB (64 << 10) /* bound allocation */ -#define LNET_SINGLE_TEXTBUF_NOB (4 << 10) +static int lnet_tbnob; /* track text buf allocation */ +#define LNET_MAX_TEXTBUF_NOB (64 << 10) /* bound allocation */ +#define LNET_SINGLE_TEXTBUF_NOB (4 << 10) #define SPACESTR " \t\v\r\n" #define DELIMITERS ":()[]" @@ -126,6 +126,7 @@ struct lnet_text_buf { /* tmp struct for parsing routes */ lnet_ni_unique_ni(char *iface_list[LNET_INTERFACES_NUM], char *iface) { int i; + for (i = 0; i < LNET_INTERFACES_NUM; i++) { if (iface_list[i] && strncmp(iface_list[i], iface, strlen(iface)) == 0) @@ -554,7 +555,7 @@ struct lnet_ni * goto failed; return ni; - failed: +failed: lnet_ni_free(ni); return NULL; } @@ -743,9 +744,9 @@ struct lnet_ni * goto failed_syntax; } rc = cfs_expr_list_parse(elstr, - nistr - elstr + 1, - 0, LNET_CPT_NUMBER - 1, - &ni_el); + nistr - elstr + 1, + 0, LNET_CPT_NUMBER - 1, + &ni_el); if (rc != 0) { str = elstr; goto failed_syntax; @@ -812,9 +813,9 @@ struct lnet_ni * kfree(tokens); return nnets; - failed_syntax: +failed_syntax: lnet_syntax("networks", networks, (int)(str - tokens), strlen(str)); - failed: +failed: /* free the net list and all the nis on each net */ while (!list_empty(netlist)) { net = list_entry(netlist->next, struct lnet_net, net_list); @@ -1038,7 +1039,7 @@ struct lnet_ni * list_splice(&pending, tbs->prev); return 1; - failed: +failed: lnet_free_text_bufs(&pending); return -EINVAL; } @@ -1093,7 +1094,6 @@ struct lnet_ni * { /* static scratch buffer OK (single threaded) */ static char cmd[LNET_SINGLE_TEXTBUF_NOB]; - struct list_head nets; struct list_head gateways; struct list_head *tmp1; @@ -1226,9 +1226,9 @@ struct lnet_ni * myrc = 0; goto out; - token_error: +token_error: lnet_syntax("routes", cmd, (int)(token - str), strlen(token)); - out: +out: lnet_free_text_bufs(&nets); lnet_free_text_bufs(&gateways); return myrc; @@ -1298,7 +1298,6 @@ struct lnet_ni * lnet_match_network_tokens(char *net_entry, u32 *ipaddrs, int nip) { static char tokens[LNET_SINGLE_TEXTBUF_NOB]; - int matched = 0; int ntokens = 0; int len; @@ -1451,7 +1450,6 @@ struct lnet_ni * { static char networks[LNET_SINGLE_TEXTBUF_NOB]; static char source[LNET_SINGLE_TEXTBUF_NOB]; - struct list_head raw_entries; struct list_head matched_nets; struct list_head current_nets; @@ -1549,7 +1547,7 @@ struct lnet_ni * count++; } - out: +out: lnet_free_text_bufs(&raw_entries); lnet_free_text_bufs(&matched_nets); lnet_free_text_bufs(¤t_nets); diff --git a/drivers/staging/lustre/lnet/lnet/lib-eq.c b/drivers/staging/lustre/lnet/lnet/lib-eq.c index f085388..f500b49 100644 --- a/drivers/staging/lustre/lnet/lnet/lib-eq.c +++ b/drivers/staging/lustre/lnet/lnet/lib-eq.c @@ -198,7 +198,7 @@ lnet_res_lh_invalidate(&eq->eq_lh); list_del(&eq->eq_list); kfree(eq); - out: +out: lnet_eq_wait_unlock(); lnet_res_unlock(LNET_LOCK_EX); diff --git a/drivers/staging/lustre/lnet/lnet/lib-move.c b/drivers/staging/lustre/lnet/lnet/lib-move.c index 639f67ed..92c6a34 100644 --- a/drivers/staging/lustre/lnet/lnet/lib-move.c +++ b/drivers/staging/lustre/lnet/lnet/lib-move.c @@ -489,7 +489,7 @@ void lnet_usr_translate_stats(struct lnet_ioctl_element_msg_stats *msg_stats, if (mlen) { niov = msg->msg_niov; - iov = msg->msg_iov; + iov = msg->msg_iov; kiov = msg->msg_kiov; LASSERT(niov > 0); @@ -541,12 +541,12 @@ void lnet_usr_translate_stats(struct lnet_ioctl_element_msg_stats *msg_stats, lnet_setpayloadbuffer(msg); memset(&msg->msg_hdr, 0, sizeof(msg->msg_hdr)); - msg->msg_hdr.type = cpu_to_le32(type); + msg->msg_hdr.type = cpu_to_le32(type); /* dest_nid will be overwritten by lnet_select_pathway() */ - msg->msg_hdr.dest_nid = cpu_to_le64(target.nid); - msg->msg_hdr.dest_pid = cpu_to_le32(target.pid); + msg->msg_hdr.dest_nid = cpu_to_le64(target.nid); + msg->msg_hdr.dest_pid = cpu_to_le32(target.pid); /* src_nid will be set later */ - msg->msg_hdr.src_pid = cpu_to_le32(the_lnet.ln_pid); + msg->msg_hdr.src_pid = cpu_to_le32(the_lnet.ln_pid); msg->msg_hdr.payload_length = cpu_to_le32(len); } @@ -635,7 +635,7 @@ void lnet_usr_translate_stats(struct lnet_ioctl_element_msg_stats *msg_stats, } deadline = lp->lpni_last_alive + - lp->lpni_net->net_tunables.lct_peer_timeout; + lp->lpni_net->net_tunables.lct_peer_timeout; alive = deadline > now; /* Update obsolete lpni_alive except for routers assumed to be dead @@ -911,7 +911,7 @@ void lnet_usr_translate_stats(struct lnet_ioctl_element_msg_stats *msg_stats, { struct lnet_peer_ni *txpeer = msg->msg_txpeer; struct lnet_msg *msg2; - struct lnet_ni *txni = msg->msg_txni; + struct lnet_ni *txni = msg->msg_txni; if (msg->msg_txcredit) { struct lnet_ni *ni = msg->msg_txni; @@ -1044,7 +1044,7 @@ void lnet_usr_translate_stats(struct lnet_ioctl_element_msg_stats *msg_stats, lnet_return_rx_credits_locked(struct lnet_msg *msg) { struct lnet_peer_ni *rxpeer = msg->msg_rxpeer; - struct lnet_ni *rxni = msg->msg_rxni; + struct lnet_ni *rxni = msg->msg_rxni; struct lnet_msg *msg2; if (msg->msg_rtrcredit) { @@ -1796,7 +1796,7 @@ void lnet_usr_translate_stats(struct lnet_ioctl_element_msg_stats *msg_stats, /* if we still can't find a peer ni then we can't reach it */ if (!best_lpni) { u32 net_id = peer_net ? peer_net->lpn_net_id : - LNET_NIDNET(dst_nid); + LNET_NIDNET(dst_nid); lnet_net_unlock(cpt); LCONSOLE_WARN("no peer_ni found on peer net %s\n", @@ -1912,7 +1912,6 @@ void lnet_usr_translate_stats(struct lnet_ioctl_element_msg_stats *msg_stats, } rc = lnet_post_send_locked(msg, 0); - if (!rc) CDEBUG(D_NET, "TRACE: %s(%s:%s) -> %s(%s:%s) : %s\n", libcfs_nid2str(msg->msg_hdr.src_nid), @@ -1931,8 +1930,8 @@ void lnet_usr_translate_stats(struct lnet_ioctl_element_msg_stats *msg_stats, int lnet_send(lnet_nid_t src_nid, struct lnet_msg *msg, lnet_nid_t rtr_nid) { - lnet_nid_t dst_nid = msg->msg_target.nid; - int rc; + lnet_nid_t dst_nid = msg->msg_target.nid; + int rc; /* * NB: rtr_nid is set to LNET_NID_ANY for all current use-cases, @@ -2008,19 +2007,19 @@ void lnet_usr_translate_stats(struct lnet_ioctl_element_msg_stats *msg_stats, le32_to_cpus(&hdr->msg.put.offset); /* Primary peer NID. */ - info.mi_id.nid = msg->msg_initiator; - info.mi_id.pid = hdr->src_pid; - info.mi_opc = LNET_MD_OP_PUT; - info.mi_portal = hdr->msg.put.ptl_index; + info.mi_id.nid = msg->msg_initiator; + info.mi_id.pid = hdr->src_pid; + info.mi_opc = LNET_MD_OP_PUT; + info.mi_portal = hdr->msg.put.ptl_index; info.mi_rlength = hdr->payload_length; info.mi_roffset = hdr->msg.put.offset; - info.mi_mbits = hdr->msg.put.match_bits; - info.mi_cpt = lnet_cpt_of_nid(msg->msg_rxpeer->lpni_nid, ni); + info.mi_mbits = hdr->msg.put.match_bits; + info.mi_cpt = lnet_cpt_of_nid(msg->msg_rxpeer->lpni_nid, ni); msg->msg_rx_ready_delay = !ni->ni_net->net_lnd->lnd_eager_recv; ready_delay = msg->msg_rx_ready_delay; - again: +again: rc = lnet_ptl_match_md(&info, msg); switch (rc) { default: @@ -2069,17 +2068,17 @@ void lnet_usr_translate_stats(struct lnet_ioctl_element_msg_stats *msg_stats, le32_to_cpus(&hdr->msg.get.sink_length); le32_to_cpus(&hdr->msg.get.src_offset); - source_id.nid = hdr->src_nid; - source_id.pid = hdr->src_pid; + source_id.nid = hdr->src_nid; + source_id.pid = hdr->src_pid; /* Primary peer NID */ - info.mi_id.nid = msg->msg_initiator; - info.mi_id.pid = hdr->src_pid; - info.mi_opc = LNET_MD_OP_GET; - info.mi_portal = hdr->msg.get.ptl_index; + info.mi_id.nid = msg->msg_initiator; + info.mi_id.pid = hdr->src_pid; + info.mi_opc = LNET_MD_OP_GET; + info.mi_portal = hdr->msg.get.ptl_index; info.mi_rlength = hdr->msg.get.sink_length; info.mi_roffset = hdr->msg.get.src_offset; - info.mi_mbits = hdr->msg.get.match_bits; - info.mi_cpt = lnet_cpt_of_nid(msg->msg_rxpeer->lpni_nid, ni); + info.mi_mbits = hdr->msg.get.match_bits; + info.mi_cpt = lnet_cpt_of_nid(msg->msg_rxpeer->lpni_nid, ni); rc = lnet_ptl_match_md(&info, msg); if (rc == LNET_MATCHMD_DROP) { @@ -2128,7 +2127,7 @@ void lnet_usr_translate_stats(struct lnet_ioctl_element_msg_stats *msg_stats, { void *private = msg->msg_private; struct lnet_hdr *hdr = &msg->msg_hdr; - struct lnet_process_id src = {0}; + struct lnet_process_id src = { 0 }; struct lnet_libmd *md; int rlength; int mlength; @@ -2192,7 +2191,7 @@ void lnet_usr_translate_stats(struct lnet_ioctl_element_msg_stats *msg_stats, lnet_parse_ack(struct lnet_ni *ni, struct lnet_msg *msg) { struct lnet_hdr *hdr = &msg->msg_hdr; - struct lnet_process_id src = {0}; + struct lnet_process_id src = { 0 }; struct lnet_libmd *md; int cpt; @@ -2316,8 +2315,8 @@ void lnet_usr_translate_stats(struct lnet_ioctl_element_msg_stats *msg_stats, void lnet_print_hdr(struct lnet_hdr *hdr) { - struct lnet_process_id src = {0}; - struct lnet_process_id dst = {0}; + struct lnet_process_id src = { 0 }; + struct lnet_process_id dst = { 0 }; char *type_str = lnet_msgtyp2str(hdr->type); src.nid = hdr->src_nid; @@ -2533,17 +2532,16 @@ void lnet_usr_translate_stats(struct lnet_ioctl_element_msg_stats *msg_stats, /* for building message event */ msg->msg_from = from_nid; if (!for_me) { - msg->msg_target.pid = dest_pid; - msg->msg_target.nid = dest_nid; - msg->msg_routing = 1; - + msg->msg_target.pid = dest_pid; + msg->msg_target.nid = dest_nid; + msg->msg_routing = 1; } else { /* convert common msg->hdr fields to host byteorder */ - msg->msg_hdr.type = type; - msg->msg_hdr.src_nid = src_nid; + msg->msg_hdr.type = type; + msg->msg_hdr.src_nid = src_nid; le32_to_cpus(&msg->msg_hdr.src_pid); - msg->msg_hdr.dest_nid = dest_nid; - msg->msg_hdr.dest_pid = dest_pid; + msg->msg_hdr.dest_nid = dest_nid; + msg->msg_hdr.dest_pid = dest_pid; msg->msg_hdr.payload_length = payload_length; } @@ -2609,11 +2607,11 @@ void lnet_usr_translate_stats(struct lnet_ioctl_element_msg_stats *msg_stats, goto free_drop; return 0; - free_drop: +free_drop: LASSERT(!msg->msg_md); lnet_finalize(msg, rc); - drop: +drop: lnet_drop_message(ni, cpt, private, payload_length, type); return 0; } @@ -2623,7 +2621,7 @@ void lnet_usr_translate_stats(struct lnet_ioctl_element_msg_stats *msg_stats, lnet_drop_delayed_msg_list(struct list_head *head, char *reason) { while (!list_empty(head)) { - struct lnet_process_id id = {0}; + struct lnet_process_id id = { 0 }; struct lnet_msg *msg; msg = list_entry(head->next, struct lnet_msg, msg_list); @@ -2887,7 +2885,7 @@ struct lnet_msg * return msg; - drop: +drop: cpt = lnet_cpt_of_nid(peer_id.nid, ni); lnet_net_lock(cpt); diff --git a/drivers/staging/lustre/lnet/lnet/lib-msg.c b/drivers/staging/lustre/lnet/lnet/lib-msg.c index 7f58cfe..b9e9257 100644 --- a/drivers/staging/lustre/lnet/lnet/lib-msg.c +++ b/drivers/staging/lustre/lnet/lnet/lib-msg.c @@ -44,9 +44,9 @@ { memset(ev, 0, sizeof(*ev)); - ev->status = 0; + ev->status = 0; ev->unlinked = 1; - ev->type = LNET_EVENT_UNLINK; + ev->type = LNET_EVENT_UNLINK; lnet_md_deconstruct(md, &ev->md); lnet_md2handle(&ev->md_handle, md); } @@ -58,7 +58,7 @@ lnet_build_msg_event(struct lnet_msg *msg, enum lnet_event_kind ev_type) { struct lnet_hdr *hdr = &msg->msg_hdr; - struct lnet_event *ev = &msg->msg_ev; + struct lnet_event *ev = &msg->msg_ev; LASSERT(!msg->msg_routing); @@ -67,27 +67,27 @@ if (ev_type == LNET_EVENT_SEND) { /* event for active message */ - ev->target.nid = le64_to_cpu(hdr->dest_nid); - ev->target.pid = le32_to_cpu(hdr->dest_pid); + ev->target.nid = le64_to_cpu(hdr->dest_nid); + ev->target.pid = le32_to_cpu(hdr->dest_pid); ev->initiator.nid = LNET_NID_ANY; ev->initiator.pid = the_lnet.ln_pid; - ev->source.nid = LNET_NID_ANY; - ev->source.pid = the_lnet.ln_pid; - ev->sender = LNET_NID_ANY; + ev->source.nid = LNET_NID_ANY; + ev->source.pid = the_lnet.ln_pid; + ev->sender = LNET_NID_ANY; } else { /* event for passive message */ - ev->target.pid = hdr->dest_pid; - ev->target.nid = hdr->dest_nid; + ev->target.pid = hdr->dest_pid; + ev->target.nid = hdr->dest_nid; ev->initiator.pid = hdr->src_pid; /* Multi-Rail: resolve src_nid to "primary" peer NID */ ev->initiator.nid = msg->msg_initiator; /* Multi-Rail: track source NID. */ - ev->source.pid = hdr->src_pid; - ev->source.nid = hdr->src_nid; - ev->rlength = hdr->payload_length; - ev->sender = msg->msg_from; - ev->mlength = msg->msg_wanted; - ev->offset = msg->msg_offset; + ev->source.pid = hdr->src_pid; + ev->source.nid = hdr->src_nid; + ev->rlength = hdr->payload_length; + ev->sender = msg->msg_from; + ev->mlength = msg->msg_wanted; + ev->offset = msg->msg_offset; } switch (ev_type) { @@ -95,20 +95,20 @@ LBUG(); case LNET_EVENT_PUT: /* passive PUT */ - ev->pt_index = hdr->msg.put.ptl_index; + ev->pt_index = hdr->msg.put.ptl_index; ev->match_bits = hdr->msg.put.match_bits; - ev->hdr_data = hdr->msg.put.hdr_data; + ev->hdr_data = hdr->msg.put.hdr_data; return; case LNET_EVENT_GET: /* passive GET */ - ev->pt_index = hdr->msg.get.ptl_index; + ev->pt_index = hdr->msg.get.ptl_index; ev->match_bits = hdr->msg.get.match_bits; - ev->hdr_data = 0; + ev->hdr_data = 0; return; case LNET_EVENT_ACK: /* ACK */ ev->match_bits = hdr->msg.ack.match_bits; - ev->mlength = hdr->msg.ack.mlength; + ev->mlength = hdr->msg.ack.mlength; return; case LNET_EVENT_REPLY: /* REPLY */ @@ -116,21 +116,21 @@ case LNET_EVENT_SEND: /* active message */ if (msg->msg_type == LNET_MSG_PUT) { - ev->pt_index = le32_to_cpu(hdr->msg.put.ptl_index); + ev->pt_index = le32_to_cpu(hdr->msg.put.ptl_index); ev->match_bits = le64_to_cpu(hdr->msg.put.match_bits); - ev->offset = le32_to_cpu(hdr->msg.put.offset); - ev->mlength = - ev->rlength = le32_to_cpu(hdr->payload_length); - ev->hdr_data = le64_to_cpu(hdr->msg.put.hdr_data); + ev->offset = le32_to_cpu(hdr->msg.put.offset); + ev->mlength = + ev->rlength = le32_to_cpu(hdr->payload_length); + ev->hdr_data = le64_to_cpu(hdr->msg.put.hdr_data); } else { LASSERT(msg->msg_type == LNET_MSG_GET); - ev->pt_index = le32_to_cpu(hdr->msg.get.ptl_index); + ev->pt_index = le32_to_cpu(hdr->msg.get.ptl_index); ev->match_bits = le64_to_cpu(hdr->msg.get.match_bits); - ev->mlength = - ev->rlength = le32_to_cpu(hdr->msg.get.sink_length); - ev->offset = le32_to_cpu(hdr->msg.get.src_offset); - ev->hdr_data = 0; + ev->mlength = + ev->rlength = le32_to_cpu(hdr->msg.get.sink_length); + ev->offset = le32_to_cpu(hdr->msg.get.src_offset); + ev->hdr_data = 0; } return; } @@ -140,7 +140,7 @@ lnet_msg_commit(struct lnet_msg *msg, int cpt) { struct lnet_msg_container *container = the_lnet.ln_msg_containers[cpt]; - struct lnet_counters *counters = the_lnet.ln_counters[cpt]; + struct lnet_counters *counters = the_lnet.ln_counters[cpt]; /* routed message can be committed for both receiving and sending */ LASSERT(!msg->msg_tx_committed); @@ -172,7 +172,7 @@ static void lnet_msg_decommit_tx(struct lnet_msg *msg, int status) { - struct lnet_counters *counters; + struct lnet_counters *counters; struct lnet_event *ev = &msg->msg_ev; LASSERT(msg->msg_tx_committed); @@ -294,7 +294,7 @@ if (ev->type == LNET_EVENT_PUT || ev->type == LNET_EVENT_REPLY) counters->recv_length += msg->msg_wanted; - out: +out: lnet_return_rx_credits_locked(msg); msg->msg_rx_committed = 0; } @@ -375,7 +375,7 @@ unlink = lnet_md_unlinkable(md); if (md->md_eq) { - msg->msg_ev.status = status; + msg->msg_ev.status = status; msg->msg_ev.unlinked = unlink; lnet_eq_enqueue_event(md->md_eq, &msg->msg_ev); } @@ -488,7 +488,7 @@ lnet_res_unlock(cpt); } - again: +again: rc = 0; if (!msg->msg_tx_committed && !msg->msg_rx_committed) { /* not committed to network yet */ diff --git a/drivers/staging/lustre/lnet/lnet/lib-ptl.c b/drivers/staging/lustre/lnet/lnet/lib-ptl.c index fa391ee..ea232c7 100644 --- a/drivers/staging/lustre/lnet/lnet/lib-ptl.c +++ b/drivers/staging/lustre/lnet/lnet/lib-ptl.c @@ -74,7 +74,7 @@ return 1; - match: +match: if ((lnet_ptl_is_unique(ptl) && !unique) || (lnet_ptl_is_wildcard(ptl) && unique)) return 0; @@ -387,7 +387,7 @@ struct list_head * head = &mtable->mt_mhash[LNET_MT_HASH_IGNORE]; else head = lnet_mt_match_head(mtable, info->mi_id, info->mi_mbits); - again: +again: /* NB: only wildcard portal needs to return LNET_MATCHMD_EXHAUSTED */ if (lnet_ptl_is_wildcard(the_lnet.ln_portals[mtable->mt_portal])) exhausted = LNET_MATCHMD_EXHAUSTED; @@ -634,9 +634,9 @@ struct list_head * info->mi_mbits, info->mi_roffset, info->mi_rlength); } goto out0; - out1: +out1: lnet_res_unlock(mtable->mt_cpt); - out0: +out0: /* EXHAUSTED bit is only meaningful for internal functions */ return rc & ~LNET_MATCHMD_EXHAUSTED; } @@ -678,7 +678,7 @@ struct list_head * lnet_ptl_lock(ptl); head = &ptl->ptl_msg_stealing; - again: +again: list_for_each_entry_safe(msg, tmp, head, msg_list) { struct lnet_match_info info; struct lnet_hdr *hdr; @@ -688,13 +688,13 @@ struct list_head * hdr = &msg->msg_hdr; /* Multi-Rail: Primary peer NID */ - info.mi_id.nid = msg->msg_initiator; - info.mi_id.pid = hdr->src_pid; - info.mi_opc = LNET_MD_OP_PUT; - info.mi_portal = hdr->msg.put.ptl_index; + info.mi_id.nid = msg->msg_initiator; + info.mi_id.pid = hdr->src_pid; + info.mi_opc = LNET_MD_OP_PUT; + info.mi_portal = hdr->msg.put.ptl_index; info.mi_rlength = hdr->payload_length; info.mi_roffset = hdr->msg.put.offset; - info.mi_mbits = hdr->msg.put.match_bits; + info.mi_mbits = hdr->msg.put.match_bits; rc = lnet_try_match_md(md, &info, msg); @@ -824,7 +824,7 @@ struct list_head * } return 0; - failed: +failed: lnet_ptl_cleanup(ptl); return -ENOMEM; } diff --git a/drivers/staging/lustre/lnet/lnet/lib-socket.c b/drivers/staging/lustre/lnet/lnet/lib-socket.c index cff3d1e..095f9f5 100644 --- a/drivers/staging/lustre/lnet/lnet/lib-socket.c +++ b/drivers/staging/lustre/lnet/lnet/lib-socket.c @@ -50,8 +50,11 @@ long jiffies_left = timeout * msecs_to_jiffies(MSEC_PER_SEC); unsigned long then; struct timeval tv; - struct kvec iov = { .iov_base = buffer, .iov_len = nob }; - struct msghdr msg = {NULL,}; + struct kvec iov = { + .iov_base = buffer, + .iov_len = nob + }; + struct msghdr msg = { NULL, }; LASSERT(nob > 0); /* @@ -102,9 +105,9 @@ long jiffies_left = timeout * msecs_to_jiffies(MSEC_PER_SEC); unsigned long then; struct timeval tv; - struct kvec iov = { + struct kvec iov = { .iov_base = buffer, - .iov_len = nob + .iov_len = nob }; struct msghdr msg = { .msg_flags = 0 diff --git a/drivers/staging/lustre/lnet/lnet/module.c b/drivers/staging/lustre/lnet/lnet/module.c index 4c08c74..f306569 100644 --- a/drivers/staging/lustre/lnet/lnet/module.c +++ b/drivers/staging/lustre/lnet/lnet/module.c @@ -52,7 +52,6 @@ if (!the_lnet.ln_niinit_self) { rc = try_module_get(THIS_MODULE); - if (rc != 1) goto out; @@ -229,7 +228,7 @@ } static struct notifier_block lnet_ioctl_handler = { - .notifier_call = lnet_ioctl, + .notifier_call = lnet_ioctl, }; static int __init lnet_init(void) diff --git a/drivers/staging/lustre/lnet/lnet/net_fault.c b/drivers/staging/lustre/lnet/lnet/net_fault.c index e2c7468..4234ce1 100644 --- a/drivers/staging/lustre/lnet/lnet/net_fault.c +++ b/drivers/staging/lustre/lnet/lnet/net_fault.c @@ -614,7 +614,6 @@ struct delay_daemon_data { rc = lnet_parse_local(ni, msg); if (!rc) continue; - } else { lnet_net_lock(cpt); rc = lnet_parse_forward_locked(ni, msg); diff --git a/drivers/staging/lustre/lnet/lnet/nidstrings.c b/drivers/staging/lustre/lnet/lnet/nidstrings.c index 0f2b75e..8f3d87c 100644 --- a/drivers/staging/lustre/lnet/lnet/nidstrings.c +++ b/drivers/staging/lustre/lnet/lnet/nidstrings.c @@ -60,8 +60,8 @@ * between getting its string and using it. */ -static char libcfs_nidstrings[LNET_NIDSTR_COUNT][LNET_NIDSTR_SIZE]; -static int libcfs_nidstring_idx; +static char libcfs_nidstrings[LNET_NIDSTR_COUNT][LNET_NIDSTR_SIZE]; +static int libcfs_nidstring_idx; static DEFINE_SPINLOCK(libcfs_nidstring_lock); @@ -117,23 +117,23 @@ struct nidrange { * Link to list of this structures which is built on nid range * list parsing. */ - struct list_head nr_link; + struct list_head nr_link; /** * List head for addrrange::ar_link. */ - struct list_head nr_addrranges; + struct list_head nr_addrranges; /** * Flag indicating that *@ is found. */ - int nr_all; + int nr_all; /** * Pointer to corresponding element of libcfs_netstrfns. */ - struct netstrfns *nr_netstrfns; + struct netstrfns *nr_netstrfns; /** * Number of network. E.g. 5 if \ is "elan5". */ - int nr_netnum; + int nr_netnum; }; /** @@ -143,11 +143,11 @@ struct addrrange { /** * Link to nidrange::nr_addrranges. */ - struct list_head ar_link; + struct list_head ar_link; /** * List head for cfs_expr_list::el_list. */ - struct list_head ar_numaddr_ranges; + struct list_head ar_numaddr_ranges; }; /** @@ -471,8 +471,8 @@ static void cfs_ip_ar_min_max(struct addrrange *ar, u32 *min_nid, struct cfs_expr_list *el; struct cfs_range_expr *re; u32 tmp_ip_addr = 0; - unsigned int min_ip[4] = {0}; - unsigned int max_ip[4] = {0}; + unsigned int min_ip[4] = { 0 }; + unsigned int max_ip[4] = { 0 }; int re_count = 0; list_for_each_entry(el, &ar->ar_numaddr_ranges, el_link) { @@ -794,11 +794,11 @@ static void cfs_ip_min_max(struct list_head *nidlist, u32 *min_nid, static int libcfs_ip_str2addr(const char *str, int nob, u32 *addr) { - unsigned int a; - unsigned int b; - unsigned int c; - unsigned int d; - int n = nob; /* XscanfX */ + unsigned int a; + unsigned int b; + unsigned int c; + unsigned int d; + int n = nob; /* XscanfX */ /* numeric IP? */ if (sscanf(str, "%u.%u.%u.%u%n", &a, &b, &c, &d, &n) >= 4 && @@ -897,7 +897,7 @@ static void cfs_ip_min_max(struct list_head *nidlist, u32 *min_nid, static int libcfs_num_str2addr(const char *str, int nob, u32 *addr) { - int n; + int n; n = nob; if (sscanf(str, "0x%x%n", addr, &n) >= 1 && n == nob) @@ -926,7 +926,7 @@ static void cfs_ip_min_max(struct list_head *nidlist, u32 *min_nid, libcfs_num_parse(char *str, int len, struct list_head *list) { struct cfs_expr_list *el; - int rc; + int rc; rc = cfs_expr_list_parse(str, len, 0, MAX_NUMERIC_VALUE, &el); if (!rc) @@ -1049,7 +1049,7 @@ static void cfs_ip_min_max(struct list_head *nidlist, u32 *min_nid, static struct netstrfns * libcfs_name2netstrfns(const char *name) { - int i; + int i; for (i = 0; i < libcfs_nnetstrfns; i++) if (!strcmp(libcfs_netstrfns[i].nf_name, name)) @@ -1194,7 +1194,7 @@ static void cfs_ip_min_max(struct list_head *nidlist, u32 *min_nid, u32 libcfs_str2net(const char *str) { - u32 net; + u32 net; if (libcfs_str2net_internal(str, &net)) return net; diff --git a/drivers/staging/lustre/lnet/lnet/peer.c b/drivers/staging/lustre/lnet/lnet/peer.c index d807dd4..dfe1f3d 100644 --- a/drivers/staging/lustre/lnet/lnet/peer.c +++ b/drivers/staging/lustre/lnet/lnet/peer.c @@ -586,8 +586,8 @@ void lnet_peer_uninit(void) static struct lnet_peer_ni * lnet_get_peer_ni_locked(struct lnet_peer_table *ptable, lnet_nid_t nid) { - struct list_head *peers; - struct lnet_peer_ni *lp; + struct list_head *peers; + struct lnet_peer_ni *lp; LASSERT(the_lnet.ln_state == LNET_STATE_RUNNING); @@ -1069,6 +1069,7 @@ struct lnet_peer_net * lnet_peer_get_net_locked(struct lnet_peer *peer, u32 net_id) { struct lnet_peer_net *peer_net; + list_for_each_entry(peer_net, &peer->lp_peer_nets, lpn_peer_nets) { if (peer_net->lpn_net_id == net_id) return peer_net; @@ -1088,9 +1089,9 @@ struct lnet_peer_net * */ static int lnet_peer_attach_peer_ni(struct lnet_peer *lp, - struct lnet_peer_net *lpn, - struct lnet_peer_ni *lpni, - unsigned int flags) + struct lnet_peer_net *lpn, + struct lnet_peer_ni *lpni, + unsigned int flags) { struct lnet_peer_table *ptable; @@ -2686,12 +2687,12 @@ static int lnet_peer_send_ping(struct lnet_peer *lp) } /* initialize md content */ - md.start = &pbuf->pb_info; - md.length = LNET_PING_INFO_SIZE(nnis); + md.start = &pbuf->pb_info; + md.length = LNET_PING_INFO_SIZE(nnis); md.threshold = 2; /* GET/REPLY */ - md.max_size = 0; - md.options = LNET_MD_TRUNCATE; - md.user_ptr = lp; + md.max_size = 0; + md.options = LNET_MD_TRUNCATE; + md.user_ptr = lp; md.eq_handle = the_lnet.ln_dc_eqh; rc = LNetMDBind(md, LNET_UNLINK, &lp->lp_ping_mdh); @@ -2715,7 +2716,6 @@ static int lnet_peer_send_ping(struct lnet_peer *lp) rc = LNetGet(LNET_NID_ANY, lp->lp_ping_mdh, id, LNET_RESERVED_PORTAL, LNET_PROTO_PING_MATCHBITS, 0); - if (rc) goto fail_unlink_md; @@ -2792,13 +2792,13 @@ static int lnet_peer_send_push(struct lnet_peer *lp) lnet_net_unlock(cpt); /* Push source MD */ - md.start = &pbuf->pb_info; - md.length = LNET_PING_INFO_SIZE(pbuf->pb_nnis); + md.start = &pbuf->pb_info; + md.length = LNET_PING_INFO_SIZE(pbuf->pb_nnis); md.threshold = 2; /* Put/Ack */ - md.max_size = 0; - md.options = 0; + md.max_size = 0; + md.options = 0; md.eq_handle = the_lnet.ln_dc_eqh; - md.user_ptr = lp; + md.user_ptr = lp; rc = LNetMDBind(md, LNET_UNLINK, &lp->lp_push_mdh); if (rc) { @@ -2821,7 +2821,6 @@ static int lnet_peer_send_push(struct lnet_peer *lp) rc = LNetPut(LNET_NID_ANY, lp->lp_push_mdh, LNET_ACK_REQ, id, LNET_RESERVED_PORTAL, LNET_PROTO_PING_MATCHBITS, 0, 0); - if (rc) goto fail_unlink; @@ -3315,8 +3314,8 @@ int lnet_get_peer_info(struct lnet_ioctl_peer_cfg *cfg, void __user *bulk) goto out; } - size = sizeof(nid) + sizeof(*lpni_info) + sizeof(*lpni_stats) - + sizeof(*lpni_msg_stats); + size = sizeof(nid) + sizeof(*lpni_info) + sizeof(*lpni_stats) + + sizeof(*lpni_msg_stats); size *= lp->lp_nnis; if (size > cfg->prcfg_size) { cfg->prcfg_size = size; diff --git a/drivers/staging/lustre/lnet/lnet/router.c b/drivers/staging/lustre/lnet/lnet/router.c index 22c88ec..463b123 100644 --- a/drivers/staging/lustre/lnet/lnet/router.c +++ b/drivers/staging/lustre/lnet/lnet/router.c @@ -172,7 +172,7 @@ notifylnd = lp->lpni_notifylnd; lp->lpni_notifylnd = 0; - lp->lpni_notify = 0; + lp->lpni_notify = 0; if (notifylnd && ni->ni_net->net_lnd->lnd_notify) { spin_unlock(&lp->lpni_lock); @@ -274,6 +274,7 @@ static void lnet_shuffle_seed(void) * the NID for this node gives the most entropy in the low bits */ while ((ni = lnet_get_next_ni_locked(NULL, ni))) { u32 lnd_type, seed; + lnd_type = LNET_NETTYP(LNET_NIDNET(ni->ni_nid)); if (lnd_type != LOLND) { seed = (LNET_NIDADDR(ni->ni_nid) | lnd_type); @@ -386,7 +387,6 @@ static void lnet_shuffle_seed(void) /* Search for a duplicate route (it's a NOOP if it is) */ add_route = 1; list_for_each_entry(route2, &rnet2->lrn_routes, lr_list) { - if (route2->lr_gateway == route->lr_gateway) { add_route = 0; break; @@ -501,7 +501,7 @@ static void lnet_shuffle_seed(void) else rn_list = lnet_net2rnethash(net); - again: +again: list_for_each_entry(rnet, rn_list, lrn_list) { if (!(net == LNET_NIDNET(LNET_NID_ANY) || net == rnet->lrn_net)) @@ -601,10 +601,10 @@ int lnet_get_rtr_pool_cfg(int idx, struct lnet_ioctl_pool_cfg *pool_cfg) list_for_each_entry(rnet, rn_list, lrn_list) { list_for_each_entry(route, &rnet->lrn_routes, lr_list) { if (!idx--) { - *net = rnet->lrn_net; - *hops = route->lr_hops; + *net = rnet->lrn_net; + *hops = route->lr_hops; *priority = route->lr_priority; - *gateway = route->lr_gateway->lpni_nid; + *gateway = route->lr_gateway->lpni_nid; *alive = lnet_is_route_alive(route); lnet_net_unlock(cpt); return 0; @@ -648,7 +648,7 @@ int lnet_get_rtr_pool_cfg(int idx, struct lnet_ioctl_pool_cfg *pool_cfg) struct lnet_ping_buffer *pbuf = rcd->rcd_pingbuffer; struct lnet_peer_ni *gw = rcd->rcd_gateway; struct lnet_route *rte; - int nnis; + int nnis; if (!gw->lpni_alive || !pbuf) return; @@ -799,7 +799,7 @@ int lnet_get_rtr_pool_cfg(int idx, struct lnet_ioctl_pool_cfg *pool_cfg) if (avoid_asym_router_failure && !event->status) lnet_parse_rc_info(rcd); - out: +out: lnet_net_unlock(lp->lpni_cpt); } @@ -1069,14 +1069,14 @@ int lnet_get_rtr_pool_cfg(int idx, struct lnet_ioctl_pool_cfg *pool_cfg) id.pid = LNET_PID_LUSTRE; CDEBUG(D_NET, "Check: %s\n", libcfs_id2str(id)); - rtr->lpni_ping_notsent = 1; + rtr->lpni_ping_notsent = 1; rtr->lpni_ping_timestamp = now; mdh = rcd->rcd_mdh; if (!rtr->lpni_ping_deadline) { rtr->lpni_ping_deadline = ktime_get_seconds() + - router_ping_timeout; + router_ping_timeout; } lnet_net_unlock(rtr->lpni_cpt); @@ -1652,7 +1652,7 @@ int lnet_get_rtr_pool_cfg(int idx, struct lnet_ioctl_pool_cfg *pool_cfg) return 0; - failed: +failed: lnet_rtrpools_free(0); return rc; } @@ -1797,8 +1797,8 @@ int lnet_get_rtr_pool_cfg(int idx, struct lnet_ioctl_pool_cfg *pool_cfg) return -EINVAL; } - if (ni && !alive && /* LND telling me she's down */ - !auto_down) { /* auto-down disabled */ + if (ni && !alive && /* LND telling me she's down */ + !auto_down) { /* auto-down disabled */ CDEBUG(D_NET, "Auto-down disabled\n"); return 0; } diff --git a/drivers/staging/lustre/lnet/lnet/router_proc.c b/drivers/staging/lustre/lnet/lnet/router_proc.c index e8cc70f..94ef441 100644 --- a/drivers/staging/lustre/lnet/lnet/router_proc.c +++ b/drivers/staging/lustre/lnet/lnet/router_proc.c @@ -66,8 +66,8 @@ #define LNET_PROC_HOFF_GET(pos) \ (int)((pos) & LNET_PROC_HOFF_MASK) -#define LNET_PROC_POS_MAKE(cpt, ver, hash, off) \ - (((((loff_t)(cpt)) & LNET_PROC_CPT_MASK) << LNET_PROC_VPOS_BITS) | \ +#define LNET_PROC_POS_MAKE(cpt, ver, hash, off) \ + (((((loff_t)(cpt)) & LNET_PROC_CPT_MASK) << LNET_PROC_VPOS_BITS) | \ ((((loff_t)(ver)) & LNET_PROC_VER_MASK) << LNET_PROC_HPOS_BITS) | \ ((((loff_t)(hash)) & LNET_PROC_HASH_MASK) << LNET_PROC_HOFF_BITS) | \ ((off) & LNET_PROC_HOFF_MASK)) @@ -91,7 +91,6 @@ static int proc_lnet_stats(struct ctl_table *table, int write, } /* read */ - ctrs = kzalloc(sizeof(*ctrs), GFP_NOFS); if (!ctrs) return -ENOMEM; @@ -395,8 +394,8 @@ static int proc_lnet_peers(struct ctl_table *table, int write, struct lnet_peer_table *ptable; char *tmpstr = NULL; char *s; - int cpt = LNET_PROC_CPT_GET(*ppos); - int ver = LNET_PROC_VER_GET(*ppos); + int cpt = LNET_PROC_CPT_GET(*ppos); + int ver = LNET_PROC_VER_GET(*ppos); int hash = LNET_PROC_HASH_GET(*ppos); int hoff = LNET_PROC_HOFF_GET(*ppos); int rc = 0; @@ -456,7 +455,7 @@ static int proc_lnet_peers(struct ctl_table *table, int write, struct lnet_peer_ni *peer; struct list_head *p; int skip; - again: +again: p = NULL; peer = NULL; skip = hoff - 1; @@ -630,7 +629,7 @@ static int proc_lnet_buffers(struct ctl_table *table, int write, lnet_net_unlock(LNET_LOCK_EX); } - out: +out: len = s - tmpstr; if (pos >= min_t(int, len, strlen(tmpstr))) @@ -787,9 +786,9 @@ static int proc_lnet_nis(struct ctl_table *table, int write, } struct lnet_portal_rotors { - int pr_value; - const char *pr_name; - const char *pr_desc; + int pr_value; + const char *pr_name; + const char *pr_desc; }; static struct lnet_portal_rotors portal_rotors[] = { @@ -890,39 +889,39 @@ static int proc_lnet_portal_rotor(struct ctl_table *table, int write, * to go via /proc for portability. */ { - .procname = "stats", - .mode = 0644, - .proc_handler = &proc_lnet_stats, + .procname = "stats", + .mode = 0644, + .proc_handler = &proc_lnet_stats, }, { - .procname = "routes", - .mode = 0444, - .proc_handler = &proc_lnet_routes, + .procname = "routes", + .mode = 0444, + .proc_handler = &proc_lnet_routes, }, { - .procname = "routers", - .mode = 0444, - .proc_handler = &proc_lnet_routers, + .procname = "routers", + .mode = 0444, + .proc_handler = &proc_lnet_routers, }, { - .procname = "peers", - .mode = 0644, - .proc_handler = &proc_lnet_peers, + .procname = "peers", + .mode = 0644, + .proc_handler = &proc_lnet_peers, }, { - .procname = "buffers", - .mode = 0444, - .proc_handler = &proc_lnet_buffers, + .procname = "buffers", + .mode = 0444, + .proc_handler = &proc_lnet_buffers, }, { - .procname = "nis", - .mode = 0644, - .proc_handler = &proc_lnet_nis, + .procname = "nis", + .mode = 0644, + .proc_handler = &proc_lnet_nis, }, { - .procname = "portal_rotor", - .mode = 0644, - .proc_handler = &proc_lnet_portal_rotor, + .procname = "portal_rotor", + .mode = 0644, + .proc_handler = &proc_lnet_portal_rotor, }, { } -- 1.8.3.1 From jsimmons at infradead.org Thu Jan 31 17:19:29 2019 From: jsimmons at infradead.org (James Simmons) Date: Thu, 31 Jan 2019 12:19:29 -0500 Subject: [lustre-devel] [PATCH 25/26] socklnd: cleanup white spaces In-Reply-To: <1548955170-13456-1-git-send-email-jsimmons@infradead.org> References: <1548955170-13456-1-git-send-email-jsimmons@infradead.org> Message-ID: <1548955170-13456-26-git-send-email-jsimmons@infradead.org> The ksocklnd code is very messy and difficult to read. Remove excess white space and properly align data structures so they are easy on the eyes. Signed-off-by: James Simmons --- .../staging/lustre/include/linux/lnet/socklnd.h | 6 +- .../staging/lustre/lnet/klnds/socklnd/socklnd.c | 71 +-- .../staging/lustre/lnet/klnds/socklnd/socklnd.h | 548 ++++++++++----------- .../staging/lustre/lnet/klnds/socklnd/socklnd_cb.c | 48 +- .../lustre/lnet/klnds/socklnd/socklnd_lib.c | 16 +- .../lustre/lnet/klnds/socklnd/socklnd_modparams.c | 54 +- .../lustre/lnet/klnds/socklnd/socklnd_proto.c | 79 ++- 7 files changed, 408 insertions(+), 414 deletions(-) diff --git a/drivers/staging/lustre/include/linux/lnet/socklnd.h b/drivers/staging/lustre/include/linux/lnet/socklnd.h index 20fa221d..ca814af 100644 --- a/drivers/staging/lustre/include/linux/lnet/socklnd.h +++ b/drivers/staging/lustre/include/linux/lnet/socklnd.h @@ -64,9 +64,9 @@ struct ksock_lnet_msg { } __packed; struct ksock_msg { - u32 ksm_type; /* type of socklnd message */ - u32 ksm_csum; /* checksum if != 0 */ - u64 ksm_zc_cookies[2]; /* Zero-Copy request/ACK cookie */ + u32 ksm_type; /* type of socklnd message */ + u32 ksm_csum; /* checksum if != 0 */ + u64 ksm_zc_cookies[2]; /* Zero-Copy request/ACK cookie */ union { struct ksock_lnet_msg lnetmsg; /* lnet message, it's empty if * it's NOOP diff --git a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c index f048f0a..785f76c 100644 --- a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c +++ b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c @@ -309,7 +309,7 @@ struct ksock_peer * } } } - out: +out: read_unlock(&ksocknal_data.ksnd_global_lock); return rc; } @@ -713,8 +713,8 @@ struct ksock_peer * ksocknal_match_peerip(struct ksock_interface *iface, u32 *ips, int nips) { int best_netmatch = 0; - int best_xor = 0; - int best = -1; + int best_xor = 0; + int best = -1; int this_xor; int this_netmatch; int i; @@ -944,7 +944,8 @@ struct ksock_peer * best_iface = iface; best_netmatch = this_netmatch; best_nroutes = iface->ksni_nroutes; - next_iface:; +next_iface: + ; } if (!best_iface) @@ -955,7 +956,8 @@ struct ksock_peer * ksocknal_add_route_locked(peer_ni, newroute); newroute = NULL; - next_ipaddr:; +next_ipaddr: + ; } write_unlock_bh(global_lock); @@ -982,7 +984,7 @@ struct ksock_peer * } lnet_ni_addref(ni); - cr->ksncr_ni = ni; + cr->ksncr_ni = ni; cr->ksncr_sock = sock; spin_lock_bh(&ksocknal_data.ksnd_connd_lock); @@ -1215,7 +1217,6 @@ struct ksock_peer * */ if (conn->ksnc_ipaddr != conn->ksnc_myipaddr) { list_for_each_entry(conn2, &peer_ni->ksnp_conns, ksnc_list) { - if (conn2->ksnc_ipaddr != conn->ksnc_ipaddr || conn2->ksnc_myipaddr != conn->ksnc_myipaddr || conn2->ksnc_type != conn->ksnc_type) @@ -1249,7 +1250,7 @@ struct ksock_peer * /* * Search for a route corresponding to the new connection and - * create an association. This allows incoming connections created + * create an association. This allows incoming connections created * by routes in my peer_ni to match my own route entries so I don't * continually create duplicate routes. */ @@ -1371,7 +1372,7 @@ struct ksock_peer * ksocknal_conn_decref(conn); return rc; - failed_2: +failed_2: if (!peer_ni->ksnp_closing && list_empty(&peer_ni->ksnp_conns) && list_empty(&peer_ni->ksnp_routes)) { @@ -1457,7 +1458,7 @@ struct ksock_peer * goto conn2_found; } route->ksnr_connected &= ~(1 << conn->ksnc_type); - conn2_found: +conn2_found: conn->ksnc_route = NULL; ksocknal_route_decref(route); /* drop conn's ref on route */ @@ -2121,7 +2122,7 @@ static int ksocknal_push(struct lnet_ni *ni, struct lnet_process_id id) switch (cmd) { case IOC_LIBCFS_GET_INTERFACE: { - struct ksock_net *net = ni->ni_data; + struct ksock_net *net = ni->ni_data; struct ksock_interface *iface; read_lock(&ksocknal_data.ksnd_global_lock); @@ -2164,8 +2165,8 @@ static int ksocknal_push(struct lnet_ni *ni, struct lnet_process_id id) if (rc) return rc; - data->ioc_nid = id.nid; - data->ioc_count = share_count; + data->ioc_nid = id.nid; + data->ioc_count = share_count; data->ioc_u32[0] = ip; data->ioc_u32[1] = port; data->ioc_u32[2] = myip; @@ -2178,14 +2179,14 @@ static int ksocknal_push(struct lnet_ni *ni, struct lnet_process_id id) id.nid = data->ioc_nid; id.pid = LNET_PID_LUSTRE; return ksocknal_add_peer(ni, id, - data->ioc_u32[0], /* IP */ - data->ioc_u32[1]); /* port */ + data->ioc_u32[0], /* IP */ + data->ioc_u32[1]); /* port */ case IOC_LIBCFS_DEL_PEER: id.nid = data->ioc_nid; id.pid = LNET_PID_ANY; return ksocknal_del_peer(ni, id, - data->ioc_u32[0]); /* IP */ + data->ioc_u32[0]); /* IP */ case IOC_LIBCFS_GET_CONN: { int txmem; @@ -2199,9 +2200,9 @@ static int ksocknal_push(struct lnet_ni *ni, struct lnet_process_id id) ksocknal_lib_get_conn_tunables(conn, &txmem, &rxmem, &nagle); - data->ioc_count = txmem; - data->ioc_nid = conn->ksnc_peer->ksnp_id.nid; - data->ioc_flags = nagle; + data->ioc_count = txmem; + data->ioc_nid = conn->ksnc_peer->ksnp_id.nid; + data->ioc_flags = nagle; data->ioc_u32[0] = conn->ksnc_ipaddr; data->ioc_u32[1] = conn->ksnc_port; data->ioc_u32[2] = conn->ksnc_myipaddr; @@ -2217,7 +2218,7 @@ static int ksocknal_push(struct lnet_ni *ni, struct lnet_process_id id) id.nid = data->ioc_nid; id.pid = LNET_PID_ANY; return ksocknal_close_matching_conns(id, - data->ioc_u32[0]); + data->ioc_u32[0]); case IOC_LIBCFS_REGISTER_MYNID: /* Ignore if this is a noop */ @@ -2449,8 +2450,8 @@ static int ksocknal_push(struct lnet_ni *ni, struct lnet_process_id id) } } - ksocknal_data.ksnd_connd_starting = 0; - ksocknal_data.ksnd_connd_failed_stamp = 0; + ksocknal_data.ksnd_connd_starting = 0; + ksocknal_data.ksnd_connd_failed_stamp = 0; ksocknal_data.ksnd_connd_starting_stamp = ktime_get_real_seconds(); /* * must have at least 2 connds to remain responsive to accepts while @@ -2495,7 +2496,7 @@ static int ksocknal_push(struct lnet_ni *ni, struct lnet_process_id id) return 0; - failed: +failed: ksocknal_base_shutdown(); return -ENETDOWN; } @@ -2512,7 +2513,7 @@ static int ksocknal_push(struct lnet_ni *ni, struct lnet_process_id id) list_for_each_entry(peer_ni, &ksocknal_data.ksnd_peers[i], ksnp_list) { struct ksock_route *route; - struct ksock_conn *conn; + struct ksock_conn *conn; if (peer_ni->ksnp_ni != ni) continue; @@ -2555,7 +2556,7 @@ static int ksocknal_push(struct lnet_ni *ni, struct lnet_process_id id) { struct ksock_net *net = ni->ni_data; int i; - struct lnet_process_id anyid = {0}; + struct lnet_process_id anyid = { 0 }; anyid.nid = LNET_NID_ANY; anyid.pid = LNET_PID_ANY; @@ -2846,9 +2847,9 @@ static int ksocknal_push(struct lnet_ni *ni, struct lnet_process_id id) return 0; - fail_1: +fail_1: kfree(net); - fail_0: +fail_0: if (!ksocknal_data.ksnd_nnets) ksocknal_base_shutdown(); @@ -2869,15 +2870,15 @@ static int __init ksocklnd_init(void) BUILD_BUG_ON(SOCKLND_CONN_ACK != SOCKLND_CONN_BULK_IN); /* initialize the_ksocklnd */ - the_ksocklnd.lnd_type = SOCKLND; - the_ksocklnd.lnd_startup = ksocknal_startup; + the_ksocklnd.lnd_type = SOCKLND; + the_ksocklnd.lnd_startup = ksocknal_startup; the_ksocklnd.lnd_shutdown = ksocknal_shutdown; - the_ksocklnd.lnd_ctl = ksocknal_ctl; - the_ksocklnd.lnd_send = ksocknal_send; - the_ksocklnd.lnd_recv = ksocknal_recv; - the_ksocklnd.lnd_notify = ksocknal_notify; - the_ksocklnd.lnd_query = ksocknal_query; - the_ksocklnd.lnd_accept = ksocknal_accept; + the_ksocklnd.lnd_ctl = ksocknal_ctl; + the_ksocklnd.lnd_send = ksocknal_send; + the_ksocklnd.lnd_recv = ksocknal_recv; + the_ksocklnd.lnd_notify = ksocknal_notify; + the_ksocklnd.lnd_query = ksocknal_query; + the_ksocklnd.lnd_accept = ksocknal_accept; rc = ksocknal_tunables_init(); if (rc) diff --git a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.h b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.h index a390381..ce1f9e7 100644 --- a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.h +++ b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.h @@ -69,36 +69,36 @@ * no risk if we're not running on a CONFIG_HIGHMEM platform. */ #ifdef CONFIG_HIGHMEM -# define SOCKNAL_RISK_KMAP_DEADLOCK 0 +# define SOCKNAL_RISK_KMAP_DEADLOCK 0 #else -# define SOCKNAL_RISK_KMAP_DEADLOCK 1 +# define SOCKNAL_RISK_KMAP_DEADLOCK 1 #endif struct ksock_sched_info; struct ksock_sched { /* per scheduler state */ - spinlock_t kss_lock; /* serialise */ - struct list_head kss_rx_conns; /* conn waiting to be read */ - struct list_head kss_tx_conns; /* conn waiting to be written */ - struct list_head kss_zombie_noop_txs; /* zombie noop tx list */ - wait_queue_head_t kss_waitq; /* where scheduler sleeps */ - int kss_nconns; /* # connections assigned to + spinlock_t kss_lock; /* serialise */ + struct list_head kss_rx_conns; /* conn waiting to be read */ + struct list_head kss_tx_conns; /* conn waiting to be written */ + struct list_head kss_zombie_noop_txs; /* zombie noop tx list */ + wait_queue_head_t kss_waitq; /* where scheduler sleeps */ + int kss_nconns; /* # connections assigned to * this scheduler */ - struct ksock_sched_info *kss_info; /* owner of it */ + struct ksock_sched_info *kss_info; /* owner of it */ }; struct ksock_sched_info { - int ksi_nthreads_max; /* max allowed threads */ - int ksi_nthreads; /* number of threads */ - int ksi_cpt; /* CPT id */ + int ksi_nthreads_max; /* max allowed threads */ + int ksi_nthreads; /* number of threads */ + int ksi_cpt; /* CPT id */ struct ksock_sched *ksi_scheds; /* array of schedulers */ }; -#define KSOCK_CPT_SHIFT 16 -#define KSOCK_THREAD_ID(cpt, sid) (((cpt) << KSOCK_CPT_SHIFT) | (sid)) -#define KSOCK_THREAD_CPT(id) ((id) >> KSOCK_CPT_SHIFT) -#define KSOCK_THREAD_SID(id) ((id) & ((1UL << KSOCK_CPT_SHIFT) - 1)) +#define KSOCK_CPT_SHIFT 16 +#define KSOCK_THREAD_ID(cpt, sid) (((cpt) << KSOCK_CPT_SHIFT) | (sid)) +#define KSOCK_THREAD_CPT(id) ((id) >> KSOCK_CPT_SHIFT) +#define KSOCK_THREAD_SID(id) ((id) & ((1UL << KSOCK_CPT_SHIFT) - 1)) struct ksock_interface { /* in-use interface */ u32 ksni_ipaddr; /* interface's IP address */ @@ -109,149 +109,149 @@ struct ksock_interface { /* in-use interface */ }; struct ksock_tunables { - int *ksnd_timeout; /* "stuck" socket timeout - * (seconds) - */ - int *ksnd_nscheds; /* # scheduler threads in each - * pool while starting - */ - int *ksnd_nconnds; /* # connection daemons */ - int *ksnd_nconnds_max; /* max # connection daemons */ - int *ksnd_min_reconnectms; /* first connection retry after - * (ms)... - */ - int *ksnd_max_reconnectms; /* ...exponentially increasing to - * this - */ - int *ksnd_eager_ack; /* make TCP ack eagerly? */ - int *ksnd_typed_conns; /* drive sockets by type? */ - int *ksnd_min_bulk; /* smallest "large" message */ - int *ksnd_tx_buffer_size; /* socket tx buffer size */ - int *ksnd_rx_buffer_size; /* socket rx buffer size */ - int *ksnd_nagle; /* enable NAGLE? */ - int *ksnd_round_robin; /* round robin for multiple - * interfaces - */ - int *ksnd_keepalive; /* # secs for sending keepalive - * NOOP - */ - int *ksnd_keepalive_idle; /* # idle secs before 1st probe - */ - int *ksnd_keepalive_count; /* # probes */ - int *ksnd_keepalive_intvl; /* time between probes */ - int *ksnd_credits; /* # concurrent sends */ - int *ksnd_peertxcredits; /* # concurrent sends to 1 peer - */ - int *ksnd_peerrtrcredits; /* # per-peer_ni router buffer - * credits - */ - int *ksnd_peertimeout; /* seconds to consider - * peer_ni dead - */ - int *ksnd_enable_csum; /* enable check sum */ - int *ksnd_inject_csum_error; /* set non-zero to inject - * checksum error - */ - int *ksnd_nonblk_zcack; /* always send zc-ack on - * non-blocking connection - */ - unsigned int *ksnd_zc_min_payload; /* minimum zero copy payload - * size - */ - int *ksnd_zc_recv; /* enable ZC receive (for - * Chelsio TOE) - */ - int *ksnd_zc_recv_min_nfrags; /* minimum # of fragments to - * enable ZC receive - */ + int *ksnd_timeout; /* "stuck" socket timeout + * (seconds) + */ + int *ksnd_nscheds; /* # scheduler threads in each + * pool while starting + */ + int *ksnd_nconnds; /* # connection daemons */ + int *ksnd_nconnds_max; /* max # connection daemons */ + int *ksnd_min_reconnectms; /* first connection retry after + * (ms)... + */ + int *ksnd_max_reconnectms; /* ...exponentially increasing to + * this + */ + int *ksnd_eager_ack; /* make TCP ack eagerly? */ + int *ksnd_typed_conns; /* drive sockets by type? */ + int *ksnd_min_bulk; /* smallest "large" message */ + int *ksnd_tx_buffer_size; /* socket tx buffer size */ + int *ksnd_rx_buffer_size; /* socket rx buffer size */ + int *ksnd_nagle; /* enable NAGLE? */ + int *ksnd_round_robin; /* round robin for multiple + * interfaces + */ + int *ksnd_keepalive; /* # secs for sending keepalive + * NOOP + */ + int *ksnd_keepalive_idle; /* # idle secs before 1st probe + */ + int *ksnd_keepalive_count; /* # probes */ + int *ksnd_keepalive_intvl; /* time between probes */ + int *ksnd_credits; /* # concurrent sends */ + int *ksnd_peertxcredits; /* # concurrent sends to 1 peer + */ + int *ksnd_peerrtrcredits; /* # per-peer_ni router buffer + * credits + */ + int *ksnd_peertimeout; /* seconds to consider + * peer_ni dead + */ + int *ksnd_enable_csum; /* enable check sum */ + int *ksnd_inject_csum_error;/* set non-zero to inject + * checksum error + */ + int *ksnd_nonblk_zcack; /* always send zc-ack on + * non-blocking connection + */ + unsigned int *ksnd_zc_min_payload; /* minimum zero copy payload + * size + */ + int *ksnd_zc_recv; /* enable ZC receive (for + * Chelsio TOE) + */ + int *ksnd_zc_recv_min_nfrags; /* minimum # of fragments to + * enable ZC receive + */ }; struct ksock_net { - u64 ksnn_incarnation; /* my epoch */ - spinlock_t ksnn_lock; /* serialise */ - struct list_head ksnn_list; /* chain on global list */ - int ksnn_npeers; /* # peers */ - int ksnn_shutdown; /* shutting down? */ - int ksnn_ninterfaces; /* IP interfaces */ - struct ksock_interface ksnn_interfaces[LNET_INTERFACES_NUM]; + u64 ksnn_incarnation; /* my epoch */ + spinlock_t ksnn_lock; /* serialise */ + struct list_head ksnn_list; /* chain on global list */ + int ksnn_npeers; /* # peers */ + int ksnn_shutdown; /* shutting down? */ + int ksnn_ninterfaces; /* IP interfaces */ + struct ksock_interface ksnn_interfaces[LNET_INTERFACES_NUM]; }; /** connd timeout */ -#define SOCKNAL_CONND_TIMEOUT 120 +#define SOCKNAL_CONND_TIMEOUT 120 /** reserved thread for accepting & creating new connd */ -#define SOCKNAL_CONND_RESV 1 +#define SOCKNAL_CONND_RESV 1 struct ksock_nal_data { - int ksnd_init; /* initialisation state + int ksnd_init; /* initialisation state */ - int ksnd_nnets; /* # networks set up */ - struct list_head ksnd_nets; /* list of nets */ - rwlock_t ksnd_global_lock; /* stabilize + int ksnd_nnets; /* # networks set up */ + struct list_head ksnd_nets; /* list of nets */ + rwlock_t ksnd_global_lock; /* stabilize * peer_ni/conn ops */ - struct list_head *ksnd_peers; /* hash table of all my + struct list_head *ksnd_peers; /* hash table of all my * known peers */ - int ksnd_peer_hash_size; /* size of ksnd_peers */ + int ksnd_peer_hash_size; /* size of ksnd_peers */ - int ksnd_nthreads; /* # live threads */ - int ksnd_shuttingdown; /* tell threads to exit + int ksnd_nthreads; /* # live threads */ + int ksnd_shuttingdown; /* tell threads to exit */ - struct ksock_sched_info **ksnd_sched_info; /* schedulers info */ + struct ksock_sched_info **ksnd_sched_info; /* schedulers info */ - atomic_t ksnd_nactive_txs; /* #active txs */ + atomic_t ksnd_nactive_txs; /* #active txs */ - struct list_head ksnd_deathrow_conns; /* conns to close: + struct list_head ksnd_deathrow_conns; /* conns to close: * reaper_lock */ - struct list_head ksnd_zombie_conns; /* conns to free: + struct list_head ksnd_zombie_conns; /* conns to free: * reaper_lock */ - struct list_head ksnd_enomem_conns; /* conns to retry: + struct list_head ksnd_enomem_conns; /* conns to retry: * reaper_lock */ - wait_queue_head_t ksnd_reaper_waitq; /* reaper sleeps here */ - time64_t ksnd_reaper_waketime; /* when reaper will wake + wait_queue_head_t ksnd_reaper_waitq; /* reaper sleeps here */ + time64_t ksnd_reaper_waketime; /* when reaper will wake */ - spinlock_t ksnd_reaper_lock; /* serialise */ + spinlock_t ksnd_reaper_lock; /* serialise */ - int ksnd_enomem_tx; /* test ENOMEM sender */ - int ksnd_stall_tx; /* test sluggish sender + int ksnd_enomem_tx; /* test ENOMEM sender */ + int ksnd_stall_tx; /* test sluggish sender */ - int ksnd_stall_rx; /* test sluggish + int ksnd_stall_rx; /* test sluggish * receiver */ - struct list_head ksnd_connd_connreqs; /* incoming connection + struct list_head ksnd_connd_connreqs; /* incoming connection * requests */ - struct list_head ksnd_connd_routes; /* routes waiting to be + struct list_head ksnd_connd_routes; /* routes waiting to be * connected */ - wait_queue_head_t ksnd_connd_waitq; /* connds sleep here */ - int ksnd_connd_connecting; /* # connds connecting + wait_queue_head_t ksnd_connd_waitq; /* connds sleep here */ + int ksnd_connd_connecting; /* # connds connecting */ - time64_t ksnd_connd_failed_stamp;/* time stamp of the + time64_t ksnd_connd_failed_stamp;/* time stamp of the * last failed * connecting attempt */ - time64_t ksnd_connd_starting_stamp;/* time stamp of the + time64_t ksnd_connd_starting_stamp;/* time stamp of the * last starting connd */ unsigned int ksnd_connd_starting; /* # starting connd */ unsigned int ksnd_connd_running; /* # running connd */ - spinlock_t ksnd_connd_lock; /* serialise */ + spinlock_t ksnd_connd_lock; /* serialise */ - struct list_head ksnd_idle_noop_txs; /* list head for freed + struct list_head ksnd_idle_noop_txs; /* list head for freed * noop tx */ - spinlock_t ksnd_tx_lock; /* serialise, g_lock + spinlock_t ksnd_tx_lock; /* serialise, g_lock * unsafe */ }; -#define SOCKNAL_INIT_NOTHING 0 -#define SOCKNAL_INIT_DATA 1 -#define SOCKNAL_INIT_ALL 2 +#define SOCKNAL_INIT_NOTHING 0 +#define SOCKNAL_INIT_DATA 1 +#define SOCKNAL_INIT_ALL 2 /* * A packet just assembled for transmission is represented by 1 or more @@ -268,34 +268,34 @@ struct ksock_nal_data { struct ksock_route; /* forward ref */ struct ksock_proto; /* forward ref */ -struct ksock_tx { /* transmit packet */ - struct list_head tx_list; /* queue on conn for transmission etc - */ - struct list_head tx_zc_list; /* queue on peer_ni for ZC request */ - atomic_t tx_refcount; /* tx reference count */ - int tx_nob; /* # packet bytes */ - int tx_resid; /* residual bytes */ - int tx_niov; /* # packet iovec frags */ - struct kvec *tx_iov; /* packet iovec frags */ - int tx_nkiov; /* # packet page frags */ - unsigned short tx_zc_aborted; /* aborted ZC request */ - unsigned short tx_zc_capable:1; /* payload is large enough for ZC */ - unsigned short tx_zc_checked:1; /* Have I checked if I should ZC? */ - unsigned short tx_nonblk:1; /* it's a non-blocking ACK */ - struct bio_vec *tx_kiov; /* packet page frags */ - struct ksock_conn *tx_conn; /* owning conn */ - struct lnet_msg *tx_lnetmsg; /* lnet message for lnet_finalize() - */ +struct ksock_tx { /* transmit packet */ + struct list_head tx_list; /* queue on conn for transmission etc + */ + struct list_head tx_zc_list; /* queue on peer_ni for ZC request */ + atomic_t tx_refcount; /* tx reference count */ + int tx_nob; /* # packet bytes */ + int tx_resid; /* residual bytes */ + int tx_niov; /* # packet iovec frags */ + struct kvec *tx_iov; /* packet iovec frags */ + int tx_nkiov; /* # packet page frags */ + unsigned short tx_zc_aborted; /* aborted ZC request */ + unsigned short tx_zc_capable:1;/* payload is large enough for ZC */ + unsigned short tx_zc_checked:1;/* Have I checked if I should ZC? */ + unsigned short tx_nonblk:1; /* it's a non-blocking ACK */ + struct bio_vec *tx_kiov; /* packet page frags */ + struct ksock_conn *tx_conn; /* owning conn */ + struct lnet_msg *tx_lnetmsg; /* lnet message for lnet_finalize() + */ time64_t tx_deadline; /* when (in secs) tx times out */ - struct ksock_msg tx_msg; /* socklnd message buffer */ - int tx_desc_size; /* size of this descriptor */ + struct ksock_msg tx_msg; /* socklnd message buffer */ + int tx_desc_size; /* size of this descriptor */ union { struct { - struct kvec iov; /* virt hdr */ - struct bio_vec kiov[0]; /* paged payload */ + struct kvec iov; /* virt hdr */ + struct bio_vec kiov[0];/* paged payload */ } paged; struct { - struct kvec iov[1]; /* virt hdr + payload */ + struct kvec iov[1]; /* virt hdr + payload */ } virt; } tx_frags; }; @@ -304,160 +304,160 @@ struct ksock_tx { /* transmit packet */ /* network zero copy callback descriptor embedded in struct ksock_tx */ -#define SOCKNAL_RX_KSM_HEADER 1 /* reading ksock message header */ -#define SOCKNAL_RX_LNET_HEADER 2 /* reading lnet message header */ -#define SOCKNAL_RX_PARSE 3 /* Calling lnet_parse() */ -#define SOCKNAL_RX_PARSE_WAIT 4 /* waiting to be told to read the body */ -#define SOCKNAL_RX_LNET_PAYLOAD 5 /* reading lnet payload (to deliver here) */ -#define SOCKNAL_RX_SLOP 6 /* skipping body */ +#define SOCKNAL_RX_KSM_HEADER 1 /* reading ksock message header */ +#define SOCKNAL_RX_LNET_HEADER 2 /* reading lnet message header */ +#define SOCKNAL_RX_PARSE 3 /* Calling lnet_parse() */ +#define SOCKNAL_RX_PARSE_WAIT 4 /* waiting to be told to read the body */ +#define SOCKNAL_RX_LNET_PAYLOAD 5 /* reading lnet payload (to deliver here) */ +#define SOCKNAL_RX_SLOP 6 /* skipping body */ struct ksock_conn { - struct ksock_peer *ksnc_peer; /* owning peer_ni */ - struct ksock_route *ksnc_route; /* owning route */ - struct list_head ksnc_list; /* stash on peer_ni's conn list */ - struct socket *ksnc_sock; /* actual socket */ - void *ksnc_saved_data_ready; /* socket's original - * data_ready() callback - */ - void *ksnc_saved_write_space; /* socket's original - * write_space() callback - */ - atomic_t ksnc_conn_refcount;/* conn refcount */ - atomic_t ksnc_sock_refcount;/* sock refcount */ - struct ksock_sched *ksnc_scheduler; /* who schedules this connection - */ - u32 ksnc_myipaddr; /* my IP */ - u32 ksnc_ipaddr; /* peer_ni's IP */ - int ksnc_port; /* peer_ni's port */ - signed int ksnc_type:3; /* type of connection, should be - * signed value - */ - unsigned int ksnc_closing:1; /* being shut down */ - unsigned int ksnc_flip:1; /* flip or not, only for V2.x */ - unsigned int ksnc_zc_capable:1; /* enable to ZC */ - struct ksock_proto *ksnc_proto; /* protocol for the connection */ + struct ksock_peer *ksnc_peer; /* owning peer_ni */ + struct ksock_route *ksnc_route; /* owning route */ + struct list_head ksnc_list; /* stash on peer_ni's conn list */ + struct socket *ksnc_sock; /* actual socket */ + void *ksnc_saved_data_ready; /* socket's original + * data_ready() callback + */ + void *ksnc_saved_write_space; /* socket's original + * write_space() callback + */ + atomic_t ksnc_conn_refcount; /* conn refcount */ + atomic_t ksnc_sock_refcount; /* sock refcount */ + struct ksock_sched *ksnc_scheduler; /* who schedules this connection + */ + u32 ksnc_myipaddr; /* my IP */ + u32 ksnc_ipaddr; /* peer_ni's IP */ + int ksnc_port; /* peer_ni's port */ + signed int ksnc_type:3; /* type of connection, should be + * signed value + */ + unsigned int ksnc_closing:1; /* being shut down */ + unsigned int ksnc_flip:1; /* flip or not, only for V2.x */ + unsigned int ksnc_zc_capable:1; /* enable to ZC */ + struct ksock_proto *ksnc_proto; /* protocol for the connection */ /* reader */ - struct list_head ksnc_rx_list; /* where I enq waiting input or a - * forwarding descriptor - */ - time64_t ksnc_rx_deadline; /* when (in secs) receive times - * out - */ - u8 ksnc_rx_started; /* started receiving a message */ - u8 ksnc_rx_ready; /* data ready to read */ - u8 ksnc_rx_scheduled; /* being progressed */ - u8 ksnc_rx_state; /* what is being read */ - int ksnc_rx_nob_left; /* # bytes to next hdr/body */ - struct iov_iter ksnc_rx_to; /* copy destination */ - struct kvec ksnc_rx_iov_space[LNET_MAX_IOV]; /* space for frag descriptors */ - u32 ksnc_rx_csum; /* partial checksum for incoming - * data - */ - void *ksnc_cookie; /* rx lnet_finalize passthru arg - */ - struct ksock_msg ksnc_msg; /* incoming message buffer: - * V2.x message takes the - * whole struct - * V1.x message is a bare - * struct lnet_hdr, it's stored in - * ksnc_msg.ksm_u.lnetmsg - */ + struct list_head ksnc_rx_list; /* where I enq waiting input or a + * forwarding descriptor + */ + time64_t ksnc_rx_deadline; /* when (in secs) receive times + * out + */ + u8 ksnc_rx_started; /* started receiving a message */ + u8 ksnc_rx_ready; /* data ready to read */ + u8 ksnc_rx_scheduled; /* being progressed */ + u8 ksnc_rx_state; /* what is being read */ + int ksnc_rx_nob_left; /* # bytes to next hdr/body */ + struct iov_iter ksnc_rx_to; /* copy destination */ + struct kvec ksnc_rx_iov_space[LNET_MAX_IOV]; /* space for frag descriptors */ + u32 ksnc_rx_csum; /* partial checksum for incoming + * data + */ + void *ksnc_cookie; /* rx lnet_finalize passthru arg + */ + struct ksock_msg ksnc_msg; /* incoming message buffer: + * V2.x message takes the + * whole struct + * V1.x message is a bare + * struct lnet_hdr, it's stored in + * ksnc_msg.ksm_u.lnetmsg + */ /* WRITER */ - struct list_head ksnc_tx_list; /* where I enq waiting for output - * space - */ - struct list_head ksnc_tx_queue; /* packets waiting to be sent */ - struct ksock_tx *ksnc_tx_carrier; /* next TX that can carry a LNet - * message or ZC-ACK - */ - time64_t ksnc_tx_deadline; /* when (in secs) tx times out - */ - int ksnc_tx_bufnob; /* send buffer marker */ - atomic_t ksnc_tx_nob; /* # bytes queued */ - int ksnc_tx_ready; /* write space */ - int ksnc_tx_scheduled; /* being progressed */ - time64_t ksnc_tx_last_post; /* time stamp of the last posted - * TX - */ + struct list_head ksnc_tx_list; /* where I enq waiting for output + * space + */ + struct list_head ksnc_tx_queue; /* packets waiting to be sent */ + struct ksock_tx *ksnc_tx_carrier; /* next TX that can carry a LNet + * message or ZC-ACK + */ + time64_t ksnc_tx_deadline; /* when (in secs) tx times out + */ + int ksnc_tx_bufnob; /* send buffer marker */ + atomic_t ksnc_tx_nob; /* # bytes queued */ + int ksnc_tx_ready; /* write space */ + int ksnc_tx_scheduled; /* being progressed */ + time64_t ksnc_tx_last_post; /* time stamp of the last posted + * TX + */ }; struct ksock_route { - struct list_head ksnr_list; /* chain on peer_ni route list */ - struct list_head ksnr_connd_list; /* chain on ksnr_connd_routes */ - struct ksock_peer *ksnr_peer; /* owning peer_ni */ - atomic_t ksnr_refcount; /* # users */ - time64_t ksnr_timeout; /* when (in secs) reconnection - * can happen next - */ - time64_t ksnr_retry_interval; /* how long between retries */ - u32 ksnr_myipaddr; /* my IP */ - u32 ksnr_ipaddr; /* IP address to connect to */ - int ksnr_port; /* port to connect to */ - unsigned int ksnr_scheduled:1; /* scheduled for attention */ - unsigned int ksnr_connecting:1; /* connection establishment in - * progress - */ - unsigned int ksnr_connected:4; /* connections established by - * type - */ - unsigned int ksnr_deleted:1; /* been removed from peer_ni? */ - unsigned int ksnr_share_count; /* created explicitly? */ - int ksnr_conn_count; /* # conns established by this - * route - */ + struct list_head ksnr_list; /* chain on peer_ni route list */ + struct list_head ksnr_connd_list; /* chain on ksnr_connd_routes */ + struct ksock_peer *ksnr_peer; /* owning peer_ni */ + atomic_t ksnr_refcount; /* # users */ + time64_t ksnr_timeout; /* when (in secs) reconnection + * can happen next + */ + time64_t ksnr_retry_interval; /* how long between retries */ + u32 ksnr_myipaddr; /* my IP */ + u32 ksnr_ipaddr; /* IP address to connect to */ + int ksnr_port; /* port to connect to */ + unsigned int ksnr_scheduled:1; /* scheduled for attention */ + unsigned int ksnr_connecting:1; /* connection establishment in + * progress + */ + unsigned int ksnr_connected:4; /* connections established by + * type + */ + unsigned int ksnr_deleted:1; /* been removed from peer_ni? */ + unsigned int ksnr_share_count; /* created explicitly? */ + int ksnr_conn_count; /* # conns established by this + * route + */ }; -#define SOCKNAL_KEEPALIVE_PING 1 /* cookie for keepalive ping */ +#define SOCKNAL_KEEPALIVE_PING 1 /* cookie for keepalive ping */ struct ksock_peer { - struct list_head ksnp_list; /* stash on global peer_ni list */ - time64_t ksnp_last_alive; /* when (in seconds) I was last - * alive - */ - struct lnet_process_id ksnp_id; /* who's on the other end(s) */ - atomic_t ksnp_refcount; /* # users */ - int ksnp_sharecount; /* lconf usage counter */ - int ksnp_closing; /* being closed */ - int ksnp_accepting; /* # passive connections pending - */ - int ksnp_error; /* errno on closing last conn */ - u64 ksnp_zc_next_cookie; /* ZC completion cookie */ - u64 ksnp_incarnation; /* latest known peer_ni - * incarnation - */ - struct ksock_proto *ksnp_proto; /* latest known peer_ni - * protocol - */ - struct list_head ksnp_conns; /* all active connections */ - struct list_head ksnp_routes; /* routes */ - struct list_head ksnp_tx_queue; /* waiting packets */ - spinlock_t ksnp_lock; /* serialize, g_lock unsafe */ - struct list_head ksnp_zc_req_list; /* zero copy requests wait for - * ACK - */ - time64_t ksnp_send_keepalive; /* time to send keepalive */ - struct lnet_ni *ksnp_ni; /* which network */ - int ksnp_n_passive_ips; /* # of... */ + struct list_head ksnp_list; /* stash on global peer_ni list */ + time64_t ksnp_last_alive; /* when (in seconds) I was last + * alive + */ + struct lnet_process_id ksnp_id; /* who's on the other end(s) */ + atomic_t ksnp_refcount; /* # users */ + int ksnp_sharecount; /* lconf usage counter */ + int ksnp_closing; /* being closed */ + int ksnp_accepting; /* # passive connections pending + */ + int ksnp_error; /* errno on closing last conn */ + u64 ksnp_zc_next_cookie; /* ZC completion cookie */ + u64 ksnp_incarnation; /* latest known peer_ni + * incarnation + */ + struct ksock_proto *ksnp_proto; /* latest known peer_ni + * protocol + */ + struct list_head ksnp_conns; /* all active connections */ + struct list_head ksnp_routes; /* routes */ + struct list_head ksnp_tx_queue; /* waiting packets */ + spinlock_t ksnp_lock; /* serialize, g_lock unsafe */ + struct list_head ksnp_zc_req_list; /* zero copy requests wait for + * ACK + */ + time64_t ksnp_send_keepalive; /* time to send keepalive */ + struct lnet_ni *ksnp_ni; /* which network */ + int ksnp_n_passive_ips; /* # of... */ /* preferred local interfaces */ - u32 ksnp_passive_ips[LNET_INTERFACES_NUM]; + u32 ksnp_passive_ips[LNET_INTERFACES_NUM]; }; struct ksock_connreq { - struct list_head ksncr_list; /* stash on ksnd_connd_connreqs */ - struct lnet_ni *ksncr_ni; /* chosen NI */ - struct socket *ksncr_sock; /* accepted socket */ + struct list_head ksncr_list; /* stash on ksnd_connd_connreqs */ + struct lnet_ni *ksncr_ni; /* chosen NI */ + struct socket *ksncr_sock; /* accepted socket */ }; extern struct ksock_nal_data ksocknal_data; extern struct ksock_tunables ksocknal_tunables; -#define SOCKNAL_MATCH_NO 0 /* TX can't match type of connection */ -#define SOCKNAL_MATCH_YES 1 /* TX matches type of connection */ -#define SOCKNAL_MATCH_MAY 2 /* TX can be sent on the connection, but not - * preferred - */ +#define SOCKNAL_MATCH_NO 0 /* TX can't match type of connection */ +#define SOCKNAL_MATCH_YES 1 /* TX matches type of connection */ +#define SOCKNAL_MATCH_MAY 2 /* TX can be sent on the connection, but not + * preferred + */ struct ksock_proto { /* version number of protocol */ @@ -501,12 +501,12 @@ struct ksock_proto { extern struct ksock_proto ksocknal_protocol_v2x; extern struct ksock_proto ksocknal_protocol_v3x; -#define KSOCK_PROTO_V1_MAJOR LNET_PROTO_TCP_VERSION_MAJOR -#define KSOCK_PROTO_V1_MINOR LNET_PROTO_TCP_VERSION_MINOR -#define KSOCK_PROTO_V1 KSOCK_PROTO_V1_MAJOR +#define KSOCK_PROTO_V1_MAJOR LNET_PROTO_TCP_VERSION_MAJOR +#define KSOCK_PROTO_V1_MINOR LNET_PROTO_TCP_VERSION_MINOR +#define KSOCK_PROTO_V1 KSOCK_PROTO_V1_MAJOR #ifndef CPU_MASK_NONE -#define CPU_MASK_NONE 0UL +#define CPU_MASK_NONE 0UL #endif static inline int @@ -646,15 +646,15 @@ int ksocknal_create_conn(struct lnet_ni *ni, struct ksock_route *route, void ksocknal_close_conn_locked(struct ksock_conn *conn, int why); void ksocknal_terminate_conn(struct ksock_conn *conn); void ksocknal_destroy_conn(struct ksock_conn *conn); -int ksocknal_close_peer_conns_locked(struct ksock_peer *peer_ni, - u32 ipaddr, int why); +int ksocknal_close_peer_conns_locked(struct ksock_peer *peer_ni, + u32 ipaddr, int why); int ksocknal_close_conn_and_siblings(struct ksock_conn *conn, int why); int ksocknal_close_matching_conns(struct lnet_process_id id, u32 ipaddr); struct ksock_conn *ksocknal_find_conn_locked(struct ksock_peer *peer_ni, struct ksock_tx *tx, int nonblk); -int ksocknal_launch_packet(struct lnet_ni *ni, struct ksock_tx *tx, - struct lnet_process_id id); +int ksocknal_launch_packet(struct lnet_ni *ni, struct ksock_tx *tx, + struct lnet_process_id id); struct ksock_tx *ksocknal_alloc_tx(int type, int size); void ksocknal_free_tx(struct ksock_tx *tx); struct ksock_tx *ksocknal_alloc_tx_noop(u64 cookie, int nonblk); diff --git a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_cb.c b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_cb.c index dd4fb69..8e20f43 100644 --- a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_cb.c +++ b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_cb.c @@ -56,7 +56,7 @@ struct ksock_tx * tx->tx_zc_aborted = 0; tx->tx_zc_capable = 0; tx->tx_zc_checked = 0; - tx->tx_desc_size = size; + tx->tx_desc_size = size; atomic_inc(&ksocknal_data.ksnd_nactive_txs); @@ -74,13 +74,13 @@ struct ksock_tx * return NULL; } - tx->tx_conn = NULL; + tx->tx_conn = NULL; tx->tx_lnetmsg = NULL; - tx->tx_kiov = NULL; - tx->tx_nkiov = 0; - tx->tx_iov = tx->tx_frags.virt.iov; - tx->tx_niov = 1; - tx->tx_nonblk = nonblk; + tx->tx_kiov = NULL; + tx->tx_nkiov = 0; + tx->tx_iov = tx->tx_frags.virt.iov; + tx->tx_niov = 1; + tx->tx_nonblk = nonblk; tx->tx_msg.ksm_csum = 0; tx->tx_msg.ksm_type = KSOCK_MSG_NOOP; @@ -228,7 +228,6 @@ struct ksock_tx * } if (rc <= 0) { /* Didn't write anything? */ - if (!rc) /* some stacks return 0 instead of -EAGAIN */ rc = -EAGAIN; @@ -260,7 +259,6 @@ struct ksock_tx * * status inside ksocknal_lib_recv */ rc = ksocknal_lib_recv(conn); - if (rc <= 0) return rc; @@ -316,7 +314,6 @@ struct ksock_tx * } /* Completed a fragment */ - if (!iov_iter_count(&conn->ksnc_rx_to)) { rc = 1; break; @@ -521,7 +518,6 @@ struct ksock_tx * ksocknal_launch_connection_locked(struct ksock_route *route) { /* called holding write lock on ksnd_global_lock */ - LASSERT(!route->ksnr_scheduled); LASSERT(!route->ksnr_connecting); LASSERT(ksocknal_route_mask() & ~route->ksnr_connected); @@ -588,7 +584,7 @@ struct ksock_conn * (tnob == nob && *ksocknal_tunables.ksnd_round_robin && typed->ksnc_tx_last_post > c->ksnc_tx_last_post)) { typed = c; - tnob = nob; + tnob = nob; } break; @@ -760,7 +756,6 @@ struct ksock_route * struct ksock_route *route; list_for_each_entry(route, &peer_ni->ksnp_routes, ksnr_list) { - LASSERT(!route->ksnr_connecting || route->ksnr_scheduled); if (route->ksnr_scheduled) @@ -978,7 +973,6 @@ struct ksock_route * { static char ksocknal_slop_buffer[4096]; struct kvec *kvec = conn->ksnc_rx_iov_space; - int nob; unsigned int niov; int skipped; @@ -1001,8 +995,8 @@ struct ksock_route * kvec->iov_base = &conn->ksnc_msg; kvec->iov_len = offsetof(struct ksock_msg, ksm_u); conn->ksnc_rx_nob_left = offsetof(struct ksock_msg, ksm_u); - iov_iter_kvec(&conn->ksnc_rx_to, READ, kvec, - 1, offsetof(struct ksock_msg, ksm_u)); + iov_iter_kvec(&conn->ksnc_rx_to, READ, kvec, 1, + offsetof(struct ksock_msg, ksm_u)); break; case KSOCK_PROTO_V1: @@ -1011,8 +1005,8 @@ struct ksock_route * kvec->iov_base = &conn->ksnc_msg.ksm_u.lnetmsg; kvec->iov_len = sizeof(struct lnet_hdr); conn->ksnc_rx_nob_left = sizeof(struct lnet_hdr); - iov_iter_kvec(&conn->ksnc_rx_to, READ, kvec, - 1, sizeof(struct lnet_hdr)); + iov_iter_kvec(&conn->ksnc_rx_to, READ, kvec, 1, + sizeof(struct lnet_hdr)); break; default: @@ -1035,7 +1029,7 @@ struct ksock_route * nob = min_t(int, nob_to_skip, sizeof(ksocknal_slop_buffer)); kvec[niov].iov_base = ksocknal_slop_buffer; - kvec[niov].iov_len = nob; + kvec[niov].iov_len = nob; niov++; skipped += nob; nob_to_skip -= nob; @@ -1063,7 +1057,7 @@ struct ksock_route * conn->ksnc_rx_state == SOCKNAL_RX_LNET_PAYLOAD || conn->ksnc_rx_state == SOCKNAL_RX_LNET_HEADER || conn->ksnc_rx_state == SOCKNAL_RX_SLOP); - again: +again: if (iov_iter_count(&conn->ksnc_rx_to)) { rc = ksocknal_receive(conn); @@ -1157,8 +1151,8 @@ struct ksock_route * kvec->iov_base = &conn->ksnc_msg.ksm_u.lnetmsg; kvec->iov_len = sizeof(struct ksock_lnet_msg); - iov_iter_kvec(&conn->ksnc_rx_to, READ, kvec, - 1, sizeof(struct ksock_lnet_msg)); + iov_iter_kvec(&conn->ksnc_rx_to, READ, kvec, 1, + sizeof(struct ksock_lnet_msg)); goto again; /* read lnet header now */ @@ -1295,8 +1289,8 @@ struct ksock_route * spin_lock_bh(&sched->kss_lock); rc = !ksocknal_data.ksnd_shuttingdown && - list_empty(&sched->kss_rx_conns) && - list_empty(&sched->kss_tx_conns); + list_empty(&sched->kss_rx_conns) && + list_empty(&sched->kss_tx_conns); spin_unlock_bh(&sched->kss_lock); return rc; @@ -1419,7 +1413,6 @@ int ksocknal_scheduler(void *arg) } rc = ksocknal_process_transmit(conn, tx); - if (rc == -ENOMEM || rc == -EAGAIN) { /* * Incomplete send: replace tx on HEAD of @@ -1879,7 +1872,7 @@ void ksocknal_write_callback(struct ksock_conn *conn) write_unlock_bh(&ksocknal_data.ksnd_global_lock); return retry_later; - failed: +failed: write_lock_bh(&ksocknal_data.ksnd_global_lock); route->ksnr_scheduled = 0; @@ -2026,7 +2019,6 @@ void ksocknal_write_callback(struct ksock_conn *conn) return 0; /* no creating in past 120 seconds */ - return ksocknal_data.ksnd_connd_running > ksocknal_data.ksnd_connd_connecting + SOCKNAL_CONND_RESV; } @@ -2341,7 +2333,7 @@ void ksocknal_write_callback(struct ksock_conn *conn) struct ksock_conn *conn; struct ksock_tx *tx; - again: +again: /* * NB. We expect to have a look at all the peers and not find any * connections to time out, so we just use a shared lock while we diff --git a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_lib.c b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_lib.c index 565c50c..a190869 100644 --- a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_lib.c +++ b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_lib.c @@ -75,14 +75,14 @@ int ksocknal_lib_send_iov(struct ksock_conn *conn, struct ksock_tx *tx) { - struct msghdr msg = {.msg_flags = MSG_DONTWAIT}; + struct msghdr msg = { .msg_flags = MSG_DONTWAIT }; struct socket *sock = conn->ksnc_sock; int nob, i; - if (*ksocknal_tunables.ksnd_enable_csum && /* checksum enabled */ - conn->ksnc_proto == &ksocknal_protocol_v2x && /* V2.x connection */ - tx->tx_nob == tx->tx_resid && /* frist sending */ - !tx->tx_msg.ksm_csum) /* not checksummed */ + if (*ksocknal_tunables.ksnd_enable_csum && /* checksum enabled */ + conn->ksnc_proto == &ksocknal_protocol_v2x && /* V2.x connection */ + tx->tx_nob == tx->tx_resid && /* first sending */ + !tx->tx_msg.ksm_csum) /* not checksummed */ ksocknal_lib_csum_tx(tx); for (nob = i = 0; i < tx->tx_niov; i++) @@ -130,7 +130,7 @@ rc = tcp_sendpage(sk, page, offset, fragsize, msgflg); } } else { - struct msghdr msg = {.msg_flags = MSG_DONTWAIT}; + struct msghdr msg = { .msg_flags = MSG_DONTWAIT }; int i; for (nob = i = 0; i < tx->tx_nkiov; i++) @@ -144,6 +144,7 @@ kiov, tx->tx_nkiov, nob); rc = sock_sendmsg(sock, &msg); } + return rc; } @@ -166,6 +167,7 @@ static int lustre_csum(struct kvec *v, void *context) { struct ksock_conn *conn = context; + conn->ksnc_rx_csum = crc32_le(conn->ksnc_rx_csum, v->iov_base, v->iov_len); return 0; @@ -325,7 +327,7 @@ static int lustre_csum(struct kvec *v, void *context) return rc; } -/* TCP_BACKOFF_* sockopt tunables unsupported in stock kernels */ + /* TCP_BACKOFF_* sockopt tunables unsupported in stock kernels */ /* snapshot tunables */ keep_idle = *ksocknal_tunables.ksnd_keepalive_idle; diff --git a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_modparams.c b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_modparams.c index da59100..0c923f9 100644 --- a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_modparams.c +++ b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_modparams.c @@ -145,36 +145,36 @@ int ksocknal_tunables_init(void) { /* initialize ksocknal_tunables structure */ - ksocknal_tunables.ksnd_timeout = &sock_timeout; - ksocknal_tunables.ksnd_nscheds = &nscheds; - ksocknal_tunables.ksnd_nconnds = &nconnds; - ksocknal_tunables.ksnd_nconnds_max = &nconnds_max; - ksocknal_tunables.ksnd_min_reconnectms = &min_reconnectms; - ksocknal_tunables.ksnd_max_reconnectms = &max_reconnectms; - ksocknal_tunables.ksnd_eager_ack = &eager_ack; - ksocknal_tunables.ksnd_typed_conns = &typed_conns; - ksocknal_tunables.ksnd_min_bulk = &min_bulk; - ksocknal_tunables.ksnd_tx_buffer_size = &tx_buffer_size; - ksocknal_tunables.ksnd_rx_buffer_size = &rx_buffer_size; - ksocknal_tunables.ksnd_nagle = &nagle; - ksocknal_tunables.ksnd_round_robin = &round_robin; - ksocknal_tunables.ksnd_keepalive = &keepalive; - ksocknal_tunables.ksnd_keepalive_idle = &keepalive_idle; - ksocknal_tunables.ksnd_keepalive_count = &keepalive_count; - ksocknal_tunables.ksnd_keepalive_intvl = &keepalive_intvl; - ksocknal_tunables.ksnd_credits = &credits; - ksocknal_tunables.ksnd_peertxcredits = &peer_credits; - ksocknal_tunables.ksnd_peerrtrcredits = &peer_buffer_credits; - ksocknal_tunables.ksnd_peertimeout = &peer_timeout; - ksocknal_tunables.ksnd_enable_csum = &enable_csum; - ksocknal_tunables.ksnd_inject_csum_error = &inject_csum_error; - ksocknal_tunables.ksnd_nonblk_zcack = &nonblk_zcack; - ksocknal_tunables.ksnd_zc_min_payload = &zc_min_payload; - ksocknal_tunables.ksnd_zc_recv = &zc_recv; + ksocknal_tunables.ksnd_timeout = &sock_timeout; + ksocknal_tunables.ksnd_nscheds = &nscheds; + ksocknal_tunables.ksnd_nconnds = &nconnds; + ksocknal_tunables.ksnd_nconnds_max = &nconnds_max; + ksocknal_tunables.ksnd_min_reconnectms = &min_reconnectms; + ksocknal_tunables.ksnd_max_reconnectms = &max_reconnectms; + ksocknal_tunables.ksnd_eager_ack = &eager_ack; + ksocknal_tunables.ksnd_typed_conns = &typed_conns; + ksocknal_tunables.ksnd_min_bulk = &min_bulk; + ksocknal_tunables.ksnd_tx_buffer_size = &tx_buffer_size; + ksocknal_tunables.ksnd_rx_buffer_size = &rx_buffer_size; + ksocknal_tunables.ksnd_nagle = &nagle; + ksocknal_tunables.ksnd_round_robin = &round_robin; + ksocknal_tunables.ksnd_keepalive = &keepalive; + ksocknal_tunables.ksnd_keepalive_idle = &keepalive_idle; + ksocknal_tunables.ksnd_keepalive_count = &keepalive_count; + ksocknal_tunables.ksnd_keepalive_intvl = &keepalive_intvl; + ksocknal_tunables.ksnd_credits = &credits; + ksocknal_tunables.ksnd_peertxcredits = &peer_credits; + ksocknal_tunables.ksnd_peerrtrcredits = &peer_buffer_credits; + ksocknal_tunables.ksnd_peertimeout = &peer_timeout; + ksocknal_tunables.ksnd_enable_csum = &enable_csum; + ksocknal_tunables.ksnd_inject_csum_error = &inject_csum_error; + ksocknal_tunables.ksnd_nonblk_zcack = &nonblk_zcack; + ksocknal_tunables.ksnd_zc_min_payload = &zc_min_payload; + ksocknal_tunables.ksnd_zc_recv = &zc_recv; ksocknal_tunables.ksnd_zc_recv_min_nfrags = &zc_recv_min_nfrags; #if SOCKNAL_VERSION_DEBUG - ksocknal_tunables.ksnd_protocol = &protocol; + ksocknal_tunables.ksnd_protocol = &protocol; #endif if (*ksocknal_tunables.ksnd_zc_min_payload < (2 << 10)) diff --git a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_proto.c b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_proto.c index 91bed59..c694fec 100644 --- a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_proto.c +++ b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_proto.c @@ -116,7 +116,7 @@ static struct ksock_tx * ksocknal_queue_tx_msg_v2(struct ksock_conn *conn, struct ksock_tx *tx_msg) { - struct ksock_tx *tx = conn->ksnc_tx_carrier; + struct ksock_tx *tx = conn->ksnc_tx_carrier; /* * Enqueue tx_msg: @@ -220,7 +220,7 @@ /* takes two or more cookies already */ if (tx->tx_msg.ksm_zc_cookies[0] > tx->tx_msg.ksm_zc_cookies[1]) { - u64 tmp = 0; + u64 tmp = 0; /* two separated cookies: (a+2, a) or (a+1, a) */ LASSERT(tx->tx_msg.ksm_zc_cookies[0] - @@ -479,7 +479,7 @@ * Re-organize V2.x message header to V1.x (struct lnet_hdr) * header and send out */ - hmv->magic = cpu_to_le32(LNET_PROTO_TCP_MAGIC); + hmv->magic = cpu_to_le32(LNET_PROTO_TCP_MAGIC); hmv->version_major = cpu_to_le16(KSOCK_PROTO_V1_MAJOR); hmv->version_minor = cpu_to_le16(KSOCK_PROTO_V1_MINOR); @@ -537,7 +537,7 @@ struct socket *sock = conn->ksnc_sock; int rc; - hello->kshm_magic = LNET_PROTO_MAGIC; + hello->kshm_magic = LNET_PROTO_MAGIC; hello->kshm_version = conn->ksnc_proto->pro_version; if (the_lnet.ln_testprotocompat) { @@ -607,12 +607,11 @@ goto out; } - hello->kshm_src_nid = le64_to_cpu(hdr->src_nid); - hello->kshm_src_pid = le32_to_cpu(hdr->src_pid); + hello->kshm_src_nid = le64_to_cpu(hdr->src_nid); + hello->kshm_src_pid = le32_to_cpu(hdr->src_pid); hello->kshm_src_incarnation = le64_to_cpu(hdr->msg.hello.incarnation); - hello->kshm_ctype = le32_to_cpu(hdr->msg.hello.type); - hello->kshm_nips = le32_to_cpu(hdr->payload_length) / - sizeof(u32); + hello->kshm_ctype = le32_to_cpu(hdr->msg.hello.type); + hello->kshm_nips = le32_to_cpu(hdr->payload_length) / sizeof(u32); if (hello->kshm_nips > LNET_INTERFACES_NUM) { CERROR("Bad nips %d from ip %pI4h\n", @@ -724,7 +723,7 @@ LASSERT(tx->tx_lnetmsg); tx->tx_iov[0].iov_base = &tx->tx_lnetmsg->msg_hdr; - tx->tx_iov[0].iov_len = sizeof(struct lnet_hdr); + tx->tx_iov[0].iov_len = sizeof(struct lnet_hdr); tx->tx_nob = tx->tx_lnetmsg->msg_len + sizeof(struct lnet_hdr); tx->tx_resid = tx->tx_lnetmsg->msg_len + sizeof(struct lnet_hdr); @@ -771,40 +770,40 @@ } struct ksock_proto ksocknal_protocol_v1x = { - .pro_version = KSOCK_PROTO_V1, - .pro_send_hello = ksocknal_send_hello_v1, - .pro_recv_hello = ksocknal_recv_hello_v1, - .pro_pack = ksocknal_pack_msg_v1, - .pro_unpack = ksocknal_unpack_msg_v1, - .pro_queue_tx_msg = ksocknal_queue_tx_msg_v1, - .pro_handle_zcreq = NULL, - .pro_handle_zcack = NULL, - .pro_queue_tx_zcack = NULL, - .pro_match_tx = ksocknal_match_tx + .pro_version = KSOCK_PROTO_V1, + .pro_send_hello = ksocknal_send_hello_v1, + .pro_recv_hello = ksocknal_recv_hello_v1, + .pro_pack = ksocknal_pack_msg_v1, + .pro_unpack = ksocknal_unpack_msg_v1, + .pro_queue_tx_msg = ksocknal_queue_tx_msg_v1, + .pro_handle_zcreq = NULL, + .pro_handle_zcack = NULL, + .pro_queue_tx_zcack = NULL, + .pro_match_tx = ksocknal_match_tx }; struct ksock_proto ksocknal_protocol_v2x = { - .pro_version = KSOCK_PROTO_V2, - .pro_send_hello = ksocknal_send_hello_v2, - .pro_recv_hello = ksocknal_recv_hello_v2, - .pro_pack = ksocknal_pack_msg_v2, - .pro_unpack = ksocknal_unpack_msg_v2, - .pro_queue_tx_msg = ksocknal_queue_tx_msg_v2, - .pro_queue_tx_zcack = ksocknal_queue_tx_zcack_v2, - .pro_handle_zcreq = ksocknal_handle_zcreq, - .pro_handle_zcack = ksocknal_handle_zcack, - .pro_match_tx = ksocknal_match_tx + .pro_version = KSOCK_PROTO_V2, + .pro_send_hello = ksocknal_send_hello_v2, + .pro_recv_hello = ksocknal_recv_hello_v2, + .pro_pack = ksocknal_pack_msg_v2, + .pro_unpack = ksocknal_unpack_msg_v2, + .pro_queue_tx_msg = ksocknal_queue_tx_msg_v2, + .pro_queue_tx_zcack = ksocknal_queue_tx_zcack_v2, + .pro_handle_zcreq = ksocknal_handle_zcreq, + .pro_handle_zcack = ksocknal_handle_zcack, + .pro_match_tx = ksocknal_match_tx }; struct ksock_proto ksocknal_protocol_v3x = { - .pro_version = KSOCK_PROTO_V3, - .pro_send_hello = ksocknal_send_hello_v2, - .pro_recv_hello = ksocknal_recv_hello_v2, - .pro_pack = ksocknal_pack_msg_v2, - .pro_unpack = ksocknal_unpack_msg_v2, - .pro_queue_tx_msg = ksocknal_queue_tx_msg_v2, - .pro_queue_tx_zcack = ksocknal_queue_tx_zcack_v3, - .pro_handle_zcreq = ksocknal_handle_zcreq, - .pro_handle_zcack = ksocknal_handle_zcack, - .pro_match_tx = ksocknal_match_tx_v3 + .pro_version = KSOCK_PROTO_V3, + .pro_send_hello = ksocknal_send_hello_v2, + .pro_recv_hello = ksocknal_recv_hello_v2, + .pro_pack = ksocknal_pack_msg_v2, + .pro_unpack = ksocknal_unpack_msg_v2, + .pro_queue_tx_msg = ksocknal_queue_tx_msg_v2, + .pro_queue_tx_zcack = ksocknal_queue_tx_zcack_v3, + .pro_handle_zcreq = ksocknal_handle_zcreq, + .pro_handle_zcack = ksocknal_handle_zcack, + .pro_match_tx = ksocknal_match_tx_v3 }; -- 1.8.3.1 From jsimmons at infradead.org Thu Jan 31 17:19:14 2019 From: jsimmons at infradead.org (James Simmons) Date: Thu, 31 Jan 2019 12:19:14 -0500 Subject: [lustre-devel] [PATCH 10/26] ldlm: cleanup white spaces In-Reply-To: <1548955170-13456-1-git-send-email-jsimmons@infradead.org> References: <1548955170-13456-1-git-send-email-jsimmons@infradead.org> Message-ID: <1548955170-13456-11-git-send-email-jsimmons@infradead.org> The ldlm code is very messy and difficult to read. Remove excess white space and properly align data structures so they are easy on the eyes. Signed-off-by: James Simmons --- drivers/staging/lustre/lustre/ldlm/ldlm_flock.c | 4 +- drivers/staging/lustre/lustre/ldlm/ldlm_lib.c | 22 +++--- drivers/staging/lustre/lustre/ldlm/ldlm_lock.c | 36 +++++----- drivers/staging/lustre/lustre/ldlm/ldlm_lockd.c | 28 ++++---- drivers/staging/lustre/lustre/ldlm/ldlm_pool.c | 5 +- drivers/staging/lustre/lustre/ldlm/ldlm_request.c | 28 ++++---- drivers/staging/lustre/lustre/ldlm/ldlm_resource.c | 78 +++++++++++----------- 7 files changed, 99 insertions(+), 102 deletions(-) diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_flock.c b/drivers/staging/lustre/lustre/ldlm/ldlm_flock.c index baa5b3a..4fc380d2 100644 --- a/drivers/staging/lustre/lustre/ldlm/ldlm_flock.c +++ b/drivers/staging/lustre/lustre/ldlm/ldlm_flock.c @@ -314,8 +314,8 @@ static int ldlm_process_flock_lock(struct ldlm_lock *req) int ldlm_flock_completion_ast(struct ldlm_lock *lock, u64 flags, void *data) { - struct file_lock *getlk = lock->l_ast_data; - int rc = 0; + struct file_lock *getlk = lock->l_ast_data; + int rc = 0; OBD_FAIL_TIMEOUT(OBD_FAIL_LDLM_CP_CB_WAIT2, 4); if (OBD_FAIL_PRECHECK(OBD_FAIL_LDLM_CP_CB_WAIT3)) { diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_lib.c b/drivers/staging/lustre/lustre/ldlm/ldlm_lib.c index 5a59c15..aef83ff 100644 --- a/drivers/staging/lustre/lustre/ldlm/ldlm_lib.c +++ b/drivers/staging/lustre/lustre/ldlm/ldlm_lib.c @@ -512,11 +512,11 @@ int client_connect_import(const struct lu_env *env, struct obd_device *obd, struct obd_uuid *cluuid, struct obd_connect_data *data, void *localdata) { - struct client_obd *cli = &obd->u.cli; - struct obd_import *imp = cli->cl_import; + struct client_obd *cli = &obd->u.cli; + struct obd_import *imp = cli->cl_import; struct obd_connect_data *ocd; - struct lustre_handle conn = { 0 }; - int rc; + struct lustre_handle conn = { 0 }; + int rc; *exp = NULL; down_write(&cli->cl_sem); @@ -703,9 +703,9 @@ int target_pack_pool_reply(struct ptlrpc_request *req) void target_send_reply(struct ptlrpc_request *req, int rc, int fail_id) { struct ptlrpc_service_part *svcpt; - int netrc; + int netrc; struct ptlrpc_reply_state *rs; - struct obd_export *exp; + struct obd_export *exp; if (req->rq_no_reply) return; @@ -736,11 +736,11 @@ void target_send_reply(struct ptlrpc_request *req, int rc, int fail_id) /* disable reply scheduling while I'm setting up */ rs->rs_scheduled = 1; - rs->rs_on_net = 1; - rs->rs_xid = req->rq_xid; - rs->rs_transno = req->rq_transno; - rs->rs_export = exp; - rs->rs_opc = lustre_msg_get_opc(req->rq_reqmsg); + rs->rs_on_net = 1; + rs->rs_xid = req->rq_xid; + rs->rs_transno = req->rq_transno; + rs->rs_export = exp; + rs->rs_opc = lustre_msg_get_opc(req->rq_reqmsg); spin_lock(&exp->exp_uncommitted_replies_lock); CDEBUG(D_NET, "rs transno = %llu, last committed = %llu\n", diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_lock.c b/drivers/staging/lustre/lustre/ldlm/ldlm_lock.c index e726e76..cea0e22 100644 --- a/drivers/staging/lustre/lustre/ldlm/ldlm_lock.c +++ b/drivers/staging/lustre/lustre/ldlm/ldlm_lock.c @@ -682,7 +682,7 @@ void ldlm_lock_addref_internal_nolock(struct ldlm_lock *lock, int ldlm_lock_addref_try(const struct lustre_handle *lockh, enum ldlm_mode mode) { struct ldlm_lock *lock; - int result; + int result; result = -EAGAIN; lock = ldlm_handle2lock(lockh); @@ -1344,7 +1344,7 @@ enum ldlm_mode ldlm_lock_match(struct ldlm_namespace *ns, u64 flags, } } } - out2: +out2: if (rc) { LDLM_DEBUG(lock, "matched (%llu %llu)", (type == LDLM_PLAIN || type == LDLM_IBITS) ? @@ -1568,8 +1568,6 @@ struct ldlm_lock *ldlm_lock_create(struct ldlm_namespace *ns, return ERR_PTR(rc); } - - /** * Enqueue (request) a lock. * On the client this is called from ldlm_cli_enqueue_fini @@ -1629,9 +1627,9 @@ enum ldlm_error ldlm_lock_enqueue(struct ldlm_namespace *ns, ldlm_work_bl_ast_lock(struct ptlrpc_request_set *rqset, void *opaq) { struct ldlm_cb_set_arg *arg = opaq; - struct ldlm_lock_desc d; - int rc; - struct ldlm_lock *lock; + struct ldlm_lock_desc d; + int rc; + struct ldlm_lock *lock; if (list_empty(arg->list)) return -ENOENT; @@ -1664,9 +1662,9 @@ enum ldlm_error ldlm_lock_enqueue(struct ldlm_namespace *ns, static int ldlm_work_cp_ast_lock(struct ptlrpc_request_set *rqset, void *opaq) { - struct ldlm_cb_set_arg *arg = opaq; - int rc = 0; - struct ldlm_lock *lock; + struct ldlm_cb_set_arg *arg = opaq; + int rc = 0; + struct ldlm_lock *lock; ldlm_completion_callback completion_callback; if (list_empty(arg->list)) @@ -1711,9 +1709,9 @@ enum ldlm_error ldlm_lock_enqueue(struct ldlm_namespace *ns, ldlm_work_revoke_ast_lock(struct ptlrpc_request_set *rqset, void *opaq) { struct ldlm_cb_set_arg *arg = opaq; - struct ldlm_lock_desc desc; - int rc; - struct ldlm_lock *lock; + struct ldlm_lock_desc desc; + int rc; + struct ldlm_lock *lock; if (list_empty(arg->list)) return -ENOENT; @@ -1737,10 +1735,10 @@ enum ldlm_error ldlm_lock_enqueue(struct ldlm_namespace *ns, */ static int ldlm_work_gl_ast_lock(struct ptlrpc_request_set *rqset, void *opaq) { - struct ldlm_cb_set_arg *arg = opaq; - struct ldlm_glimpse_work *gl_work; - struct ldlm_lock *lock; - int rc = 0; + struct ldlm_cb_set_arg *arg = opaq; + struct ldlm_glimpse_work *gl_work; + struct ldlm_lock *lock; + int rc = 0; if (list_empty(arg->list)) return -ENOENT; @@ -1776,8 +1774,8 @@ int ldlm_run_ast_work(struct ldlm_namespace *ns, struct list_head *rpc_list, enum ldlm_desc_ast_t ast_type) { struct ldlm_cb_set_arg *arg; - set_producer_func work_ast_lock; - int rc; + set_producer_func work_ast_lock; + int rc; if (list_empty(rpc_list)) return 0; diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_lockd.c b/drivers/staging/lustre/lustre/ldlm/ldlm_lockd.c index e766f798..bae67ac 100644 --- a/drivers/staging/lustre/lustre/ldlm/ldlm_lockd.c +++ b/drivers/staging/lustre/lustre/ldlm/ldlm_lockd.c @@ -77,32 +77,32 @@ struct ldlm_bl_pool { * as a priority. It is used for LDLM_FL_DISCARD_DATA requests. * see bug 13843 */ - struct list_head blp_prio_list; + struct list_head blp_prio_list; /* * blp_list is used for all other callbacks which are likely * to take longer to process. */ - struct list_head blp_list; + struct list_head blp_list; - wait_queue_head_t blp_waitq; + wait_queue_head_t blp_waitq; struct completion blp_comp; - atomic_t blp_num_threads; - atomic_t blp_busy_threads; - int blp_min_threads; - int blp_max_threads; + atomic_t blp_num_threads; + atomic_t blp_busy_threads; + int blp_min_threads; + int blp_max_threads; }; struct ldlm_bl_work_item { - struct list_head blwi_entry; + struct list_head blwi_entry; struct ldlm_namespace *blwi_ns; struct ldlm_lock_desc blwi_ld; struct ldlm_lock *blwi_lock; - struct list_head blwi_head; - int blwi_count; + struct list_head blwi_head; + int blwi_count; struct completion blwi_comp; - enum ldlm_cancel_flags blwi_flags; - int blwi_mem_pressure; + enum ldlm_cancel_flags blwi_flags; + int blwi_mem_pressure; }; /** @@ -928,8 +928,8 @@ static ssize_t cancel_unused_locks_before_replay_store(struct kobject *kobj, static int ldlm_setup(void) { - static struct ptlrpc_service_conf conf; - struct ldlm_bl_pool *blp = NULL; + static struct ptlrpc_service_conf conf; + struct ldlm_bl_pool *blp = NULL; int rc = 0; int i; diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_pool.c b/drivers/staging/lustre/lustre/ldlm/ldlm_pool.c index e94d8a3..5b23767f 100644 --- a/drivers/staging/lustre/lustre/ldlm/ldlm_pool.c +++ b/drivers/staging/lustre/lustre/ldlm/ldlm_pool.c @@ -465,8 +465,7 @@ static ssize_t grant_speed_show(struct kobject *kobj, struct attribute *attr, { struct ldlm_pool *pl = container_of(kobj, struct ldlm_pool, pl_kobj); - - int grant_speed; + int grant_speed; spin_lock(&pl->pl_lock); /* serialize with ldlm_pool_recalc */ @@ -902,7 +901,7 @@ static void ldlm_pools_recalc(struct work_struct *ws) * Recalc at least ldlm_namespace_nr_read(client) namespaces. */ for (nr = ldlm_namespace_nr_read(client); nr > 0; nr--) { - int skip; + int skip; /* * Lock the list, get first @ns in the list, getref, move it * to the tail, unlock and call pool recalc. This way we avoid diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_request.c b/drivers/staging/lustre/lustre/ldlm/ldlm_request.c index a7fe8c6..b819ade 100644 --- a/drivers/staging/lustre/lustre/ldlm/ldlm_request.c +++ b/drivers/staging/lustre/lustre/ldlm/ldlm_request.c @@ -565,9 +565,9 @@ int ldlm_prep_elc_req(struct obd_export *exp, struct ptlrpc_request *req, int version, int opc, int canceloff, struct list_head *cancels, int count) { - struct ldlm_namespace *ns = exp->exp_obd->obd_namespace; - struct req_capsule *pill = &req->rq_pill; - struct ldlm_request *dlm = NULL; + struct ldlm_namespace *ns = exp->exp_obd->obd_namespace; + struct req_capsule *pill = &req->rq_pill; + struct ldlm_request *dlm = NULL; int flags, avail, to_free, pack = 0; LIST_HEAD(head); int rc; @@ -675,11 +675,11 @@ int ldlm_cli_enqueue(struct obd_export *exp, struct ptlrpc_request **reqp, struct lustre_handle *lockh, int async) { struct ldlm_namespace *ns; - struct ldlm_lock *lock; - struct ldlm_request *body; - int is_replay = *flags & LDLM_FL_REPLAY; - int req_passed_in = 1; - int rc, err; + struct ldlm_lock *lock; + struct ldlm_request *body; + int is_replay = *flags & LDLM_FL_REPLAY; + int req_passed_in = 1; + int rc, err; struct ptlrpc_request *req; ns = exp->exp_obd->obd_namespace; @@ -1718,8 +1718,8 @@ static int ldlm_cli_hash_cancel_unused(struct cfs_hash *hs, struct cfs_hash_bd *bd, struct hlist_node *hnode, void *arg) { - struct ldlm_resource *res = cfs_hash_object(hs, hnode); - struct ldlm_cli_cancel_arg *lc = arg; + struct ldlm_resource *res = cfs_hash_object(hs, hnode); + struct ldlm_cli_cancel_arg *lc = arg; ldlm_cli_cancel_unused_resource(ldlm_res_to_ns(res), &res->lr_name, NULL, LCK_MINMODE, @@ -1878,9 +1878,9 @@ static int replay_lock_interpret(const struct lu_env *env, struct ptlrpc_request *req, struct ldlm_async_args *aa, int rc) { - struct ldlm_lock *lock; - struct ldlm_reply *reply; - struct obd_export *exp; + struct ldlm_lock *lock; + struct ldlm_reply *reply; + struct obd_export *exp; atomic_dec(&req->rq_import->imp_replay_inflight); if (rc != ELDLM_OK) @@ -1920,7 +1920,7 @@ static int replay_one_lock(struct obd_import *imp, struct ldlm_lock *lock) { struct ptlrpc_request *req; struct ldlm_async_args *aa; - struct ldlm_request *body; + struct ldlm_request *body; int flags; /* Bug 11974: Do not replay a lock which is actively being canceled */ diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_resource.c b/drivers/staging/lustre/lustre/ldlm/ldlm_resource.c index e0b9918..85c5047 100644 --- a/drivers/staging/lustre/lustre/ldlm/ldlm_resource.c +++ b/drivers/staging/lustre/lustre/ldlm/ldlm_resource.c @@ -132,9 +132,9 @@ static ssize_t resource_count_show(struct kobject *kobj, struct attribute *attr, { struct ldlm_namespace *ns = container_of(kobj, struct ldlm_namespace, ns_kobj); - u64 res = 0; - struct cfs_hash_bd bd; - int i; + u64 res = 0; + struct cfs_hash_bd bd; + int i; /* result is not strictly consistent */ cfs_hash_for_each_bucket(ns->ns_rs_hash, &bd, i) @@ -148,7 +148,7 @@ static ssize_t lock_count_show(struct kobject *kobj, struct attribute *attr, { struct ldlm_namespace *ns = container_of(kobj, struct ldlm_namespace, ns_kobj); - u64 locks; + u64 locks; locks = lprocfs_stats_collector(ns->ns_stats, LDLM_NSS_LOCKS, LPROCFS_FIELDS_FLAGS_SUM); @@ -407,9 +407,9 @@ struct ldlm_resource *ldlm_resource_getref(struct ldlm_resource *res) static unsigned int ldlm_res_hop_hash(struct cfs_hash *hs, const void *key, unsigned int mask) { - const struct ldlm_res_id *id = key; - unsigned int val = 0; - unsigned int i; + const struct ldlm_res_id *id = key; + unsigned int val = 0; + unsigned int i; for (i = 0; i < RES_NAME_SIZE; i++) val += id->name[i]; @@ -420,9 +420,9 @@ static unsigned int ldlm_res_hop_fid_hash(struct cfs_hash *hs, const void *key, unsigned int mask) { const struct ldlm_res_id *id = key; - struct lu_fid fid; - u32 hash; - u32 val; + struct lu_fid fid; + u32 hash; + u32 val; fid.f_seq = id->name[LUSTRE_RES_ID_SEQ_OFF]; fid.f_oid = (u32)id->name[LUSTRE_RES_ID_VER_OID_OFF]; @@ -448,7 +448,7 @@ static unsigned int ldlm_res_hop_fid_hash(struct cfs_hash *hs, static void *ldlm_res_hop_key(struct hlist_node *hnode) { - struct ldlm_resource *res; + struct ldlm_resource *res; res = hlist_entry(hnode, struct ldlm_resource, lr_hash); return &res->lr_name; @@ -456,7 +456,7 @@ static void *ldlm_res_hop_key(struct hlist_node *hnode) static int ldlm_res_hop_keycmp(const void *key, struct hlist_node *hnode) { - struct ldlm_resource *res; + struct ldlm_resource *res; res = hlist_entry(hnode, struct ldlm_resource, lr_hash); return ldlm_res_eq((const struct ldlm_res_id *)key, @@ -506,13 +506,13 @@ static void ldlm_res_hop_put(struct cfs_hash *hs, struct hlist_node *hnode) }; struct ldlm_ns_hash_def { - enum ldlm_ns_type nsd_type; + enum ldlm_ns_type nsd_type; /** hash bucket bits */ - unsigned int nsd_bkt_bits; + unsigned int nsd_bkt_bits; /** hash bits */ - unsigned int nsd_all_bits; + unsigned int nsd_all_bits; /** hash operations */ - struct cfs_hash_ops *nsd_hops; + struct cfs_hash_ops *nsd_hops; }; static struct ldlm_ns_hash_def ldlm_ns_hash_defs[] = { @@ -578,10 +578,10 @@ struct ldlm_namespace *ldlm_namespace_new(struct obd_device *obd, char *name, { struct ldlm_namespace *ns = NULL; struct ldlm_ns_bucket *nsb; - struct ldlm_ns_hash_def *nsd; - struct cfs_hash_bd bd; - int idx; - int rc; + struct ldlm_ns_hash_def *nsd; + struct cfs_hash_bd bd; + int idx; + int rc; LASSERT(obd); @@ -625,10 +625,10 @@ struct ldlm_namespace *ldlm_namespace_new(struct obd_device *obd, char *name, nsb->nsb_namespace = ns; } - ns->ns_obd = obd; + ns->ns_obd = obd; ns->ns_appetite = apt; - ns->ns_client = client; - ns->ns_name = kstrdup(name, GFP_KERNEL); + ns->ns_client = client; + ns->ns_name = kstrdup(name, GFP_KERNEL); if (!ns->ns_name) goto out_hash; @@ -638,13 +638,13 @@ struct ldlm_namespace *ldlm_namespace_new(struct obd_device *obd, char *name, atomic_set(&ns->ns_bref, 0); init_waitqueue_head(&ns->ns_waitq); - ns->ns_max_parallel_ast = LDLM_DEFAULT_PARALLEL_AST_LIMIT; - ns->ns_nr_unused = 0; - ns->ns_max_unused = LDLM_DEFAULT_LRU_SIZE; - ns->ns_max_age = LDLM_DEFAULT_MAX_ALIVE; + ns->ns_max_parallel_ast = LDLM_DEFAULT_PARALLEL_AST_LIMIT; + ns->ns_nr_unused = 0; + ns->ns_max_unused = LDLM_DEFAULT_LRU_SIZE; + ns->ns_max_age = LDLM_DEFAULT_MAX_ALIVE; ns->ns_orig_connect_flags = 0; - ns->ns_connect_flags = 0; - ns->ns_stopping = 0; + ns->ns_connect_flags = 0; + ns->ns_stopping = 0; rc = ldlm_namespace_sysfs_register(ns); if (rc != 0) { @@ -775,7 +775,7 @@ static int ldlm_resource_clean(struct cfs_hash *hs, struct cfs_hash_bd *bd, static int ldlm_resource_complain(struct cfs_hash *hs, struct cfs_hash_bd *bd, struct hlist_node *hnode, void *arg) { - struct ldlm_resource *res = cfs_hash_object(hs, hnode); + struct ldlm_resource *res = cfs_hash_object(hs, hnode); lock_res(res); CERROR("%s: namespace resource " DLDLMRES @@ -1045,11 +1045,11 @@ struct ldlm_resource * const struct ldlm_res_id *name, enum ldlm_type type, int create) { - struct hlist_node *hnode; + struct hlist_node *hnode; struct ldlm_resource *res = NULL; - struct cfs_hash_bd bd; - u64 version; - int ns_refcount = 0; + struct cfs_hash_bd bd; + u64 version; + int ns_refcount = 0; int rc; LASSERT(!parent); @@ -1075,9 +1075,9 @@ struct ldlm_resource * if (!res) return ERR_PTR(-ENOMEM); - res->lr_ns_bucket = cfs_hash_bd_extra_get(ns->ns_rs_hash, &bd); - res->lr_name = *name; - res->lr_type = type; + res->lr_ns_bucket = cfs_hash_bd_extra_get(ns->ns_rs_hash, &bd); + res->lr_name = *name; + res->lr_type = type; cfs_hash_bd_lock(ns->ns_rs_hash, &bd, 1); hnode = (version == cfs_hash_bd_version_get(&bd)) ? NULL : @@ -1179,7 +1179,7 @@ static void __ldlm_resource_putref_final(struct cfs_hash_bd *bd, void ldlm_resource_putref(struct ldlm_resource *res) { struct ldlm_namespace *ns = ldlm_res_to_ns(res); - struct cfs_hash_bd bd; + struct cfs_hash_bd bd; LASSERT_ATOMIC_GT_LT(&res->lr_refcount, 0, LI_POISON); CDEBUG(D_INFO, "putref res: %p count: %d\n", @@ -1253,7 +1253,7 @@ static int ldlm_res_hash_dump(struct cfs_hash *hs, struct cfs_hash_bd *bd, struct hlist_node *hnode, void *arg) { struct ldlm_resource *res = cfs_hash_object(hs, hnode); - int level = (int)(unsigned long)arg; + int level = (int)(unsigned long)arg; lock_res(res); ldlm_resource_dump(level, res); -- 1.8.3.1 From jsimmons at infradead.org Thu Jan 31 17:19:20 2019 From: jsimmons at infradead.org (James Simmons) Date: Thu, 31 Jan 2019 12:19:20 -0500 Subject: [lustre-devel] [PATCH 16/26] obdclass: cleanup white spaces In-Reply-To: <1548955170-13456-1-git-send-email-jsimmons@infradead.org> References: <1548955170-13456-1-git-send-email-jsimmons@infradead.org> Message-ID: <1548955170-13456-17-git-send-email-jsimmons@infradead.org> The obdclass code is very messy and difficult to read. Remove excess white space and properly align data structures so they are easy on the eyes. Signed-off-by: James Simmons --- .../staging/lustre/lustre/obdclass/cl_internal.h | 2 +- drivers/staging/lustre/lustre/obdclass/cl_io.c | 28 ++--- drivers/staging/lustre/lustre/obdclass/cl_lock.c | 2 +- drivers/staging/lustre/lustre/obdclass/cl_object.c | 40 +++--- drivers/staging/lustre/lustre/obdclass/cl_page.c | 62 ++++----- drivers/staging/lustre/lustre/obdclass/class_obd.c | 6 +- drivers/staging/lustre/lustre/obdclass/genops.c | 16 +-- .../staging/lustre/lustre/obdclass/kernelcomm.c | 8 +- drivers/staging/lustre/lustre/obdclass/linkea.c | 6 +- drivers/staging/lustre/lustre/obdclass/llog.c | 40 +++--- drivers/staging/lustre/lustre/obdclass/llog_cat.c | 6 +- .../staging/lustre/lustre/obdclass/llog_internal.h | 24 ++-- drivers/staging/lustre/lustre/obdclass/llog_swab.c | 16 +-- .../lustre/lustre/obdclass/lprocfs_counters.c | 16 +-- .../lustre/lustre/obdclass/lprocfs_status.c | 140 ++++++++++----------- drivers/staging/lustre/lustre/obdclass/lu_object.c | 98 +++++++-------- .../lustre/lustre/obdclass/lustre_handles.c | 2 +- .../staging/lustre/lustre/obdclass/lustre_peer.c | 8 +- .../staging/lustre/lustre/obdclass/obd_config.c | 35 +++--- drivers/staging/lustre/lustre/obdclass/obd_mount.c | 15 ++- 20 files changed, 283 insertions(+), 287 deletions(-) diff --git a/drivers/staging/lustre/lustre/obdclass/cl_internal.h b/drivers/staging/lustre/lustre/obdclass/cl_internal.h index 8770e32..dc6bf10 100644 --- a/drivers/staging/lustre/lustre/obdclass/cl_internal.h +++ b/drivers/staging/lustre/lustre/obdclass/cl_internal.h @@ -44,7 +44,7 @@ struct cl_thread_info { /** * Used for submitting a sync I/O. */ - struct cl_sync_io clt_anchor; + struct cl_sync_io clt_anchor; }; struct cl_thread_info *cl_env_info(const struct lu_env *env); diff --git a/drivers/staging/lustre/lustre/obdclass/cl_io.c b/drivers/staging/lustre/lustre/obdclass/cl_io.c index d3f2455..09fd45d 100644 --- a/drivers/staging/lustre/lustre/obdclass/cl_io.c +++ b/drivers/staging/lustre/lustre/obdclass/cl_io.c @@ -86,7 +86,7 @@ static int cl_io_invariant(const struct cl_io *io) */ void cl_io_fini(const struct lu_env *env, struct cl_io *io) { - struct cl_io_slice *slice; + struct cl_io_slice *slice; LINVRNT(cl_io_type_is_valid(io->ci_type)); LINVRNT(cl_io_invariant(io)); @@ -207,8 +207,8 @@ int cl_io_rw_init(const struct lu_env *env, struct cl_io *io, "io range: %u [%llu, %llu) %u %u\n", iot, (u64)pos, (u64)pos + count, io->u.ci_rw.crw_nonblock, io->u.ci_wr.wr_append); - io->u.ci_rw.crw_pos = pos; - io->u.ci_rw.crw_count = count; + io->u.ci_rw.crw_pos = pos; + io->u.ci_rw.crw_count = count; return cl_io_init(env, io, iot, io->ci_obj); } EXPORT_SYMBOL(cl_io_rw_init); @@ -363,9 +363,9 @@ int cl_io_lock(const struct lu_env *env, struct cl_io *io) */ void cl_io_unlock(const struct lu_env *env, struct cl_io *io) { - struct cl_lockset *set; - struct cl_io_lock_link *link; - struct cl_io_lock_link *temp; + struct cl_lockset *set; + struct cl_io_lock_link *link; + struct cl_io_lock_link *temp; const struct cl_io_slice *scan; LASSERT(cl_io_is_loopable(io)); @@ -460,7 +460,7 @@ static void cl_io_rw_advance(const struct lu_env *env, struct cl_io *io, LINVRNT(cl_io_is_loopable(io)); LINVRNT(cl_io_invariant(io)); - io->u.ci_rw.crw_pos += nob; + io->u.ci_rw.crw_pos += nob; io->u.ci_rw.crw_count -= nob; /* layers have to be notified. */ @@ -506,8 +506,8 @@ int cl_io_lock_alloc_add(const struct lu_env *env, struct cl_io *io, link = kzalloc(sizeof(*link), GFP_NOFS); if (link) { - link->cill_descr = *descr; - link->cill_fini = cl_free_io_lock_link; + link->cill_descr = *descr; + link->cill_fini = cl_free_io_lock_link; result = cl_io_lock_add(env, io, link); if (result) /* lock match */ link->cill_fini(env, link); @@ -575,7 +575,7 @@ int cl_io_read_ahead(const struct lu_env *env, struct cl_io *io, pgoff_t start, struct cl_read_ahead *ra) { const struct cl_io_slice *scan; - int result = 0; + int result = 0; LINVRNT(io->ci_type == CIT_READ || io->ci_type == CIT_FAULT); LINVRNT(cl_io_invariant(io)); @@ -715,7 +715,7 @@ int cl_io_submit_sync(const struct lu_env *env, struct cl_io *io, */ int cl_io_loop(const struct lu_env *env, struct cl_io *io) { - int result = 0; + int result = 0; LINVRNT(cl_io_is_loopable(io)); @@ -725,7 +725,7 @@ int cl_io_loop(const struct lu_env *env, struct cl_io *io) io->ci_continue = 0; result = cl_io_iter_init(env, io); if (result == 0) { - nob = io->ci_nob; + nob = io->ci_nob; result = cl_io_lock(env, io); if (result == 0) { /* @@ -774,7 +774,7 @@ void cl_io_slice_add(struct cl_io *io, struct cl_io_slice *slice, list_empty(linkage)); list_add_tail(linkage, &io->ci_layers); - slice->cis_io = io; + slice->cis_io = io; slice->cis_obj = obj; slice->cis_iop = ops; } @@ -879,7 +879,6 @@ void cl_page_list_splice(struct cl_page_list *list, struct cl_page_list *head) } EXPORT_SYMBOL(cl_page_list_splice); - /** * Disowns pages in a queue. */ @@ -1102,7 +1101,6 @@ int cl_sync_io_wait(const struct lu_env *env, struct cl_sync_io *anchor, while (unlikely(atomic_read(&anchor->csi_barrier) != 0)) cpu_relax(); - return rc; } EXPORT_SYMBOL(cl_sync_io_wait); diff --git a/drivers/staging/lustre/lustre/obdclass/cl_lock.c b/drivers/staging/lustre/lustre/obdclass/cl_lock.c index 425ca9c..d7bcb8c 100644 --- a/drivers/staging/lustre/lustre/obdclass/cl_lock.c +++ b/drivers/staging/lustre/lustre/obdclass/cl_lock.c @@ -243,7 +243,7 @@ void cl_lock_descr_print(const struct lu_env *env, void *cookie, lu_printer_t printer, const struct cl_lock_descr *descr) { - const struct lu_fid *fid; + const struct lu_fid *fid; fid = lu_object_fid(&descr->cld_obj->co_lu); (*printer)(env, cookie, DDESCR "@" DFID, PDESCR(descr), PFID(fid)); diff --git a/drivers/staging/lustre/lustre/obdclass/cl_object.c b/drivers/staging/lustre/lustre/obdclass/cl_object.c index 5b59a71..05d784a 100644 --- a/drivers/staging/lustre/lustre/obdclass/cl_object.c +++ b/drivers/staging/lustre/lustre/obdclass/cl_object.c @@ -483,8 +483,8 @@ void cl_site_fini(struct cl_site *s) EXPORT_SYMBOL(cl_site_fini); static struct cache_stats cl_env_stats = { - .cs_name = "envs", - .cs_stats = { ATOMIC_INIT(0), } + .cs_name = "envs", + .cs_stats = { ATOMIC_INIT(0), } }; /** @@ -495,11 +495,11 @@ int cl_site_stats_print(const struct cl_site *site, struct seq_file *m) { size_t i; static const char * const pstate[] = { - [CPS_CACHED] = "c", - [CPS_OWNED] = "o", - [CPS_PAGEOUT] = "w", - [CPS_PAGEIN] = "r", - [CPS_FREEING] = "f" + [CPS_CACHED] = "c", + [CPS_OWNED] = "o", + [CPS_PAGEOUT] = "w", + [CPS_PAGEIN] = "r", + [CPS_FREEING] = "f" }; /* lookup hit total busy create @@ -553,9 +553,9 @@ int cl_site_stats_print(const struct cl_site *site, struct seq_file *m) } *cl_envs = NULL; struct cl_env { - void *ce_magic; - struct lu_env ce_lu; - struct lu_context ce_ses; + void *ce_magic; + struct lu_env ce_lu; + struct lu_context ce_ses; /* * Linkage into global list of all client environments. Used for @@ -565,12 +565,12 @@ struct cl_env { /* * */ - int ce_ref; + int ce_ref; /* * Debugging field: address of the caller who made original * allocation. */ - void *ce_debug; + void *ce_debug; }; static void cl_env_inc(enum cache_stats_item item) @@ -818,10 +818,10 @@ void cl_env_put(struct lu_env *env, u16 *refcheck) */ void cl_lvb2attr(struct cl_attr *attr, const struct ost_lvb *lvb) { - attr->cat_size = lvb->lvb_size; - attr->cat_mtime = lvb->lvb_mtime; - attr->cat_atime = lvb->lvb_atime; - attr->cat_ctime = lvb->lvb_ctime; + attr->cat_size = lvb->lvb_size; + attr->cat_mtime = lvb->lvb_mtime; + attr->cat_atime = lvb->lvb_atime; + attr->cat_ctime = lvb->lvb_ctime; attr->cat_blocks = lvb->lvb_blocks; } EXPORT_SYMBOL(cl_lvb2attr); @@ -936,7 +936,7 @@ struct cl_device *cl_type_setup(const struct lu_env *env, struct lu_site *site, struct lu_device_type *ldt, struct lu_device *next) { - const char *typename; + const char *typename; struct lu_device *d; typename = ldt->ldt_name; @@ -983,9 +983,9 @@ struct cl_thread_info *cl_env_info(const struct lu_env *env) LU_KEY_INIT_FINI(cl, struct cl_thread_info); static struct lu_context_key cl_key = { - .lct_tags = LCT_CL_THREAD, - .lct_init = cl_key_init, - .lct_fini = cl_key_fini, + .lct_tags = LCT_CL_THREAD, + .lct_init = cl_key_init, + .lct_fini = cl_key_fini, }; static struct lu_kmem_descr cl_object_caches[] = { diff --git a/drivers/staging/lustre/lustre/obdclass/cl_page.c b/drivers/staging/lustre/lustre/obdclass/cl_page.c index a560af1..b1b4dc7 100644 --- a/drivers/staging/lustre/lustre/obdclass/cl_page.c +++ b/drivers/staging/lustre/lustre/obdclass/cl_page.c @@ -95,7 +95,7 @@ static void cl_page_get_trust(struct cl_page *page) static void cl_page_free(const struct lu_env *env, struct cl_page *page) { - struct cl_object *obj = page->cp_obj; + struct cl_object *obj = page->cp_obj; PASSERT(env, page, list_empty(&page->cp_batch)); PASSERT(env, page, !page->cp_owner); @@ -132,7 +132,7 @@ struct cl_page *cl_page_alloc(const struct lu_env *env, struct page *vmpage, enum cl_page_type type) { - struct cl_page *page; + struct cl_page *page; struct lu_object_header *head; page = kzalloc(cl_object_header(o)->coh_page_bufsize, GFP_NOFS); @@ -185,7 +185,7 @@ struct cl_page *cl_page_find(const struct lu_env *env, pgoff_t idx, struct page *vmpage, enum cl_page_type type) { - struct cl_page *page = NULL; + struct cl_page *page = NULL; struct cl_object_header *hdr; LASSERT(type == CPT_CACHEABLE || type == CPT_TRANSIENT); @@ -239,39 +239,39 @@ static void __cl_page_state_set(const struct lu_env *env, */ static const int allowed_transitions[CPS_NR][CPS_NR] = { [CPS_CACHED] = { - [CPS_CACHED] = 0, - [CPS_OWNED] = 1, /* io finds existing cached page */ - [CPS_PAGEIN] = 0, - [CPS_PAGEOUT] = 1, /* write-out from the cache */ - [CPS_FREEING] = 1, /* eviction on the memory pressure */ + [CPS_CACHED] = 0, + [CPS_OWNED] = 1, /* io finds existing cached page */ + [CPS_PAGEIN] = 0, + [CPS_PAGEOUT] = 1, /* write-out from the cache */ + [CPS_FREEING] = 1, /* eviction on the memory pressure */ }, [CPS_OWNED] = { - [CPS_CACHED] = 1, /* release to the cache */ - [CPS_OWNED] = 0, - [CPS_PAGEIN] = 1, /* start read immediately */ - [CPS_PAGEOUT] = 1, /* start write immediately */ - [CPS_FREEING] = 1, /* lock invalidation or truncate */ + [CPS_CACHED] = 1, /* release to the cache */ + [CPS_OWNED] = 0, + [CPS_PAGEIN] = 1, /* start read immediately */ + [CPS_PAGEOUT] = 1, /* start write immediately */ + [CPS_FREEING] = 1, /* lock invalidation or truncate */ }, [CPS_PAGEIN] = { - [CPS_CACHED] = 1, /* io completion */ - [CPS_OWNED] = 0, - [CPS_PAGEIN] = 0, - [CPS_PAGEOUT] = 0, - [CPS_FREEING] = 0, + [CPS_CACHED] = 1, /* io completion */ + [CPS_OWNED] = 0, + [CPS_PAGEIN] = 0, + [CPS_PAGEOUT] = 0, + [CPS_FREEING] = 0, }, [CPS_PAGEOUT] = { - [CPS_CACHED] = 1, /* io completion */ - [CPS_OWNED] = 0, - [CPS_PAGEIN] = 0, - [CPS_PAGEOUT] = 0, - [CPS_FREEING] = 0, + [CPS_CACHED] = 1, /* io completion */ + [CPS_OWNED] = 0, + [CPS_PAGEIN] = 0, + [CPS_PAGEOUT] = 0, + [CPS_FREEING] = 0, }, [CPS_FREEING] = { - [CPS_CACHED] = 0, - [CPS_OWNED] = 0, - [CPS_PAGEIN] = 0, - [CPS_PAGEOUT] = 0, - [CPS_FREEING] = 0, + [CPS_CACHED] = 0, + [CPS_OWNED] = 0, + [CPS_PAGEIN] = 0, + [CPS_PAGEOUT] = 0, + [CPS_FREEING] = 0, } }; @@ -976,9 +976,9 @@ void cl_page_slice_add(struct cl_page *page, struct cl_page_slice *slice, const struct cl_page_operations *ops) { list_add_tail(&slice->cpl_linkage, &page->cp_layers); - slice->cpl_obj = obj; + slice->cpl_obj = obj; slice->cpl_index = index; - slice->cpl_ops = ops; + slice->cpl_ops = ops; slice->cpl_page = page; } EXPORT_SYMBOL(cl_page_slice_add); @@ -988,7 +988,7 @@ void cl_page_slice_add(struct cl_page *page, struct cl_page_slice *slice, */ struct cl_client_cache *cl_cache_init(unsigned long lru_page_max) { - struct cl_client_cache *cache = NULL; + struct cl_client_cache *cache = NULL; cache = kzalloc(sizeof(*cache), GFP_KERNEL); if (!cache) diff --git a/drivers/staging/lustre/lustre/obdclass/class_obd.c b/drivers/staging/lustre/lustre/obdclass/class_obd.c index e130cf7..b859ab19 100644 --- a/drivers/staging/lustre/lustre/obdclass/class_obd.c +++ b/drivers/staging/lustre/lustre/obdclass/class_obd.c @@ -587,9 +587,9 @@ static long obd_class_ioctl(struct file *filp, unsigned int cmd, /* modules setup */ static struct miscdevice obd_psdev = { - .minor = MISC_DYNAMIC_MINOR, - .name = OBD_DEV_NAME, - .fops = &obd_psdev_fops, + .minor = MISC_DYNAMIC_MINOR, + .name = OBD_DEV_NAME, + .fops = &obd_psdev_fops, }; static int obd_init_checks(void) diff --git a/drivers/staging/lustre/lustre/obdclass/genops.c b/drivers/staging/lustre/lustre/obdclass/genops.c index 3d4d6e1..cee144c 100644 --- a/drivers/staging/lustre/lustre/obdclass/genops.c +++ b/drivers/staging/lustre/lustre/obdclass/genops.c @@ -622,9 +622,9 @@ struct obd_device *class_devices_in_group(struct obd_uuid *grp_uuid, int *next) */ int class_notify_sptlrpc_conf(const char *fsname, int namelen) { - struct obd_device *obd; - const char *type; - int i, rc = 0, rc2; + struct obd_device *obd; + const char *type; + int i, rc = 0, rc2; LASSERT(namelen > 0); @@ -693,7 +693,7 @@ int obd_init_caches(void) goto out; return 0; - out: +out: obd_cleanup_caches(); return -ENOMEM; } @@ -772,8 +772,8 @@ static void export_handle_addref(void *export) } static struct portals_handle_ops export_handle_ops = { - .hop_addref = export_handle_addref, - .hop_free = NULL, + .hop_addref = export_handle_addref, + .hop_free = NULL, }; struct obd_export *class_export_get(struct obd_export *exp) @@ -967,8 +967,8 @@ static void import_handle_addref(void *import) } static struct portals_handle_ops import_handle_ops = { - .hop_addref = import_handle_addref, - .hop_free = NULL, + .hop_addref = import_handle_addref, + .hop_free = NULL, }; struct obd_import *class_import_get(struct obd_import *import) diff --git a/drivers/staging/lustre/lustre/obdclass/kernelcomm.c b/drivers/staging/lustre/lustre/obdclass/kernelcomm.c index 5d81996..925ba52 100644 --- a/drivers/staging/lustre/lustre/obdclass/kernelcomm.c +++ b/drivers/staging/lustre/lustre/obdclass/kernelcomm.c @@ -89,10 +89,10 @@ int libcfs_kkuc_msg_put(struct file *filp, void *payload) */ /** A single group registration has a uid and a file pointer */ struct kkuc_reg { - struct list_head kr_chain; - int kr_uid; - struct file *kr_fp; - char kr_data[0]; + struct list_head kr_chain; + int kr_uid; + struct file *kr_fp; + char kr_data[0]; }; static struct list_head kkuc_groups[KUC_GRP_MAX + 1]; diff --git a/drivers/staging/lustre/lustre/obdclass/linkea.c b/drivers/staging/lustre/lustre/obdclass/linkea.c index 74c99ee..33594bd 100644 --- a/drivers/staging/lustre/lustre/obdclass/linkea.c +++ b/drivers/staging/lustre/lustre/obdclass/linkea.c @@ -95,8 +95,8 @@ int linkea_init_with_rec(struct linkea_data *ldata) int linkea_entry_pack(struct link_ea_entry *lee, const struct lu_name *lname, const struct lu_fid *pfid) { - struct lu_fid tmpfid; - int reclen; + struct lu_fid tmpfid; + int reclen; tmpfid = *pfid; if (OBD_FAIL_CHECK(OBD_FAIL_LFSCK_LINKEA_CRASH)) @@ -216,7 +216,7 @@ int linkea_links_find(struct linkea_data *ldata, const struct lu_name *lname, const struct lu_fid *pfid) { struct lu_name tmpname; - struct lu_fid tmpfid; + struct lu_fid tmpfid; int count; LASSERT(ldata->ld_leh); diff --git a/drivers/staging/lustre/lustre/obdclass/llog.c b/drivers/staging/lustre/lustre/obdclass/llog.c index 8644d34..7aa459b 100644 --- a/drivers/staging/lustre/lustre/obdclass/llog.c +++ b/drivers/staging/lustre/lustre/obdclass/llog.c @@ -151,8 +151,8 @@ int llog_init_handle(const struct lu_env *env, struct llog_handle *handle, { int chunk_size = handle->lgh_ctxt->loc_chunk_size; enum llog_flag fmt = flags & LLOG_F_EXT_MASK; - struct llog_log_hdr *llh; - int rc; + struct llog_log_hdr *llh; + int rc; LASSERT(!handle->lgh_hdr); @@ -223,16 +223,16 @@ int llog_init_handle(const struct lu_env *env, struct llog_handle *handle, static int llog_process_thread(void *arg) { - struct llog_process_info *lpi = arg; - struct llog_handle *loghandle = lpi->lpi_loghandle; - struct llog_log_hdr *llh = loghandle->lgh_hdr; - struct llog_process_cat_data *cd = lpi->lpi_catdata; - char *buf; + struct llog_process_info *lpi = arg; + struct llog_handle *loghandle = lpi->lpi_loghandle; + struct llog_log_hdr *llh = loghandle->lgh_hdr; + struct llog_process_cat_data *cd = lpi->lpi_catdata; + char *buf; u64 cur_offset, tmp_offset; int chunk_size; - int rc = 0, index = 1, last_index; - int saved_index = 0; - int last_called_index = 0; + int rc = 0, index = 1, last_index; + int saved_index = 0; + int last_called_index = 0; if (!llh) return -EINVAL; @@ -394,9 +394,9 @@ static int llog_process_thread(void *arg) static int llog_process_thread_daemonize(void *arg) { - struct llog_process_info *lpi = arg; - struct lu_env env; - int rc; + struct llog_process_info *lpi = arg; + struct lu_env env; + int rc; unshare_fs_struct(); @@ -419,15 +419,15 @@ int llog_process_or_fork(const struct lu_env *env, llog_cb_t cb, void *data, void *catdata, bool fork) { struct llog_process_info *lpi; - int rc; + int rc; lpi = kzalloc(sizeof(*lpi), GFP_KERNEL); if (!lpi) return -ENOMEM; lpi->lpi_loghandle = loghandle; - lpi->lpi_cb = cb; - lpi->lpi_cbdata = data; - lpi->lpi_catdata = catdata; + lpi->lpi_cb = cb; + lpi->lpi_cbdata = data; + lpi->lpi_catdata = catdata; if (fork) { struct task_struct *task; @@ -469,7 +469,7 @@ int llog_open(const struct lu_env *env, struct llog_ctxt *ctxt, char *name, enum llog_open_param open_param) { const struct cred *old_cred = NULL; - int rc; + int rc; LASSERT(ctxt); LASSERT(ctxt->loc_logops); @@ -507,8 +507,8 @@ int llog_open(const struct lu_env *env, struct llog_ctxt *ctxt, int llog_close(const struct lu_env *env, struct llog_handle *loghandle) { - struct llog_operations *lop; - int rc; + struct llog_operations *lop; + int rc; rc = llog_handle2ops(loghandle, &lop); if (rc) diff --git a/drivers/staging/lustre/lustre/obdclass/llog_cat.c b/drivers/staging/lustre/lustre/obdclass/llog_cat.c index 172a368..b61c858 100644 --- a/drivers/staging/lustre/lustre/obdclass/llog_cat.c +++ b/drivers/staging/lustre/lustre/obdclass/llog_cat.c @@ -63,9 +63,9 @@ static int llog_cat_id2handle(const struct lu_env *env, struct llog_handle **res, struct llog_logid *logid) { - struct llog_handle *loghandle; + struct llog_handle *loghandle; enum llog_flag fmt; - int rc = 0; + int rc = 0; if (!cathandle) return -EBADF; @@ -125,7 +125,7 @@ static int llog_cat_id2handle(const struct lu_env *env, int llog_cat_close(const struct lu_env *env, struct llog_handle *cathandle) { - struct llog_handle *loghandle, *n; + struct llog_handle *loghandle, *n; list_for_each_entry_safe(loghandle, n, &cathandle->u.chd.chd_head, u.phd.phd_entry) { diff --git a/drivers/staging/lustre/lustre/obdclass/llog_internal.h b/drivers/staging/lustre/lustre/obdclass/llog_internal.h index 4991d4e..545119e 100644 --- a/drivers/staging/lustre/lustre/obdclass/llog_internal.h +++ b/drivers/staging/lustre/lustre/obdclass/llog_internal.h @@ -37,23 +37,23 @@ #include struct llog_process_info { - struct llog_handle *lpi_loghandle; - llog_cb_t lpi_cb; - void *lpi_cbdata; - void *lpi_catdata; - int lpi_rc; + struct llog_handle *lpi_loghandle; + llog_cb_t lpi_cb; + void *lpi_cbdata; + void *lpi_catdata; + int lpi_rc; struct completion lpi_completion; - const struct lu_env *lpi_env; + const struct lu_env *lpi_env; }; struct llog_thread_info { - struct lu_attr lgi_attr; - struct lu_fid lgi_fid; - struct lu_buf lgi_buf; - loff_t lgi_off; - struct llog_rec_hdr lgi_lrh; - struct llog_rec_tail lgi_tail; + struct lu_attr lgi_attr; + struct lu_fid lgi_fid; + struct lu_buf lgi_buf; + loff_t lgi_off; + struct llog_rec_hdr lgi_lrh; + struct llog_rec_tail lgi_tail; }; extern struct lu_context_key llog_thread_key; diff --git a/drivers/staging/lustre/lustre/obdclass/llog_swab.c b/drivers/staging/lustre/lustre/obdclass/llog_swab.c index fddc1ea..57dadec 100644 --- a/drivers/staging/lustre/lustre/obdclass/llog_swab.c +++ b/drivers/staging/lustre/lustre/obdclass/llog_swab.c @@ -358,14 +358,14 @@ void lustre_swab_lustre_cfg(struct lustre_cfg *lcfg) /* used only for compatibility with old on-disk cfg_marker data */ struct cfg_marker32 { - u32 cm_step; - u32 cm_flags; - u32 cm_vers; - u32 padding; - u32 cm_createtime; - u32 cm_canceltime; - char cm_tgtname[MTI_NAME_MAXLEN]; - char cm_comment[MTI_NAME_MAXLEN]; + u32 cm_step; + u32 cm_flags; + u32 cm_vers; + u32 padding; + u32 cm_createtime; + u32 cm_canceltime; + char cm_tgtname[MTI_NAME_MAXLEN]; + char cm_comment[MTI_NAME_MAXLEN]; }; #define MTI_NAMELEN32 (MTI_NAME_MAXLEN - \ diff --git a/drivers/staging/lustre/lustre/obdclass/lprocfs_counters.c b/drivers/staging/lustre/lustre/obdclass/lprocfs_counters.c index 77bc66f..c7bf1ee 100644 --- a/drivers/staging/lustre/lustre/obdclass/lprocfs_counters.c +++ b/drivers/staging/lustre/lustre/obdclass/lprocfs_counters.c @@ -45,10 +45,10 @@ void lprocfs_counter_add(struct lprocfs_stats *stats, int idx, long amount) { - struct lprocfs_counter *percpu_cntr; - struct lprocfs_counter_header *header; - int smp_id; - unsigned long flags = 0; + struct lprocfs_counter *percpu_cntr; + struct lprocfs_counter_header *header; + int smp_id; + unsigned long flags = 0; if (!stats) return; @@ -94,10 +94,10 @@ void lprocfs_counter_add(struct lprocfs_stats *stats, int idx, long amount) void lprocfs_counter_sub(struct lprocfs_stats *stats, int idx, long amount) { - struct lprocfs_counter *percpu_cntr; - struct lprocfs_counter_header *header; - int smp_id; - unsigned long flags = 0; + struct lprocfs_counter *percpu_cntr; + struct lprocfs_counter_header *header; + int smp_id; + unsigned long flags = 0; if (!stats) return; diff --git a/drivers/staging/lustre/lustre/obdclass/lprocfs_status.c b/drivers/staging/lustre/lustre/obdclass/lprocfs_status.c index cc70402..e1ac610 100644 --- a/drivers/staging/lustre/lustre/obdclass/lprocfs_status.c +++ b/drivers/staging/lustre/lustre/obdclass/lprocfs_status.c @@ -364,7 +364,7 @@ static ssize_t blocksize_show(struct kobject *kobj, struct attribute *attr, { struct obd_device *obd = container_of(kobj, struct obd_device, obd_kset.kobj); - struct obd_statfs osfs; + struct obd_statfs osfs; int rc = obd_statfs(NULL, obd->obd_self_export, &osfs, get_jiffies_64() - OBD_STATFS_CACHE_SECONDS * HZ, OBD_STATFS_NODELAY); @@ -380,7 +380,7 @@ static ssize_t kbytestotal_show(struct kobject *kobj, struct attribute *attr, { struct obd_device *obd = container_of(kobj, struct obd_device, obd_kset.kobj); - struct obd_statfs osfs; + struct obd_statfs osfs; int rc = obd_statfs(NULL, obd->obd_self_export, &osfs, get_jiffies_64() - OBD_STATFS_CACHE_SECONDS * HZ, OBD_STATFS_NODELAY); @@ -403,7 +403,7 @@ static ssize_t kbytesfree_show(struct kobject *kobj, struct attribute *attr, { struct obd_device *obd = container_of(kobj, struct obd_device, obd_kset.kobj); - struct obd_statfs osfs; + struct obd_statfs osfs; int rc = obd_statfs(NULL, obd->obd_self_export, &osfs, get_jiffies_64() - OBD_STATFS_CACHE_SECONDS * HZ, OBD_STATFS_NODELAY); @@ -426,7 +426,7 @@ static ssize_t kbytesavail_show(struct kobject *kobj, struct attribute *attr, { struct obd_device *obd = container_of(kobj, struct obd_device, obd_kset.kobj); - struct obd_statfs osfs; + struct obd_statfs osfs; int rc = obd_statfs(NULL, obd->obd_self_export, &osfs, get_jiffies_64() - OBD_STATFS_CACHE_SECONDS * HZ, OBD_STATFS_NODELAY); @@ -449,7 +449,7 @@ static ssize_t filestotal_show(struct kobject *kobj, struct attribute *attr, { struct obd_device *obd = container_of(kobj, struct obd_device, obd_kset.kobj); - struct obd_statfs osfs; + struct obd_statfs osfs; int rc = obd_statfs(NULL, obd->obd_self_export, &osfs, get_jiffies_64() - OBD_STATFS_CACHE_SECONDS * HZ, OBD_STATFS_NODELAY); @@ -465,7 +465,7 @@ static ssize_t filesfree_show(struct kobject *kobj, struct attribute *attr, { struct obd_device *obd = container_of(kobj, struct obd_device, obd_kset.kobj); - struct obd_statfs osfs; + struct obd_statfs osfs; int rc = obd_statfs(NULL, obd->obd_self_export, &osfs, get_jiffies_64() - OBD_STATFS_CACHE_SECONDS * HZ, OBD_STATFS_NODELAY); @@ -638,10 +638,10 @@ void lprocfs_stats_unlock(struct lprocfs_stats *stats, void lprocfs_stats_collect(struct lprocfs_stats *stats, int idx, struct lprocfs_counter *cnt) { - unsigned int num_entry; - struct lprocfs_counter *percpu_cntr; - int i; - unsigned long flags = 0; + unsigned int num_entry; + struct lprocfs_counter *percpu_cntr; + int i; + unsigned long flags = 0; memset(cnt, 0, sizeof(*cnt)); @@ -740,17 +740,17 @@ static void obd_connect_seq_flags2str(struct seq_file *m, u64 flags, int lprocfs_rd_import(struct seq_file *m, void *data) { - char nidstr[LNET_NIDSTR_SIZE]; - struct lprocfs_counter ret; - struct lprocfs_counter_header *header; - struct obd_device *obd = data; - struct obd_import *imp; - struct obd_import_conn *conn; + char nidstr[LNET_NIDSTR_SIZE]; + struct lprocfs_counter ret; + struct lprocfs_counter_header *header; + struct obd_device *obd = data; + struct obd_import *imp; + struct obd_import_conn *conn; struct obd_connect_data *ocd; - int j; - int k; - int rw = 0; - int rc; + int j; + int k; + int rw = 0; + int rc; LASSERT(obd); rc = lprocfs_climp_check(obd); @@ -1101,11 +1101,11 @@ int lprocfs_obd_cleanup(struct obd_device *obd) int lprocfs_stats_alloc_one(struct lprocfs_stats *stats, unsigned int cpuid) { - struct lprocfs_counter *cntr; - unsigned int percpusize; - int rc = -ENOMEM; - unsigned long flags = 0; - int i; + struct lprocfs_counter *cntr; + unsigned int percpusize; + int rc = -ENOMEM; + unsigned long flags = 0; + int i; LASSERT(!stats->ls_percpu[cpuid]); LASSERT((stats->ls_flags & LPROCFS_STATS_FLAG_NOPERCPU) == 0); @@ -1138,10 +1138,10 @@ int lprocfs_stats_alloc_one(struct lprocfs_stats *stats, unsigned int cpuid) struct lprocfs_stats *lprocfs_alloc_stats(unsigned int num, enum lprocfs_stats_flags flags) { - struct lprocfs_stats *stats; - unsigned int num_entry; - unsigned int percpusize = 0; - int i; + struct lprocfs_stats *stats; + unsigned int num_entry; + unsigned int percpusize = 0; + int i; if (num == 0) return NULL; @@ -1221,9 +1221,9 @@ u64 lprocfs_stats_collector(struct lprocfs_stats *stats, int idx, enum lprocfs_fields_flags field) { unsigned int i; - unsigned int num_cpu; - unsigned long flags = 0; - u64 ret = 0; + unsigned int num_cpu; + unsigned long flags = 0; + u64 ret = 0; LASSERT(stats); @@ -1243,11 +1243,11 @@ u64 lprocfs_stats_collector(struct lprocfs_stats *stats, int idx, void lprocfs_clear_stats(struct lprocfs_stats *stats) { - struct lprocfs_counter *percpu_cntr; - int i; - int j; - unsigned int num_entry; - unsigned long flags = 0; + struct lprocfs_counter *percpu_cntr; + int i; + int j; + unsigned int num_entry; + unsigned long flags = 0; num_entry = lprocfs_stats_lock(stats, LPROCFS_GET_NUM_CPU, &flags); @@ -1256,11 +1256,11 @@ void lprocfs_clear_stats(struct lprocfs_stats *stats) continue; for (j = 0; j < stats->ls_num; j++) { percpu_cntr = lprocfs_stats_counter_get(stats, i, j); - percpu_cntr->lc_count = 0; - percpu_cntr->lc_min = LC_MIN_INIT; - percpu_cntr->lc_max = 0; - percpu_cntr->lc_sumsquare = 0; - percpu_cntr->lc_sum = 0; + percpu_cntr->lc_count = 0; + percpu_cntr->lc_min = LC_MIN_INIT; + percpu_cntr->lc_max = 0; + percpu_cntr->lc_sumsquare = 0; + percpu_cntr->lc_sum = 0; if (stats->ls_flags & LPROCFS_STATS_FLAG_IRQ_SAFE) percpu_cntr->lc_sum_irq = 0; } @@ -1302,10 +1302,10 @@ static void *lprocfs_stats_seq_next(struct seq_file *p, void *v, loff_t *pos) /* seq file export of one lprocfs counter */ static int lprocfs_stats_seq_show(struct seq_file *p, void *v) { - struct lprocfs_stats *stats = p->private; - struct lprocfs_counter_header *hdr; - struct lprocfs_counter ctr; - int idx = *(loff_t *)v; + struct lprocfs_stats *stats = p->private; + struct lprocfs_counter_header *hdr; + struct lprocfs_counter ctr; + int idx = *(loff_t *)v; if (idx == 0) { struct timespec64 now; @@ -1337,10 +1337,10 @@ static int lprocfs_stats_seq_show(struct seq_file *p, void *v) } static const struct seq_operations lprocfs_stats_seq_sops = { - .start = lprocfs_stats_seq_start, - .stop = lprocfs_stats_seq_stop, - .next = lprocfs_stats_seq_next, - .show = lprocfs_stats_seq_show, + .start = lprocfs_stats_seq_start, + .stop = lprocfs_stats_seq_stop, + .next = lprocfs_stats_seq_next, + .show = lprocfs_stats_seq_show, }; static int lprocfs_stats_seq_open(struct inode *inode, struct file *file) @@ -1359,12 +1359,12 @@ static int lprocfs_stats_seq_open(struct inode *inode, struct file *file) } const struct file_operations lprocfs_stats_seq_fops = { - .owner = THIS_MODULE, - .open = lprocfs_stats_seq_open, - .read = seq_read, - .write = lprocfs_stats_seq_write, - .llseek = seq_lseek, - .release = lprocfs_seq_release, + .owner = THIS_MODULE, + .open = lprocfs_stats_seq_open, + .read = seq_read, + .write = lprocfs_stats_seq_write, + .llseek = seq_lseek, + .release = lprocfs_seq_release, }; EXPORT_SYMBOL_GPL(lprocfs_stats_seq_fops); @@ -1372,30 +1372,30 @@ void lprocfs_counter_init(struct lprocfs_stats *stats, int index, unsigned int conf, const char *name, const char *units) { - struct lprocfs_counter_header *header; - struct lprocfs_counter *percpu_cntr; - unsigned long flags = 0; - unsigned int i; - unsigned int num_cpu; + struct lprocfs_counter_header *header; + struct lprocfs_counter *percpu_cntr; + unsigned long flags = 0; + unsigned int i; + unsigned int num_cpu; header = &stats->ls_cnt_header[index]; LASSERTF(header, "Failed to allocate stats header:[%d]%s/%s\n", index, name, units); header->lc_config = conf; - header->lc_name = name; - header->lc_units = units; + header->lc_name = name; + header->lc_units = units; num_cpu = lprocfs_stats_lock(stats, LPROCFS_GET_NUM_CPU, &flags); for (i = 0; i < num_cpu; ++i) { if (!stats->ls_percpu[i]) continue; percpu_cntr = lprocfs_stats_counter_get(stats, i, index); - percpu_cntr->lc_count = 0; - percpu_cntr->lc_min = LC_MIN_INIT; - percpu_cntr->lc_max = 0; - percpu_cntr->lc_sumsquare = 0; - percpu_cntr->lc_sum = 0; + percpu_cntr->lc_count = 0; + percpu_cntr->lc_min = LC_MIN_INIT; + percpu_cntr->lc_max = 0; + percpu_cntr->lc_sumsquare = 0; + percpu_cntr->lc_sum = 0; if ((stats->ls_flags & LPROCFS_STATS_FLAG_IRQ_SAFE) != 0) percpu_cntr->lc_sum_irq = 0; } @@ -1843,8 +1843,8 @@ ssize_t lustre_attr_store(struct kobject *kobj, struct attribute *attr, EXPORT_SYMBOL_GPL(lustre_attr_store); const struct sysfs_ops lustre_sysfs_ops = { - .show = lustre_attr_show, - .store = lustre_attr_store, + .show = lustre_attr_show, + .store = lustre_attr_store, }; EXPORT_SYMBOL_GPL(lustre_sysfs_ops); diff --git a/drivers/staging/lustre/lustre/obdclass/lu_object.c b/drivers/staging/lustre/lustre/obdclass/lu_object.c index a132d87..3bd4874 100644 --- a/drivers/staging/lustre/lustre/obdclass/lu_object.c +++ b/drivers/staging/lustre/lustre/obdclass/lu_object.c @@ -87,15 +87,15 @@ enum { #define LU_CACHE_NR_LDISKFS_LIMIT LU_CACHE_NR_UNLIMITED #define LU_CACHE_NR_ZFS_LIMIT 256 -#define LU_SITE_BITS_MIN 12 -#define LU_SITE_BITS_MAX 24 -#define LU_SITE_BITS_MAX_CL 19 +#define LU_SITE_BITS_MIN 12 +#define LU_SITE_BITS_MAX 24 +#define LU_SITE_BITS_MAX_CL 19 /** * total 256 buckets, we don't want too many buckets because: * - consume too much memory * - avoid unbalanced LRU list */ -#define LU_SITE_BKT_BITS 8 +#define LU_SITE_BKT_BITS 8 static unsigned int lu_cache_percent = LU_CACHE_PERCENT_DEFAULT; module_param(lu_cache_percent, int, 0644); @@ -129,10 +129,10 @@ void lu_object_put(const struct lu_env *env, struct lu_object *o) { struct lu_site_bkt_data *bkt; struct lu_object_header *top; - struct lu_site *site; - struct lu_object *orig; - struct cfs_hash_bd bd; - const struct lu_fid *fid; + struct lu_site *site; + struct lu_object *orig; + struct cfs_hash_bd bd; + const struct lu_fid *fid; top = o->lo_header; site = o->lo_dev->ld_site; @@ -319,14 +319,14 @@ static struct lu_object *lu_object_alloc(const struct lu_env *env, static void lu_object_free(const struct lu_env *env, struct lu_object *o) { wait_queue_head_t *wq; - struct lu_site *site; - struct lu_object *scan; - struct list_head *layers; - struct list_head splice; + struct lu_site *site; + struct lu_object *scan; + struct list_head *layers; + struct list_head splice; - site = o->lo_dev->ld_site; + site = o->lo_dev->ld_site; layers = &o->lo_header->loh_layers; - wq = lu_site_wq_from_fid(site, &o->lo_header->loh_fid); + wq = lu_site_wq_from_fid(site, &o->lo_header->loh_fid); /* * First call ->loo_object_delete() method to release all resources. */ @@ -369,13 +369,13 @@ int lu_site_purge_objects(const struct lu_env *env, struct lu_site *s, struct lu_object_header *h; struct lu_object_header *temp; struct lu_site_bkt_data *bkt; - struct cfs_hash_bd bd; - struct cfs_hash_bd bd2; - struct list_head dispose; - int did_sth; + struct cfs_hash_bd bd; + struct cfs_hash_bd bd2; + struct list_head dispose; + int did_sth; unsigned int start = 0; - int count; - int bnr; + int count; + int bnr; unsigned int i; if (OBD_FAIL_CHECK(OBD_FAIL_OBD_NO_LRU)) @@ -389,7 +389,7 @@ int lu_site_purge_objects(const struct lu_env *env, struct lu_site *s, if (nr != ~0) start = s->ls_purge_start; bnr = (nr == ~0) ? -1 : nr / (int)CFS_HASH_NBKT(s->ls_obj_hash) + 1; - again: +again: /* * It doesn't make any sense to make purge threads parallel, that can * only bring troubles to us. See LU-5331. @@ -496,10 +496,10 @@ struct lu_cdebug_data { * lu_global_init(). */ static struct lu_context_key lu_global_key = { - .lct_tags = LCT_MD_THREAD | LCT_DT_THREAD | - LCT_MG_THREAD | LCT_CL_THREAD | LCT_LOCAL, - .lct_init = lu_global_key_init, - .lct_fini = lu_global_key_fini + .lct_tags = LCT_MD_THREAD | LCT_DT_THREAD | + LCT_MG_THREAD | LCT_CL_THREAD | LCT_LOCAL, + .lct_init = lu_global_key_init, + .lct_fini = lu_global_key_fini }; /** @@ -509,7 +509,7 @@ int lu_cdebug_printer(const struct lu_env *env, void *cookie, const char *format, ...) { struct libcfs_debug_msg_data *msgdata = cookie; - struct lu_cdebug_data *key; + struct lu_cdebug_data *key; int used; int complete; va_list args; @@ -594,7 +594,7 @@ static struct lu_object *htable_lookup(struct lu_site *s, { struct lu_site_bkt_data *bkt; struct lu_object_header *h; - struct hlist_node *hnode; + struct hlist_node *hnode; u64 ver = cfs_hash_bd_version_get(bd); if (*version == ver) @@ -670,12 +670,12 @@ struct lu_object *lu_object_find_at(const struct lu_env *env, const struct lu_fid *f, const struct lu_object_conf *conf) { - struct lu_object *o; - struct lu_object *shadow; - struct lu_site *s; - struct cfs_hash *hs; - struct cfs_hash_bd bd; - u64 version = 0; + struct lu_object *o; + struct lu_object *shadow; + struct lu_site *s; + struct cfs_hash *hs; + struct cfs_hash_bd bd; + u64 version = 0; /* * This uses standard index maintenance protocol: @@ -795,9 +795,9 @@ void lu_device_type_fini(struct lu_device_type *ldt) static struct lu_env lu_shrink_env; struct lu_site_print_arg { - struct lu_env *lsp_env; - void *lsp_cookie; - lu_printer_t lsp_printer; + struct lu_env *lsp_env; + void *lsp_cookie; + lu_printer_t lsp_printer; }; static int @@ -805,7 +805,7 @@ struct lu_site_print_arg { struct hlist_node *hnode, void *data) { struct lu_site_print_arg *arg = (struct lu_site_print_arg *)data; - struct lu_object_header *h; + struct lu_object_header *h; h = hlist_entry(hnode, struct lu_object_header, loh_hash); if (!list_empty(&h->loh_layers)) { @@ -828,9 +828,9 @@ void lu_site_print(const struct lu_env *env, struct lu_site *s, void *cookie, lu_printer_t printer) { struct lu_site_print_arg arg = { - .lsp_env = (struct lu_env *)env, - .lsp_cookie = cookie, - .lsp_printer = printer, + .lsp_env = (struct lu_env *)env, + .lsp_cookie = cookie, + .lsp_printer = printer, }; cfs_hash_for_each(s->ls_obj_hash, lu_site_obj_print, &arg); @@ -883,8 +883,8 @@ static unsigned long lu_htable_order(struct lu_device *top) static unsigned int lu_obj_hop_hash(struct cfs_hash *hs, const void *key, unsigned int mask) { - struct lu_fid *fid = (struct lu_fid *)key; - u32 hash; + struct lu_fid *fid = (struct lu_fid *)key; + u32 hash; hash = fid_flatten32(fid); hash += (hash >> 4) + (hash << 12); /* mixing oid and seq */ @@ -1247,7 +1247,7 @@ struct lu_object *lu_object_locate(struct lu_object_header *h, */ void lu_stack_fini(const struct lu_env *env, struct lu_device *top) { - struct lu_site *site = top->ld_site; + struct lu_site *site = top->ld_site; struct lu_device *scan; struct lu_device *next; @@ -1263,7 +1263,7 @@ void lu_stack_fini(const struct lu_env *env, struct lu_device *top) for (scan = top; scan; scan = next) { const struct lu_device_type *ldt = scan->ld_type; - struct obd_type *type; + struct obd_type *type; next = ldt->ldt_ops->ldto_device_free(env, scan); type = ldt->ldt_obd_type; @@ -1595,7 +1595,7 @@ static int keys_init(struct lu_context *ctx) */ int lu_context_init(struct lu_context *ctx, u32 tags) { - int rc; + int rc; memset(ctx, 0, sizeof(*ctx)); ctx->lc_state = LCS_INITIALIZED; @@ -1761,7 +1761,7 @@ static void lu_site_stats_get(const struct lu_site *s, stats->lss_busy += cfs_hash_size_get(hs) - percpu_counter_sum_positive(&s2->ls_lru_len_counter); cfs_hash_for_each_bucket(hs, &bd, i) { - struct hlist_head *hhead; + struct hlist_head *hhead; cfs_hash_bd_lock(hs, &bd, 1); stats->lss_total += cfs_hash_bd_count_get(&bd); @@ -1860,9 +1860,9 @@ static unsigned long lu_cache_shrink_scan(struct shrinker *sk, * Debugging printer function using printk(). */ static struct shrinker lu_site_shrinker = { - .count_objects = lu_cache_shrink_count, - .scan_objects = lu_cache_shrink_scan, - .seeks = DEFAULT_SEEKS, + .count_objects = lu_cache_shrink_count, + .scan_objects = lu_cache_shrink_scan, + .seeks = DEFAULT_SEEKS, }; /** diff --git a/drivers/staging/lustre/lustre/obdclass/lustre_handles.c b/drivers/staging/lustre/lustre/obdclass/lustre_handles.c index b296877..0674afb 100644 --- a/drivers/staging/lustre/lustre/obdclass/lustre_handles.c +++ b/drivers/staging/lustre/lustre/obdclass/lustre_handles.c @@ -47,7 +47,7 @@ static spinlock_t handle_base_lock; static struct handle_bucket { - spinlock_t lock; + spinlock_t lock; struct list_head head; } *handle_hash; diff --git a/drivers/staging/lustre/lustre/obdclass/lustre_peer.c b/drivers/staging/lustre/lustre/obdclass/lustre_peer.c index 8e7f3a8..0c3e0ca 100644 --- a/drivers/staging/lustre/lustre/obdclass/lustre_peer.c +++ b/drivers/staging/lustre/lustre/obdclass/lustre_peer.c @@ -44,10 +44,10 @@ #define NIDS_MAX 32 struct uuid_nid_data { - struct list_head un_list; - struct obd_uuid un_uuid; - int un_nid_count; - lnet_nid_t un_nids[NIDS_MAX]; + struct list_head un_list; + struct obd_uuid un_uuid; + int un_nid_count; + lnet_nid_t un_nids[NIDS_MAX]; }; /* FIXME: This should probably become more elegant than a global linked list */ diff --git a/drivers/staging/lustre/lustre/obdclass/obd_config.c b/drivers/staging/lustre/lustre/obdclass/obd_config.c index 887afda..0cdadea4 100644 --- a/drivers/staging/lustre/lustre/obdclass/obd_config.c +++ b/drivers/staging/lustre/lustre/obdclass/obd_config.c @@ -189,8 +189,8 @@ static int class_parse_value(char *buf, int opc, void *value, char **endh, int quiet) { char *endp; - char tmp; - int rc = 0; + char tmp; + int rc = 0; if (!buf) return 1; @@ -249,7 +249,7 @@ char *lustre_cfg_string(struct lustre_cfg *lcfg, u32 index) /* * make sure it's NULL terminated, even if this kills a char - * of data. Try to use the padding first though. + * of data. Try to use the padding first though. */ if (s[lcfg->lcfg_buflens[index] - 1] != '\0') { size_t last = ALIGN(lcfg->lcfg_buflens[index], 8) - 1; @@ -388,7 +388,6 @@ static int class_setup(struct obd_device *obd, struct lustre_cfg *lcfg) /* create an uuid-export lustre hash */ err = rhashtable_init(&obd->obd_uuid_hash, &uuid_hash_params); - if (err) goto err_hash; @@ -1407,7 +1406,7 @@ int class_config_llog_handler(const struct lu_env *env, } lustre_cfg_init(lcfg_new, lcfg->lcfg_command, &bufs); - lcfg_new->lcfg_num = lcfg->lcfg_num; + lcfg_new->lcfg_num = lcfg->lcfg_num; lcfg_new->lcfg_flags = lcfg->lcfg_flags; /* XXX Hack to try to remain binary compatible with @@ -1454,9 +1453,9 @@ int class_config_parse_llog(const struct lu_env *env, struct llog_ctxt *ctxt, struct llog_process_cat_data cd = { .lpcd_first_idx = 0, }; - struct llog_handle *llh; - llog_cb_t callback; - int rc; + struct llog_handle *llh; + llog_cb_t callback; + int rc; CDEBUG(D_INFO, "looking up llog %s\n", name); rc = llog_open(env, ctxt, &llh, NULL, name, LLOG_OPEN_EXISTS); @@ -1499,10 +1498,10 @@ int class_config_parse_llog(const struct lu_env *env, struct llog_ctxt *ctxt, static int class_config_parse_rec(struct llog_rec_hdr *rec, char *buf, int size) { - struct lustre_cfg *lcfg = (struct lustre_cfg *)(rec + 1); - char *ptr = buf; - char *end = buf + size; - int rc = 0; + struct lustre_cfg *lcfg = (struct lustre_cfg *)(rec + 1); + char *ptr = buf; + char *end = buf + size; + int rc = 0; LASSERT(rec->lrh_type == OBD_CFG_REC); rc = lustre_cfg_sanity_check(lcfg, rec->lrh_len); @@ -1549,8 +1548,8 @@ int class_config_dump_handler(const struct lu_env *env, struct llog_handle *handle, struct llog_rec_hdr *rec, void *data) { - char *outstr; - int rc = 0; + char *outstr; + int rc = 0; outstr = kzalloc(256, GFP_NOFS); if (!outstr) @@ -1573,10 +1572,10 @@ int class_config_dump_handler(const struct lu_env *env, */ int class_manual_cleanup(struct obd_device *obd) { - char flags[3] = ""; - struct lustre_cfg *lcfg; - struct lustre_cfg_bufs bufs; - int rc; + char flags[3] = ""; + struct lustre_cfg *lcfg; + struct lustre_cfg_bufs bufs; + int rc; if (!obd) { CERROR("empty cleanup\n"); diff --git a/drivers/staging/lustre/lustre/obdclass/obd_mount.c b/drivers/staging/lustre/lustre/obdclass/obd_mount.c index eab3216..33aa790 100644 --- a/drivers/staging/lustre/lustre/obdclass/obd_mount.c +++ b/drivers/staging/lustre/lustre/obdclass/obd_mount.c @@ -150,7 +150,7 @@ static int do_lcfg(char *cfgname, lnet_nid_t nid, int cmd, char *s1, char *s2, char *s3, char *s4) { struct lustre_cfg_bufs bufs; - struct lustre_cfg *lcfg = NULL; + struct lustre_cfg *lcfg = NULL; int rc; CDEBUG(D_TRACE, "lcfg %s %#x %s %s %s %s\n", cfgname, @@ -801,8 +801,8 @@ static int lmd_make_exclusion(struct lustre_mount_data *lmd, const char *ptr) static int lmd_parse_mgssec(struct lustre_mount_data *lmd, char *ptr) { - char *tail; - int length; + char *tail; + int length; kfree(lmd->lmd_mgssec); lmd->lmd_mgssec = NULL; @@ -845,8 +845,8 @@ static int lmd_parse_network(struct lustre_mount_data *lmd, char *ptr) static int lmd_parse_string(char **handle, char *ptr) { - char *tail; - int length; + char *tail; + int length; if (!handle || !ptr) return -EINVAL; @@ -876,8 +876,8 @@ static int lmd_parse_mgs(struct lustre_mount_data *lmd, char **ptr) lnet_nid_t nid; char *tail = *ptr; char *mgsnid; - int length; - int oldlen = 0; + int length; + int oldlen = 0; /* Find end of nidlist */ while (class_parse_nid_quiet(tail, &nid, &tail) == 0) @@ -1252,4 +1252,3 @@ int lmd_parse(char *options, struct lustre_mount_data *lmd) return -EINVAL; } EXPORT_SYMBOL(lmd_parse); - -- 1.8.3.1 From jsimmons at infradead.org Thu Jan 31 17:19:25 2019 From: jsimmons at infradead.org (James Simmons) Date: Thu, 31 Jan 2019 12:19:25 -0500 Subject: [lustre-devel] [PATCH 21/26] lustre: second batch to cleanup white spaces in internal headers In-Reply-To: <1548955170-13456-1-git-send-email-jsimmons@infradead.org> References: <1548955170-13456-1-git-send-email-jsimmons@infradead.org> Message-ID: <1548955170-13456-22-git-send-email-jsimmons@infradead.org> The internal headers are very messy and difficult to read. Remove excess white space and properly align data structures so they are easy on the eyes. This is the second batch since it covers many lines of changes. Signed-off-by: James Simmons --- .../staging/lustre/lustre/include/lustre_export.h | 76 ++-- drivers/staging/lustre/lustre/include/lustre_fid.h | 12 +- drivers/staging/lustre/lustre/include/lustre_fld.h | 14 +- .../staging/lustre/lustre/include/lustre_handles.h | 2 +- .../staging/lustre/lustre/include/lustre_import.h | 225 ++++++------ .../staging/lustre/lustre/include/lustre_intent.h | 24 +- drivers/staging/lustre/lustre/include/lustre_lib.h | 2 - drivers/staging/lustre/lustre/include/lustre_log.h | 38 +- drivers/staging/lustre/lustre/include/lustre_mdc.h | 2 +- drivers/staging/lustre/lustre/include/lustre_mds.h | 4 +- drivers/staging/lustre/lustre/include/lustre_net.h | 388 +++++++++++---------- .../lustre/lustre/include/lustre_nrs_fifo.h | 4 +- .../lustre/lustre/include/lustre_req_layout.h | 8 +- drivers/staging/lustre/lustre/include/lustre_sec.h | 300 ++++++++-------- 14 files changed, 550 insertions(+), 549 deletions(-) diff --git a/drivers/staging/lustre/lustre/include/lustre_export.h b/drivers/staging/lustre/lustre/include/lustre_export.h index 1c70259..63fa656 100644 --- a/drivers/staging/lustre/lustre/include/lustre_export.h +++ b/drivers/staging/lustre/lustre/include/lustre_export.h @@ -48,9 +48,9 @@ #include enum obd_option { - OBD_OPT_FORCE = 0x0001, - OBD_OPT_FAILOVER = 0x0002, - OBD_OPT_ABORT_RECOV = 0x0004, + OBD_OPT_FORCE = 0x0001, + OBD_OPT_FAILOVER = 0x0002, + OBD_OPT_ABORT_RECOV = 0x0004, }; /** @@ -66,77 +66,77 @@ struct obd_export { * Subsequent client RPCs contain this handle id to identify * what export they are talking to. */ - struct portals_handle exp_handle; - atomic_t exp_refcount; + struct portals_handle exp_handle; + atomic_t exp_refcount; /** * Set of counters below is to track where export references are * kept. The exp_rpc_count is used for reconnect handling also, * the cb_count and locks_count are for debug purposes only for now. * The sum of them should be less than exp_refcount by 3 */ - atomic_t exp_rpc_count; /* RPC references */ - atomic_t exp_cb_count; /* Commit callback references */ + atomic_t exp_rpc_count; /* RPC references */ + atomic_t exp_cb_count; /* Commit callback references */ /** Number of queued replay requests to be processes */ - atomic_t exp_replay_count; - atomic_t exp_locks_count; /** Lock references */ + atomic_t exp_replay_count; + atomic_t exp_locks_count; /** Lock references */ #if LUSTRE_TRACKS_LOCK_EXP_REFS struct list_head exp_locks_list; - spinlock_t exp_locks_list_guard; + spinlock_t exp_locks_list_guard; #endif /** UUID of client connected to this export */ - struct obd_uuid exp_client_uuid; + struct obd_uuid exp_client_uuid; /** To link all exports on an obd device */ struct list_head exp_obd_chain; /** work_struct for destruction of export */ - struct work_struct exp_zombie_work; - struct rhash_head exp_uuid_hash; /** uuid-export hash*/ + struct work_struct exp_zombie_work; + struct rhash_head exp_uuid_hash; /** uuid-export hash*/ /** Obd device of this export */ - struct obd_device *exp_obd; + struct obd_device *exp_obd; /** * "reverse" import to send requests (e.g. from ldlm) back to client * exp_lock protect its change */ - struct obd_import *exp_imp_reverse; - struct lprocfs_stats *exp_md_stats; + struct obd_import *exp_imp_reverse; + struct lprocfs_stats *exp_md_stats; /** Active connection */ - struct ptlrpc_connection *exp_connection; + struct ptlrpc_connection *exp_connection; /** Connection count value from last successful reconnect rpc */ - u32 exp_conn_cnt; + u32 exp_conn_cnt; struct list_head exp_outstanding_replies; struct list_head exp_uncommitted_replies; - spinlock_t exp_uncommitted_replies_lock; + spinlock_t exp_uncommitted_replies_lock; /** Last committed transno for this export */ - u64 exp_last_committed; + u64 exp_last_committed; /** On replay all requests waiting for replay are linked here */ struct list_head exp_req_replay_queue; /** * protects exp_flags, exp_outstanding_replies and the change * of exp_imp_reverse */ - spinlock_t exp_lock; + spinlock_t exp_lock; /** Compatibility flags for this export are embedded into * exp_connect_data */ - struct obd_connect_data exp_connect_data; - enum obd_option exp_flags; - unsigned long exp_failed:1, - exp_disconnected:1, - exp_connecting:1, - exp_flvr_changed:1, - exp_flvr_adapt:1; + struct obd_connect_data exp_connect_data; + enum obd_option exp_flags; + unsigned long exp_failed:1, + exp_disconnected:1, + exp_connecting:1, + exp_flvr_changed:1, + exp_flvr_adapt:1; /* also protected by exp_lock */ - enum lustre_sec_part exp_sp_peer; - struct sptlrpc_flavor exp_flvr; /* current */ - struct sptlrpc_flavor exp_flvr_old[2]; /* about-to-expire */ - time64_t exp_flvr_expire[2]; /* seconds */ + enum lustre_sec_part exp_sp_peer; + struct sptlrpc_flavor exp_flvr; /* current */ + struct sptlrpc_flavor exp_flvr_old[2]; /* about-to-expire */ + time64_t exp_flvr_expire[2]; /* seconds */ /** protects exp_hp_rpcs */ - spinlock_t exp_rpc_lock; - struct list_head exp_hp_rpcs; /* (potential) HP RPCs */ + spinlock_t exp_rpc_lock; + struct list_head exp_hp_rpcs; /* (potential) HP RPCs */ /** blocking dlm lock list, protected by exp_bl_list_lock */ struct list_head exp_bl_list; - spinlock_t exp_bl_list_lock; + spinlock_t exp_bl_list_lock; }; static inline u64 *exp_connect_flags_ptr(struct obd_export *exp) @@ -239,9 +239,9 @@ static inline bool imp_connect_disp_stripe(struct obd_import *imp) #define KKUC_CT_DATA_MAGIC 0x092013cea struct kkuc_ct_data { - u32 kcd_magic; - struct obd_uuid kcd_uuid; - u32 kcd_archive; + u32 kcd_magic; + struct obd_uuid kcd_uuid; + u32 kcd_archive; }; /** @} export */ diff --git a/drivers/staging/lustre/lustre/include/lustre_fid.h b/drivers/staging/lustre/lustre/include/lustre_fid.h index f0afa8d..5108864 100644 --- a/drivers/staging/lustre/lustre/include/lustre_fid.h +++ b/drivers/staging/lustre/lustre/include/lustre_fid.h @@ -331,13 +331,13 @@ struct lu_client_seq { * clients, this contains meta-sequence range. And for servers this * contains super-sequence range. */ - struct lu_seq_range lcs_space; + struct lu_seq_range lcs_space; /* Seq related proc */ struct dentry *lcs_debugfs_entry; /* This holds last allocated fid in last obtained seq */ - struct lu_fid lcs_fid; + struct lu_fid lcs_fid; /* LUSTRE_SEQ_METADATA or LUSTRE_SEQ_DATA */ enum lu_cli_type lcs_type; @@ -346,17 +346,17 @@ struct lu_client_seq { * Service uuid, passed from MDT + seq name to form unique seq name to * use it with procfs. */ - char lcs_name[LUSTRE_MDT_MAXNAMELEN]; + char lcs_name[LUSTRE_MDT_MAXNAMELEN]; /* * Sequence width, that is how many objects may be allocated in one * sequence. Default value for it is LUSTRE_SEQ_MAX_WIDTH. */ - u64 lcs_width; + u64 lcs_width; /* wait queue for fid allocation and update indicator */ - wait_queue_head_t lcs_waitq; - int lcs_update; + wait_queue_head_t lcs_waitq; + int lcs_update; }; /* Client methods */ diff --git a/drivers/staging/lustre/lustre/include/lustre_fld.h b/drivers/staging/lustre/lustre/include/lustre_fld.h index 4bcabf7..92074ab 100644 --- a/drivers/staging/lustre/lustre/include/lustre_fld.h +++ b/drivers/staging/lustre/lustre/include/lustre_fld.h @@ -59,10 +59,10 @@ enum { }; struct lu_fld_target { - struct list_head ft_chain; - struct obd_export *ft_exp; - struct lu_server_fld *ft_srv; - u64 ft_idx; + struct list_head ft_chain; + struct obd_export *ft_exp; + struct lu_server_fld *ft_srv; + u64 ft_idx; }; struct lu_server_fld { @@ -79,7 +79,7 @@ struct lu_server_fld { struct mutex lsf_lock; /** Fld service name in form "fld-srv-lustre-MDTXXX" */ - char lsf_name[LUSTRE_MDT_MAXNAMELEN]; + char lsf_name[LUSTRE_MDT_MAXNAMELEN]; }; @@ -88,13 +88,13 @@ struct lu_client_fld { struct dentry *lcf_debugfs_entry; /** List of exports client FLD knows about. */ - struct list_head lcf_targets; + struct list_head lcf_targets; /** Current hash to be used to chose an export. */ struct lu_fld_hash *lcf_hash; /** Exports count. */ - int lcf_count; + int lcf_count; /** Lock protecting exports list and fld_hash. */ spinlock_t lcf_lock; diff --git a/drivers/staging/lustre/lustre/include/lustre_handles.h b/drivers/staging/lustre/lustre/include/lustre_handles.h index 84f70f3..6836808 100644 --- a/drivers/staging/lustre/lustre/include/lustre_handles.h +++ b/drivers/staging/lustre/lustre/include/lustre_handles.h @@ -63,7 +63,7 @@ struct portals_handle_ops { * to compute the start of the structure based on the handle field. */ struct portals_handle { - struct list_head h_link; + struct list_head h_link; u64 h_cookie; const void *h_owner; struct portals_handle_ops *h_ops; diff --git a/drivers/staging/lustre/lustre/include/lustre_import.h b/drivers/staging/lustre/lustre/include/lustre_import.h index db075be..7d52665 100644 --- a/drivers/staging/lustre/lustre/include/lustre_import.h +++ b/drivers/staging/lustre/lustre/include/lustre_import.h @@ -58,26 +58,26 @@ #define AT_FLG_NOHIST 0x1 /* use last reported value only */ struct adaptive_timeout { - time64_t at_binstart; /* bin start time */ - unsigned int at_hist[AT_BINS]; /* timeout history bins */ + time64_t at_binstart; /* bin start time */ + unsigned int at_hist[AT_BINS]; /* timeout history bins */ unsigned int at_flags; - unsigned int at_current; /* current timeout value */ - unsigned int at_worst_ever; /* worst-ever timeout value */ - time64_t at_worst_time; /* worst-ever timeout timestamp */ + unsigned int at_current; /* current timeout value */ + unsigned int at_worst_ever; /* worst-ever timeout value */ + time64_t at_worst_time; /* worst-ever timeout timestamp */ spinlock_t at_lock; }; struct ptlrpc_at_array { - struct list_head *paa_reqs_array; /** array to hold requests */ - u32 paa_size; /** the size of array */ - u32 paa_count; /** the total count of reqs */ - time64_t paa_deadline; /** the earliest deadline of reqs */ - u32 *paa_reqs_count; /** the count of reqs in each entry */ + struct list_head *paa_reqs_array; /** array to hold requests */ + u32 paa_size; /** the size of array */ + u32 paa_count; /** the total count of reqs */ + time64_t paa_deadline; /** the earliest deadline of reqs */ + u32 *paa_reqs_count; /** the count of reqs in each entry */ }; #define IMP_AT_MAX_PORTALS 8 struct imp_at { - int iat_portal[IMP_AT_MAX_PORTALS]; + int iat_portal[IMP_AT_MAX_PORTALS]; struct adaptive_timeout iat_net_latency; struct adaptive_timeout iat_service_estimate[IMP_AT_MAX_PORTALS]; }; @@ -86,16 +86,16 @@ struct imp_at { /** Possible import states */ enum lustre_imp_state { - LUSTRE_IMP_CLOSED = 1, - LUSTRE_IMP_NEW = 2, - LUSTRE_IMP_DISCON = 3, - LUSTRE_IMP_CONNECTING = 4, - LUSTRE_IMP_REPLAY = 5, + LUSTRE_IMP_CLOSED = 1, + LUSTRE_IMP_NEW = 2, + LUSTRE_IMP_DISCON = 3, + LUSTRE_IMP_CONNECTING = 4, + LUSTRE_IMP_REPLAY = 5, LUSTRE_IMP_REPLAY_LOCKS = 6, - LUSTRE_IMP_REPLAY_WAIT = 7, - LUSTRE_IMP_RECOVER = 8, - LUSTRE_IMP_FULL = 9, - LUSTRE_IMP_EVICTED = 10, + LUSTRE_IMP_REPLAY_WAIT = 7, + LUSTRE_IMP_RECOVER = 8, + LUSTRE_IMP_FULL = 9, + LUSTRE_IMP_EVICTED = 10, }; /** Returns test string representation of numeric import state \a state */ @@ -115,13 +115,13 @@ static inline char *ptlrpc_import_state_name(enum lustre_imp_state state) * List of import event types */ enum obd_import_event { - IMP_EVENT_DISCON = 0x808001, - IMP_EVENT_INACTIVE = 0x808002, - IMP_EVENT_INVALIDATE = 0x808003, - IMP_EVENT_ACTIVE = 0x808004, - IMP_EVENT_OCD = 0x808005, - IMP_EVENT_DEACTIVATE = 0x808006, - IMP_EVENT_ACTIVATE = 0x808007, + IMP_EVENT_DISCON = 0x808001, + IMP_EVENT_INACTIVE = 0x808002, + IMP_EVENT_INVALIDATE = 0x808003, + IMP_EVENT_ACTIVE = 0x808004, + IMP_EVENT_OCD = 0x808005, + IMP_EVENT_DEACTIVATE = 0x808006, + IMP_EVENT_ACTIVATE = 0x808007, }; /** @@ -131,20 +131,20 @@ struct obd_import_conn { /** Item for linking connections together */ struct list_head oic_item; /** Pointer to actual PortalRPC connection */ - struct ptlrpc_connection *oic_conn; + struct ptlrpc_connection *oic_conn; /** uuid of remote side */ - struct obd_uuid oic_uuid; + struct obd_uuid oic_uuid; /** * Time (64 bit jiffies) of last connection attempt on this connection */ - u64 oic_last_attempt; + u64 oic_last_attempt; }; /* state history */ #define IMP_STATE_HIST_LEN 16 struct import_state_hist { - enum lustre_imp_state ish_state; - time64_t ish_time; + enum lustre_imp_state ish_state; + time64_t ish_time; }; /** @@ -153,14 +153,14 @@ struct import_state_hist { */ struct obd_import { /** Local handle (== id) for this import. */ - struct portals_handle imp_handle; + struct portals_handle imp_handle; /** Reference counter */ - atomic_t imp_refcount; - struct lustre_handle imp_dlm_handle; /* client's ldlm export */ + atomic_t imp_refcount; + struct lustre_handle imp_dlm_handle; /* client's ldlm export */ /** Currently active connection */ - struct ptlrpc_connection *imp_connection; + struct ptlrpc_connection *imp_connection; /** PortalRPC client structure for this import */ - struct ptlrpc_client *imp_client; + struct ptlrpc_client *imp_client; /** List element for linking into pinger chain */ struct list_head imp_pinger_chain; /** work struct for destruction of import */ @@ -188,133 +188,134 @@ struct obd_import { /** @} */ /** List of not replied requests */ - struct list_head imp_unreplied_list; + struct list_head imp_unreplied_list; /** Known maximal replied XID */ - u64 imp_known_replied_xid; + u64 imp_known_replied_xid; /** obd device for this import */ - struct obd_device *imp_obd; + struct obd_device *imp_obd; /** * some seciruty-related fields * @{ */ - struct ptlrpc_sec *imp_sec; - struct mutex imp_sec_mutex; - time64_t imp_sec_expire; + struct ptlrpc_sec *imp_sec; + struct mutex imp_sec_mutex; + time64_t imp_sec_expire; /** @} */ /** Wait queue for those who need to wait for recovery completion */ - wait_queue_head_t imp_recovery_waitq; + wait_queue_head_t imp_recovery_waitq; /** Number of requests currently in-flight */ - atomic_t imp_inflight; + atomic_t imp_inflight; /** Number of requests currently unregistering */ - atomic_t imp_unregistering; + atomic_t imp_unregistering; /** Number of replay requests inflight */ - atomic_t imp_replay_inflight; + atomic_t imp_replay_inflight; /** Number of currently happening import invalidations */ - atomic_t imp_inval_count; + atomic_t imp_inval_count; /** Numbner of request timeouts */ - atomic_t imp_timeouts; + atomic_t imp_timeouts; /** Current import state */ - enum lustre_imp_state imp_state; + enum lustre_imp_state imp_state; /** Last replay state */ - enum lustre_imp_state imp_replay_state; + enum lustre_imp_state imp_replay_state; /** History of import states */ - struct import_state_hist imp_state_hist[IMP_STATE_HIST_LEN]; - int imp_state_hist_idx; + struct import_state_hist imp_state_hist[IMP_STATE_HIST_LEN]; + int imp_state_hist_idx; /** Current import generation. Incremented on every reconnect */ - int imp_generation; + int imp_generation; /** Incremented every time we send reconnection request */ - u32 imp_conn_cnt; + u32 imp_conn_cnt; /** * \see ptlrpc_free_committed remembers imp_generation value here * after a check to save on unnecessary replay list iterations */ - int imp_last_generation_checked; + int imp_last_generation_checked; /** Last transno we replayed */ - u64 imp_last_replay_transno; + u64 imp_last_replay_transno; /** Last transno committed on remote side */ - u64 imp_peer_committed_transno; + u64 imp_peer_committed_transno; /** * \see ptlrpc_free_committed remembers last_transno since its last * check here and if last_transno did not change since last run of * ptlrpc_free_committed and import generation is the same, we can * skip looking for requests to remove from replay list as optimisation */ - u64 imp_last_transno_checked; + u64 imp_last_transno_checked; /** * Remote export handle. This is how remote side knows what export * we are talking to. Filled from response to connect request */ - struct lustre_handle imp_remote_handle; + struct lustre_handle imp_remote_handle; /** When to perform next ping. time in jiffies. */ - unsigned long imp_next_ping; + unsigned long imp_next_ping; /** When we last successfully connected. time in 64bit jiffies */ - u64 imp_last_success_conn; + u64 imp_last_success_conn; /** List of all possible connection for import. */ struct list_head imp_conn_list; /** * Current connection. \a imp_connection is imp_conn_current->oic_conn */ - struct obd_import_conn *imp_conn_current; + struct obd_import_conn *imp_conn_current; /** Protects flags, level, generation, conn_cnt, *_list */ - spinlock_t imp_lock; + spinlock_t imp_lock; /* flags */ - unsigned long imp_no_timeout:1, /* timeouts are disabled */ - imp_invalid:1, /* evicted */ - /* administratively disabled */ - imp_deactive:1, - /* try to recover the import */ - imp_replayable:1, - /* don't run recovery (timeout instead) */ - imp_dlm_fake:1, - /* use 1/2 timeout on MDS' OSCs */ - imp_server_timeout:1, - /* VBR: imp in delayed recovery */ - imp_delayed_recovery:1, - /* VBR: if gap was found then no lock replays - */ - imp_no_lock_replay:1, - /* recovery by versions was failed */ - imp_vbr_failed:1, - /* force an immediate ping */ - imp_force_verify:1, - /* force a scheduled ping */ - imp_force_next_verify:1, - /* pingable */ - imp_pingable:1, - /* resend for replay */ - imp_resend_replay:1, - /* disable normal recovery, for test only. */ - imp_no_pinger_recover:1, + unsigned long imp_no_timeout:1, /* timeouts are disabled */ + imp_invalid:1, /* evicted */ + /* administratively disabled */ + imp_deactive:1, + /* try to recover the import */ + imp_replayable:1, + /* don't run recovery (timeout instead) */ + imp_dlm_fake:1, + /* use 1/2 timeout on MDS' OSCs */ + imp_server_timeout:1, + /* VBR: imp in delayed recovery */ + imp_delayed_recovery:1, + /* VBR: if gap was found then no lock replays + */ + imp_no_lock_replay:1, + /* recovery by versions was failed */ + imp_vbr_failed:1, + /* force an immediate ping */ + imp_force_verify:1, + /* force a scheduled ping */ + imp_force_next_verify:1, + /* pingable */ + imp_pingable:1, + /* resend for replay */ + imp_resend_replay:1, + /* disable normal recovery, for test only. */ + imp_no_pinger_recover:1, #if OBD_OCD_VERSION(3, 0, 53, 0) > LUSTRE_VERSION_CODE - /* need IR MNE swab */ - imp_need_mne_swab:1, + /* need IR MNE swab */ + imp_need_mne_swab:1, #endif - /* import must be reconnected instead of - * chosing new connection - */ - imp_force_reconnect:1, - /* import has tried to connect with server */ - imp_connect_tried:1, - /* connected but not FULL yet */ - imp_connected:1; - u32 imp_connect_op; - struct obd_connect_data imp_connect_data; - u64 imp_connect_flags_orig; - u64 imp_connect_flags2_orig; - int imp_connect_error; - - u32 imp_msg_magic; - u32 imp_msghdr_flags; /* adjusted based on server capability */ - - struct imp_at imp_at; /* adaptive timeout data */ - time64_t imp_last_reply_time; /* for health check */ + /* import must be reconnected instead of + * chosing new connection + */ + imp_force_reconnect:1, + /* import has tried to connect with server */ + imp_connect_tried:1, + /* connected but not FULL yet */ + imp_connected:1; + + u32 imp_connect_op; + struct obd_connect_data imp_connect_data; + u64 imp_connect_flags_orig; + u64 imp_connect_flags2_orig; + int imp_connect_error; + + u32 imp_msg_magic; + u32 imp_msghdr_flags; /* adjusted based on server capability */ + + struct imp_at imp_at; /* adaptive timeout data */ + time64_t imp_last_reply_time; /* for health check */ }; /* import.c */ diff --git a/drivers/staging/lustre/lustre/include/lustre_intent.h b/drivers/staging/lustre/lustre/include/lustre_intent.h index 3f26d7a..f97c318 100644 --- a/drivers/staging/lustre/lustre/include/lustre_intent.h +++ b/drivers/staging/lustre/lustre/include/lustre_intent.h @@ -39,18 +39,18 @@ /* intent IT_XXX are defined in lustre/include/obd.h */ struct lookup_intent { - int it_op; - int it_create_mode; - u64 it_flags; - int it_disposition; - int it_status; - u64 it_lock_handle; - u64 it_lock_bits; - int it_lock_mode; - int it_remote_lock_mode; - u64 it_remote_lock_handle; - struct ptlrpc_request *it_request; - unsigned int it_lock_set:1; + int it_op; + int it_create_mode; + u64 it_flags; + int it_disposition; + int it_status; + u64 it_lock_handle; + u64 it_lock_bits; + int it_lock_mode; + int it_remote_lock_mode; + u64 it_remote_lock_handle; + struct ptlrpc_request *it_request; + unsigned int it_lock_set:1; }; static inline int it_disposition(struct lookup_intent *it, int flag) diff --git a/drivers/staging/lustre/lustre/include/lustre_lib.h b/drivers/staging/lustre/lustre/include/lustre_lib.h index 87748e9..da86e46 100644 --- a/drivers/staging/lustre/lustre/include/lustre_lib.h +++ b/drivers/staging/lustre/lustre/include/lustre_lib.h @@ -85,8 +85,6 @@ static inline int l_fatal_signal_pending(struct task_struct *p) /** @} lib */ - - /* l_wait_event_abortable() is a bit like wait_event_killable() * except there is a fixed set of signals which will abort: * LUSTRE_FATAL_SIGS diff --git a/drivers/staging/lustre/lustre/include/lustre_log.h b/drivers/staging/lustre/lustre/include/lustre_log.h index 4ba4501..a576d40 100644 --- a/drivers/staging/lustre/lustre/include/lustre_log.h +++ b/drivers/staging/lustre/lustre/include/lustre_log.h @@ -66,15 +66,15 @@ enum llog_open_param { }; struct plain_handle_data { - struct list_head phd_entry; - struct llog_handle *phd_cat_handle; - struct llog_cookie phd_cookie; /* cookie of this log in its cat */ + struct list_head phd_entry; + struct llog_handle *phd_cat_handle; + struct llog_cookie phd_cookie; /* cookie of this log in its cat */ }; struct cat_handle_data { - struct list_head chd_head; + struct list_head chd_head; struct llog_handle *chd_current_log; /* currently open log */ - struct llog_handle *chd_next_log; /* llog to be used next */ + struct llog_handle *chd_next_log; /* llog to be used next */ }; struct llog_handle; @@ -101,28 +101,28 @@ struct llog_process_data { * Any useful data needed while processing catalog. This is * passed later to process callback. */ - void *lpd_data; + void *lpd_data; /** * Catalog process callback function, called for each record * in catalog. */ - llog_cb_t lpd_cb; + llog_cb_t lpd_cb; /** * Start processing the catalog from startcat/startidx */ - int lpd_startcat; - int lpd_startidx; + int lpd_startcat; + int lpd_startidx; }; struct llog_process_cat_data { /** * Temporary stored first_idx while scanning log. */ - int lpcd_first_idx; + int lpcd_first_idx; /** * Temporary stored last_idx while scanning log. */ - int lpcd_last_idx; + int lpcd_last_idx; }; struct thandle; @@ -234,23 +234,23 @@ struct llog_handle { #define LLOG_CTXT_FLAG_STOP 0x00000002 struct llog_ctxt { - int loc_idx; /* my index the obd array of ctxt's */ - struct obd_device *loc_obd; /* points back to the containing obd*/ - struct obd_llog_group *loc_olg; /* group containing that ctxt */ - struct obd_export *loc_exp; /* parent "disk" export (e.g. MDS) */ - struct obd_import *loc_imp; /* to use in RPC's: can be backward + int loc_idx; /* my index the obd array of ctxt's */ + struct obd_device *loc_obd; /* points back to the containing obd*/ + struct obd_llog_group *loc_olg; /* group containing that ctxt */ + struct obd_export *loc_exp; /* parent "disk" export (e.g. MDS) */ + struct obd_import *loc_imp; /* to use in RPC's: can be backward * pointing import */ struct llog_operations *loc_logops; struct llog_handle *loc_handle; struct mutex loc_mutex; /* protect loc_imp */ - atomic_t loc_refcount; - long loc_flags; /* flags, see above defines */ + atomic_t loc_refcount; + long loc_flags; /* flags, see above defines */ /* * llog chunk size, and llog record size can not be bigger than * loc_chunk_size */ - u32 loc_chunk_size; + u32 loc_chunk_size; }; #define LLOG_PROC_BREAK 0x0001 diff --git a/drivers/staging/lustre/lustre/include/lustre_mdc.h b/drivers/staging/lustre/lustre/include/lustre_mdc.h index c1fb324..90fcbae 100644 --- a/drivers/staging/lustre/lustre/include/lustre_mdc.h +++ b/drivers/staging/lustre/lustre/include/lustre_mdc.h @@ -106,7 +106,7 @@ static inline void mdc_get_rpc_lock(struct mdc_rpc_lock *lck, * Only when all fake requests are finished can normal requests * be sent, to ensure they are recoverable again. */ - again: +again: mutex_lock(&lck->rpcl_mutex); if (CFS_FAIL_CHECK_QUIET(OBD_FAIL_MDC_RPCS_SEM)) { diff --git a/drivers/staging/lustre/lustre/include/lustre_mds.h b/drivers/staging/lustre/lustre/include/lustre_mds.h index f665556..df178cc 100644 --- a/drivers/staging/lustre/lustre/include/lustre_mds.h +++ b/drivers/staging/lustre/lustre/include/lustre_mds.h @@ -50,8 +50,8 @@ #include struct mds_group_info { - struct obd_uuid *uuid; - int group; + struct obd_uuid *uuid; + int group; }; #define MDD_OBD_NAME "mdd_obd" diff --git a/drivers/staging/lustre/lustre/include/lustre_net.h b/drivers/staging/lustre/lustre/include/lustre_net.h index 050a7ec..47b9632 100644 --- a/drivers/staging/lustre/lustre/include/lustre_net.h +++ b/drivers/staging/lustre/lustre/include/lustre_net.h @@ -136,9 +136,9 @@ * * Constants determine how memory is used to buffer incoming service requests. * - * ?_NBUFS # buffers to allocate when growing the pool - * ?_BUFSIZE # bytes in a single request buffer - * ?_MAXREQSIZE # maximum request service will receive + * ?_NBUFS # buffers to allocate when growing the pool + * ?_BUFSIZE # bytes in a single request buffer + * ?_MAXREQSIZE # maximum request service will receive * * When fewer than ?_NBUFS/2 buffers are posted for receive, another chunk * of ?_NBUFS is added to the pool. @@ -231,7 +231,7 @@ * top of this subset * b) bind service threads on a few partitions, see modparameters of * MDS and OSS for details -* + * * NB: these calculations (and examples below) are simplified to help * understanding, the real implementation is a little more complex, * please see ptlrpc_server_nthreads_check() for details. @@ -263,12 +263,12 @@ #define LDLM_NTHRS_BASE 24 #define LDLM_NTHRS_MAX (num_online_cpus() == 1 ? 64 : 128) -#define LDLM_BL_THREADS LDLM_NTHRS_AUTO_INIT -#define LDLM_CLIENT_NBUFS 1 -#define LDLM_SERVER_NBUFS 64 -#define LDLM_BUFSIZE (8 * 1024) -#define LDLM_MAXREQSIZE (5 * 1024) -#define LDLM_MAXREPSIZE (1024) +#define LDLM_BL_THREADS LDLM_NTHRS_AUTO_INIT +#define LDLM_CLIENT_NBUFS 1 +#define LDLM_SERVER_NBUFS 64 +#define LDLM_BUFSIZE (8 * 1024) +#define LDLM_MAXREQSIZE (5 * 1024) +#define LDLM_MAXREPSIZE (1024) #define MDS_MAXREQSIZE (5 * 1024) /* >= 4736 */ @@ -292,23 +292,23 @@ struct ptlrpc_connection { /** linkage for connections hash table */ struct rhash_head c_hash; /** Our own lnet nid for this connection */ - lnet_nid_t c_self; + lnet_nid_t c_self; /** Remote side nid for this connection */ struct lnet_process_id c_peer; /** UUID of the other side */ - struct obd_uuid c_remote_uuid; + struct obd_uuid c_remote_uuid; /** reference counter for this connection */ - atomic_t c_refcount; + atomic_t c_refcount; }; /** Client definition for PortalRPC */ struct ptlrpc_client { /** What lnet portal does this client send messages to by default */ - u32 cli_request_portal; + u32 cli_request_portal; /** What portal do we expect replies on */ - u32 cli_reply_portal; + u32 cli_reply_portal; /** Name of the client */ - char *cli_name; + char *cli_name; }; /** state flags of requests */ @@ -326,8 +326,8 @@ struct ptlrpc_client { * a pointer to it here. The pointer_arg ensures this struct is at * least big enough for that. */ - void *pointer_arg[11]; - u64 space[7]; + void *pointer_arg[11]; + u64 space[7]; }; struct ptlrpc_request_set; @@ -346,26 +346,26 @@ struct ptlrpc_client { * returned. */ struct ptlrpc_request_set { - atomic_t set_refcount; + atomic_t set_refcount; /** number of in queue requests */ - atomic_t set_new_count; + atomic_t set_new_count; /** number of uncompleted requests */ - atomic_t set_remaining; + atomic_t set_remaining; /** wait queue to wait on for request events */ - wait_queue_head_t set_waitq; - wait_queue_head_t *set_wakeup_ptr; + wait_queue_head_t set_waitq; + wait_queue_head_t *set_wakeup_ptr; /** List of requests in the set */ - struct list_head set_requests; + struct list_head set_requests; /** * List of completion callbacks to be called when the set is completed * This is only used if \a set_interpret is NULL. * Links struct ptlrpc_set_cbdata. */ - struct list_head set_cblist; + struct list_head set_cblist; /** Completion callback, if only one. */ - set_interpreter_func set_interpret; + set_interpreter_func set_interpret; /** opaq argument passed to completion \a set_interpret callback. */ - void *set_arg; + void *set_arg; /** * Lock for \a set_new_requests manipulations * locked so that any old caller can communicate requests to @@ -373,17 +373,17 @@ struct ptlrpc_request_set { */ spinlock_t set_new_req_lock; /** List of new yet unsent requests. Only used with ptlrpcd now. */ - struct list_head set_new_requests; + struct list_head set_new_requests; /** rq_status of requests that have been freed already */ - int set_rc; + int set_rc; /** Additional fields used by the flow control extension */ /** Maximum number of RPCs in flight */ - int set_max_inflight; + int set_max_inflight; /** Callback function used to generate RPCs */ - set_producer_func set_producer; + set_producer_func set_producer; /** opaq argument passed to the producer callback */ - void *set_producer_arg; + void *set_producer_arg; }; /** @@ -391,11 +391,11 @@ struct ptlrpc_request_set { */ struct ptlrpc_set_cbdata { /** List linkage item */ - struct list_head psc_item; + struct list_head psc_item; /** Pointer to interpreting function */ set_interpreter_func psc_interpret; /** Opaq argument to pass to the callback */ - void *psc_data; + void *psc_data; }; struct ptlrpc_bulk_desc; @@ -423,76 +423,76 @@ struct ptlrpc_cb_id { */ struct ptlrpc_reply_state { /** Callback description */ - struct ptlrpc_cb_id rs_cb_id; + struct ptlrpc_cb_id rs_cb_id; /** Linkage for list of all reply states in a system */ - struct list_head rs_list; + struct list_head rs_list; /** Linkage for list of all reply states on same export */ - struct list_head rs_exp_list; + struct list_head rs_exp_list; /** Linkage for list of all reply states for same obd */ - struct list_head rs_obd_list; + struct list_head rs_obd_list; #if RS_DEBUG - struct list_head rs_debug_list; + struct list_head rs_debug_list; #endif /** A spinlock to protect the reply state flags */ spinlock_t rs_lock; /** Reply state flags */ - unsigned long rs_difficult:1; /* ACK/commit stuff */ - unsigned long rs_no_ack:1; /* no ACK, even for - * difficult requests - */ - unsigned long rs_scheduled:1; /* being handled? */ - unsigned long rs_scheduled_ever:1;/* any schedule attempts? */ - unsigned long rs_handled:1; /* been handled yet? */ - unsigned long rs_on_net:1; /* reply_out_callback pending? */ - unsigned long rs_prealloc:1; /* rs from prealloc list */ - unsigned long rs_committed:1;/* the transaction was committed - * and the rs was dispatched - */ + unsigned long rs_difficult:1; /* ACK/commit stuff */ + unsigned long rs_no_ack:1; /* no ACK, even for + * difficult requests + */ + unsigned long rs_scheduled:1; /* being handled? */ + unsigned long rs_scheduled_ever:1; /* any schedule attempts? */ + unsigned long rs_handled:1; /* been handled yet? */ + unsigned long rs_on_net:1; /* reply_out_callback pending? */ + unsigned long rs_prealloc:1; /* rs from prealloc list */ + unsigned long rs_committed:1; /* the transaction was committed + * and the rs was dispatched + */ atomic_t rs_refcount; /* number of users */ /** Number of locks awaiting client ACK */ int rs_nlocks; /** Size of the state */ - int rs_size; + int rs_size; /** opcode */ - u32 rs_opc; + u32 rs_opc; /** Transaction number */ - u64 rs_transno; + u64 rs_transno; /** xid */ - u64 rs_xid; - struct obd_export *rs_export; + u64 rs_xid; + struct obd_export *rs_export; struct ptlrpc_service_part *rs_svcpt; /** Lnet metadata handle for the reply */ - struct lnet_handle_md rs_md_h; + struct lnet_handle_md rs_md_h; /** Context for the service thread */ - struct ptlrpc_svc_ctx *rs_svc_ctx; + struct ptlrpc_svc_ctx *rs_svc_ctx; /** Reply buffer (actually sent to the client), encoded if needed */ - struct lustre_msg *rs_repbuf; /* wrapper */ + struct lustre_msg *rs_repbuf; /* wrapper */ /** Size of the reply buffer */ - int rs_repbuf_len; /* wrapper buf length */ + int rs_repbuf_len; /* wrapper buf length */ /** Size of the reply message */ - int rs_repdata_len; /* wrapper msg length */ + int rs_repdata_len; /* wrapper msg length */ /** * Actual reply message. Its content is encrypted (if needed) to * produce reply buffer for actual sending. In simple case * of no network encryption we just set \a rs_repbuf to \a rs_msg */ - struct lustre_msg *rs_msg; /* reply message */ + struct lustre_msg *rs_msg; /* reply message */ /** Handles of locks awaiting client reply ACK */ - struct lustre_handle rs_locks[RS_MAX_LOCKS]; + struct lustre_handle rs_locks[RS_MAX_LOCKS]; /** Lock modes of locks in \a rs_locks */ - enum ldlm_mode rs_modes[RS_MAX_LOCKS]; + enum ldlm_mode rs_modes[RS_MAX_LOCKS]; }; struct ptlrpc_thread; /** RPC stages */ enum rq_phase { - RQ_PHASE_NEW = 0xebc0de00, - RQ_PHASE_RPC = 0xebc0de01, - RQ_PHASE_BULK = 0xebc0de02, + RQ_PHASE_NEW = 0xebc0de00, + RQ_PHASE_RPC = 0xebc0de01, + RQ_PHASE_BULK = 0xebc0de02, RQ_PHASE_INTERPRET = 0xebc0de03, RQ_PHASE_COMPLETE = 0xebc0de04, RQ_PHASE_UNREG_RPC = 0xebc0de05, @@ -513,11 +513,11 @@ typedef int (*ptlrpc_interpterer_t)(const struct lu_env *env, */ struct ptlrpc_request_pool { /** Locks the list */ - spinlock_t prp_lock; + spinlock_t prp_lock; /** list of ptlrpc_request structs */ - struct list_head prp_req_list; + struct list_head prp_req_list; /** Maximum message size that would fit into a request from this pool */ - int prp_rq_size; + int prp_rq_size; /** Function to allocate more requests for this pool */ int (*prp_populate)(struct ptlrpc_request_pool *, int); }; @@ -741,9 +741,10 @@ struct ptlrpc_request { */ spinlock_t rq_lock; spinlock_t rq_early_free_lock; + /** client-side flags are serialized by rq_lock @{ */ unsigned int rq_intr:1, rq_replied:1, rq_err:1, - rq_timedout:1, rq_resend:1, rq_restart:1, + rq_timedout:1, rq_resend:1, rq_restart:1, /** * when ->rq_replay is set, request is kept by the client even * after server commits corresponding transaction. This is @@ -797,21 +798,21 @@ struct ptlrpc_request { * !rq_truncate : # reply bytes actually received, * rq_truncate : required repbuf_len for resend */ - int rq_nob_received; + int rq_nob_received; /** Request length */ - int rq_reqlen; + int rq_reqlen; /** Reply length */ - int rq_replen; + int rq_replen; /** Pool if request is from preallocated list */ struct ptlrpc_request_pool *rq_pool; /** Request message - what client sent */ - struct lustre_msg *rq_reqmsg; + struct lustre_msg *rq_reqmsg; /** Reply message - server response */ - struct lustre_msg *rq_repmsg; + struct lustre_msg *rq_repmsg; /** Transaction number */ - u64 rq_transno; + u64 rq_transno; /** xid */ - u64 rq_xid; + u64 rq_xid; /** bulk match bits */ u64 rq_mbits; /** @@ -820,7 +821,7 @@ struct ptlrpc_request { * Also see \a rq_replay comment above. * It's also link chain on obd_export::exp_req_replay_queue */ - struct list_head rq_replay_list; + struct list_head rq_replay_list; /** non-shared members for client & server request*/ union { struct ptlrpc_cli_req rq_cli; @@ -857,32 +858,32 @@ struct ptlrpc_request { char *rq_repbuf; /**< rep buffer */ struct lustre_msg *rq_repdata; /**< rep wrapper msg */ /** only in priv mode */ - struct lustre_msg *rq_clrbuf; - int rq_reqbuf_len; /* req wrapper buf len */ - int rq_reqdata_len; /* req wrapper msg len */ - int rq_repbuf_len; /* rep buffer len */ - int rq_repdata_len; /* rep wrapper msg len */ - int rq_clrbuf_len; /* only in priv mode */ - int rq_clrdata_len; /* only in priv mode */ + struct lustre_msg *rq_clrbuf; + int rq_reqbuf_len; /* req wrapper buf len */ + int rq_reqdata_len; /* req wrapper msg len */ + int rq_repbuf_len; /* rep buffer len */ + int rq_repdata_len; /* rep wrapper msg len */ + int rq_clrbuf_len; /* only in priv mode */ + int rq_clrdata_len; /* only in priv mode */ /** early replies go to offset 0, regular replies go after that */ - unsigned int rq_reply_off; + unsigned int rq_reply_off; /** @} */ /** Fields that help to see if request and reply were swabbed or not */ - u32 rq_req_swab_mask; - u32 rq_rep_swab_mask; + u32 rq_req_swab_mask; + u32 rq_rep_swab_mask; /** how many early replies (for stats) */ - int rq_early_count; + int rq_early_count; /** Server-side, export on which request was received */ - struct obd_export *rq_export; + struct obd_export *rq_export; /** import where request is being sent */ - struct obd_import *rq_import; + struct obd_import *rq_import; /** our LNet NID */ - lnet_nid_t rq_self; + lnet_nid_t rq_self; /** Peer description (the other side) */ struct lnet_process_id rq_peer; /** Descriptor for the NID from which the peer sent the request. */ @@ -895,11 +896,11 @@ struct ptlrpc_request { /** * when request/reply sent (secs), or time when request should be sent */ - time64_t rq_sent; + time64_t rq_sent; /** when request must finish. */ - time64_t rq_deadline; + time64_t rq_deadline; /** request format description */ - struct req_capsule rq_pill; + struct req_capsule rq_pill; }; /** @@ -1039,15 +1040,15 @@ static inline void lustre_set_rep_swabbed(struct ptlrpc_request *req, #define FLAG(field, str) (field ? str : "") /** Convert bit flags into a string */ -#define DEBUG_REQ_FLAGS(req) \ - ptlrpc_rqphase2str(req), \ - FLAG(req->rq_intr, "I"), FLAG(req->rq_replied, "R"), \ - FLAG(req->rq_err, "E"), FLAG(req->rq_net_err, "e"), \ - FLAG(req->rq_timedout, "X") /* eXpired */, FLAG(req->rq_resend, "S"), \ - FLAG(req->rq_restart, "T"), FLAG(req->rq_replay, "P"), \ - FLAG(req->rq_no_resend, "N"), \ - FLAG(req->rq_waiting, "W"), \ - FLAG(req->rq_wait_ctx, "C"), FLAG(req->rq_hp, "H"), \ +#define DEBUG_REQ_FLAGS(req) \ + ptlrpc_rqphase2str(req), \ + FLAG(req->rq_intr, "I"), FLAG(req->rq_replied, "R"), \ + FLAG(req->rq_err, "E"), FLAG(req->rq_net_err, "e"), \ + FLAG(req->rq_timedout, "X") /* eXpired */, FLAG(req->rq_resend, "S"), \ + FLAG(req->rq_restart, "T"), FLAG(req->rq_replay, "P"), \ + FLAG(req->rq_no_resend, "N"), \ + FLAG(req->rq_waiting, "W"), \ + FLAG(req->rq_wait_ctx, "C"), FLAG(req->rq_hp, "H"), \ FLAG(req->rq_committed, "M") #define REQ_FLAGS_FMT "%s:%s%s%s%s%s%s%s%s%s%s%s%s%s" @@ -1060,14 +1061,14 @@ void _debug_req(struct ptlrpc_request *req, * Helper that decides if we need to print request according to current debug * level settings */ -#define debug_req(msgdata, mask, cdls, req, fmt, a...) \ -do { \ - CFS_CHECK_STACK(msgdata, mask, cdls); \ +#define debug_req(msgdata, mask, cdls, req, fmt, a...) \ +do { \ + CFS_CHECK_STACK(msgdata, mask, cdls); \ \ - if (((mask) & D_CANTMASK) != 0 || \ - ((libcfs_debug & (mask)) != 0 && \ - (libcfs_subsystem_debug & DEBUG_SUBSYSTEM) != 0)) \ - _debug_req((req), msgdata, fmt, ##a); \ + if (((mask) & D_CANTMASK) != 0 || \ + ((libcfs_debug & (mask)) != 0 && \ + (libcfs_subsystem_debug & DEBUG_SUBSYSTEM) != 0)) \ + _debug_req((req), msgdata, fmt, ##a); \ } while (0) /** @@ -1075,16 +1076,16 @@ void _debug_req(struct ptlrpc_request *req, * content into lustre debug log. * for most callers (level is a constant) this is resolved at compile time */ -#define DEBUG_REQ(level, req, fmt, args...) \ -do { \ - if ((level) & (D_ERROR | D_WARNING)) { \ - static struct cfs_debug_limit_state cdls; \ - LIBCFS_DEBUG_MSG_DATA_DECL(msgdata, level, &cdls); \ +#define DEBUG_REQ(level, req, fmt, args...) \ +do { \ + if ((level) & (D_ERROR | D_WARNING)) { \ + static struct cfs_debug_limit_state cdls; \ + LIBCFS_DEBUG_MSG_DATA_DECL(msgdata, level, &cdls); \ debug_req(&msgdata, level, &cdls, req, "@@@ "fmt" ", ## args);\ } else { \ - LIBCFS_DEBUG_MSG_DATA_DECL(msgdata, level, NULL); \ + LIBCFS_DEBUG_MSG_DATA_DECL(msgdata, level, NULL); \ debug_req(&msgdata, level, NULL, req, "@@@ "fmt" ", ## args); \ - } \ + } \ } while (0) /** @} */ @@ -1093,15 +1094,15 @@ void _debug_req(struct ptlrpc_request *req, */ struct ptlrpc_bulk_page { /** Linkage to list of pages in a bulk */ - struct list_head bp_link; + struct list_head bp_link; /** * Number of bytes in a page to transfer starting from \a bp_pageoffset */ - int bp_buflen; + int bp_buflen; /** offset within a page */ - int bp_pageoffset; + int bp_pageoffset; /** The page itself */ - struct page *bp_page; + struct page *bp_page; }; enum ptlrpc_bulk_op_type { @@ -1204,38 +1205,38 @@ struct ptlrpc_bulk_frag_ops { */ struct ptlrpc_bulk_desc { /** completed with failure */ - unsigned long bd_failure:1; + unsigned long bd_failure:1; /** client side */ - unsigned long bd_registered:1; + unsigned long bd_registered:1; /** For serialization with callback */ - spinlock_t bd_lock; + spinlock_t bd_lock; /** Import generation when request for this bulk was sent */ - int bd_import_generation; + int bd_import_generation; /** {put,get}{source,sink}{kvec,kiov} */ - enum ptlrpc_bulk_op_type bd_type; + enum ptlrpc_bulk_op_type bd_type; /** LNet portal for this bulk */ - u32 bd_portal; + u32 bd_portal; /** Server side - export this bulk created for */ - struct obd_export *bd_export; + struct obd_export *bd_export; /** Client side - import this bulk was sent on */ - struct obd_import *bd_import; + struct obd_import *bd_import; /** Back pointer to the request */ - struct ptlrpc_request *bd_req; - struct ptlrpc_bulk_frag_ops *bd_frag_ops; - wait_queue_head_t bd_waitq; /* server side only WQ */ - int bd_iov_count; /* # entries in bd_iov */ - int bd_max_iov; /* allocated size of bd_iov */ - int bd_nob; /* # bytes covered */ - int bd_nob_transferred; /* # bytes GOT/PUT */ - - u64 bd_last_mbits; - - struct ptlrpc_cb_id bd_cbid; /* network callback info */ - lnet_nid_t bd_sender; /* stash event::sender */ - int bd_md_count; /* # valid entries in bd_mds */ - int bd_md_max_brw; /* max entries in bd_mds */ + struct ptlrpc_request *bd_req; + struct ptlrpc_bulk_frag_ops *bd_frag_ops; + wait_queue_head_t bd_waitq; /* server side only WQ */ + int bd_iov_count; /* # entries in bd_iov */ + int bd_max_iov; /* allocated size of bd_iov */ + int bd_nob; /* # bytes covered */ + int bd_nob_transferred; /* # bytes GOT/PUT */ + + u64 bd_last_mbits; + + struct ptlrpc_cb_id bd_cbid; /* network callback info */ + lnet_nid_t bd_sender; /* stash event::sender */ + int bd_md_count; /* # valid entries in bd_mds */ + int bd_md_max_brw; /* max entries in bd_mds */ /** array of associated MDs */ - struct lnet_handle_md bd_mds[PTLRPC_BULK_OPS_COUNT]; + struct lnet_handle_md bd_mds[PTLRPC_BULK_OPS_COUNT]; union { struct { @@ -1277,20 +1278,20 @@ struct ptlrpc_thread { /** * List of active threads in svc->srv_threads */ - struct list_head t_link; + struct list_head t_link; /** * thread-private data (preallocated memory) */ - void *t_data; - u32 t_flags; + void *t_data; + u32 t_flags; /** * service thread index, from ptlrpc_start_threads */ - unsigned int t_id; + unsigned int t_id; /** * service thread pid */ - pid_t t_pid; + pid_t t_pid; /** * put watchdog in the structure per thread b=14840 * @@ -1304,7 +1305,7 @@ struct ptlrpc_thread { * the svc this thread belonged to b=18582 */ struct ptlrpc_service_part *t_svcpt; - wait_queue_head_t t_ctl_waitq; + wait_queue_head_t t_ctl_waitq; struct lu_env *t_env; char t_name[PTLRPC_THR_NAME_LEN]; }; @@ -1363,22 +1364,22 @@ static inline int thread_test_and_clear_flags(struct ptlrpc_thread *thread, */ struct ptlrpc_request_buffer_desc { /** Link item for rqbds on a service */ - struct list_head rqbd_list; + struct list_head rqbd_list; /** History of requests for this buffer */ - struct list_head rqbd_reqs; + struct list_head rqbd_reqs; /** Back pointer to service for which this buffer is registered */ - struct ptlrpc_service_part *rqbd_svcpt; + struct ptlrpc_service_part *rqbd_svcpt; /** LNet descriptor */ struct lnet_handle_md rqbd_md_h; - int rqbd_refcount; + int rqbd_refcount; /** The buffer itself */ - char *rqbd_buffer; - struct ptlrpc_cb_id rqbd_cbid; + char *rqbd_buffer; + struct ptlrpc_cb_id rqbd_cbid; /** * This "embedded" request structure is only used for the * last request to fit into the buffer */ - struct ptlrpc_request rqbd_req; + struct ptlrpc_request rqbd_req; }; typedef int (*svc_handler_t)(struct ptlrpc_request *req); @@ -1431,44 +1432,44 @@ struct ptlrpc_service { spinlock_t srv_lock; /** most often accessed fields */ /** chain thru all services */ - struct list_head srv_list; + struct list_head srv_list; /** service operations table */ struct ptlrpc_service_ops srv_ops; /** only statically allocated strings here; we don't clean them */ - char *srv_name; + char *srv_name; /** only statically allocated strings here; we don't clean them */ - char *srv_thread_name; + char *srv_thread_name; /** service thread list */ - struct list_head srv_threads; + struct list_head srv_threads; /** threads # should be created for each partition on initializing */ int srv_nthrs_cpt_init; /** limit of threads number for each partition */ int srv_nthrs_cpt_limit; /** Root of debugfs dir tree for this service */ - struct dentry *srv_debugfs_entry; + struct dentry *srv_debugfs_entry; /** Pointer to statistic data for this service */ - struct lprocfs_stats *srv_stats; + struct lprocfs_stats *srv_stats; /** # hp per lp reqs to handle */ - int srv_hpreq_ratio; + int srv_hpreq_ratio; /** biggest request to receive */ - int srv_max_req_size; + int srv_max_req_size; /** biggest reply to send */ - int srv_max_reply_size; + int srv_max_reply_size; /** size of individual buffers */ - int srv_buf_size; + int srv_buf_size; /** # buffers to allocate in 1 group */ - int srv_nbuf_per_group; + int srv_nbuf_per_group; /** Local portal on which to receive requests */ - u32 srv_req_portal; + u32 srv_req_portal; /** Portal on the client to send replies to */ - u32 srv_rep_portal; + u32 srv_rep_portal; /** * Tags for lu_context associated with this thread, see struct * lu_context. */ - u32 srv_ctx_tags; + u32 srv_ctx_tags; /** soft watchdog timeout multiplier */ - int srv_watchdog_factor; + int srv_watchdog_factor; /** under unregister_service */ unsigned srv_is_stopping:1; @@ -1524,14 +1525,14 @@ struct ptlrpc_service_part { /** # running threads */ int scp_nthrs_running; /** service threads list */ - struct list_head scp_threads; + struct list_head scp_threads; /** * serialize the following fields, used for protecting * rqbd list and incoming requests waiting for preprocess, * threads starting & stopping are also protected by this lock. */ - spinlock_t scp_lock __cfs_cacheline_aligned; + spinlock_t scp_lock __cfs_cacheline_aligned; /** total # req buffer descs allocated */ int scp_nrqbds_total; /** # posted request buffers for receiving */ @@ -1541,23 +1542,23 @@ struct ptlrpc_service_part { /** # incoming reqs */ int scp_nreqs_incoming; /** request buffers to be reposted */ - struct list_head scp_rqbd_idle; + struct list_head scp_rqbd_idle; /** req buffers receiving */ - struct list_head scp_rqbd_posted; + struct list_head scp_rqbd_posted; /** incoming reqs */ - struct list_head scp_req_incoming; + struct list_head scp_req_incoming; /** timeout before re-posting reqs, in tick */ - long scp_rqbd_timeout; + long scp_rqbd_timeout; /** * all threads sleep on this. This wait-queue is signalled when new * incoming request arrives and when difficult reply has to be handled. */ - wait_queue_head_t scp_waitq; + wait_queue_head_t scp_waitq; /** request history */ - struct list_head scp_hist_reqs; + struct list_head scp_hist_reqs; /** request buffer history */ - struct list_head scp_hist_rqbds; + struct list_head scp_hist_rqbds; /** # request buffers in history */ int scp_hist_nrqbds; /** sequence number for request */ @@ -1610,11 +1611,11 @@ struct ptlrpc_service_part { */ spinlock_t scp_rep_lock __cfs_cacheline_aligned; /** all the active replies */ - struct list_head scp_rep_active; + struct list_head scp_rep_active; /** List of free reply_states */ - struct list_head scp_rep_idle; + struct list_head scp_rep_idle; /** waitq to run, when adding stuff to srv_free_rs_list */ - wait_queue_head_t scp_rep_waitq; + wait_queue_head_t scp_rep_waitq; /** # 'difficult' replies */ atomic_t scp_nreps_difficult; }; @@ -1648,11 +1649,11 @@ struct ptlrpcd_ctl { /** * Thread requests set. */ - struct ptlrpc_request_set *pc_set; + struct ptlrpc_request_set *pc_set; /** * Thread name used in kthread_run() */ - char pc_name[16]; + char pc_name[16]; /** * CPT the thread is bound on. */ @@ -1664,7 +1665,7 @@ struct ptlrpcd_ctl { /** * Pointer to the array of partners' ptlrpcd_ctl structure. */ - struct ptlrpcd_ctl **pc_partners; + struct ptlrpcd_ctl **pc_partners; /** * Number of the ptlrpcd's partners. */ @@ -1672,7 +1673,7 @@ struct ptlrpcd_ctl { /** * Record the partner index to be processed next. */ - int pc_cursor; + int pc_cursor; /** * Error code if the thread failed to fully start. */ @@ -1777,7 +1778,7 @@ struct ptlrpc_connection *ptlrpc_connection_get(struct lnet_process_id peer, static inline int ptlrpc_client_bulk_active(struct ptlrpc_request *req) { struct ptlrpc_bulk_desc *desc; - int rc; + int rc; desc = req->rq_bulk; @@ -1793,8 +1794,9 @@ static inline int ptlrpc_client_bulk_active(struct ptlrpc_request *req) return rc; } -#define PTLRPC_REPLY_MAYBE_DIFFICULT 0x01 -#define PTLRPC_REPLY_EARLY 0x02 +#define PTLRPC_REPLY_MAYBE_DIFFICULT 0x01 +#define PTLRPC_REPLY_EARLY 0x02 + int ptlrpc_send_reply(struct ptlrpc_request *req, int flags); int ptlrpc_reply(struct ptlrpc_request *req); int ptlrpc_send_error(struct ptlrpc_request *req, int difficult); diff --git a/drivers/staging/lustre/lustre/include/lustre_nrs_fifo.h b/drivers/staging/lustre/lustre/include/lustre_nrs_fifo.h index 0db4345f..1c47c80 100644 --- a/drivers/staging/lustre/lustre/include/lustre_nrs_fifo.h +++ b/drivers/staging/lustre/lustre/include/lustre_nrs_fifo.h @@ -63,8 +63,8 @@ struct nrs_fifo_head { }; struct nrs_fifo_req { - struct list_head fr_list; - u64 fr_sequence; + struct list_head fr_list; + u64 fr_sequence; }; /** @} fifo */ diff --git a/drivers/staging/lustre/lustre/include/lustre_req_layout.h b/drivers/staging/lustre/lustre/include/lustre_req_layout.h index 2aba99f..57ac618 100644 --- a/drivers/staging/lustre/lustre/include/lustre_req_layout.h +++ b/drivers/staging/lustre/lustre/include/lustre_req_layout.h @@ -63,10 +63,10 @@ enum req_location { #define REQ_MAX_FIELD_NR 10 struct req_capsule { - struct ptlrpc_request *rc_req; - const struct req_format *rc_fmt; - enum req_location rc_loc; - u32 rc_area[RCL_NR][REQ_MAX_FIELD_NR]; + struct ptlrpc_request *rc_req; + const struct req_format *rc_fmt; + enum req_location rc_loc; + u32 rc_area[RCL_NR][REQ_MAX_FIELD_NR]; }; void req_capsule_init(struct req_capsule *pill, struct ptlrpc_request *req, diff --git a/drivers/staging/lustre/lustre/include/lustre_sec.h b/drivers/staging/lustre/lustre/include/lustre_sec.h index c622c8d..5a5625e 100644 --- a/drivers/staging/lustre/lustre/include/lustre_sec.h +++ b/drivers/staging/lustre/lustre/include/lustre_sec.h @@ -85,25 +85,25 @@ * flavor constants */ enum sptlrpc_policy { - SPTLRPC_POLICY_NULL = 0, - SPTLRPC_POLICY_PLAIN = 1, - SPTLRPC_POLICY_GSS = 2, + SPTLRPC_POLICY_NULL = 0, + SPTLRPC_POLICY_PLAIN = 1, + SPTLRPC_POLICY_GSS = 2, SPTLRPC_POLICY_MAX, }; enum sptlrpc_mech_null { - SPTLRPC_MECH_NULL = 0, + SPTLRPC_MECH_NULL = 0, SPTLRPC_MECH_NULL_MAX, }; enum sptlrpc_mech_plain { - SPTLRPC_MECH_PLAIN = 0, + SPTLRPC_MECH_PLAIN = 0, SPTLRPC_MECH_PLAIN_MAX, }; enum sptlrpc_mech_gss { - SPTLRPC_MECH_GSS_NULL = 0, - SPTLRPC_MECH_GSS_KRB5 = 1, + SPTLRPC_MECH_GSS_NULL = 0, + SPTLRPC_MECH_GSS_KRB5 = 1, SPTLRPC_MECH_GSS_MAX, }; @@ -116,113 +116,113 @@ enum sptlrpc_service_type { }; enum sptlrpc_bulk_type { - SPTLRPC_BULK_DEFAULT = 0, /**< follow rpc flavor */ - SPTLRPC_BULK_HASH = 1, /**< hash integrity */ + SPTLRPC_BULK_DEFAULT = 0, /**< follow rpc flavor */ + SPTLRPC_BULK_HASH = 1, /**< hash integrity */ SPTLRPC_BULK_MAX, }; enum sptlrpc_bulk_service { - SPTLRPC_BULK_SVC_NULL = 0, /**< no security */ - SPTLRPC_BULK_SVC_AUTH = 1, /**< authentication only */ - SPTLRPC_BULK_SVC_INTG = 2, /**< integrity */ - SPTLRPC_BULK_SVC_PRIV = 3, /**< privacy */ + SPTLRPC_BULK_SVC_NULL = 0, /**< no security */ + SPTLRPC_BULK_SVC_AUTH = 1, /**< authentication only */ + SPTLRPC_BULK_SVC_INTG = 2, /**< integrity */ + SPTLRPC_BULK_SVC_PRIV = 3, /**< privacy */ SPTLRPC_BULK_SVC_MAX, }; /* * compose/extract macros */ -#define FLVR_POLICY_OFFSET (0) +#define FLVR_POLICY_OFFSET (0) #define FLVR_MECH_OFFSET (4) -#define FLVR_SVC_OFFSET (8) -#define FLVR_BULK_TYPE_OFFSET (12) -#define FLVR_BULK_SVC_OFFSET (16) - -#define MAKE_FLVR(policy, mech, svc, btype, bsvc) \ - (((u32)(policy) << FLVR_POLICY_OFFSET) | \ - ((u32)(mech) << FLVR_MECH_OFFSET) | \ - ((u32)(svc) << FLVR_SVC_OFFSET) | \ - ((u32)(btype) << FLVR_BULK_TYPE_OFFSET) | \ +#define FLVR_SVC_OFFSET (8) +#define FLVR_BULK_TYPE_OFFSET (12) +#define FLVR_BULK_SVC_OFFSET (16) + +#define MAKE_FLVR(policy, mech, svc, btype, bsvc) \ + (((u32)(policy) << FLVR_POLICY_OFFSET) | \ + ((u32)(mech) << FLVR_MECH_OFFSET) | \ + ((u32)(svc) << FLVR_SVC_OFFSET) | \ + ((u32)(btype) << FLVR_BULK_TYPE_OFFSET) | \ ((u32)(bsvc) << FLVR_BULK_SVC_OFFSET)) /* * extraction */ -#define SPTLRPC_FLVR_POLICY(flavor) \ +#define SPTLRPC_FLVR_POLICY(flavor) \ ((((u32)(flavor)) >> FLVR_POLICY_OFFSET) & 0xF) -#define SPTLRPC_FLVR_MECH(flavor) \ +#define SPTLRPC_FLVR_MECH(flavor) \ ((((u32)(flavor)) >> FLVR_MECH_OFFSET) & 0xF) -#define SPTLRPC_FLVR_SVC(flavor) \ +#define SPTLRPC_FLVR_SVC(flavor) \ ((((u32)(flavor)) >> FLVR_SVC_OFFSET) & 0xF) -#define SPTLRPC_FLVR_BULK_TYPE(flavor) \ +#define SPTLRPC_FLVR_BULK_TYPE(flavor) \ ((((u32)(flavor)) >> FLVR_BULK_TYPE_OFFSET) & 0xF) -#define SPTLRPC_FLVR_BULK_SVC(flavor) \ +#define SPTLRPC_FLVR_BULK_SVC(flavor) \ ((((u32)(flavor)) >> FLVR_BULK_SVC_OFFSET) & 0xF) -#define SPTLRPC_FLVR_BASE(flavor) \ +#define SPTLRPC_FLVR_BASE(flavor) \ ((((u32)(flavor)) >> FLVR_POLICY_OFFSET) & 0xFFF) -#define SPTLRPC_FLVR_BASE_SUB(flavor) \ +#define SPTLRPC_FLVR_BASE_SUB(flavor) \ ((((u32)(flavor)) >> FLVR_MECH_OFFSET) & 0xFF) /* * gss subflavors */ -#define MAKE_BASE_SUBFLVR(mech, svc) \ - ((u32)(mech) | \ +#define MAKE_BASE_SUBFLVR(mech, svc) \ + ((u32)(mech) | \ ((u32)(svc) << (FLVR_SVC_OFFSET - FLVR_MECH_OFFSET))) -#define SPTLRPC_SUBFLVR_KRB5N \ +#define SPTLRPC_SUBFLVR_KRB5N \ MAKE_BASE_SUBFLVR(SPTLRPC_MECH_GSS_KRB5, SPTLRPC_SVC_NULL) -#define SPTLRPC_SUBFLVR_KRB5A \ +#define SPTLRPC_SUBFLVR_KRB5A \ MAKE_BASE_SUBFLVR(SPTLRPC_MECH_GSS_KRB5, SPTLRPC_SVC_AUTH) -#define SPTLRPC_SUBFLVR_KRB5I \ +#define SPTLRPC_SUBFLVR_KRB5I \ MAKE_BASE_SUBFLVR(SPTLRPC_MECH_GSS_KRB5, SPTLRPC_SVC_INTG) -#define SPTLRPC_SUBFLVR_KRB5P \ +#define SPTLRPC_SUBFLVR_KRB5P \ MAKE_BASE_SUBFLVR(SPTLRPC_MECH_GSS_KRB5, SPTLRPC_SVC_PRIV) /* * "end user" flavors */ -#define SPTLRPC_FLVR_NULL \ - MAKE_FLVR(SPTLRPC_POLICY_NULL, \ - SPTLRPC_MECH_NULL, \ - SPTLRPC_SVC_NULL, \ - SPTLRPC_BULK_DEFAULT, \ +#define SPTLRPC_FLVR_NULL \ + MAKE_FLVR(SPTLRPC_POLICY_NULL, \ + SPTLRPC_MECH_NULL, \ + SPTLRPC_SVC_NULL, \ + SPTLRPC_BULK_DEFAULT, \ SPTLRPC_BULK_SVC_NULL) -#define SPTLRPC_FLVR_PLAIN \ - MAKE_FLVR(SPTLRPC_POLICY_PLAIN, \ - SPTLRPC_MECH_PLAIN, \ - SPTLRPC_SVC_NULL, \ - SPTLRPC_BULK_HASH, \ +#define SPTLRPC_FLVR_PLAIN \ + MAKE_FLVR(SPTLRPC_POLICY_PLAIN, \ + SPTLRPC_MECH_PLAIN, \ + SPTLRPC_SVC_NULL, \ + SPTLRPC_BULK_HASH, \ SPTLRPC_BULK_SVC_INTG) -#define SPTLRPC_FLVR_KRB5N \ - MAKE_FLVR(SPTLRPC_POLICY_GSS, \ +#define SPTLRPC_FLVR_KRB5N \ + MAKE_FLVR(SPTLRPC_POLICY_GSS, \ SPTLRPC_MECH_GSS_KRB5, \ - SPTLRPC_SVC_NULL, \ - SPTLRPC_BULK_DEFAULT, \ + SPTLRPC_SVC_NULL, \ + SPTLRPC_BULK_DEFAULT, \ SPTLRPC_BULK_SVC_NULL) -#define SPTLRPC_FLVR_KRB5A \ - MAKE_FLVR(SPTLRPC_POLICY_GSS, \ +#define SPTLRPC_FLVR_KRB5A \ + MAKE_FLVR(SPTLRPC_POLICY_GSS, \ SPTLRPC_MECH_GSS_KRB5, \ - SPTLRPC_SVC_AUTH, \ - SPTLRPC_BULK_DEFAULT, \ + SPTLRPC_SVC_AUTH, \ + SPTLRPC_BULK_DEFAULT, \ SPTLRPC_BULK_SVC_NULL) -#define SPTLRPC_FLVR_KRB5I \ - MAKE_FLVR(SPTLRPC_POLICY_GSS, \ +#define SPTLRPC_FLVR_KRB5I \ + MAKE_FLVR(SPTLRPC_POLICY_GSS, \ SPTLRPC_MECH_GSS_KRB5, \ - SPTLRPC_SVC_INTG, \ - SPTLRPC_BULK_DEFAULT, \ + SPTLRPC_SVC_INTG, \ + SPTLRPC_BULK_DEFAULT, \ SPTLRPC_BULK_SVC_INTG) -#define SPTLRPC_FLVR_KRB5P \ - MAKE_FLVR(SPTLRPC_POLICY_GSS, \ +#define SPTLRPC_FLVR_KRB5P \ + MAKE_FLVR(SPTLRPC_POLICY_GSS, \ SPTLRPC_MECH_GSS_KRB5, \ - SPTLRPC_SVC_PRIV, \ - SPTLRPC_BULK_DEFAULT, \ + SPTLRPC_SVC_PRIV, \ + SPTLRPC_BULK_DEFAULT, \ SPTLRPC_BULK_SVC_PRIV) -#define SPTLRPC_FLVR_DEFAULT SPTLRPC_FLVR_NULL +#define SPTLRPC_FLVR_DEFAULT SPTLRPC_FLVR_NULL -#define SPTLRPC_FLVR_INVALID ((u32)0xFFFFFFFF) +#define SPTLRPC_FLVR_INVALID ((u32)0xFFFFFFFF) #define SPTLRPC_FLVR_ANY ((u32)0xFFF00000) /** @@ -253,7 +253,7 @@ static inline void flvr_set_bulk_svc(u32 *flvr, u32 svc) } struct bulk_spec_hash { - u8 hash_alg; + u8 hash_alg; }; /** @@ -264,11 +264,11 @@ struct sptlrpc_flavor { /** * wire flavor, should be renamed to sf_wire. */ - u32 sf_rpc; + u32 sf_rpc; /** * general flags of PTLRPC_SEC_FL_* */ - u32 sf_flags; + u32 sf_flags; /** * rpc flavor specification */ @@ -288,12 +288,12 @@ struct sptlrpc_flavor { * RPC requests and to be checked by ptlrpc service. */ enum lustre_sec_part { - LUSTRE_SP_CLI = 0, + LUSTRE_SP_CLI = 0, LUSTRE_SP_MDT, LUSTRE_SP_OST, LUSTRE_SP_MGC, LUSTRE_SP_MGS, - LUSTRE_SP_ANY = 0xFF + LUSTRE_SP_ANY = 0xFF }; enum lustre_sec_part sptlrpc_target_sec_part(struct obd_device *obd); @@ -303,11 +303,11 @@ enum lustre_sec_part { * two Lustre parts. */ struct sptlrpc_rule { - u32 sr_netid; /* LNET network ID */ - u8 sr_from; /* sec_part */ - u8 sr_to; /* sec_part */ - u16 sr_padding; - struct sptlrpc_flavor sr_flvr; + u32 sr_netid; /* LNET network ID */ + u8 sr_from; /* sec_part */ + u8 sr_to; /* sec_part */ + u16 sr_padding; + struct sptlrpc_flavor sr_flvr; }; /** @@ -317,8 +317,8 @@ struct sptlrpc_rule { * and client when needed. */ struct sptlrpc_rule_set { - int srs_nslot; - int srs_nrule; + int srs_nslot; + int srs_nrule; struct sptlrpc_rule *srs_rules; }; @@ -460,37 +460,37 @@ struct ptlrpc_ctx_ops { struct ptlrpc_bulk_desc *desc); }; -#define PTLRPC_CTX_NEW_BIT (0) /* newly created */ -#define PTLRPC_CTX_UPTODATE_BIT (1) /* uptodate */ -#define PTLRPC_CTX_DEAD_BIT (2) /* mark expired gracefully */ -#define PTLRPC_CTX_ERROR_BIT (3) /* fatal error (refresh, etc.) */ -#define PTLRPC_CTX_CACHED_BIT (8) /* in ctx cache (hash etc.) */ -#define PTLRPC_CTX_ETERNAL_BIT (9) /* always valid */ - -#define PTLRPC_CTX_NEW (1 << PTLRPC_CTX_NEW_BIT) -#define PTLRPC_CTX_UPTODATE (1 << PTLRPC_CTX_UPTODATE_BIT) -#define PTLRPC_CTX_DEAD (1 << PTLRPC_CTX_DEAD_BIT) -#define PTLRPC_CTX_ERROR (1 << PTLRPC_CTX_ERROR_BIT) -#define PTLRPC_CTX_CACHED (1 << PTLRPC_CTX_CACHED_BIT) -#define PTLRPC_CTX_ETERNAL (1 << PTLRPC_CTX_ETERNAL_BIT) - -#define PTLRPC_CTX_STATUS_MASK (PTLRPC_CTX_NEW_BIT | \ - PTLRPC_CTX_UPTODATE | \ - PTLRPC_CTX_DEAD | \ +#define PTLRPC_CTX_NEW_BIT (0) /* newly created */ +#define PTLRPC_CTX_UPTODATE_BIT (1) /* uptodate */ +#define PTLRPC_CTX_DEAD_BIT (2) /* mark expired gracefully */ +#define PTLRPC_CTX_ERROR_BIT (3) /* fatal error (refresh, etc.) */ +#define PTLRPC_CTX_CACHED_BIT (8) /* in ctx cache (hash etc.) */ +#define PTLRPC_CTX_ETERNAL_BIT (9) /* always valid */ + +#define PTLRPC_CTX_NEW (1 << PTLRPC_CTX_NEW_BIT) +#define PTLRPC_CTX_UPTODATE (1 << PTLRPC_CTX_UPTODATE_BIT) +#define PTLRPC_CTX_DEAD (1 << PTLRPC_CTX_DEAD_BIT) +#define PTLRPC_CTX_ERROR (1 << PTLRPC_CTX_ERROR_BIT) +#define PTLRPC_CTX_CACHED (1 << PTLRPC_CTX_CACHED_BIT) +#define PTLRPC_CTX_ETERNAL (1 << PTLRPC_CTX_ETERNAL_BIT) + +#define PTLRPC_CTX_STATUS_MASK (PTLRPC_CTX_NEW_BIT | \ + PTLRPC_CTX_UPTODATE | \ + PTLRPC_CTX_DEAD | \ PTLRPC_CTX_ERROR) struct ptlrpc_cli_ctx { - struct hlist_node cc_cache; /* linked into ctx cache */ - atomic_t cc_refcount; + struct hlist_node cc_cache; /* linked into ctx cache */ + atomic_t cc_refcount; struct ptlrpc_sec *cc_sec; struct ptlrpc_ctx_ops *cc_ops; - unsigned long cc_expire; /* in seconds */ - unsigned int cc_early_expire:1; - unsigned long cc_flags; - struct vfs_cred cc_vcred; + unsigned long cc_expire; /* in seconds */ + unsigned int cc_early_expire:1; + unsigned long cc_flags; + struct vfs_cred cc_vcred; spinlock_t cc_lock; - struct list_head cc_req_list; /* waiting reqs linked here */ - struct list_head cc_gc_chain; /* linked to gc chain */ + struct list_head cc_req_list; /* waiting reqs linked here */ + struct list_head cc_gc_chain; /* linked to gc chain */ }; /** @@ -755,18 +755,18 @@ struct ptlrpc_sec_sops { }; struct ptlrpc_sec_policy { - struct module *sp_owner; - char *sp_name; - u16 sp_policy; /* policy number */ - struct ptlrpc_sec_cops *sp_cops; /* client ops */ - struct ptlrpc_sec_sops *sp_sops; /* server ops */ + struct module *sp_owner; + char *sp_name; + u16 sp_policy; /* policy number */ + struct ptlrpc_sec_cops *sp_cops; /* client ops */ + struct ptlrpc_sec_sops *sp_sops; /* server ops */ }; -#define PTLRPC_SEC_FL_REVERSE 0x0001 /* reverse sec */ -#define PTLRPC_SEC_FL_ROOTONLY 0x0002 /* treat everyone as root */ -#define PTLRPC_SEC_FL_UDESC 0x0004 /* ship udesc */ -#define PTLRPC_SEC_FL_BULK 0x0008 /* intensive bulk i/o expected */ -#define PTLRPC_SEC_FL_PAG 0x0010 /* PAG mode */ +#define PTLRPC_SEC_FL_REVERSE 0x0001 /* reverse sec */ +#define PTLRPC_SEC_FL_ROOTONLY 0x0002 /* treat everyone as root */ +#define PTLRPC_SEC_FL_UDESC 0x0004 /* ship udesc */ +#define PTLRPC_SEC_FL_BULK 0x0008 /* intensive bulk i/o expected */ +#define PTLRPC_SEC_FL_PAG 0x0010 /* PAG mode */ /** * The ptlrpc_sec represents the client side ptlrpc security facilities, @@ -777,25 +777,25 @@ struct ptlrpc_sec_policy { */ struct ptlrpc_sec { struct ptlrpc_sec_policy *ps_policy; - atomic_t ps_refcount; + atomic_t ps_refcount; /** statistic only */ - atomic_t ps_nctx; + atomic_t ps_nctx; /** unique identifier */ - int ps_id; - struct sptlrpc_flavor ps_flvr; - enum lustre_sec_part ps_part; + int ps_id; + struct sptlrpc_flavor ps_flvr; + enum lustre_sec_part ps_part; /** after set, no more new context will be created */ - unsigned int ps_dying:1; + unsigned int ps_dying:1; /** owning import */ - struct obd_import *ps_import; + struct obd_import *ps_import; spinlock_t ps_lock; /* * garbage collection */ - struct list_head ps_gc_list; - unsigned long ps_gc_interval; /* in seconds */ - time64_t ps_gc_next; /* in seconds */ + struct list_head ps_gc_list; + unsigned long ps_gc_interval; /* in seconds */ + time64_t ps_gc_next; /* in seconds */ }; static inline int sec_is_reverse(struct ptlrpc_sec *sec) @@ -809,30 +809,30 @@ static inline int sec_is_rootonly(struct ptlrpc_sec *sec) } struct ptlrpc_svc_ctx { - atomic_t sc_refcount; + atomic_t sc_refcount; struct ptlrpc_sec_policy *sc_policy; }; /* * user identity descriptor */ -#define LUSTRE_MAX_GROUPS (128) +#define LUSTRE_MAX_GROUPS (128) struct ptlrpc_user_desc { - u32 pud_uid; - u32 pud_gid; - u32 pud_fsuid; - u32 pud_fsgid; - u32 pud_cap; - u32 pud_ngroups; - u32 pud_groups[0]; + u32 pud_uid; + u32 pud_gid; + u32 pud_fsuid; + u32 pud_fsgid; + u32 pud_cap; + u32 pud_ngroups; + u32 pud_groups[0]; }; /* * bulk flavors */ enum sptlrpc_bulk_hash_alg { - BULK_HASH_ALG_NULL = 0, + BULK_HASH_ALG_NULL = 0, BULK_HASH_ALG_ADLER32, BULK_HASH_ALG_CRC32, BULK_HASH_ALG_MD5, @@ -847,16 +847,16 @@ enum sptlrpc_bulk_hash_alg { u8 sptlrpc_get_hash_alg(const char *algname); enum { - BSD_FL_ERR = 1, + BSD_FL_ERR = 1, }; struct ptlrpc_bulk_sec_desc { - u8 bsd_version; /* 0 */ - u8 bsd_type; /* SPTLRPC_BULK_XXX */ - u8 bsd_svc; /* SPTLRPC_BULK_SVC_XXXX */ - u8 bsd_flags; /* flags */ - u32 bsd_nob; /* nob of bulk data */ - u8 bsd_data[0]; /* policy-specific token */ + u8 bsd_version; /* 0 */ + u8 bsd_type; /* SPTLRPC_BULK_XXX */ + u8 bsd_svc; /* SPTLRPC_BULK_SVC_XXXX */ + u8 bsd_flags; /* flags */ + u32 bsd_nob; /* nob of bulk data */ + u8 bsd_data[0]; /* policy-specific token */ }; /* @@ -979,8 +979,8 @@ int cli_ctx_is_eternal(struct ptlrpc_cli_ctx *ctx) int sptlrpc_cli_enlarge_reqbuf(struct ptlrpc_request *req, const struct req_msg_field *field, int newsize); -int sptlrpc_cli_unwrap_early_reply(struct ptlrpc_request *req, - struct ptlrpc_request **req_ret); +int sptlrpc_cli_unwrap_early_reply(struct ptlrpc_request *req, + struct ptlrpc_request **req_ret); void sptlrpc_cli_finish_early_reply(struct ptlrpc_request *early_req); void sptlrpc_request_out_callback(struct ptlrpc_request *req); @@ -994,13 +994,13 @@ int sptlrpc_import_sec_adapt(struct obd_import *imp, struct ptlrpc_sec *sptlrpc_import_sec_ref(struct obd_import *imp); void sptlrpc_import_sec_put(struct obd_import *imp); -int sptlrpc_import_check_ctx(struct obd_import *imp); +int sptlrpc_import_check_ctx(struct obd_import *imp); void sptlrpc_import_flush_root_ctx(struct obd_import *imp); void sptlrpc_import_flush_my_ctx(struct obd_import *imp); void sptlrpc_import_flush_all_ctx(struct obd_import *imp); -int sptlrpc_req_get_ctx(struct ptlrpc_request *req); +int sptlrpc_req_get_ctx(struct ptlrpc_request *req); void sptlrpc_req_put_ctx(struct ptlrpc_request *req, int sync); -int sptlrpc_req_refresh_ctx(struct ptlrpc_request *req, long timeout); +int sptlrpc_req_refresh_ctx(struct ptlrpc_request *req, long timeout); void sptlrpc_req_set_flavor(struct ptlrpc_request *req, int opcode); /* gc */ @@ -1023,15 +1023,15 @@ enum secsvc_accept_res { SECSVC_DROP, }; -int sptlrpc_svc_unwrap_request(struct ptlrpc_request *req); -int sptlrpc_svc_alloc_rs(struct ptlrpc_request *req, int msglen); -int sptlrpc_svc_wrap_reply(struct ptlrpc_request *req); +int sptlrpc_svc_unwrap_request(struct ptlrpc_request *req); +int sptlrpc_svc_alloc_rs(struct ptlrpc_request *req, int msglen); +int sptlrpc_svc_wrap_reply(struct ptlrpc_request *req); void sptlrpc_svc_free_rs(struct ptlrpc_reply_state *rs); void sptlrpc_svc_ctx_addref(struct ptlrpc_request *req); void sptlrpc_svc_ctx_decref(struct ptlrpc_request *req); -int sptlrpc_target_export_check(struct obd_export *exp, - struct ptlrpc_request *req); +int sptlrpc_target_export_check(struct obd_export *exp, + struct ptlrpc_request *req); /* bulk security api */ void sptlrpc_enc_pool_put_pages(struct ptlrpc_bulk_desc *desc); @@ -1063,10 +1063,10 @@ static inline int sptlrpc_user_desc_size(int ngroups) int sptlrpc_unpack_user_desc(struct lustre_msg *req, int offset, int swabbed); enum { - LUSTRE_SEC_NONE = 0, + LUSTRE_SEC_NONE = 0, LUSTRE_SEC_REMOTE = 1, LUSTRE_SEC_SPECIFY = 2, - LUSTRE_SEC_ALL = 3 + LUSTRE_SEC_ALL = 3 }; /** @} sptlrpc */ -- 1.8.3.1 From jsimmons at infradead.org Thu Jan 31 17:19:26 2019 From: jsimmons at infradead.org (James Simmons) Date: Thu, 31 Jan 2019 12:19:26 -0500 Subject: [lustre-devel] [PATCH 22/26] lustre: last batch to cleanup white spaces in internal headers In-Reply-To: <1548955170-13456-1-git-send-email-jsimmons@infradead.org> References: <1548955170-13456-1-git-send-email-jsimmons@infradead.org> Message-ID: <1548955170-13456-23-git-send-email-jsimmons@infradead.org> The internal headers are very messy and difficult to read. Remove excess white space and properly align data structures so they are easy on the eyes. This is the last batch since it covers many lines of changes. Signed-off-by: James Simmons --- drivers/staging/lustre/lustre/include/obd.h | 509 +++++++------- drivers/staging/lustre/lustre/include/obd_cksum.h | 4 +- drivers/staging/lustre/lustre/include/obd_class.h | 82 +-- .../staging/lustre/lustre/include/obd_support.h | 744 ++++++++++----------- drivers/staging/lustre/lustre/include/seq_range.h | 2 +- 5 files changed, 671 insertions(+), 670 deletions(-) diff --git a/drivers/staging/lustre/lustre/include/obd.h b/drivers/staging/lustre/lustre/include/obd.h index 0bb3cf8..171d2c2 100644 --- a/drivers/staging/lustre/lustre/include/obd.h +++ b/drivers/staging/lustre/lustre/include/obd.h @@ -53,20 +53,20 @@ #define MAX_OBD_DEVICES 8192 struct osc_async_rc { - int ar_rc; - int ar_force_sync; - u64 ar_min_xid; + int ar_rc; + int ar_force_sync; + u64 ar_min_xid; }; -struct lov_oinfo { /* per-stripe data structure */ - struct ost_id loi_oi; /* object ID/Sequence on the target OST */ - int loi_ost_idx; /* OST stripe index in lov_tgt_desc->tgts */ - int loi_ost_gen; /* generation of this loi_ost_idx */ +struct lov_oinfo { /* per-stripe data structure */ + struct ost_id loi_oi; /* object ID/Sequence on the target OST */ + int loi_ost_idx; /* OST stripe index in lov_tgt_desc->tgts */ + int loi_ost_gen; /* generation of this loi_ost_idx */ - unsigned long loi_kms_valid:1; - u64 loi_kms; /* known minimum size */ - struct ost_lvb loi_lvb; - struct osc_async_rc loi_ar; + unsigned long loi_kms_valid:1; + u64 loi_kms; /* known minimum size */ + struct ost_lvb loi_lvb; + struct osc_async_rc loi_ar; }; static inline void loi_kms_set(struct lov_oinfo *oinfo, u64 kms) @@ -85,7 +85,7 @@ static inline void loi_kms_set(struct lov_oinfo *oinfo, u64 kms) /* obd info for a particular level (lov, osc). */ struct obd_info { /* OBD_STATFS_* flags */ - u64 oi_flags; + u64 oi_flags; /* lsm data specific for every OSC. */ struct lov_stripe_md *oi_md; /* statfs data specific for every OSC, if needed at all. */ @@ -99,31 +99,31 @@ struct obd_info { }; struct obd_type { - struct list_head typ_chain; - struct obd_ops *typ_dt_ops; - struct md_ops *typ_md_ops; - struct dentry *typ_debugfs_entry; - char *typ_name; - int typ_refcnt; - struct lu_device_type *typ_lu; - spinlock_t obd_type_lock; + struct list_head typ_chain; + struct obd_ops *typ_dt_ops; + struct md_ops *typ_md_ops; + struct dentry *typ_debugfs_entry; + char *typ_name; + int typ_refcnt; + struct lu_device_type *typ_lu; + spinlock_t obd_type_lock; struct kobject *typ_kobj; }; struct brw_page { - u64 off; - struct page *pg; - unsigned int count; - u32 flag; + u64 off; + struct page *pg; + unsigned int count; + u32 flag; }; struct timeout_item { - enum timeout_event ti_event; - unsigned long ti_timeout; - timeout_cb_t ti_cb; - void *ti_cb_data; - struct list_head ti_obd_list; - struct list_head ti_chain; + enum timeout_event ti_event; + unsigned long ti_timeout; + timeout_cb_t ti_cb; + void *ti_cb_data; + struct list_head ti_obd_list; + struct list_head ti_chain; }; #define OBD_MAX_RIF_DEFAULT 8 @@ -135,9 +135,9 @@ struct timeout_item { /* possible values for fo_sync_lock_cancel */ enum { - NEVER_SYNC_ON_CANCEL = 0, - BLOCKING_SYNC_ON_CANCEL = 1, - ALWAYS_SYNC_ON_CANCEL = 2, + NEVER_SYNC_ON_CANCEL = 0, + BLOCKING_SYNC_ON_CANCEL = 1, + ALWAYS_SYNC_ON_CANCEL = 2, NUM_SYNC_ON_CANCEL_STATES }; @@ -159,10 +159,10 @@ enum obd_cl_sem_lock_class { struct mdc_rpc_lock; struct obd_import; struct client_obd { - struct rw_semaphore cl_sem; - struct obd_uuid cl_target_uuid; - struct obd_import *cl_import; /* ptlrpc connection state */ - size_t cl_conn_count; + struct rw_semaphore cl_sem; + struct obd_uuid cl_target_uuid; + struct obd_import *cl_import; /* ptlrpc connection state */ + size_t cl_conn_count; /* * Cache maximum and default values for easize. This is * strictly a performance optimization to minimize calls to @@ -203,22 +203,22 @@ struct client_obd { * grant before trying to dirty a page and unreserve the rest. * See osc_{reserve|unreserve}_grant for details. */ - long cl_reserved_grant; - wait_queue_head_t cl_cache_waiters; /* waiting for cache/grant */ - unsigned long cl_next_shrink_grant; /* jiffies */ - struct list_head cl_grant_shrink_list; /* Timeout event list */ - int cl_grant_shrink_interval; /* seconds */ + long cl_reserved_grant; + wait_queue_head_t cl_cache_waiters; /* waiting for cache/grant */ + unsigned long cl_next_shrink_grant; /* jiffies */ + struct list_head cl_grant_shrink_list; /* Timeout event list */ + int cl_grant_shrink_interval; /* seconds */ /* A chunk is an optimal size used by osc_extent to determine * the extent size. A chunk is max(PAGE_SIZE, OST block size) */ - int cl_chunkbits; + int cl_chunkbits; /* extent insertion metadata overhead to be accounted in grant, * in bytes */ - unsigned int cl_grant_extent_tax; + unsigned int cl_grant_extent_tax; /* maximum extent size, in number of pages */ - unsigned int cl_max_extent_pages; + unsigned int cl_max_extent_pages; /* keep track of objects that have lois that contain pages which * have been queued for async brw. this lock also protects the @@ -238,29 +238,29 @@ struct client_obd { * NB by Jinshan: though field names are still _loi_, but actually * osc_object{}s are in the list. */ - spinlock_t cl_loi_list_lock; - struct list_head cl_loi_ready_list; - struct list_head cl_loi_hp_ready_list; - struct list_head cl_loi_write_list; - struct list_head cl_loi_read_list; - u32 cl_r_in_flight; - u32 cl_w_in_flight; + spinlock_t cl_loi_list_lock; + struct list_head cl_loi_ready_list; + struct list_head cl_loi_hp_ready_list; + struct list_head cl_loi_write_list; + struct list_head cl_loi_read_list; + u32 cl_r_in_flight; + u32 cl_w_in_flight; /* just a sum of the loi/lop pending numbers to be exported by sysfs */ - atomic_t cl_pending_w_pages; - atomic_t cl_pending_r_pages; - u32 cl_max_pages_per_rpc; - u32 cl_max_rpcs_in_flight; - struct obd_histogram cl_read_rpc_hist; - struct obd_histogram cl_write_rpc_hist; - struct obd_histogram cl_read_page_hist; - struct obd_histogram cl_write_page_hist; - struct obd_histogram cl_read_offset_hist; - struct obd_histogram cl_write_offset_hist; + atomic_t cl_pending_w_pages; + atomic_t cl_pending_r_pages; + u32 cl_max_pages_per_rpc; + u32 cl_max_rpcs_in_flight; + struct obd_histogram cl_read_rpc_hist; + struct obd_histogram cl_write_rpc_hist; + struct obd_histogram cl_read_page_hist; + struct obd_histogram cl_write_page_hist; + struct obd_histogram cl_read_offset_hist; + struct obd_histogram cl_write_offset_hist; /* LRU for osc caching pages */ struct cl_client_cache *cl_cache; /** member of cl_cache->ccc_lru */ - struct list_head cl_lru_osc; + struct list_head cl_lru_osc; /** # of available LRU slots left in the per-OSC cache. * Available LRU slots are shared by all OSCs of the same file system, * therefore this is a pointer to cl_client_cache::ccc_lru_left. @@ -270,73 +270,74 @@ struct client_obd { * queue, or in transfer. Busy pages can't be discarded so they are not * in LRU cache. */ - atomic_long_t cl_lru_busy; + atomic_long_t cl_lru_busy; /** # of LRU pages in the cache for this client_obd */ - atomic_long_t cl_lru_in_list; + atomic_long_t cl_lru_in_list; /** # of threads are shrinking LRU cache. To avoid contention, it's not * allowed to have multiple threads shrinking LRU cache. */ - atomic_t cl_lru_shrinkers; + atomic_t cl_lru_shrinkers; /** The time when this LRU cache was last used. */ - time64_t cl_lru_last_used; + time64_t cl_lru_last_used; /** stats: how many reclaims have happened for this client_obd. * reclaim and shrink - shrink is async, voluntarily rebalancing; * reclaim is sync, initiated by IO thread when the LRU slots are * in shortage. */ - u64 cl_lru_reclaim; + u64 cl_lru_reclaim; /** List of LRU pages for this client_obd */ - struct list_head cl_lru_list; + struct list_head cl_lru_list; /** Lock for LRU page list */ - spinlock_t cl_lru_list_lock; + spinlock_t cl_lru_list_lock; /** # of unstable pages in this client_obd. * An unstable page is a page state that WRITE RPC has finished but * the transaction has NOT yet committed. */ - atomic_long_t cl_unstable_count; + atomic_long_t cl_unstable_count; /** Link to osc_shrinker_list */ - struct list_head cl_shrink_list; + struct list_head cl_shrink_list; /* number of in flight destroy rpcs is limited to max_rpcs_in_flight */ - atomic_t cl_destroy_in_flight; - wait_queue_head_t cl_destroy_waitq; + atomic_t cl_destroy_in_flight; + wait_queue_head_t cl_destroy_waitq; struct mdc_rpc_lock *cl_rpc_lock; /* modify rpcs in flight * currently used for metadata only */ - spinlock_t cl_mod_rpcs_lock; - u16 cl_max_mod_rpcs_in_flight; - u16 cl_mod_rpcs_in_flight; - u16 cl_close_rpcs_in_flight; - wait_queue_head_t cl_mod_rpcs_waitq; - unsigned long *cl_mod_tag_bitmap; - struct obd_histogram cl_mod_rpcs_hist; + spinlock_t cl_mod_rpcs_lock; + u16 cl_max_mod_rpcs_in_flight; + u16 cl_mod_rpcs_in_flight; + u16 cl_close_rpcs_in_flight; + wait_queue_head_t cl_mod_rpcs_waitq; + unsigned long *cl_mod_tag_bitmap; + struct obd_histogram cl_mod_rpcs_hist; /* mgc datastruct */ - atomic_t cl_mgc_refcount; - struct obd_export *cl_mgc_mgsexp; + atomic_t cl_mgc_refcount; + struct obd_export *cl_mgc_mgsexp; /* checksumming for data sent over the network */ - unsigned int cl_checksum:1, /* 0 = disabled, 1 = enabled */ - cl_checksum_dump:1; /* same */ + unsigned int cl_checksum:1, /* 0 = disabled, 1 = enabled */ + cl_checksum_dump:1; /* same */ /* supported checksum types that are worked out at connect time */ - u32 cl_supp_cksum_types; + u32 cl_supp_cksum_types; /* checksum algorithm to be used */ - enum cksum_type cl_cksum_type; + enum cksum_type cl_cksum_type; /* also protected by the poorly named _loi_list_lock lock above */ - struct osc_async_rc cl_ar; + struct osc_async_rc cl_ar; /* sequence manager */ struct lu_client_seq *cl_seq; - struct rw_semaphore cl_seq_rwsem; + struct rw_semaphore cl_seq_rwsem; + + atomic_t cl_resends; /* resend count */ - atomic_t cl_resends; /* resend count */ /* ptlrpc work for writeback in ptlrpcd context */ - void *cl_writeback_work; + void *cl_writeback_work; void *cl_lru_work; /* hash tables for osc_quota_info */ struct rhashtable cl_quota_hash[MAXQUOTAS]; @@ -347,55 +348,55 @@ struct client_obd { #define obd2cli_tgt(obd) ((char *)(obd)->u.cli.cl_target_uuid.uuid) struct obd_id_info { - u32 idx; + u32 idx; u64 *data; }; struct echo_client_obd { struct obd_export *ec_exp; /* the local connection to osc/lov */ spinlock_t ec_lock; - struct list_head ec_objects; - struct list_head ec_locks; - u64 ec_unique; + struct list_head ec_objects; + struct list_head ec_locks; + u64 ec_unique; }; /* Generic subset of OSTs */ struct ost_pool { - u32 *op_array; /* array of index of lov_obd->lov_tgts */ - unsigned int op_count; /* number of OSTs in the array */ - unsigned int op_size; /* allocated size of lp_array */ - struct rw_semaphore op_rw_sem; /* to protect ost_pool use */ + u32 *op_array; /* array of index of lov_obd->lov_tgts */ + unsigned int op_count; /* number of OSTs in the array */ + unsigned int op_size; /* allocated size of lp_array */ + struct rw_semaphore op_rw_sem; /* to protect ost_pool use */ }; /* allow statfs data caching for 1 second */ #define OBD_STATFS_CACHE_SECONDS 1 struct lov_tgt_desc { - struct list_head ltd_kill; - struct obd_uuid ltd_uuid; - struct obd_device *ltd_obd; - struct obd_export *ltd_exp; - u32 ltd_gen; - u32 ltd_index; /* index in lov_obd->tgts */ - unsigned long ltd_active:1,/* is this target up for requests */ - ltd_activate:1,/* should target be activated */ - ltd_reap:1; /* should this target be deleted */ + struct list_head ltd_kill; + struct obd_uuid ltd_uuid; + struct obd_device *ltd_obd; + struct obd_export *ltd_exp; + u32 ltd_gen; + u32 ltd_index; /* index in lov_obd->tgts */ + unsigned long ltd_active:1,/* is this target up for requests */ + ltd_activate:1,/* should target be activated */ + ltd_reap:1; /* should this target be deleted */ }; struct lov_obd { - struct lov_desc desc; - struct lov_tgt_desc **lov_tgts; /* sparse array */ - struct ost_pool lov_packed; /* all OSTs in a packed array */ + struct lov_desc desc; + struct lov_tgt_desc **lov_tgts; /* sparse array */ + struct ost_pool lov_packed; /* all OSTs in a packed array */ struct mutex lov_lock; struct obd_connect_data lov_ocd; - atomic_t lov_refcount; - u32 lov_death_row;/* tgts scheduled to be deleted */ - u32 lov_tgt_size; /* size of tgts array */ - int lov_connects; - int lov_pool_count; + atomic_t lov_refcount; + u32 lov_death_row;/* tgts scheduled to be deleted */ + u32 lov_tgt_size; /* size of tgts array */ + int lov_connects; + int lov_pool_count; struct rhashtable lov_pools_hash_body; /* used for key access */ struct list_head lov_pool_list; /* used for sequential access */ - struct dentry *lov_pool_debugfs_entry; + struct dentry *lov_pool_debugfs_entry; enum lustre_sec_part lov_sp_me; /* Cached LRU and unstable data from upper layer */ @@ -403,12 +404,12 @@ struct lov_obd { struct rw_semaphore lov_notify_lock; - struct kobject *lov_tgts_kobj; + struct kobject *lov_tgts_kobj; }; struct lmv_tgt_desc { struct obd_uuid ltd_uuid; - struct obd_export *ltd_exp; + struct obd_export *ltd_exp; u32 ltd_idx; struct mutex ltd_fid_mutex; unsigned long ltd_active:1; /* target up for requests */ @@ -433,52 +434,52 @@ struct lmv_obd { }; struct niobuf_local { - u64 lnb_file_offset; - u32 lnb_page_offset; - u32 lnb_len; - u32 lnb_flags; - int lnb_rc; - struct page *lnb_page; - void *lnb_data; + u64 lnb_file_offset; + u32 lnb_page_offset; + u32 lnb_len; + u32 lnb_flags; + int lnb_rc; + struct page *lnb_page; + void *lnb_data; }; -#define LUSTRE_FLD_NAME "fld" -#define LUSTRE_SEQ_NAME "seq" +#define LUSTRE_FLD_NAME "fld" +#define LUSTRE_SEQ_NAME "seq" -#define LUSTRE_MDD_NAME "mdd" +#define LUSTRE_MDD_NAME "mdd" #define LUSTRE_OSD_LDISKFS_NAME "osd-ldiskfs" #define LUSTRE_OSD_ZFS_NAME "osd-zfs" -#define LUSTRE_VVP_NAME "vvp" -#define LUSTRE_LMV_NAME "lmv" -#define LUSTRE_SLP_NAME "slp" +#define LUSTRE_VVP_NAME "vvp" +#define LUSTRE_LMV_NAME "lmv" +#define LUSTRE_SLP_NAME "slp" #define LUSTRE_LOD_NAME "lod" #define LUSTRE_OSP_NAME "osp" #define LUSTRE_LWP_NAME "lwp" /* obd device type names */ /* FIXME all the references to LUSTRE_MDS_NAME should be swapped with LUSTRE_MDT_NAME */ -#define LUSTRE_MDS_NAME "mds" -#define LUSTRE_MDT_NAME "mdt" -#define LUSTRE_MDC_NAME "mdc" -#define LUSTRE_OSS_NAME "ost" /* FIXME change name to oss */ -#define LUSTRE_OST_NAME "obdfilter" /* FIXME change name to ost */ -#define LUSTRE_OSC_NAME "osc" -#define LUSTRE_LOV_NAME "lov" -#define LUSTRE_MGS_NAME "mgs" -#define LUSTRE_MGC_NAME "mgc" +#define LUSTRE_MDS_NAME "mds" +#define LUSTRE_MDT_NAME "mdt" +#define LUSTRE_MDC_NAME "mdc" +#define LUSTRE_OSS_NAME "ost" /* FIXME change name to oss */ +#define LUSTRE_OST_NAME "obdfilter" /* FIXME change name to ost */ +#define LUSTRE_OSC_NAME "osc" +#define LUSTRE_LOV_NAME "lov" +#define LUSTRE_MGS_NAME "mgs" +#define LUSTRE_MGC_NAME "mgc" #define LUSTRE_ECHO_NAME "obdecho" #define LUSTRE_ECHO_CLIENT_NAME "echo_client" -#define LUSTRE_QMT_NAME "qmt" +#define LUSTRE_QMT_NAME "qmt" /* Constant obd names (post-rename) */ -#define LUSTRE_MDS_OBDNAME "MDS" -#define LUSTRE_OSS_OBDNAME "OSS" -#define LUSTRE_MGS_OBDNAME "MGS" -#define LUSTRE_MGC_OBDNAME "MGC" +#define LUSTRE_MDS_OBDNAME "MDS" +#define LUSTRE_OSS_OBDNAME "OSS" +#define LUSTRE_MGS_OBDNAME "MGS" +#define LUSTRE_MGC_OBDNAME "MGC" /* Don't conflict with on-wire flags OBD_BRW_WRITE, etc */ -#define N_LOCAL_TEMP_PAGE 0x10000000 +#define N_LOCAL_TEMP_PAGE 0x10000000 /* * Events signalled through obd_notify() upcall-chain. @@ -516,21 +517,21 @@ struct target_recovery_data { }; struct obd_llog_group { - struct llog_ctxt *olg_ctxts[LLOG_MAX_CTXTS]; + struct llog_ctxt *olg_ctxts[LLOG_MAX_CTXTS]; wait_queue_head_t olg_waitq; - spinlock_t olg_lock; - struct mutex olg_cat_processing; + spinlock_t olg_lock; + struct mutex olg_cat_processing; }; /* corresponds to one of the obd's */ #define OBD_DEVICE_MAGIC 0XAB5CD6EF struct lvfs_run_ctxt { - struct dt_device *dt; + struct dt_device *dt; }; struct obd_device { - struct obd_type *obd_type; + struct obd_type *obd_type; u32 obd_magic; /* OBD_DEVICE_MAGIC */ int obd_minor; /* device number: lctl dl */ struct lu_device *obd_lu_dev; @@ -562,35 +563,35 @@ struct obd_device { */ unsigned long obd_recovery_expired:1; /* uuid-export hash body */ - struct rhashtable obd_uuid_hash; - wait_queue_head_t obd_refcount_waitq; - struct list_head obd_exports; - struct list_head obd_unlinked_exports; - struct list_head obd_delayed_exports; - atomic_t obd_refcount; - int obd_num_exports; - spinlock_t obd_nid_lock; - struct ldlm_namespace *obd_namespace; - struct ptlrpc_client obd_ldlm_client; /* XXX OST/MDS only */ + struct rhashtable obd_uuid_hash; + wait_queue_head_t obd_refcount_waitq; + struct list_head obd_exports; + struct list_head obd_unlinked_exports; + struct list_head obd_delayed_exports; + atomic_t obd_refcount; + int obd_num_exports; + spinlock_t obd_nid_lock; + struct ldlm_namespace *obd_namespace; + struct ptlrpc_client obd_ldlm_client; /* XXX OST/MDS only */ /* a spinlock is OK for what we do now, may need a semaphore later */ - spinlock_t obd_dev_lock; /* protect OBD bitfield above */ - spinlock_t obd_osfs_lock; - struct obd_statfs obd_osfs; /* locked by obd_osfs_lock */ - u64 obd_osfs_age; - u64 obd_last_committed; - struct mutex obd_dev_mutex; - struct lvfs_run_ctxt obd_lvfs_ctxt; - struct obd_llog_group obd_olg; /* default llog group */ + spinlock_t obd_dev_lock; /* protect OBD bitfield above */ + spinlock_t obd_osfs_lock; + struct obd_statfs obd_osfs; /* locked by obd_osfs_lock */ + u64 obd_osfs_age; + u64 obd_last_committed; + struct mutex obd_dev_mutex; + struct lvfs_run_ctxt obd_lvfs_ctxt; + struct obd_llog_group obd_olg; /* default llog group */ struct obd_device *obd_observer; - struct rw_semaphore obd_observer_link_sem; + struct rw_semaphore obd_observer_link_sem; struct obd_notify_upcall obd_upcall; - struct obd_export *obd_self_export; + struct obd_export *obd_self_export; union { - struct client_obd cli; - struct echo_client_obd echo_client; - struct lov_obd lov; - struct lmv_obd lmv; + struct client_obd cli; + struct echo_client_obd echo_client; + struct lov_obd lov; + struct lmv_obd lmv; } u; /* Fields used by LProcFS */ @@ -600,12 +601,12 @@ struct obd_device { struct dentry *obd_debugfs_entry; struct dentry *obd_svc_debugfs_entry; - struct lprocfs_stats *obd_svc_stats; - const struct attribute **obd_attrs; - struct lprocfs_vars *obd_vars; - atomic_t obd_evict_inprogress; - wait_queue_head_t obd_evict_inprogress_waitq; - struct list_head obd_evict_list; /* protected with pet_lock */ + struct lprocfs_stats *obd_svc_stats; + const struct attribute **obd_attrs; + struct lprocfs_vars *obd_vars; + atomic_t obd_evict_inprogress; + wait_queue_head_t obd_evict_inprogress_waitq; + struct list_head obd_evict_list; /* protected with pet_lock */ /** * Ldlm pool part. Save last calculated SLV and Limit. @@ -620,39 +621,39 @@ struct obd_device { * A list of outstanding class_incref()'s against this obd. For * debugging. */ - struct lu_ref obd_reference; + struct lu_ref obd_reference; - struct kset obd_kset; /* sysfs object collection */ - struct kobj_type obd_ktype; - struct completion obd_kobj_unregister; + struct kset obd_kset; /* sysfs object collection */ + struct kobj_type obd_ktype; + struct completion obd_kobj_unregister; }; int obd_uuid_add(struct obd_device *obd, struct obd_export *export); void obd_uuid_del(struct obd_device *obd, struct obd_export *export); /* get/set_info keys */ -#define KEY_ASYNC "async" -#define KEY_CHANGELOG_CLEAR "changelog_clear" -#define KEY_FID2PATH "fid2path" -#define KEY_CHECKSUM "checksum" -#define KEY_CLEAR_FS "clear_fs" -#define KEY_CONN_DATA "conn_data" +#define KEY_ASYNC "async" +#define KEY_CHANGELOG_CLEAR "changelog_clear" +#define KEY_FID2PATH "fid2path" +#define KEY_CHECKSUM "checksum" +#define KEY_CLEAR_FS "clear_fs" +#define KEY_CONN_DATA "conn_data" #define KEY_EVICT_BY_NID "evict_by_nid" -#define KEY_FIEMAP "fiemap" -#define KEY_FLUSH_CTX "flush_ctx" +#define KEY_FIEMAP "fiemap" +#define KEY_FLUSH_CTX "flush_ctx" #define KEY_GRANT_SHRINK "grant_shrink" #define KEY_HSM_COPYTOOL_SEND "hsm_send" #define KEY_INIT_RECOV_BACKUP "init_recov_bk" -#define KEY_INTERMDS "inter_mds" -#define KEY_LAST_ID "last_id" +#define KEY_INTERMDS "inter_mds" +#define KEY_LAST_ID "last_id" #define KEY_LAST_FID "last_fid" #define KEY_MAX_EASIZE "max_easize" #define KEY_DEFAULT_EASIZE "default_easize" -#define KEY_MGSSEC "mgssec" -#define KEY_READ_ONLY "read-only" -#define KEY_REGISTER_TARGET "register_target" -#define KEY_SET_FS "set_fs" -#define KEY_TGT_COUNT "tgt_count" +#define KEY_MGSSEC "mgssec" +#define KEY_READ_ONLY "read-only" +#define KEY_REGISTER_TARGET "register_target" +#define KEY_SET_FS "set_fs" +#define KEY_TGT_COUNT "tgt_count" /* KEY_SET_INFO in lustre_idl.h */ #define KEY_SPTLRPC_CONF "sptlrpc_conf" @@ -698,11 +699,11 @@ enum md_op_flags { }; enum md_cli_flags { - CLI_SET_MEA = BIT(0), - CLI_RM_ENTRY = BIT(1), - CLI_HASH64 = BIT(2), - CLI_API32 = BIT(3), - CLI_MIGRATE = BIT(4), + CLI_SET_MEA = BIT(0), + CLI_RM_ENTRY = BIT(1), + CLI_HASH64 = BIT(2), + CLI_API32 = BIT(3), + CLI_MIGRATE = BIT(4), }; /** @@ -716,39 +717,39 @@ static inline bool it_has_reply_body(const struct lookup_intent *it) } struct md_op_data { - struct lu_fid op_fid1; /* operation fid1 (usually parent) */ - struct lu_fid op_fid2; /* operation fid2 (usually child) */ - struct lu_fid op_fid3; /* 2 extra fids to find conflicting */ - struct lu_fid op_fid4; /* to the operation locks. */ + struct lu_fid op_fid1; /* operation fid1 (usually parent) */ + struct lu_fid op_fid2; /* operation fid2 (usually child) */ + struct lu_fid op_fid3; /* 2 extra fids to find conflicting */ + struct lu_fid op_fid4; /* to the operation locks. */ u32 op_mds; /* what mds server open will go to */ u32 op_mode; - struct lustre_handle op_handle; + struct lustre_handle op_handle; s64 op_mod_time; - const char *op_name; + const char *op_name; size_t op_namelen; struct lmv_stripe_md *op_mea1; struct lmv_stripe_md *op_mea2; - u32 op_suppgids[2]; - u32 op_fsuid; - u32 op_fsgid; - kernel_cap_t op_cap; - void *op_data; + u32 op_suppgids[2]; + u32 op_fsuid; + u32 op_fsgid; + kernel_cap_t op_cap; + void *op_data; size_t op_data_size; /* iattr fields and blocks. */ - struct iattr op_attr; + struct iattr op_attr; enum op_xvalid op_xvalid; /* eXtra validity flags */ - unsigned int op_attr_flags; - u64 op_valid; - loff_t op_attr_blocks; + unsigned int op_attr_flags; + u64 op_valid; + loff_t op_attr_blocks; - u32 op_flags; + u32 op_flags; /* Various operation flags. */ enum mds_op_bias op_bias; /* Used by readdir */ - u64 op_offset; + u64 op_offset; /* used to transfer info between the stacks of MD client * see enum op_cli_flags @@ -780,14 +781,14 @@ struct md_callback { /* metadata stat-ahead */ struct md_enqueue_info { - struct md_op_data mi_data; - struct lookup_intent mi_it; - struct lustre_handle mi_lockh; - struct inode *mi_dir; + struct md_op_data mi_data; + struct lookup_intent mi_it; + struct lustre_handle mi_lockh; + struct inode *mi_dir; struct ldlm_enqueue_info mi_einfo; int (*mi_cb)(struct ptlrpc_request *req, struct md_enqueue_info *minfo, int rc); - void *mi_cbdata; + void *mi_cbdata; }; struct obd_ops { @@ -886,33 +887,33 @@ struct obd_ops { /* lmv structures */ struct lustre_md { - struct mdt_body *body; - struct lu_buf layout; - struct lmv_stripe_md *lmv; + struct mdt_body *body; + struct lu_buf layout; + struct lmv_stripe_md *lmv; #ifdef CONFIG_FS_POSIX_ACL - struct posix_acl *posix_acl; + struct posix_acl *posix_acl; #endif - struct mdt_remote_perm *remote_perm; + struct mdt_remote_perm *remote_perm; }; struct md_open_data { - struct obd_client_handle *mod_och; - struct ptlrpc_request *mod_open_req; - struct ptlrpc_request *mod_close_req; - atomic_t mod_refcount; - bool mod_is_create; + struct obd_client_handle *mod_och; + struct ptlrpc_request *mod_open_req; + struct ptlrpc_request *mod_close_req; + atomic_t mod_refcount; + bool mod_is_create; }; struct obd_client_handle { - struct lustre_handle och_fh; - struct lu_fid och_fid; - struct md_open_data *och_mod; - struct lustre_handle och_lease_handle; /* open lock for lease */ - u32 och_magic; - fmode_t och_flags; + struct lustre_handle och_fh; + struct lu_fid och_fid; + struct md_open_data *och_mod; + struct lustre_handle och_lease_handle; /* open lock for lease */ + u32 och_magic; + fmode_t och_flags; }; -#define OBD_CLIENT_HANDLE_MAGIC 0xd15ea5ed +#define OBD_CLIENT_HANDLE_MAGIC 0xd15ea5ed struct lookup_intent; struct cl_attr; @@ -1015,13 +1016,13 @@ static inline struct md_open_data *obd_mod_alloc(void) } #define obd_mod_get(mod) atomic_inc(&(mod)->mod_refcount) -#define obd_mod_put(mod) \ -({ \ - if (atomic_dec_and_test(&(mod)->mod_refcount)) { \ - if ((mod)->mod_open_req) \ - ptlrpc_req_finished((mod)->mod_open_req); \ - kfree(mod); \ - } \ +#define obd_mod_put(mod) \ +({ \ + if (atomic_dec_and_test(&(mod)->mod_refcount)) { \ + if ((mod)->mod_open_req) \ + ptlrpc_req_finished((mod)->mod_open_req); \ + kfree(mod); \ + } \ }) void obdo_from_inode(struct obdo *dst, struct inode *src, u32 valid); @@ -1050,8 +1051,8 @@ static inline const char *lu_dev_name(const struct lu_device *lu_dev) static inline bool filename_is_volatile(const char *name, size_t namelen, int *idx) { - const char *start; - char *end; + const char *start; + char *end; if (strncmp(name, LUSTRE_VOLATILE_HDR, LUSTRE_VOLATILE_HDR_LEN) != 0) return false; diff --git a/drivers/staging/lustre/lustre/include/obd_cksum.h b/drivers/staging/lustre/lustre/include/obd_cksum.h index e5f7bb2..26a9555 100644 --- a/drivers/staging/lustre/lustre/include/obd_cksum.h +++ b/drivers/staging/lustre/lustre/include/obd_cksum.h @@ -65,8 +65,8 @@ static inline unsigned char cksum_obd2cfs(enum cksum_type cksum_type) */ static inline u32 cksum_type_pack(enum cksum_type cksum_type) { - unsigned int performance = 0, tmp; - u32 flag = OBD_FL_CKSUM_ADLER; + unsigned int performance = 0, tmp; + u32 flag = OBD_FL_CKSUM_ADLER; if (cksum_type & OBD_CKSUM_CRC32) { tmp = cfs_crypto_hash_speed(cksum_obd2cfs(OBD_CKSUM_CRC32)); diff --git a/drivers/staging/lustre/lustre/include/obd_class.h b/drivers/staging/lustre/lustre/include/obd_class.h index b64ba8b..30b3e2c 100644 --- a/drivers/staging/lustre/lustre/include/obd_class.h +++ b/drivers/staging/lustre/lustre/include/obd_class.h @@ -144,22 +144,22 @@ int class_config_llog_handler(const struct lu_env *env, /* obdecho */ void lprocfs_echo_init_vars(struct lprocfs_static_vars *lvars); -#define CFG_F_START 0x01 /* Set when we start updating from a log */ -#define CFG_F_MARKER 0x02 /* We are within a maker */ -#define CFG_F_SKIP 0x04 /* We should ignore this cfg command */ -#define CFG_F_COMPAT146 0x08 /* Allow old-style logs */ -#define CFG_F_EXCLUDE 0x10 /* OST exclusion list */ +#define CFG_F_START 0x01 /* Set when we start updating from a log */ +#define CFG_F_MARKER 0x02 /* We are within a maker */ +#define CFG_F_SKIP 0x04 /* We should ignore this cfg command */ +#define CFG_F_COMPAT146 0x08 /* Allow old-style logs */ +#define CFG_F_EXCLUDE 0x10 /* OST exclusion list */ /* Passed as data param to class_config_parse_llog */ struct config_llog_instance { - char *cfg_obdname; - void *cfg_instance; - struct super_block *cfg_sb; - struct obd_uuid cfg_uuid; - llog_cb_t cfg_callback; - int cfg_last_idx; /* for partial llog processing */ - int cfg_flags; - u32 cfg_sub_clds; + char *cfg_obdname; + void *cfg_instance; + struct super_block *cfg_sb; + struct obd_uuid cfg_uuid; + llog_cb_t cfg_callback; + int cfg_last_idx; /* for partial llog processing */ + int cfg_flags; + u32 cfg_sub_clds; }; int class_config_parse_llog(const struct lu_env *env, struct llog_ctxt *ctxt, @@ -181,31 +181,31 @@ int class_config_parse_llog(const struct lu_env *env, struct llog_ctxt *ctxt, /* list of active configuration logs */ struct config_llog_data { - struct ldlm_res_id cld_resid; - struct config_llog_instance cld_cfg; - struct list_head cld_list_chain; - atomic_t cld_refcount; - struct config_llog_data *cld_sptlrpc;/* depended sptlrpc log */ - struct config_llog_data *cld_params; /* common parameters log */ - struct config_llog_data *cld_recover;/* imperative recover log */ - struct obd_export *cld_mgcexp; - struct mutex cld_lock; - int cld_type; - unsigned int cld_stopping:1, /* - * we were told to stop - * watching - */ - cld_lostlock:1; /* lock not requeued */ - char cld_logname[0]; + struct ldlm_res_id cld_resid; + struct config_llog_instance cld_cfg; + struct list_head cld_list_chain; + atomic_t cld_refcount; + struct config_llog_data *cld_sptlrpc; /* depended sptlrpc log */ + struct config_llog_data *cld_params; /* common parameters log */ + struct config_llog_data *cld_recover; /* imperative recover log */ + struct obd_export *cld_mgcexp; + struct mutex cld_lock; + int cld_type; + unsigned int cld_stopping:1, /* + * we were told to stop + * watching + */ + cld_lostlock:1; /* lock not requeued */ + char cld_logname[0]; }; struct lustre_profile { - struct list_head lp_list; - char *lp_profile; - char *lp_dt; - char *lp_md; - int lp_refs; - bool lp_list_deleted; + struct list_head lp_list; + char *lp_profile; + char *lp_dt; + char *lp_md; + int lp_refs; + bool lp_list_deleted; }; struct lustre_profile *class_get_profile(const char *prof); @@ -423,7 +423,7 @@ static inline int obd_setup(struct obd_device *obd, struct lustre_cfg *cfg) ldt = obd->obd_type->typ_lu; if (ldt) { - struct lu_context session_ctx; + struct lu_context session_ctx; struct lu_env env; lu_context_init(&session_ctx, LCT_SESSION | LCT_SERVER_SESSION); @@ -1642,11 +1642,11 @@ static inline int md_unpackmd(struct obd_export *exp, typedef int (*register_lwp_cb)(void *data); struct lwp_register_item { - struct obd_export **lri_exp; - register_lwp_cb lri_cb_func; - void *lri_cb_data; - struct list_head lri_list; - char lri_name[MTI_NAME_MAXLEN]; + struct obd_export **lri_exp; + register_lwp_cb lri_cb_func; + void *lri_cb_data; + struct list_head lri_list; + char lri_name[MTI_NAME_MAXLEN]; }; /* diff --git a/drivers/staging/lustre/lustre/include/obd_support.h b/drivers/staging/lustre/lustre/include/obd_support.h index 93a3745..3e15cac 100644 --- a/drivers/staging/lustre/lustre/include/obd_support.h +++ b/drivers/staging/lustre/lustre/include/obd_support.h @@ -59,151 +59,151 @@ /* Some hash init argument constants */ /* Timeout definitions */ -#define OBD_TIMEOUT_DEFAULT 100 +#define OBD_TIMEOUT_DEFAULT 100 /* Time to wait for all clients to reconnect during recovery (hard limit) */ -#define OBD_RECOVERY_TIME_HARD (obd_timeout * 9) +#define OBD_RECOVERY_TIME_HARD (obd_timeout * 9) /* Time to wait for all clients to reconnect during recovery (soft limit) */ /* Should be very conservative; must catch the first reconnect after reboot */ -#define OBD_RECOVERY_TIME_SOFT (obd_timeout * 3) +#define OBD_RECOVERY_TIME_SOFT (obd_timeout * 3) /* Change recovery-small 26b time if you change this */ -#define PING_INTERVAL max(obd_timeout / 4, 1U) +#define PING_INTERVAL max(obd_timeout / 4, 1U) /* a bit more than maximal journal commit time in seconds */ -#define PING_INTERVAL_SHORT min(PING_INTERVAL, 7U) +#define PING_INTERVAL_SHORT min(PING_INTERVAL, 7U) /* Client may skip 1 ping; we must wait at least 2.5. But for multiple * failover targets the client only pings one server at a time, and pings * can be lost on a loaded network. Since eviction has serious consequences, * and there's no urgent need to evict a client just because it's idle, we * should be very conservative here. */ -#define PING_EVICT_TIMEOUT (PING_INTERVAL * 6) -#define DISK_TIMEOUT 50 /* Beyond this we warn about disk speed */ -#define CONNECTION_SWITCH_MIN 5U /* Connection switching rate limiter */ +#define PING_EVICT_TIMEOUT (PING_INTERVAL * 6) +#define DISK_TIMEOUT 50 /* Beyond this we warn about disk speed */ +#define CONNECTION_SWITCH_MIN 5U /* Connection switching rate limiter */ /* Max connect interval for nonresponsive servers; ~50s to avoid building up * connect requests in the LND queues, but within obd_timeout so we don't * miss the recovery window */ -#define CONNECTION_SWITCH_MAX min(50U, max(CONNECTION_SWITCH_MIN, obd_timeout)) -#define CONNECTION_SWITCH_INC 5 /* Connection timeout backoff */ +#define CONNECTION_SWITCH_MAX min(50U, max(CONNECTION_SWITCH_MIN, obd_timeout)) +#define CONNECTION_SWITCH_INC 5 /* Connection timeout backoff */ /* In general this should be low to have quick detection of a system * running on a backup server. (If it's too low, import_select_connection * will increase the timeout anyhow.) */ -#define INITIAL_CONNECT_TIMEOUT max(CONNECTION_SWITCH_MIN, obd_timeout / 20) +#define INITIAL_CONNECT_TIMEOUT max(CONNECTION_SWITCH_MIN, obd_timeout / 20) /* The max delay between connects is SWITCH_MAX + SWITCH_INC + INITIAL */ -#define RECONNECT_DELAY_MAX (CONNECTION_SWITCH_MAX + CONNECTION_SWITCH_INC + \ - INITIAL_CONNECT_TIMEOUT) +#define RECONNECT_DELAY_MAX (CONNECTION_SWITCH_MAX + CONNECTION_SWITCH_INC + \ + INITIAL_CONNECT_TIMEOUT) /* The min time a target should wait for clients to reconnect in recovery */ -#define OBD_RECOVERY_TIME_MIN (2 * RECONNECT_DELAY_MAX) -#define OBD_IR_FACTOR_MIN 1 -#define OBD_IR_FACTOR_MAX 10 -#define OBD_IR_FACTOR_DEFAULT (OBD_IR_FACTOR_MAX / 2) +#define OBD_RECOVERY_TIME_MIN (2 * RECONNECT_DELAY_MAX) +#define OBD_IR_FACTOR_MIN 1 +#define OBD_IR_FACTOR_MAX 10 +#define OBD_IR_FACTOR_DEFAULT (OBD_IR_FACTOR_MAX / 2) /* default timeout for the MGS to become IR_FULL */ -#define OBD_IR_MGS_TIMEOUT (4 * obd_timeout) -#define LONG_UNLINK 300 /* Unlink should happen before now */ +#define OBD_IR_MGS_TIMEOUT (4 * obd_timeout) +#define LONG_UNLINK 300 /* Unlink should happen before now */ /** * Time interval of shrink, if the client is "idle" more than this interval, * then the ll_grant thread will return the requested grant space to filter */ -#define GRANT_SHRINK_INTERVAL 1200/*20 minutes*/ - -#define OBD_FAIL_MDS 0x100 -#define OBD_FAIL_MDS_HANDLE_UNPACK 0x101 -#define OBD_FAIL_MDS_GETATTR_NET 0x102 -#define OBD_FAIL_MDS_GETATTR_PACK 0x103 -#define OBD_FAIL_MDS_READPAGE_NET 0x104 -#define OBD_FAIL_MDS_READPAGE_PACK 0x105 -#define OBD_FAIL_MDS_SENDPAGE 0x106 -#define OBD_FAIL_MDS_REINT_NET 0x107 -#define OBD_FAIL_MDS_REINT_UNPACK 0x108 -#define OBD_FAIL_MDS_REINT_SETATTR 0x109 -#define OBD_FAIL_MDS_REINT_SETATTR_WRITE 0x10a -#define OBD_FAIL_MDS_REINT_CREATE 0x10b -#define OBD_FAIL_MDS_REINT_CREATE_WRITE 0x10c -#define OBD_FAIL_MDS_REINT_UNLINK 0x10d -#define OBD_FAIL_MDS_REINT_UNLINK_WRITE 0x10e -#define OBD_FAIL_MDS_REINT_LINK 0x10f -#define OBD_FAIL_MDS_REINT_LINK_WRITE 0x110 -#define OBD_FAIL_MDS_REINT_RENAME 0x111 -#define OBD_FAIL_MDS_REINT_RENAME_WRITE 0x112 -#define OBD_FAIL_MDS_OPEN_NET 0x113 -#define OBD_FAIL_MDS_OPEN_PACK 0x114 -#define OBD_FAIL_MDS_CLOSE_NET 0x115 -#define OBD_FAIL_MDS_CLOSE_PACK 0x116 -#define OBD_FAIL_MDS_CONNECT_NET 0x117 -#define OBD_FAIL_MDS_CONNECT_PACK 0x118 -#define OBD_FAIL_MDS_REINT_NET_REP 0x119 -#define OBD_FAIL_MDS_DISCONNECT_NET 0x11a -#define OBD_FAIL_MDS_GET_ROOT_NET 0x11b -#define OBD_FAIL_MDS_GET_ROOT_PACK 0x11c -#define OBD_FAIL_MDS_STATFS_PACK 0x11d -#define OBD_FAIL_MDS_STATFS_NET 0x11e -#define OBD_FAIL_MDS_GETATTR_NAME_NET 0x11f -#define OBD_FAIL_MDS_PIN_NET 0x120 -#define OBD_FAIL_MDS_UNPIN_NET 0x121 -#define OBD_FAIL_MDS_ALL_REPLY_NET 0x122 -#define OBD_FAIL_MDS_ALL_REQUEST_NET 0x123 -#define OBD_FAIL_MDS_SYNC_NET 0x124 -#define OBD_FAIL_MDS_SYNC_PACK 0x125 +#define GRANT_SHRINK_INTERVAL 1200/*20 minutes*/ + +#define OBD_FAIL_MDS 0x100 +#define OBD_FAIL_MDS_HANDLE_UNPACK 0x101 +#define OBD_FAIL_MDS_GETATTR_NET 0x102 +#define OBD_FAIL_MDS_GETATTR_PACK 0x103 +#define OBD_FAIL_MDS_READPAGE_NET 0x104 +#define OBD_FAIL_MDS_READPAGE_PACK 0x105 +#define OBD_FAIL_MDS_SENDPAGE 0x106 +#define OBD_FAIL_MDS_REINT_NET 0x107 +#define OBD_FAIL_MDS_REINT_UNPACK 0x108 +#define OBD_FAIL_MDS_REINT_SETATTR 0x109 +#define OBD_FAIL_MDS_REINT_SETATTR_WRITE 0x10a +#define OBD_FAIL_MDS_REINT_CREATE 0x10b +#define OBD_FAIL_MDS_REINT_CREATE_WRITE 0x10c +#define OBD_FAIL_MDS_REINT_UNLINK 0x10d +#define OBD_FAIL_MDS_REINT_UNLINK_WRITE 0x10e +#define OBD_FAIL_MDS_REINT_LINK 0x10f +#define OBD_FAIL_MDS_REINT_LINK_WRITE 0x110 +#define OBD_FAIL_MDS_REINT_RENAME 0x111 +#define OBD_FAIL_MDS_REINT_RENAME_WRITE 0x112 +#define OBD_FAIL_MDS_OPEN_NET 0x113 +#define OBD_FAIL_MDS_OPEN_PACK 0x114 +#define OBD_FAIL_MDS_CLOSE_NET 0x115 +#define OBD_FAIL_MDS_CLOSE_PACK 0x116 +#define OBD_FAIL_MDS_CONNECT_NET 0x117 +#define OBD_FAIL_MDS_CONNECT_PACK 0x118 +#define OBD_FAIL_MDS_REINT_NET_REP 0x119 +#define OBD_FAIL_MDS_DISCONNECT_NET 0x11a +#define OBD_FAIL_MDS_GET_ROOT_NET 0x11b +#define OBD_FAIL_MDS_GET_ROOT_PACK 0x11c +#define OBD_FAIL_MDS_STATFS_PACK 0x11d +#define OBD_FAIL_MDS_STATFS_NET 0x11e +#define OBD_FAIL_MDS_GETATTR_NAME_NET 0x11f +#define OBD_FAIL_MDS_PIN_NET 0x120 +#define OBD_FAIL_MDS_UNPIN_NET 0x121 +#define OBD_FAIL_MDS_ALL_REPLY_NET 0x122 +#define OBD_FAIL_MDS_ALL_REQUEST_NET 0x123 +#define OBD_FAIL_MDS_SYNC_NET 0x124 +#define OBD_FAIL_MDS_SYNC_PACK 0x125 /* OBD_FAIL_MDS_DONE_WRITING_NET 0x126 obsolete since 2.8.0 */ /* OBD_FAIL_MDS_DONE_WRITING_PACK 0x127 obsolete since 2.8.0 */ -#define OBD_FAIL_MDS_ALLOC_OBDO 0x128 -#define OBD_FAIL_MDS_PAUSE_OPEN 0x129 -#define OBD_FAIL_MDS_STATFS_LCW_SLEEP 0x12a -#define OBD_FAIL_MDS_OPEN_CREATE 0x12b -#define OBD_FAIL_MDS_OST_SETATTR 0x12c +#define OBD_FAIL_MDS_ALLOC_OBDO 0x128 +#define OBD_FAIL_MDS_PAUSE_OPEN 0x129 +#define OBD_FAIL_MDS_STATFS_LCW_SLEEP 0x12a +#define OBD_FAIL_MDS_OPEN_CREATE 0x12b +#define OBD_FAIL_MDS_OST_SETATTR 0x12c /* OBD_FAIL_MDS_QUOTACHECK_NET 0x12d obsolete since 2.4 */ -#define OBD_FAIL_MDS_QUOTACTL_NET 0x12e -#define OBD_FAIL_MDS_CLIENT_ADD 0x12f -#define OBD_FAIL_MDS_GETXATTR_NET 0x130 -#define OBD_FAIL_MDS_GETXATTR_PACK 0x131 -#define OBD_FAIL_MDS_SETXATTR_NET 0x132 -#define OBD_FAIL_MDS_SETXATTR 0x133 -#define OBD_FAIL_MDS_SETXATTR_WRITE 0x134 -#define OBD_FAIL_MDS_FS_SETUP 0x135 -#define OBD_FAIL_MDS_RESEND 0x136 -#define OBD_FAIL_MDS_LLOG_CREATE_FAILED 0x137 -#define OBD_FAIL_MDS_LOV_SYNC_RACE 0x138 -#define OBD_FAIL_MDS_OSC_PRECREATE 0x139 -#define OBD_FAIL_MDS_LLOG_SYNC_TIMEOUT 0x13a -#define OBD_FAIL_MDS_CLOSE_NET_REP 0x13b -#define OBD_FAIL_MDS_BLOCK_QUOTA_REQ 0x13c -#define OBD_FAIL_MDS_DROP_QUOTA_REQ 0x13d -#define OBD_FAIL_MDS_REMOVE_COMMON_EA 0x13e -#define OBD_FAIL_MDS_ALLOW_COMMON_EA_SETTING 0x13f -#define OBD_FAIL_MDS_FAIL_LOV_LOG_ADD 0x140 -#define OBD_FAIL_MDS_LOV_PREP_CREATE 0x141 -#define OBD_FAIL_MDS_REINT_DELAY 0x142 -#define OBD_FAIL_MDS_READLINK_EPROTO 0x143 -#define OBD_FAIL_MDS_OPEN_WAIT_CREATE 0x144 -#define OBD_FAIL_MDS_PDO_LOCK 0x145 -#define OBD_FAIL_MDS_PDO_LOCK2 0x146 -#define OBD_FAIL_MDS_OSC_CREATE_FAIL 0x147 -#define OBD_FAIL_MDS_NEGATIVE_POSITIVE 0x148 -#define OBD_FAIL_MDS_HSM_STATE_GET_NET 0x149 -#define OBD_FAIL_MDS_HSM_STATE_SET_NET 0x14a -#define OBD_FAIL_MDS_HSM_PROGRESS_NET 0x14b -#define OBD_FAIL_MDS_HSM_REQUEST_NET 0x14c -#define OBD_FAIL_MDS_HSM_CT_REGISTER_NET 0x14d -#define OBD_FAIL_MDS_HSM_CT_UNREGISTER_NET 0x14e -#define OBD_FAIL_MDS_SWAP_LAYOUTS_NET 0x14f -#define OBD_FAIL_MDS_HSM_ACTION_NET 0x150 -#define OBD_FAIL_MDS_CHANGELOG_INIT 0x151 +#define OBD_FAIL_MDS_QUOTACTL_NET 0x12e +#define OBD_FAIL_MDS_CLIENT_ADD 0x12f +#define OBD_FAIL_MDS_GETXATTR_NET 0x130 +#define OBD_FAIL_MDS_GETXATTR_PACK 0x131 +#define OBD_FAIL_MDS_SETXATTR_NET 0x132 +#define OBD_FAIL_MDS_SETXATTR 0x133 +#define OBD_FAIL_MDS_SETXATTR_WRITE 0x134 +#define OBD_FAIL_MDS_FS_SETUP 0x135 +#define OBD_FAIL_MDS_RESEND 0x136 +#define OBD_FAIL_MDS_LLOG_CREATE_FAILED 0x137 +#define OBD_FAIL_MDS_LOV_SYNC_RACE 0x138 +#define OBD_FAIL_MDS_OSC_PRECREATE 0x139 +#define OBD_FAIL_MDS_LLOG_SYNC_TIMEOUT 0x13a +#define OBD_FAIL_MDS_CLOSE_NET_REP 0x13b +#define OBD_FAIL_MDS_BLOCK_QUOTA_REQ 0x13c +#define OBD_FAIL_MDS_DROP_QUOTA_REQ 0x13d +#define OBD_FAIL_MDS_REMOVE_COMMON_EA 0x13e +#define OBD_FAIL_MDS_ALLOW_COMMON_EA_SETTING 0x13f +#define OBD_FAIL_MDS_FAIL_LOV_LOG_ADD 0x140 +#define OBD_FAIL_MDS_LOV_PREP_CREATE 0x141 +#define OBD_FAIL_MDS_REINT_DELAY 0x142 +#define OBD_FAIL_MDS_READLINK_EPROTO 0x143 +#define OBD_FAIL_MDS_OPEN_WAIT_CREATE 0x144 +#define OBD_FAIL_MDS_PDO_LOCK 0x145 +#define OBD_FAIL_MDS_PDO_LOCK2 0x146 +#define OBD_FAIL_MDS_OSC_CREATE_FAIL 0x147 +#define OBD_FAIL_MDS_NEGATIVE_POSITIVE 0x148 +#define OBD_FAIL_MDS_HSM_STATE_GET_NET 0x149 +#define OBD_FAIL_MDS_HSM_STATE_SET_NET 0x14a +#define OBD_FAIL_MDS_HSM_PROGRESS_NET 0x14b +#define OBD_FAIL_MDS_HSM_REQUEST_NET 0x14c +#define OBD_FAIL_MDS_HSM_CT_REGISTER_NET 0x14d +#define OBD_FAIL_MDS_HSM_CT_UNREGISTER_NET 0x14e +#define OBD_FAIL_MDS_SWAP_LAYOUTS_NET 0x14f +#define OBD_FAIL_MDS_HSM_ACTION_NET 0x150 +#define OBD_FAIL_MDS_CHANGELOG_INIT 0x151 /* layout lock */ -#define OBD_FAIL_MDS_NO_LL_GETATTR 0x170 -#define OBD_FAIL_MDS_NO_LL_OPEN 0x171 -#define OBD_FAIL_MDS_LL_BLOCK 0x172 +#define OBD_FAIL_MDS_NO_LL_GETATTR 0x170 +#define OBD_FAIL_MDS_NO_LL_OPEN 0x171 +#define OBD_FAIL_MDS_LL_BLOCK 0x172 /* CMD */ -#define OBD_FAIL_MDS_IS_SUBDIR_NET 0x180 -#define OBD_FAIL_MDS_IS_SUBDIR_PACK 0x181 -#define OBD_FAIL_MDS_SET_INFO_NET 0x182 -#define OBD_FAIL_MDS_WRITEPAGE_NET 0x183 -#define OBD_FAIL_MDS_WRITEPAGE_PACK 0x184 -#define OBD_FAIL_MDS_RECOVERY_ACCEPTS_GAPS 0x185 -#define OBD_FAIL_MDS_GET_INFO_NET 0x186 -#define OBD_FAIL_MDS_DQACQ_NET 0x187 +#define OBD_FAIL_MDS_IS_SUBDIR_NET 0x180 +#define OBD_FAIL_MDS_IS_SUBDIR_PACK 0x181 +#define OBD_FAIL_MDS_SET_INFO_NET 0x182 +#define OBD_FAIL_MDS_WRITEPAGE_NET 0x183 +#define OBD_FAIL_MDS_WRITEPAGE_PACK 0x184 +#define OBD_FAIL_MDS_RECOVERY_ACCEPTS_GAPS 0x185 +#define OBD_FAIL_MDS_GET_INFO_NET 0x186 +#define OBD_FAIL_MDS_DQACQ_NET 0x187 /* OI scrub */ #define OBD_FAIL_OSD_SCRUB_DELAY 0x190 @@ -213,278 +213,278 @@ #define OBD_FAIL_OSD_LMA_INCOMPAT 0x194 #define OBD_FAIL_OSD_COMPAT_INVALID_ENTRY 0x195 -#define OBD_FAIL_OST 0x200 -#define OBD_FAIL_OST_CONNECT_NET 0x201 -#define OBD_FAIL_OST_DISCONNECT_NET 0x202 -#define OBD_FAIL_OST_GET_INFO_NET 0x203 -#define OBD_FAIL_OST_CREATE_NET 0x204 -#define OBD_FAIL_OST_DESTROY_NET 0x205 -#define OBD_FAIL_OST_GETATTR_NET 0x206 -#define OBD_FAIL_OST_SETATTR_NET 0x207 -#define OBD_FAIL_OST_OPEN_NET 0x208 -#define OBD_FAIL_OST_CLOSE_NET 0x209 -#define OBD_FAIL_OST_BRW_NET 0x20a -#define OBD_FAIL_OST_PUNCH_NET 0x20b -#define OBD_FAIL_OST_STATFS_NET 0x20c -#define OBD_FAIL_OST_HANDLE_UNPACK 0x20d -#define OBD_FAIL_OST_BRW_WRITE_BULK 0x20e -#define OBD_FAIL_OST_BRW_READ_BULK 0x20f -#define OBD_FAIL_OST_SYNC_NET 0x210 -#define OBD_FAIL_OST_ALL_REPLY_NET 0x211 -#define OBD_FAIL_OST_ALL_REQUEST_NET 0x212 -#define OBD_FAIL_OST_LDLM_REPLY_NET 0x213 -#define OBD_FAIL_OST_BRW_PAUSE_BULK 0x214 -#define OBD_FAIL_OST_ENOSPC 0x215 -#define OBD_FAIL_OST_EROFS 0x216 -#define OBD_FAIL_OST_ENOENT 0x217 +#define OBD_FAIL_OST 0x200 +#define OBD_FAIL_OST_CONNECT_NET 0x201 +#define OBD_FAIL_OST_DISCONNECT_NET 0x202 +#define OBD_FAIL_OST_GET_INFO_NET 0x203 +#define OBD_FAIL_OST_CREATE_NET 0x204 +#define OBD_FAIL_OST_DESTROY_NET 0x205 +#define OBD_FAIL_OST_GETATTR_NET 0x206 +#define OBD_FAIL_OST_SETATTR_NET 0x207 +#define OBD_FAIL_OST_OPEN_NET 0x208 +#define OBD_FAIL_OST_CLOSE_NET 0x209 +#define OBD_FAIL_OST_BRW_NET 0x20a +#define OBD_FAIL_OST_PUNCH_NET 0x20b +#define OBD_FAIL_OST_STATFS_NET 0x20c +#define OBD_FAIL_OST_HANDLE_UNPACK 0x20d +#define OBD_FAIL_OST_BRW_WRITE_BULK 0x20e +#define OBD_FAIL_OST_BRW_READ_BULK 0x20f +#define OBD_FAIL_OST_SYNC_NET 0x210 +#define OBD_FAIL_OST_ALL_REPLY_NET 0x211 +#define OBD_FAIL_OST_ALL_REQUEST_NET 0x212 +#define OBD_FAIL_OST_LDLM_REPLY_NET 0x213 +#define OBD_FAIL_OST_BRW_PAUSE_BULK 0x214 +#define OBD_FAIL_OST_ENOSPC 0x215 +#define OBD_FAIL_OST_EROFS 0x216 +#define OBD_FAIL_OST_ENOENT 0x217 /* OBD_FAIL_OST_QUOTACHECK_NET 0x218 obsolete since 2.4 */ -#define OBD_FAIL_OST_QUOTACTL_NET 0x219 -#define OBD_FAIL_OST_CHECKSUM_RECEIVE 0x21a -#define OBD_FAIL_OST_CHECKSUM_SEND 0x21b -#define OBD_FAIL_OST_BRW_SIZE 0x21c -#define OBD_FAIL_OST_DROP_REQ 0x21d -#define OBD_FAIL_OST_SETATTR_CREDITS 0x21e -#define OBD_FAIL_OST_HOLD_WRITE_RPC 0x21f -#define OBD_FAIL_OST_BRW_WRITE_BULK2 0x220 -#define OBD_FAIL_OST_LLOG_RECOVERY_TIMEOUT 0x221 -#define OBD_FAIL_OST_CANCEL_COOKIE_TIMEOUT 0x222 -#define OBD_FAIL_OST_PAUSE_CREATE 0x223 -#define OBD_FAIL_OST_BRW_PAUSE_PACK 0x224 -#define OBD_FAIL_OST_CONNECT_NET2 0x225 -#define OBD_FAIL_OST_NOMEM 0x226 -#define OBD_FAIL_OST_BRW_PAUSE_BULK2 0x227 -#define OBD_FAIL_OST_MAPBLK_ENOSPC 0x228 -#define OBD_FAIL_OST_ENOINO 0x229 -#define OBD_FAIL_OST_DQACQ_NET 0x230 -#define OBD_FAIL_OST_STATFS_EINPROGRESS 0x231 -#define OBD_FAIL_OST_SET_INFO_NET 0x232 - -#define OBD_FAIL_LDLM 0x300 -#define OBD_FAIL_LDLM_NAMESPACE_NEW 0x301 +#define OBD_FAIL_OST_QUOTACTL_NET 0x219 +#define OBD_FAIL_OST_CHECKSUM_RECEIVE 0x21a +#define OBD_FAIL_OST_CHECKSUM_SEND 0x21b +#define OBD_FAIL_OST_BRW_SIZE 0x21c +#define OBD_FAIL_OST_DROP_REQ 0x21d +#define OBD_FAIL_OST_SETATTR_CREDITS 0x21e +#define OBD_FAIL_OST_HOLD_WRITE_RPC 0x21f +#define OBD_FAIL_OST_BRW_WRITE_BULK2 0x220 +#define OBD_FAIL_OST_LLOG_RECOVERY_TIMEOUT 0x221 +#define OBD_FAIL_OST_CANCEL_COOKIE_TIMEOUT 0x222 +#define OBD_FAIL_OST_PAUSE_CREATE 0x223 +#define OBD_FAIL_OST_BRW_PAUSE_PACK 0x224 +#define OBD_FAIL_OST_CONNECT_NET2 0x225 +#define OBD_FAIL_OST_NOMEM 0x226 +#define OBD_FAIL_OST_BRW_PAUSE_BULK2 0x227 +#define OBD_FAIL_OST_MAPBLK_ENOSPC 0x228 +#define OBD_FAIL_OST_ENOINO 0x229 +#define OBD_FAIL_OST_DQACQ_NET 0x230 +#define OBD_FAIL_OST_STATFS_EINPROGRESS 0x231 +#define OBD_FAIL_OST_SET_INFO_NET 0x232 + +#define OBD_FAIL_LDLM 0x300 +#define OBD_FAIL_LDLM_NAMESPACE_NEW 0x301 #define OBD_FAIL_LDLM_ENQUEUE_NET 0x302 #define OBD_FAIL_LDLM_CONVERT_NET 0x303 #define OBD_FAIL_LDLM_CANCEL_NET 0x304 #define OBD_FAIL_LDLM_BL_CALLBACK_NET 0x305 #define OBD_FAIL_LDLM_CP_CALLBACK_NET 0x306 #define OBD_FAIL_LDLM_GL_CALLBACK_NET 0x307 -#define OBD_FAIL_LDLM_ENQUEUE_EXTENT_ERR 0x308 -#define OBD_FAIL_LDLM_ENQUEUE_INTENT_ERR 0x309 -#define OBD_FAIL_LDLM_CREATE_RESOURCE 0x30a -#define OBD_FAIL_LDLM_ENQUEUE_BLOCKED 0x30b -#define OBD_FAIL_LDLM_REPLY 0x30c -#define OBD_FAIL_LDLM_RECOV_CLIENTS 0x30d -#define OBD_FAIL_LDLM_ENQUEUE_OLD_EXPORT 0x30e -#define OBD_FAIL_LDLM_GLIMPSE 0x30f -#define OBD_FAIL_LDLM_CANCEL_RACE 0x310 -#define OBD_FAIL_LDLM_CANCEL_EVICT_RACE 0x311 -#define OBD_FAIL_LDLM_PAUSE_CANCEL 0x312 -#define OBD_FAIL_LDLM_CLOSE_THREAD 0x313 -#define OBD_FAIL_LDLM_CANCEL_BL_CB_RACE 0x314 -#define OBD_FAIL_LDLM_CP_CB_WAIT 0x315 -#define OBD_FAIL_LDLM_OST_FAIL_RACE 0x316 -#define OBD_FAIL_LDLM_INTR_CP_AST 0x317 -#define OBD_FAIL_LDLM_CP_BL_RACE 0x318 -#define OBD_FAIL_LDLM_NEW_LOCK 0x319 -#define OBD_FAIL_LDLM_AGL_DELAY 0x31a -#define OBD_FAIL_LDLM_AGL_NOLOCK 0x31b -#define OBD_FAIL_LDLM_OST_LVB 0x31c -#define OBD_FAIL_LDLM_ENQUEUE_HANG 0x31d -#define OBD_FAIL_LDLM_PAUSE_CANCEL2 0x31f -#define OBD_FAIL_LDLM_CP_CB_WAIT2 0x320 -#define OBD_FAIL_LDLM_CP_CB_WAIT3 0x321 -#define OBD_FAIL_LDLM_CP_CB_WAIT4 0x322 -#define OBD_FAIL_LDLM_CP_CB_WAIT5 0x323 - -#define OBD_FAIL_LDLM_GRANT_CHECK 0x32a +#define OBD_FAIL_LDLM_ENQUEUE_EXTENT_ERR 0x308 +#define OBD_FAIL_LDLM_ENQUEUE_INTENT_ERR 0x309 +#define OBD_FAIL_LDLM_CREATE_RESOURCE 0x30a +#define OBD_FAIL_LDLM_ENQUEUE_BLOCKED 0x30b +#define OBD_FAIL_LDLM_REPLY 0x30c +#define OBD_FAIL_LDLM_RECOV_CLIENTS 0x30d +#define OBD_FAIL_LDLM_ENQUEUE_OLD_EXPORT 0x30e +#define OBD_FAIL_LDLM_GLIMPSE 0x30f +#define OBD_FAIL_LDLM_CANCEL_RACE 0x310 +#define OBD_FAIL_LDLM_CANCEL_EVICT_RACE 0x311 +#define OBD_FAIL_LDLM_PAUSE_CANCEL 0x312 +#define OBD_FAIL_LDLM_CLOSE_THREAD 0x313 +#define OBD_FAIL_LDLM_CANCEL_BL_CB_RACE 0x314 +#define OBD_FAIL_LDLM_CP_CB_WAIT 0x315 +#define OBD_FAIL_LDLM_OST_FAIL_RACE 0x316 +#define OBD_FAIL_LDLM_INTR_CP_AST 0x317 +#define OBD_FAIL_LDLM_CP_BL_RACE 0x318 +#define OBD_FAIL_LDLM_NEW_LOCK 0x319 +#define OBD_FAIL_LDLM_AGL_DELAY 0x31a +#define OBD_FAIL_LDLM_AGL_NOLOCK 0x31b +#define OBD_FAIL_LDLM_OST_LVB 0x31c +#define OBD_FAIL_LDLM_ENQUEUE_HANG 0x31d +#define OBD_FAIL_LDLM_PAUSE_CANCEL2 0x31f +#define OBD_FAIL_LDLM_CP_CB_WAIT2 0x320 +#define OBD_FAIL_LDLM_CP_CB_WAIT3 0x321 +#define OBD_FAIL_LDLM_CP_CB_WAIT4 0x322 +#define OBD_FAIL_LDLM_CP_CB_WAIT5 0x323 + +#define OBD_FAIL_LDLM_GRANT_CHECK 0x32a /* LOCKLESS IO */ -#define OBD_FAIL_LDLM_SET_CONTENTION 0x385 - -#define OBD_FAIL_OSC 0x400 -#define OBD_FAIL_OSC_BRW_READ_BULK 0x401 -#define OBD_FAIL_OSC_BRW_WRITE_BULK 0x402 -#define OBD_FAIL_OSC_LOCK_BL_AST 0x403 -#define OBD_FAIL_OSC_LOCK_CP_AST 0x404 -#define OBD_FAIL_OSC_MATCH 0x405 -#define OBD_FAIL_OSC_BRW_PREP_REQ 0x406 -#define OBD_FAIL_OSC_SHUTDOWN 0x407 -#define OBD_FAIL_OSC_CHECKSUM_RECEIVE 0x408 -#define OBD_FAIL_OSC_CHECKSUM_SEND 0x409 -#define OBD_FAIL_OSC_BRW_PREP_REQ2 0x40a +#define OBD_FAIL_LDLM_SET_CONTENTION 0x385 + +#define OBD_FAIL_OSC 0x400 +#define OBD_FAIL_OSC_BRW_READ_BULK 0x401 +#define OBD_FAIL_OSC_BRW_WRITE_BULK 0x402 +#define OBD_FAIL_OSC_LOCK_BL_AST 0x403 +#define OBD_FAIL_OSC_LOCK_CP_AST 0x404 +#define OBD_FAIL_OSC_MATCH 0x405 +#define OBD_FAIL_OSC_BRW_PREP_REQ 0x406 +#define OBD_FAIL_OSC_SHUTDOWN 0x407 +#define OBD_FAIL_OSC_CHECKSUM_RECEIVE 0x408 +#define OBD_FAIL_OSC_CHECKSUM_SEND 0x409 +#define OBD_FAIL_OSC_BRW_PREP_REQ2 0x40a /* #define OBD_FAIL_OSC_CONNECT_CKSUM 0x40b Obsolete since 2.9 */ -#define OBD_FAIL_OSC_CKSUM_ADLER_ONLY 0x40c -#define OBD_FAIL_OSC_DIO_PAUSE 0x40d -#define OBD_FAIL_OSC_OBJECT_CONTENTION 0x40e -#define OBD_FAIL_OSC_CP_CANCEL_RACE 0x40f -#define OBD_FAIL_OSC_CP_ENQ_RACE 0x410 -#define OBD_FAIL_OSC_NO_GRANT 0x411 -#define OBD_FAIL_OSC_DELAY_SETTIME 0x412 -#define OBD_FAIL_OSC_CONNECT_GRANT_PARAM 0x413 -#define OBD_FAIL_OSC_DELAY_IO 0x414 - -#define OBD_FAIL_PTLRPC 0x500 -#define OBD_FAIL_PTLRPC_ACK 0x501 -#define OBD_FAIL_PTLRPC_RQBD 0x502 -#define OBD_FAIL_PTLRPC_BULK_GET_NET 0x503 -#define OBD_FAIL_PTLRPC_BULK_PUT_NET 0x504 -#define OBD_FAIL_PTLRPC_DROP_RPC 0x505 -#define OBD_FAIL_PTLRPC_DELAY_SEND 0x506 -#define OBD_FAIL_PTLRPC_DELAY_RECOV 0x507 -#define OBD_FAIL_PTLRPC_CLIENT_BULK_CB 0x508 -#define OBD_FAIL_PTLRPC_PAUSE_REQ 0x50a -#define OBD_FAIL_PTLRPC_PAUSE_REP 0x50c -#define OBD_FAIL_PTLRPC_IMP_DEACTIVE 0x50d -#define OBD_FAIL_PTLRPC_DUMP_LOG 0x50e -#define OBD_FAIL_PTLRPC_LONG_REPL_UNLINK 0x50f -#define OBD_FAIL_PTLRPC_LONG_BULK_UNLINK 0x510 -#define OBD_FAIL_PTLRPC_HPREQ_TIMEOUT 0x511 -#define OBD_FAIL_PTLRPC_HPREQ_NOTIMEOUT 0x512 -#define OBD_FAIL_PTLRPC_DROP_REQ_OPC 0x513 -#define OBD_FAIL_PTLRPC_FINISH_REPLAY 0x514 -#define OBD_FAIL_PTLRPC_CLIENT_BULK_CB2 0x515 -#define OBD_FAIL_PTLRPC_DELAY_IMP_FULL 0x516 -#define OBD_FAIL_PTLRPC_CANCEL_RESEND 0x517 -#define OBD_FAIL_PTLRPC_DROP_BULK 0x51a -#define OBD_FAIL_PTLRPC_LONG_REQ_UNLINK 0x51b -#define OBD_FAIL_PTLRPC_LONG_BOTH_UNLINK 0x51c - -#define OBD_FAIL_OBD_PING_NET 0x600 -#define OBD_FAIL_OBD_LOG_CANCEL_NET 0x601 -#define OBD_FAIL_OBD_LOGD_NET 0x602 +#define OBD_FAIL_OSC_CKSUM_ADLER_ONLY 0x40c +#define OBD_FAIL_OSC_DIO_PAUSE 0x40d +#define OBD_FAIL_OSC_OBJECT_CONTENTION 0x40e +#define OBD_FAIL_OSC_CP_CANCEL_RACE 0x40f +#define OBD_FAIL_OSC_CP_ENQ_RACE 0x410 +#define OBD_FAIL_OSC_NO_GRANT 0x411 +#define OBD_FAIL_OSC_DELAY_SETTIME 0x412 +#define OBD_FAIL_OSC_CONNECT_GRANT_PARAM 0x413 +#define OBD_FAIL_OSC_DELAY_IO 0x414 + +#define OBD_FAIL_PTLRPC 0x500 +#define OBD_FAIL_PTLRPC_ACK 0x501 +#define OBD_FAIL_PTLRPC_RQBD 0x502 +#define OBD_FAIL_PTLRPC_BULK_GET_NET 0x503 +#define OBD_FAIL_PTLRPC_BULK_PUT_NET 0x504 +#define OBD_FAIL_PTLRPC_DROP_RPC 0x505 +#define OBD_FAIL_PTLRPC_DELAY_SEND 0x506 +#define OBD_FAIL_PTLRPC_DELAY_RECOV 0x507 +#define OBD_FAIL_PTLRPC_CLIENT_BULK_CB 0x508 +#define OBD_FAIL_PTLRPC_PAUSE_REQ 0x50a +#define OBD_FAIL_PTLRPC_PAUSE_REP 0x50c +#define OBD_FAIL_PTLRPC_IMP_DEACTIVE 0x50d +#define OBD_FAIL_PTLRPC_DUMP_LOG 0x50e +#define OBD_FAIL_PTLRPC_LONG_REPL_UNLINK 0x50f +#define OBD_FAIL_PTLRPC_LONG_BULK_UNLINK 0x510 +#define OBD_FAIL_PTLRPC_HPREQ_TIMEOUT 0x511 +#define OBD_FAIL_PTLRPC_HPREQ_NOTIMEOUT 0x512 +#define OBD_FAIL_PTLRPC_DROP_REQ_OPC 0x513 +#define OBD_FAIL_PTLRPC_FINISH_REPLAY 0x514 +#define OBD_FAIL_PTLRPC_CLIENT_BULK_CB2 0x515 +#define OBD_FAIL_PTLRPC_DELAY_IMP_FULL 0x516 +#define OBD_FAIL_PTLRPC_CANCEL_RESEND 0x517 +#define OBD_FAIL_PTLRPC_DROP_BULK 0x51a +#define OBD_FAIL_PTLRPC_LONG_REQ_UNLINK 0x51b +#define OBD_FAIL_PTLRPC_LONG_BOTH_UNLINK 0x51c + +#define OBD_FAIL_OBD_PING_NET 0x600 +#define OBD_FAIL_OBD_LOG_CANCEL_NET 0x601 +#define OBD_FAIL_OBD_LOGD_NET 0x602 /* OBD_FAIL_OBD_QC_CALLBACK_NET 0x603 obsolete since 2.4 */ -#define OBD_FAIL_OBD_DQACQ 0x604 -#define OBD_FAIL_OBD_LLOG_SETUP 0x605 -#define OBD_FAIL_OBD_LOG_CANCEL_REP 0x606 -#define OBD_FAIL_OBD_IDX_READ_NET 0x607 -#define OBD_FAIL_OBD_IDX_READ_BREAK 0x608 -#define OBD_FAIL_OBD_NO_LRU 0x609 -#define OBD_FAIL_OBDCLASS_MODULE_LOAD 0x60a - -#define OBD_FAIL_TGT_REPLY_NET 0x700 -#define OBD_FAIL_TGT_CONN_RACE 0x701 -#define OBD_FAIL_TGT_FORCE_RECONNECT 0x702 -#define OBD_FAIL_TGT_DELAY_CONNECT 0x703 -#define OBD_FAIL_TGT_DELAY_RECONNECT 0x704 -#define OBD_FAIL_TGT_DELAY_PRECREATE 0x705 -#define OBD_FAIL_TGT_TOOMANY_THREADS 0x706 -#define OBD_FAIL_TGT_REPLAY_DROP 0x707 -#define OBD_FAIL_TGT_FAKE_EXP 0x708 -#define OBD_FAIL_TGT_REPLAY_DELAY 0x709 -#define OBD_FAIL_TGT_LAST_REPLAY 0x710 -#define OBD_FAIL_TGT_CLIENT_ADD 0x711 -#define OBD_FAIL_TGT_RCVG_FLAG 0x712 -#define OBD_FAIL_TGT_DELAY_CONDITIONAL 0x713 - -#define OBD_FAIL_MDC_REVALIDATE_PAUSE 0x800 -#define OBD_FAIL_MDC_ENQUEUE_PAUSE 0x801 -#define OBD_FAIL_MDC_OLD_EXT_FLAGS 0x802 -#define OBD_FAIL_MDC_GETATTR_ENQUEUE 0x803 -#define OBD_FAIL_MDC_RPCS_SEM 0x804 -#define OBD_FAIL_MDC_LIGHTWEIGHT 0x805 -#define OBD_FAIL_MDC_CLOSE 0x806 - -#define OBD_FAIL_MGS 0x900 -#define OBD_FAIL_MGS_ALL_REQUEST_NET 0x901 -#define OBD_FAIL_MGS_ALL_REPLY_NET 0x902 -#define OBD_FAIL_MGC_PAUSE_PROCESS_LOG 0x903 -#define OBD_FAIL_MGS_PAUSE_REQ 0x904 -#define OBD_FAIL_MGS_PAUSE_TARGET_REG 0x905 -#define OBD_FAIL_MGS_CONNECT_NET 0x906 -#define OBD_FAIL_MGS_DISCONNECT_NET 0x907 -#define OBD_FAIL_MGS_SET_INFO_NET 0x908 -#define OBD_FAIL_MGS_EXCEPTION_NET 0x909 -#define OBD_FAIL_MGS_TARGET_REG_NET 0x90a -#define OBD_FAIL_MGS_TARGET_DEL_NET 0x90b -#define OBD_FAIL_MGS_CONFIG_READ_NET 0x90c +#define OBD_FAIL_OBD_DQACQ 0x604 +#define OBD_FAIL_OBD_LLOG_SETUP 0x605 +#define OBD_FAIL_OBD_LOG_CANCEL_REP 0x606 +#define OBD_FAIL_OBD_IDX_READ_NET 0x607 +#define OBD_FAIL_OBD_IDX_READ_BREAK 0x608 +#define OBD_FAIL_OBD_NO_LRU 0x609 +#define OBD_FAIL_OBDCLASS_MODULE_LOAD 0x60a + +#define OBD_FAIL_TGT_REPLY_NET 0x700 +#define OBD_FAIL_TGT_CONN_RACE 0x701 +#define OBD_FAIL_TGT_FORCE_RECONNECT 0x702 +#define OBD_FAIL_TGT_DELAY_CONNECT 0x703 +#define OBD_FAIL_TGT_DELAY_RECONNECT 0x704 +#define OBD_FAIL_TGT_DELAY_PRECREATE 0x705 +#define OBD_FAIL_TGT_TOOMANY_THREADS 0x706 +#define OBD_FAIL_TGT_REPLAY_DROP 0x707 +#define OBD_FAIL_TGT_FAKE_EXP 0x708 +#define OBD_FAIL_TGT_REPLAY_DELAY 0x709 +#define OBD_FAIL_TGT_LAST_REPLAY 0x710 +#define OBD_FAIL_TGT_CLIENT_ADD 0x711 +#define OBD_FAIL_TGT_RCVG_FLAG 0x712 +#define OBD_FAIL_TGT_DELAY_CONDITIONAL 0x713 + +#define OBD_FAIL_MDC_REVALIDATE_PAUSE 0x800 +#define OBD_FAIL_MDC_ENQUEUE_PAUSE 0x801 +#define OBD_FAIL_MDC_OLD_EXT_FLAGS 0x802 +#define OBD_FAIL_MDC_GETATTR_ENQUEUE 0x803 +#define OBD_FAIL_MDC_RPCS_SEM 0x804 +#define OBD_FAIL_MDC_LIGHTWEIGHT 0x805 +#define OBD_FAIL_MDC_CLOSE 0x806 + +#define OBD_FAIL_MGS 0x900 +#define OBD_FAIL_MGS_ALL_REQUEST_NET 0x901 +#define OBD_FAIL_MGS_ALL_REPLY_NET 0x902 +#define OBD_FAIL_MGC_PAUSE_PROCESS_LOG 0x903 +#define OBD_FAIL_MGS_PAUSE_REQ 0x904 +#define OBD_FAIL_MGS_PAUSE_TARGET_REG 0x905 +#define OBD_FAIL_MGS_CONNECT_NET 0x906 +#define OBD_FAIL_MGS_DISCONNECT_NET 0x907 +#define OBD_FAIL_MGS_SET_INFO_NET 0x908 +#define OBD_FAIL_MGS_EXCEPTION_NET 0x909 +#define OBD_FAIL_MGS_TARGET_REG_NET 0x90a +#define OBD_FAIL_MGS_TARGET_DEL_NET 0x90b +#define OBD_FAIL_MGS_CONFIG_READ_NET 0x90c #define OBD_FAIL_QUOTA_DQACQ_NET 0xA01 -#define OBD_FAIL_QUOTA_EDQUOT 0xA02 -#define OBD_FAIL_QUOTA_DELAY_REINT 0xA03 -#define OBD_FAIL_QUOTA_RECOVERABLE_ERR 0xA04 - -#define OBD_FAIL_LPROC_REMOVE 0xB00 - -#define OBD_FAIL_SEQ 0x1000 -#define OBD_FAIL_SEQ_QUERY_NET 0x1001 -#define OBD_FAIL_SEQ_EXHAUST 0x1002 - -#define OBD_FAIL_FLD 0x1100 -#define OBD_FAIL_FLD_QUERY_NET 0x1101 -#define OBD_FAIL_FLD_READ_NET 0x1102 - -#define OBD_FAIL_SEC_CTX 0x1200 -#define OBD_FAIL_SEC_CTX_INIT_NET 0x1201 -#define OBD_FAIL_SEC_CTX_INIT_CONT_NET 0x1202 -#define OBD_FAIL_SEC_CTX_FINI_NET 0x1203 -#define OBD_FAIL_SEC_CTX_HDL_PAUSE 0x1204 - -#define OBD_FAIL_LLOG 0x1300 -#define OBD_FAIL_LLOG_ORIGIN_CONNECT_NET 0x1301 -#define OBD_FAIL_LLOG_ORIGIN_HANDLE_CREATE_NET 0x1302 -#define OBD_FAIL_LLOG_ORIGIN_HANDLE_DESTROY_NET 0x1303 -#define OBD_FAIL_LLOG_ORIGIN_HANDLE_READ_HEADER_NET 0x1304 -#define OBD_FAIL_LLOG_ORIGIN_HANDLE_NEXT_BLOCK_NET 0x1305 -#define OBD_FAIL_LLOG_ORIGIN_HANDLE_PREV_BLOCK_NET 0x1306 -#define OBD_FAIL_LLOG_ORIGIN_HANDLE_WRITE_REC_NET 0x1307 -#define OBD_FAIL_LLOG_ORIGIN_HANDLE_CLOSE_NET 0x1308 -#define OBD_FAIL_LLOG_CATINFO_NET 0x1309 -#define OBD_FAIL_MDS_SYNC_CAPA_SL 0x1310 -#define OBD_FAIL_SEQ_ALLOC 0x1311 - -#define OBD_FAIL_LLITE 0x1400 -#define OBD_FAIL_LLITE_FAULT_TRUNC_RACE 0x1401 -#define OBD_FAIL_LOCK_STATE_WAIT_INTR 0x1402 -#define OBD_FAIL_LOV_INIT 0x1403 -#define OBD_FAIL_GLIMPSE_DELAY 0x1404 -#define OBD_FAIL_LLITE_XATTR_ENOMEM 0x1405 -#define OBD_FAIL_MAKE_LOVEA_HOLE 0x1406 -#define OBD_FAIL_LLITE_LOST_LAYOUT 0x1407 -#define OBD_FAIL_GETATTR_DELAY 0x1409 -#define OBD_FAIL_LLITE_CREATE_NODE_PAUSE 0x140c -#define OBD_FAIL_LLITE_IMUTEX_SEC 0x140e -#define OBD_FAIL_LLITE_IMUTEX_NOSEC 0x140f - -#define OBD_FAIL_FID_INDIR 0x1501 -#define OBD_FAIL_FID_INLMA 0x1502 -#define OBD_FAIL_FID_IGIF 0x1504 -#define OBD_FAIL_FID_LOOKUP 0x1505 -#define OBD_FAIL_FID_NOLMA 0x1506 +#define OBD_FAIL_QUOTA_EDQUOT 0xA02 +#define OBD_FAIL_QUOTA_DELAY_REINT 0xA03 +#define OBD_FAIL_QUOTA_RECOVERABLE_ERR 0xA04 + +#define OBD_FAIL_LPROC_REMOVE 0xB00 + +#define OBD_FAIL_SEQ 0x1000 +#define OBD_FAIL_SEQ_QUERY_NET 0x1001 +#define OBD_FAIL_SEQ_EXHAUST 0x1002 + +#define OBD_FAIL_FLD 0x1100 +#define OBD_FAIL_FLD_QUERY_NET 0x1101 +#define OBD_FAIL_FLD_READ_NET 0x1102 + +#define OBD_FAIL_SEC_CTX 0x1200 +#define OBD_FAIL_SEC_CTX_INIT_NET 0x1201 +#define OBD_FAIL_SEC_CTX_INIT_CONT_NET 0x1202 +#define OBD_FAIL_SEC_CTX_FINI_NET 0x1203 +#define OBD_FAIL_SEC_CTX_HDL_PAUSE 0x1204 + +#define OBD_FAIL_LLOG 0x1300 +#define OBD_FAIL_LLOG_ORIGIN_CONNECT_NET 0x1301 +#define OBD_FAIL_LLOG_ORIGIN_HANDLE_CREATE_NET 0x1302 +#define OBD_FAIL_LLOG_ORIGIN_HANDLE_DESTROY_NET 0x1303 +#define OBD_FAIL_LLOG_ORIGIN_HANDLE_READ_HEADER_NET 0x1304 +#define OBD_FAIL_LLOG_ORIGIN_HANDLE_NEXT_BLOCK_NET 0x1305 +#define OBD_FAIL_LLOG_ORIGIN_HANDLE_PREV_BLOCK_NET 0x1306 +#define OBD_FAIL_LLOG_ORIGIN_HANDLE_WRITE_REC_NET 0x1307 +#define OBD_FAIL_LLOG_ORIGIN_HANDLE_CLOSE_NET 0x1308 +#define OBD_FAIL_LLOG_CATINFO_NET 0x1309 +#define OBD_FAIL_MDS_SYNC_CAPA_SL 0x1310 +#define OBD_FAIL_SEQ_ALLOC 0x1311 + +#define OBD_FAIL_LLITE 0x1400 +#define OBD_FAIL_LLITE_FAULT_TRUNC_RACE 0x1401 +#define OBD_FAIL_LOCK_STATE_WAIT_INTR 0x1402 +#define OBD_FAIL_LOV_INIT 0x1403 +#define OBD_FAIL_GLIMPSE_DELAY 0x1404 +#define OBD_FAIL_LLITE_XATTR_ENOMEM 0x1405 +#define OBD_FAIL_MAKE_LOVEA_HOLE 0x1406 +#define OBD_FAIL_LLITE_LOST_LAYOUT 0x1407 +#define OBD_FAIL_GETATTR_DELAY 0x1409 +#define OBD_FAIL_LLITE_CREATE_NODE_PAUSE 0x140c +#define OBD_FAIL_LLITE_IMUTEX_SEC 0x140e +#define OBD_FAIL_LLITE_IMUTEX_NOSEC 0x140f + +#define OBD_FAIL_FID_INDIR 0x1501 +#define OBD_FAIL_FID_INLMA 0x1502 +#define OBD_FAIL_FID_IGIF 0x1504 +#define OBD_FAIL_FID_LOOKUP 0x1505 +#define OBD_FAIL_FID_NOLMA 0x1506 /* LFSCK */ -#define OBD_FAIL_LFSCK_DELAY1 0x1600 -#define OBD_FAIL_LFSCK_DELAY2 0x1601 -#define OBD_FAIL_LFSCK_DELAY3 0x1602 -#define OBD_FAIL_LFSCK_LINKEA_CRASH 0x1603 -#define OBD_FAIL_LFSCK_LINKEA_MORE 0x1604 -#define OBD_FAIL_LFSCK_LINKEA_MORE2 0x1605 -#define OBD_FAIL_LFSCK_FATAL1 0x1608 -#define OBD_FAIL_LFSCK_FATAL2 0x1609 -#define OBD_FAIL_LFSCK_CRASH 0x160a -#define OBD_FAIL_LFSCK_NO_AUTO 0x160b -#define OBD_FAIL_LFSCK_NO_DOUBLESCAN 0x160c -#define OBD_FAIL_LFSCK_INVALID_PFID 0x1619 -#define OBD_FAIL_LFSCK_BAD_NAME_HASH 0x1628 +#define OBD_FAIL_LFSCK_DELAY1 0x1600 +#define OBD_FAIL_LFSCK_DELAY2 0x1601 +#define OBD_FAIL_LFSCK_DELAY3 0x1602 +#define OBD_FAIL_LFSCK_LINKEA_CRASH 0x1603 +#define OBD_FAIL_LFSCK_LINKEA_MORE 0x1604 +#define OBD_FAIL_LFSCK_LINKEA_MORE2 0x1605 +#define OBD_FAIL_LFSCK_FATAL1 0x1608 +#define OBD_FAIL_LFSCK_FATAL2 0x1609 +#define OBD_FAIL_LFSCK_CRASH 0x160a +#define OBD_FAIL_LFSCK_NO_AUTO 0x160b +#define OBD_FAIL_LFSCK_NO_DOUBLESCAN 0x160c +#define OBD_FAIL_LFSCK_INVALID_PFID 0x1619 +#define OBD_FAIL_LFSCK_BAD_NAME_HASH 0x1628 /* UPDATE */ -#define OBD_FAIL_UPDATE_OBJ_NET 0x1700 -#define OBD_FAIL_UPDATE_OBJ_NET_REP 0x1701 +#define OBD_FAIL_UPDATE_OBJ_NET 0x1700 +#define OBD_FAIL_UPDATE_OBJ_NET_REP 0x1701 /* LMV */ -#define OBD_FAIL_UNKNOWN_LMV_STRIPE 0x1901 +#define OBD_FAIL_UNKNOWN_LMV_STRIPE 0x1901 /* Assign references to moved code to reduce code changes */ -#define OBD_FAIL_PRECHECK(id) CFS_FAIL_PRECHECK(id) -#define OBD_FAIL_CHECK(id) CFS_FAIL_CHECK(id) -#define OBD_FAIL_CHECK_VALUE(id, value) CFS_FAIL_CHECK_VALUE(id, value) -#define OBD_FAIL_CHECK_ORSET(id, value) CFS_FAIL_CHECK_ORSET(id, value) -#define OBD_FAIL_CHECK_RESET(id, value) CFS_FAIL_CHECK_RESET(id, value) +#define OBD_FAIL_PRECHECK(id) CFS_FAIL_PRECHECK(id) +#define OBD_FAIL_CHECK(id) CFS_FAIL_CHECK(id) +#define OBD_FAIL_CHECK_VALUE(id, value) CFS_FAIL_CHECK_VALUE(id, value) +#define OBD_FAIL_CHECK_ORSET(id, value) CFS_FAIL_CHECK_ORSET(id, value) +#define OBD_FAIL_CHECK_RESET(id, value) CFS_FAIL_CHECK_RESET(id, value) #define OBD_FAIL_RETURN(id, ret) CFS_FAIL_RETURN(id, ret) -#define OBD_FAIL_TIMEOUT(id, secs) CFS_FAIL_TIMEOUT(id, secs) -#define OBD_FAIL_TIMEOUT_MS(id, ms) CFS_FAIL_TIMEOUT_MS(id, ms) -#define OBD_FAIL_TIMEOUT_ORSET(id, value, secs) CFS_FAIL_TIMEOUT_ORSET(id, value, secs) -#define OBD_RACE(id) CFS_RACE(id) -#define OBD_FAIL_ONCE CFS_FAIL_ONCE -#define OBD_FAILED CFS_FAILED +#define OBD_FAIL_TIMEOUT(id, secs) CFS_FAIL_TIMEOUT(id, secs) +#define OBD_FAIL_TIMEOUT_MS(id, ms) CFS_FAIL_TIMEOUT_MS(id, ms) +#define OBD_FAIL_TIMEOUT_ORSET(id, value, secs) CFS_FAIL_TIMEOUT_ORSET(id, value, secs) +#define OBD_RACE(id) CFS_RACE(id) +#define OBD_FAIL_ONCE CFS_FAIL_ONCE +#define OBD_FAILED CFS_FAILED #ifdef CONFIG_DEBUG_SLAB #define POISON(ptr, c, s) do {} while (0) @@ -495,22 +495,22 @@ #endif #ifdef POISON_BULK -#define POISON_PAGE(page, val) do { \ - memset(kmap(page), val, PAGE_SIZE); \ - kunmap(page); \ +#define POISON_PAGE(page, val) do { \ + memset(kmap(page), val, PAGE_SIZE); \ + kunmap(page); \ } while (0) #else #define POISON_PAGE(page, val) do { } while (0) #endif -#define OBD_FREE_RCU(ptr, size, handle) \ -do { \ - struct portals_handle *__h = (handle); \ - \ - __h->h_cookie = (unsigned long)(ptr); \ - __h->h_size = (size); \ - call_rcu(&__h->h_rcu, class_handle_free_cb); \ - POISON_PTR(ptr); \ +#define OBD_FREE_RCU(ptr, size, handle) \ +do { \ + struct portals_handle *__h = (handle); \ + \ + __h->h_cookie = (unsigned long)(ptr); \ + __h->h_size = (size); \ + call_rcu(&__h->h_rcu, class_handle_free_cb); \ + POISON_PTR(ptr); \ } while (0) #define KEY_IS(str) \ diff --git a/drivers/staging/lustre/lustre/include/seq_range.h b/drivers/staging/lustre/lustre/include/seq_range.h index 9450da72..884d4d4 100644 --- a/drivers/staging/lustre/lustre/include/seq_range.h +++ b/drivers/staging/lustre/lustre/include/seq_range.h @@ -176,7 +176,7 @@ static inline int lu_seq_range_compare_loc(const struct lu_seq_range *r1, const struct lu_seq_range *r2) { return r1->lsr_index != r2->lsr_index || - r1->lsr_flags != r2->lsr_flags; + r1->lsr_flags != r2->lsr_flags; } #if !defined(__REQ_LAYOUT_USER__) -- 1.8.3.1 From jsimmons at infradead.org Thu Jan 31 17:19:30 2019 From: jsimmons at infradead.org (James Simmons) Date: Thu, 31 Jan 2019 12:19:30 -0500 Subject: [lustre-devel] [PATCH 26/26] o2iblnd: cleanup white spaces In-Reply-To: <1548955170-13456-1-git-send-email-jsimmons@infradead.org> References: <1548955170-13456-1-git-send-email-jsimmons@infradead.org> Message-ID: <1548955170-13456-27-git-send-email-jsimmons@infradead.org> The o2iblnd code is very messy and difficult to read. Remove excess white space and properly align data structures so they are easy on the eyes. Signed-off-by: James Simmons --- .../staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c | 79 +-- .../staging/lustre/lnet/klnds/o2iblnd/o2iblnd.h | 612 +++++++++++---------- .../staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c | 99 ++-- .../lustre/lnet/klnds/o2iblnd/o2iblnd_modparams.c | 22 +- 4 files changed, 407 insertions(+), 405 deletions(-) diff --git a/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c b/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c index 1a6bc45..74b21fe2 100644 --- a/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c +++ b/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c @@ -183,15 +183,15 @@ void kiblnd_pack_msg(struct lnet_ni *ni, struct kib_msg *msg, int version, * CAVEAT EMPTOR! all message fields not set here should have been * initialised previously. */ - msg->ibm_magic = IBLND_MSG_MAGIC; - msg->ibm_version = version; + msg->ibm_magic = IBLND_MSG_MAGIC; + msg->ibm_version = version; /* ibm_type */ - msg->ibm_credits = credits; + msg->ibm_credits = credits; /* ibm_nob */ - msg->ibm_cksum = 0; - msg->ibm_srcnid = ni->ni_nid; + msg->ibm_cksum = 0; + msg->ibm_srcnid = ni->ni_nid; msg->ibm_srcstamp = net->ibn_incarnation; - msg->ibm_dstnid = dstnid; + msg->ibm_dstnid = dstnid; msg->ibm_dststamp = dststamp; if (*kiblnd_tunables.kib_cksum) { @@ -260,7 +260,7 @@ int kiblnd_unpack_msg(struct kib_msg *msg, int nob) msg->ibm_version = version; BUILD_BUG_ON(sizeof(msg->ibm_type) != 1); BUILD_BUG_ON(sizeof(msg->ibm_credits) != 1); - msg->ibm_nob = msg_nob; + msg->ibm_nob = msg_nob; __swab64s(&msg->ibm_srcnid); __swab64s(&msg->ibm_srcstamp); __swab64s(&msg->ibm_dstnid); @@ -903,12 +903,12 @@ struct kib_conn *kiblnd_create_conn(struct kib_peer_ni *peer_ni, atomic_inc(&net->ibn_nconns); return conn; - failed_2: +failed_2: kiblnd_destroy_conn(conn); kfree(conn); - failed_1: +failed_1: kfree(init_qp_attr); - failed_0: +failed_0: return NULL; } @@ -1004,7 +1004,7 @@ int kiblnd_close_stale_conns_locked(struct kib_peer_ni *peer_ni, list_for_each_safe(ctmp, cnxt, &peer_ni->ibp_conns) { conn = list_entry(ctmp, struct kib_conn, ibc_list); - if (conn->ibc_version == version && + if (conn->ibc_version == version && conn->ibc_incarnation == incarnation) continue; @@ -1077,7 +1077,7 @@ static int kiblnd_ctl(struct lnet_ni *ni, unsigned int cmd, void *arg) rc = kiblnd_get_peer_info(ni, data->ioc_count, &nid, &count); - data->ioc_nid = nid; + data->ioc_nid = nid; data->ioc_count = count; break; } @@ -1414,15 +1414,16 @@ static void kiblnd_destroy_fmr_pool_list(struct list_head *head) static int kiblnd_alloc_fmr_pool(struct kib_fmr_poolset *fps, struct kib_fmr_pool *fpo) { struct ib_fmr_pool_param param = { - .max_pages_per_fmr = LNET_MAX_IOV, - .page_shift = PAGE_SHIFT, - .access = (IB_ACCESS_LOCAL_WRITE | - IB_ACCESS_REMOTE_WRITE), - .pool_size = fps->fps_pool_size, - .dirty_watermark = fps->fps_flush_trigger, - .flush_function = NULL, - .flush_arg = NULL, - .cache = !!fps->fps_cache }; + .max_pages_per_fmr = LNET_MAX_IOV, + .page_shift = PAGE_SHIFT, + .access = (IB_ACCESS_LOCAL_WRITE | + IB_ACCESS_REMOTE_WRITE), + .pool_size = fps->fps_pool_size, + .dirty_watermark = fps->fps_flush_trigger, + .flush_function = NULL, + .flush_arg = NULL, + .cache = !!fps->fps_cache + }; int rc = 0; fpo->fmr.fpo_fmr_pool = ib_create_fmr_pool(fpo->fpo_hdev->ibh_pd, @@ -1696,7 +1697,7 @@ int kiblnd_fmr_pool_map(struct kib_fmr_poolset *fps, struct kib_tx *tx, u64 version; int rc; - again: +again: spin_lock(&fps->fps_lock); version = fps->fps_version; list_for_each_entry(fpo, &fps->fps_pool_list, fpo_list) { @@ -1844,8 +1845,8 @@ static void kiblnd_init_pool(struct kib_poolset *ps, struct kib_pool *pool, int memset(pool, 0, sizeof(*pool)); INIT_LIST_HEAD(&pool->po_free_list); pool->po_deadline = ktime_get_seconds() + IBLND_POOL_DEADLINE; - pool->po_owner = ps; - pool->po_size = size; + pool->po_owner = ps; + pool->po_size = size; } static void kiblnd_destroy_pool_list(struct list_head *head) @@ -1900,13 +1901,13 @@ static int kiblnd_init_poolset(struct kib_poolset *ps, int cpt, memset(ps, 0, sizeof(*ps)); - ps->ps_cpt = cpt; - ps->ps_net = net; + ps->ps_cpt = cpt; + ps->ps_net = net; ps->ps_pool_create = po_create; ps->ps_pool_destroy = po_destroy; - ps->ps_node_init = nd_init; - ps->ps_node_fini = nd_fini; - ps->ps_pool_size = size; + ps->ps_node_init = nd_init; + ps->ps_node_fini = nd_fini; + ps->ps_pool_size = size; if (strlcpy(ps->ps_name, name, sizeof(ps->ps_name)) >= sizeof(ps->ps_name)) return -E2BIG; @@ -1971,7 +1972,7 @@ struct list_head *kiblnd_pool_alloc_node(struct kib_poolset *ps) unsigned int trips = 0; int rc; - again: +again: spin_lock(&ps->ps_lock); list_for_each_entry(pool, &ps->ps_pool_list, po_list) { if (list_empty(&pool->po_free_list)) @@ -2286,7 +2287,7 @@ static int kiblnd_net_init_pools(struct kib_net *net, struct lnet_ni *ni, } return 0; - failed: +failed: kiblnd_net_fini_pools(net); LASSERT(rc); return rc; @@ -2302,8 +2303,8 @@ static int kiblnd_hdev_get_attr(struct kib_hca_dev *hdev) * matching that of the native system */ hdev->ibh_page_shift = PAGE_SHIFT; - hdev->ibh_page_size = 1 << PAGE_SHIFT; - hdev->ibh_page_mask = ~((u64)hdev->ibh_page_size - 1); + hdev->ibh_page_size = 1 << PAGE_SHIFT; + hdev->ibh_page_mask = ~((u64)hdev->ibh_page_size - 1); if (hdev->ibh_ibdev->ops.alloc_fmr && hdev->ibh_ibdev->ops.dealloc_fmr && @@ -2455,9 +2456,9 @@ int kiblnd_dev_failover(struct kib_dev *dev) } memset(&addr, 0, sizeof(addr)); - addr.sin_family = AF_INET; + addr.sin_family = AF_INET; addr.sin_addr.s_addr = htonl(dev->ibd_ifip); - addr.sin_port = htons(*kiblnd_tunables.kib_service); + addr.sin_port = htons(*kiblnd_tunables.kib_service); /* Bind to failover device or port */ rc = rdma_bind_addr(cmid, (struct sockaddr *)&addr); @@ -2478,8 +2479,8 @@ int kiblnd_dev_failover(struct kib_dev *dev) } atomic_set(&hdev->ibh_ref, 1); - hdev->ibh_dev = dev; - hdev->ibh_cmid = cmid; + hdev->ibh_dev = dev; + hdev->ibh_cmid = cmid; hdev->ibh_ibdev = cmid->device; pd = ib_alloc_pd(cmid->device, 0); @@ -2519,7 +2520,7 @@ int kiblnd_dev_failover(struct kib_dev *dev) } write_unlock_irqrestore(&kiblnd_data.kib_global_lock, flags); - out: +out: if (!list_empty(&zombie_tpo)) kiblnd_destroy_pool_list(&zombie_tpo); if (!list_empty(&zombie_ppo)) @@ -2832,7 +2833,7 @@ static int kiblnd_base_startup(void) return 0; - failed: +failed: kiblnd_base_shutdown(); return -ENETDOWN; } diff --git a/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.h b/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.h index 423bae7..2bf1228 100644 --- a/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.h +++ b/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.h @@ -97,10 +97,10 @@ struct kib_tunables { extern struct kib_tunables kiblnd_tunables; -#define IBLND_MSG_QUEUE_SIZE_V1 8 /* V1 only : # messages/RDMAs in-flight */ +#define IBLND_MSG_QUEUE_SIZE_V1 8 /* V1 only : # messages/RDMAs in-flight */ #define IBLND_CREDIT_HIGHWATER_V1 7 /* V1 only : when eagerly to return credits */ -#define IBLND_CREDITS_DEFAULT 8 /* default # of peer_ni credits */ +#define IBLND_CREDITS_DEFAULT 8 /* default # of peer_ni credits */ /* Max # of peer_ni credits */ #define IBLND_CREDITS_MAX ((typeof(((struct kib_msg *)0)->ibm_credits)) - 1) @@ -114,8 +114,8 @@ struct kib_tunables { ps, qpt) /* 2 OOB shall suffice for 1 keepalive and 1 returning credits */ -#define IBLND_OOB_CAPABLE(v) ((v) != IBLND_MSG_VERSION_1) -#define IBLND_OOB_MSGS(v) (IBLND_OOB_CAPABLE(v) ? 2 : 0) +#define IBLND_OOB_CAPABLE(v) ((v) != IBLND_MSG_VERSION_1) +#define IBLND_OOB_MSGS(v) (IBLND_OOB_CAPABLE(v) ? 2 : 0) #define IBLND_MSG_SIZE (4 << 10) /* max size of queued messages (inc hdr) */ #define IBLND_MAX_RDMA_FRAGS LNET_MAX_IOV /* max # of fragments supported */ @@ -124,9 +124,9 @@ struct kib_tunables { /* derived constants... */ /* Pools (shared by connections on each CPT) */ /* These pools can grow at runtime, so don't need give a very large value */ -#define IBLND_TX_POOL 256 -#define IBLND_FMR_POOL 256 -#define IBLND_FMR_POOL_FLUSH 192 +#define IBLND_TX_POOL 256 +#define IBLND_FMR_POOL 256 +#define IBLND_FMR_POOL_FLUSH 192 #define IBLND_RX_MSGS(c) \ ((c->ibc_queue_depth) * 2 + IBLND_OOB_MSGS(c->ibc_version)) @@ -143,9 +143,9 @@ struct kib_tunables { /* o2iblnd can run over aliased interface */ #ifdef IFALIASZ -#define KIB_IFNAME_SIZE IFALIASZ +#define KIB_IFNAME_SIZE IFALIASZ #else -#define KIB_IFNAME_SIZE 256 +#define KIB_IFNAME_SIZE 256 #endif enum kib_dev_caps { @@ -155,44 +155,46 @@ enum kib_dev_caps { }; struct kib_dev { - struct list_head ibd_list; /* chain on kib_devs */ - struct list_head ibd_fail_list; /* chain on kib_failed_devs */ - u32 ibd_ifip; /* IPoIB interface IP */ + struct list_head ibd_list; /* chain on kib_devs */ + struct list_head ibd_fail_list; /* chain on kib_failed_devs */ + u32 ibd_ifip; /* IPoIB interface IP */ /* IPoIB interface name */ - char ibd_ifname[KIB_IFNAME_SIZE]; - int ibd_nnets; /* # nets extant */ - - time64_t ibd_next_failover; - int ibd_failed_failover; /* # failover failures */ - unsigned int ibd_failover; /* failover in progress */ - unsigned int ibd_can_failover; /* IPoIB interface is a bonding master */ - struct list_head ibd_nets; - struct kib_hca_dev *ibd_hdev; + char ibd_ifname[KIB_IFNAME_SIZE]; + int ibd_nnets; /* # nets extant */ + + time64_t ibd_next_failover; + int ibd_failed_failover; /* # failover failures */ + unsigned int ibd_failover; /* failover in progress */ + unsigned int ibd_can_failover; /* IPoIB interface is a + * bonding master + */ + struct list_head ibd_nets; + struct kib_hca_dev *ibd_hdev; enum kib_dev_caps ibd_dev_caps; }; struct kib_hca_dev { - struct rdma_cm_id *ibh_cmid; /* listener cmid */ - struct ib_device *ibh_ibdev; /* IB device */ - int ibh_page_shift; /* page shift of current HCA */ - int ibh_page_size; /* page size of current HCA */ - u64 ibh_page_mask; /* page mask of current HCA */ - int ibh_mr_shift; /* bits shift of max MR size */ - u64 ibh_mr_size; /* size of MR */ - struct ib_pd *ibh_pd; /* PD */ - struct kib_dev *ibh_dev; /* owner */ - atomic_t ibh_ref; /* refcount */ + struct rdma_cm_id *ibh_cmid; /* listener cmid */ + struct ib_device *ibh_ibdev; /* IB device */ + int ibh_page_shift; /* page shift of current HCA */ + int ibh_page_size; /* page size of current HCA */ + u64 ibh_page_mask; /* page mask of current HCA */ + int ibh_mr_shift; /* bits shift of max MR size */ + u64 ibh_mr_size; /* size of MR */ + struct ib_pd *ibh_pd; /* PD */ + struct kib_dev *ibh_dev; /* owner */ + atomic_t ibh_ref; /* refcount */ }; /** # of seconds to keep pool alive */ -#define IBLND_POOL_DEADLINE 300 +#define IBLND_POOL_DEADLINE 300 /** # of seconds to retry if allocation failed */ #define IBLND_POOL_RETRY 1 struct kib_pages { - int ibp_npages; /* # pages */ - struct page *ibp_pages[0]; /* page array */ + int ibp_npages; /* # pages */ + struct page *ibp_pages[0]; /* page array */ }; struct kib_pool; @@ -206,39 +208,39 @@ typedef int (*kib_ps_pool_create_t)(struct kib_poolset *ps, struct kib_net; -#define IBLND_POOL_NAME_LEN 32 +#define IBLND_POOL_NAME_LEN 32 struct kib_poolset { - spinlock_t ps_lock; /* serialize */ - struct kib_net *ps_net; /* network it belongs to */ - char ps_name[IBLND_POOL_NAME_LEN]; /* pool set name */ - struct list_head ps_pool_list; /* list of pools */ - struct list_head ps_failed_pool_list;/* failed pool list */ - time64_t ps_next_retry; /* time stamp for retry if */ - /* failed to allocate */ - int ps_increasing; /* is allocating new pool */ - int ps_pool_size; /* new pool size */ - int ps_cpt; /* CPT id */ - - kib_ps_pool_create_t ps_pool_create; /* create a new pool */ - kib_ps_pool_destroy_t ps_pool_destroy; /* destroy a pool */ - kib_ps_node_init_t ps_node_init; /* initialize new allocated node */ - kib_ps_node_fini_t ps_node_fini; /* finalize node */ + spinlock_t ps_lock; /* serialize */ + struct kib_net *ps_net; /* network it belongs to */ + char ps_name[IBLND_POOL_NAME_LEN]; /* pool set name */ + struct list_head ps_pool_list; /* list of pools */ + struct list_head ps_failed_pool_list;/* failed pool list */ + time64_t ps_next_retry; /* time stamp for retry if */ + /* failed to allocate */ + int ps_increasing; /* is allocating new pool */ + int ps_pool_size; /* new pool size */ + int ps_cpt; /* CPT id */ + + kib_ps_pool_create_t ps_pool_create; /* create a new pool */ + kib_ps_pool_destroy_t ps_pool_destroy; /* destroy a pool */ + kib_ps_node_init_t ps_node_init; /* initialize new allocated node */ + kib_ps_node_fini_t ps_node_fini; /* finalize node */ }; struct kib_pool { - struct list_head po_list; /* chain on pool list */ - struct list_head po_free_list; /* pre-allocated node */ - struct kib_poolset *po_owner; /* pool_set of this pool */ + struct list_head po_list; /* chain on pool list */ + struct list_head po_free_list; /* pre-allocated node */ + struct kib_poolset *po_owner; /* pool_set of this pool */ time64_t po_deadline; /* deadline of this pool */ - int po_allocated; /* # of elements in use */ - int po_failed; /* pool is created on failed HCA */ - int po_size; /* # of pre-allocated elements */ + int po_allocated; /* # of elements in use */ + int po_failed; /* pool is created on failed HCA */ + int po_size; /* # of pre-allocated elements */ }; struct kib_tx_poolset { struct kib_poolset tps_poolset; /* pool-set */ - u64 tps_next_tx_cookie; /* cookie of TX */ + u64 tps_next_tx_cookie; /* cookie of TX */ }; struct kib_tx_pool { @@ -249,27 +251,27 @@ struct kib_tx_pool { }; struct kib_fmr_poolset { - spinlock_t fps_lock; /* serialize */ - struct kib_net *fps_net; /* IB network */ - struct list_head fps_pool_list; /* FMR pool list */ - struct list_head fps_failed_pool_list;/* FMR pool list */ - u64 fps_version; /* validity stamp */ - int fps_cpt; /* CPT id */ - int fps_pool_size; - int fps_flush_trigger; - int fps_cache; - int fps_increasing; /* is allocating new pool */ + spinlock_t fps_lock; /* serialize */ + struct kib_net *fps_net; /* IB network */ + struct list_head fps_pool_list; /* FMR pool list */ + struct list_head fps_failed_pool_list; /* FMR pool list */ + u64 fps_version; /* validity stamp */ + int fps_cpt; /* CPT id */ + int fps_pool_size; + int fps_flush_trigger; + int fps_cache; + int fps_increasing; /* is allocating new pool */ time64_t fps_next_retry; /* time stamp for retry * if failed to allocate */ }; struct kib_fast_reg_descriptor { /* For fast registration */ - struct list_head frd_list; - struct ib_send_wr frd_inv_wr; - struct ib_reg_wr frd_fastreg_wr; - struct ib_mr *frd_mr; - bool frd_valid; + struct list_head frd_list; + struct ib_send_wr frd_inv_wr; + struct ib_reg_wr frd_fastreg_wr; + struct ib_mr *frd_mr; + bool frd_valid; }; struct kib_fmr_pool { @@ -278,16 +280,16 @@ struct kib_fmr_pool { struct kib_fmr_poolset *fpo_owner; /* owner of this pool */ union { struct { - struct ib_fmr_pool *fpo_fmr_pool; /* IB FMR pool */ + struct ib_fmr_pool *fpo_fmr_pool; /* IB FMR pool */ } fmr; struct { /* For fast registration */ - struct list_head fpo_pool_list; - int fpo_pool_size; + struct list_head fpo_pool_list; + int fpo_pool_size; } fast_reg; }; time64_t fpo_deadline; /* deadline of this pool */ - int fpo_failed; /* fmr pool is failed */ - int fpo_map_count; /* # of mapped FMR */ + int fpo_failed; /* fmr pool is failed */ + int fpo_map_count; /* # of mapped FMR */ }; struct kib_fmr { @@ -298,13 +300,13 @@ struct kib_fmr { }; struct kib_net { - struct list_head ibn_list; /* chain on struct kib_dev::ibd_nets */ - u64 ibn_incarnation;/* my epoch */ - int ibn_init; /* initialisation state */ - int ibn_shutdown; /* shutting down? */ + struct list_head ibn_list; /* chain on struct kib_dev::ibd_nets */ + u64 ibn_incarnation;/* my epoch */ + int ibn_init; /* initialisation state */ + int ibn_shutdown; /* shutting down? */ - atomic_t ibn_npeers; /* # peers extant */ - atomic_t ibn_nconns; /* # connections extant */ + atomic_t ibn_npeers; /* # peers extant */ + atomic_t ibn_nconns; /* # connections extant */ struct kib_tx_poolset **ibn_tx_ps; /* tx pool-set */ struct kib_fmr_poolset **ibn_fmr_ps; /* fmr pool-set */ @@ -318,27 +320,27 @@ struct kib_net { #define KIB_THREAD_TID(id) ((id) & ((1UL << KIB_THREAD_SHIFT) - 1)) struct kib_sched_info { - spinlock_t ibs_lock; /* serialise */ - wait_queue_head_t ibs_waitq; /* schedulers sleep here */ - struct list_head ibs_conns; /* conns to check for rx completions */ - int ibs_nthreads; /* number of scheduler threads */ - int ibs_nthreads_max; /* max allowed scheduler threads */ - int ibs_cpt; /* CPT id */ + spinlock_t ibs_lock; /* serialise */ + wait_queue_head_t ibs_waitq; /* schedulers sleep here */ + struct list_head ibs_conns; /* conns to check for rx completions */ + int ibs_nthreads; /* number of scheduler threads */ + int ibs_nthreads_max; /* max allowed scheduler threads */ + int ibs_cpt; /* CPT id */ }; struct kib_data { - int kib_init; /* initialisation state */ - int kib_shutdown; /* shut down? */ - struct list_head kib_devs; /* IB devices extant */ - struct list_head kib_failed_devs; /* list head of failed devices */ - wait_queue_head_t kib_failover_waitq; /* schedulers sleep here */ - atomic_t kib_nthreads; /* # live threads */ - rwlock_t kib_global_lock; /* stabilize net/dev/peer_ni/conn ops */ - struct list_head *kib_peers; /* hash table of all my known peers */ - int kib_peer_hash_size; /* size of kib_peers */ - void *kib_connd; /* the connd task (serialisation assertions) */ - struct list_head kib_connd_conns; /* connections to setup/teardown */ - struct list_head kib_connd_zombies; /* connections with zero refcount */ + int kib_init; /* initialisation state */ + int kib_shutdown; /* shut down? */ + struct list_head kib_devs; /* IB devices extant */ + struct list_head kib_failed_devs; /* list head of failed devices */ + wait_queue_head_t kib_failover_waitq; /* schedulers sleep here */ + atomic_t kib_nthreads; /* # live threads */ + rwlock_t kib_global_lock; /* stabilize net/dev/peer_ni/conn ops */ + struct list_head *kib_peers; /* hash table of all my known peers */ + int kib_peer_hash_size; /* size of kib_peers */ + void *kib_connd; /* the connd task (serialisation assertions) */ + struct list_head kib_connd_conns; /* connections to setup/teardown */ + struct list_head kib_connd_zombies; /* connections with zero refcount */ /* connections to reconnect */ struct list_head kib_reconn_list; /* peers wait for reconnection */ @@ -349,15 +351,15 @@ struct kib_data { */ time64_t kib_reconn_sec; - wait_queue_head_t kib_connd_waitq; /* connection daemon sleeps here */ - spinlock_t kib_connd_lock; /* serialise */ - struct ib_qp_attr kib_error_qpa; /* QP->ERROR */ - struct kib_sched_info **kib_scheds; /* percpt data for schedulers */ + wait_queue_head_t kib_connd_waitq; /* connection daemon sleeps here */ + spinlock_t kib_connd_lock; /* serialise */ + struct ib_qp_attr kib_error_qpa; /* QP->ERROR */ + struct kib_sched_info **kib_scheds; /* percpt data for schedulers */ }; -#define IBLND_INIT_NOTHING 0 -#define IBLND_INIT_DATA 1 -#define IBLND_INIT_ALL 2 +#define IBLND_INIT_NOTHING 0 +#define IBLND_INIT_DATA 1 +#define IBLND_INIT_ALL 2 /************************************************************************ * IB Wire message format. @@ -365,62 +367,62 @@ struct kib_data { */ struct kib_connparams { - u16 ibcp_queue_depth; - u16 ibcp_max_frags; - u32 ibcp_max_msg_size; + u16 ibcp_queue_depth; + u16 ibcp_max_frags; + u32 ibcp_max_msg_size; } __packed; struct kib_immediate_msg { - struct lnet_hdr ibim_hdr; /* portals header */ - char ibim_payload[0]; /* piggy-backed payload */ + struct lnet_hdr ibim_hdr; /* portals header */ + char ibim_payload[0];/* piggy-backed payload */ } __packed; struct kib_rdma_frag { - u32 rf_nob; /* # bytes this frag */ - u64 rf_addr; /* CAVEAT EMPTOR: misaligned!! */ + u32 rf_nob; /* # bytes this frag */ + u64 rf_addr; /* CAVEAT EMPTOR: misaligned!! */ } __packed; struct kib_rdma_desc { - u32 rd_key; /* local/remote key */ - u32 rd_nfrags; /* # fragments */ + u32 rd_key; /* local/remote key */ + u32 rd_nfrags; /* # fragments */ struct kib_rdma_frag rd_frags[0]; /* buffer frags */ } __packed; struct kib_putreq_msg { - struct lnet_hdr ibprm_hdr; /* portals header */ - u64 ibprm_cookie; /* opaque completion cookie */ + struct lnet_hdr ibprm_hdr; /* portals header */ + u64 ibprm_cookie; /* opaque completion cookie */ } __packed; struct kib_putack_msg { - u64 ibpam_src_cookie; /* reflected completion cookie */ - u64 ibpam_dst_cookie; /* opaque completion cookie */ - struct kib_rdma_desc ibpam_rd; /* sender's sink buffer */ + u64 ibpam_src_cookie; /* reflected completion cookie */ + u64 ibpam_dst_cookie; /* opaque completion cookie */ + struct kib_rdma_desc ibpam_rd; /* sender's sink buffer */ } __packed; struct kib_get_msg { - struct lnet_hdr ibgm_hdr; /* portals header */ - u64 ibgm_cookie; /* opaque completion cookie */ - struct kib_rdma_desc ibgm_rd; /* rdma descriptor */ + struct lnet_hdr ibgm_hdr; /* portals header */ + u64 ibgm_cookie; /* opaque completion cookie */ + struct kib_rdma_desc ibgm_rd; /* rdma descriptor */ } __packed; struct kib_completion_msg { - u64 ibcm_cookie; /* opaque completion cookie */ - s32 ibcm_status; /* < 0 failure: >= 0 length */ + u64 ibcm_cookie; /* opaque completion cookie */ + s32 ibcm_status; /* < 0 failure: >= 0 length */ } __packed; struct kib_msg { /* First 2 fields fixed FOR ALL TIME */ - u32 ibm_magic; /* I'm an ibnal message */ - u16 ibm_version; /* this is my version number */ - - u8 ibm_type; /* msg type */ - u8 ibm_credits; /* returned credits */ - u32 ibm_nob; /* # bytes in whole message */ - u32 ibm_cksum; /* checksum (0 == no checksum) */ - u64 ibm_srcnid; /* sender's NID */ - u64 ibm_srcstamp; /* sender's incarnation */ - u64 ibm_dstnid; /* destination's NID */ - u64 ibm_dststamp; /* destination's incarnation */ + u32 ibm_magic; /* I'm an ibnal message */ + u16 ibm_version; /* this is my version number */ + + u8 ibm_type; /* msg type */ + u8 ibm_credits; /* returned credits */ + u32 ibm_nob; /* # bytes in whole message */ + u32 ibm_cksum; /* checksum (0 == no checksum) */ + u64 ibm_srcnid; /* sender's NID */ + u64 ibm_srcstamp; /* sender's incarnation */ + u64 ibm_dstnid; /* destination's NID */ + u64 ibm_dststamp; /* destination's incarnation */ union { struct kib_connparams connparams; @@ -432,161 +434,161 @@ struct kib_msg { } __packed ibm_u; } __packed; -#define IBLND_MSG_MAGIC LNET_PROTO_IB_MAGIC /* unique magic */ +#define IBLND_MSG_MAGIC LNET_PROTO_IB_MAGIC /* unique magic */ -#define IBLND_MSG_VERSION_1 0x11 -#define IBLND_MSG_VERSION_2 0x12 -#define IBLND_MSG_VERSION IBLND_MSG_VERSION_2 +#define IBLND_MSG_VERSION_1 0x11 +#define IBLND_MSG_VERSION_2 0x12 +#define IBLND_MSG_VERSION IBLND_MSG_VERSION_2 -#define IBLND_MSG_CONNREQ 0xc0 /* connection request */ -#define IBLND_MSG_CONNACK 0xc1 /* connection acknowledge */ -#define IBLND_MSG_NOOP 0xd0 /* nothing (just credits) */ -#define IBLND_MSG_IMMEDIATE 0xd1 /* immediate */ -#define IBLND_MSG_PUT_REQ 0xd2 /* putreq (src->sink) */ -#define IBLND_MSG_PUT_NAK 0xd3 /* completion (sink->src) */ -#define IBLND_MSG_PUT_ACK 0xd4 /* putack (sink->src) */ -#define IBLND_MSG_PUT_DONE 0xd5 /* completion (src->sink) */ -#define IBLND_MSG_GET_REQ 0xd6 /* getreq (sink->src) */ -#define IBLND_MSG_GET_DONE 0xd7 /* completion (src->sink: all OK) */ +#define IBLND_MSG_CONNREQ 0xc0 /* connection request */ +#define IBLND_MSG_CONNACK 0xc1 /* connection acknowledge */ +#define IBLND_MSG_NOOP 0xd0 /* nothing (just credits) */ +#define IBLND_MSG_IMMEDIATE 0xd1 /* immediate */ +#define IBLND_MSG_PUT_REQ 0xd2 /* putreq (src->sink) */ +#define IBLND_MSG_PUT_NAK 0xd3 /* completion (sink->src) */ +#define IBLND_MSG_PUT_ACK 0xd4 /* putack (sink->src) */ +#define IBLND_MSG_PUT_DONE 0xd5 /* completion (src->sink) */ +#define IBLND_MSG_GET_REQ 0xd6 /* getreq (sink->src) */ +#define IBLND_MSG_GET_DONE 0xd7 /* completion (src->sink: all OK) */ struct kib_rej { - u32 ibr_magic; /* sender's magic */ - u16 ibr_version; /* sender's version */ - u8 ibr_why; /* reject reason */ - u8 ibr_padding; /* padding */ - u64 ibr_incarnation; /* incarnation of peer_ni */ - struct kib_connparams ibr_cp; /* connection parameters */ + u32 ibr_magic; /* sender's magic */ + u16 ibr_version; /* sender's version */ + u8 ibr_why; /* reject reason */ + u8 ibr_padding; /* padding */ + u64 ibr_incarnation;/* incarnation of peer_ni */ + struct kib_connparams ibr_cp; /* connection parameters */ } __packed; /* connection rejection reasons */ -#define IBLND_REJECT_CONN_RACE 1 /* You lost connection race */ -#define IBLND_REJECT_NO_RESOURCES 2 /* Out of memory/conns etc */ -#define IBLND_REJECT_FATAL 3 /* Anything else */ -#define IBLND_REJECT_CONN_UNCOMPAT 4 /* incompatible version peer_ni */ -#define IBLND_REJECT_CONN_STALE 5 /* stale peer_ni */ +#define IBLND_REJECT_CONN_RACE 1 /* You lost connection race */ +#define IBLND_REJECT_NO_RESOURCES 2 /* Out of memory/conns etc */ +#define IBLND_REJECT_FATAL 3 /* Anything else */ +#define IBLND_REJECT_CONN_UNCOMPAT 4 /* incompatible version peer_ni */ +#define IBLND_REJECT_CONN_STALE 5 /* stale peer_ni */ /* peer_ni's rdma frags doesn't match mine */ -#define IBLND_REJECT_RDMA_FRAGS 6 +#define IBLND_REJECT_RDMA_FRAGS 6 /* peer_ni's msg queue size doesn't match mine */ -#define IBLND_REJECT_MSG_QUEUE_SIZE 7 -#define IBLND_REJECT_INVALID_SRV_ID 8 +#define IBLND_REJECT_MSG_QUEUE_SIZE 7 +#define IBLND_REJECT_INVALID_SRV_ID 8 /***********************************************************************/ struct kib_rx { /* receive message */ - struct list_head rx_list; /* queue for attention */ - struct kib_conn *rx_conn; /* owning conn */ - int rx_nob; /* # bytes received (-1 while posted) */ - enum ib_wc_status rx_status; /* completion status */ - struct kib_msg *rx_msg; /* message buffer (host vaddr) */ - u64 rx_msgaddr; /* message buffer (I/O addr) */ - DEFINE_DMA_UNMAP_ADDR(rx_msgunmap); /* for dma_unmap_single() */ - struct ib_recv_wr rx_wrq; /* receive work item... */ - struct ib_sge rx_sge; /* ...and its memory */ + struct list_head rx_list; /* queue for attention */ + struct kib_conn *rx_conn; /* owning conn */ + int rx_nob; /* # bytes received (-1 while posted) */ + enum ib_wc_status rx_status; /* completion status */ + struct kib_msg *rx_msg; /* message buffer (host vaddr) */ + u64 rx_msgaddr; /* message buffer (I/O addr) */ + DEFINE_DMA_UNMAP_ADDR(rx_msgunmap); /* for dma_unmap_single() */ + struct ib_recv_wr rx_wrq; /* receive work item... */ + struct ib_sge rx_sge; /* ...and its memory */ }; -#define IBLND_POSTRX_DONT_POST 0 /* don't post */ -#define IBLND_POSTRX_NO_CREDIT 1 /* post: no credits */ -#define IBLND_POSTRX_PEER_CREDIT 2 /* post: give peer_ni back 1 credit */ -#define IBLND_POSTRX_RSRVD_CREDIT 3 /* post: give self back 1 reserved credit */ +#define IBLND_POSTRX_DONT_POST 0 /* don't post */ +#define IBLND_POSTRX_NO_CREDIT 1 /* post: no credits */ +#define IBLND_POSTRX_PEER_CREDIT 2 /* post: give peer_ni back 1 credit */ +#define IBLND_POSTRX_RSRVD_CREDIT 3 /* post: give self back 1 reserved credit */ struct kib_tx { /* transmit message */ - struct list_head tx_list; /* queue on idle_txs ibc_tx_queue etc. */ - struct kib_tx_pool *tx_pool; /* pool I'm from */ - struct kib_conn *tx_conn; /* owning conn */ - short tx_sending; /* # tx callbacks outstanding */ - short tx_queued; /* queued for sending */ - short tx_waiting; /* waiting for peer_ni */ - int tx_status; /* LNET completion status */ + struct list_head tx_list; /* queue on idle_txs ibc_tx_queue etc. */ + struct kib_tx_pool *tx_pool; /* pool I'm from */ + struct kib_conn *tx_conn; /* owning conn */ + short tx_sending; /* # tx callbacks outstanding */ + short tx_queued; /* queued for sending */ + short tx_waiting; /* waiting for peer_ni */ + int tx_status; /* LNET completion status */ ktime_t tx_deadline; /* completion deadline */ - u64 tx_cookie; /* completion cookie */ - struct lnet_msg *tx_lntmsg[2]; /* lnet msgs to finalize on completion */ - struct kib_msg *tx_msg; /* message buffer (host vaddr) */ - u64 tx_msgaddr; /* message buffer (I/O addr) */ - DEFINE_DMA_UNMAP_ADDR(tx_msgunmap); /* for dma_unmap_single() */ + u64 tx_cookie; /* completion cookie */ + struct lnet_msg *tx_lntmsg[2]; /* lnet msgs to finalize on completion */ + struct kib_msg *tx_msg; /* message buffer (host vaddr) */ + u64 tx_msgaddr; /* message buffer (I/O addr) */ + DEFINE_DMA_UNMAP_ADDR(tx_msgunmap); /* for dma_unmap_single() */ /** sge for tx_msgaddr */ struct ib_sge tx_msgsge; - int tx_nwrq; /* # send work items */ + int tx_nwrq; /* # send work items */ /* # used scatter/gather elements */ int tx_nsge; - struct ib_rdma_wr *tx_wrq; /* send work items... */ - struct ib_sge *tx_sge; /* ...and their memory */ - struct kib_rdma_desc *tx_rd; /* rdma descriptor */ - int tx_nfrags; /* # entries in... */ - struct scatterlist *tx_frags; /* dma_map_sg descriptor */ - u64 *tx_pages; /* rdma phys page addrs */ + struct ib_rdma_wr *tx_wrq; /* send work items... */ + struct ib_sge *tx_sge; /* ...and their memory */ + struct kib_rdma_desc *tx_rd; /* rdma descriptor */ + int tx_nfrags; /* # entries in... */ + struct scatterlist *tx_frags; /* dma_map_sg descriptor */ + u64 *tx_pages; /* rdma phys page addrs */ /* gaps in fragments */ bool tx_gaps; struct kib_fmr tx_fmr; /* FMR */ - int tx_dmadir; /* dma direction */ + int tx_dmadir; /* dma direction */ }; struct kib_connvars { - struct kib_msg cv_msg; /* connection-in-progress variables */ + struct kib_msg cv_msg; /* connection-in-progress variables */ }; struct kib_conn { - struct kib_sched_info *ibc_sched; /* scheduler information */ - struct kib_peer_ni *ibc_peer; /* owning peer_ni */ - struct kib_hca_dev *ibc_hdev; /* HCA bound on */ - struct list_head ibc_list; /* stash on peer_ni's conn list */ - struct list_head ibc_sched_list; /* schedule for attention */ - u16 ibc_version; /* version of connection */ + struct kib_sched_info *ibc_sched; /* scheduler information */ + struct kib_peer_ni *ibc_peer; /* owning peer_ni */ + struct kib_hca_dev *ibc_hdev; /* HCA bound on */ + struct list_head ibc_list; /* stash on peer_ni's conn list */ + struct list_head ibc_sched_list; /* schedule for attention */ + u16 ibc_version; /* version of connection */ /* reconnect later */ u16 ibc_reconnect:1; - u64 ibc_incarnation; /* which instance of the peer_ni */ - atomic_t ibc_refcount; /* # users */ - int ibc_state; /* what's happening */ - int ibc_nsends_posted; /* # uncompleted sends */ - int ibc_noops_posted; /* # uncompleted NOOPs */ - int ibc_credits; /* # credits I have */ - int ibc_outstanding_credits; /* # credits to return */ - int ibc_reserved_credits; /* # ACK/DONE msg credits */ - int ibc_comms_error; /* set on comms error */ + u64 ibc_incarnation;/* which instance of the peer_ni */ + atomic_t ibc_refcount; /* # users */ + int ibc_state; /* what's happening */ + int ibc_nsends_posted; /* # uncompleted sends */ + int ibc_noops_posted; /* # uncompleted NOOPs */ + int ibc_credits; /* # credits I have */ + int ibc_outstanding_credits; /* # credits to return */ + int ibc_reserved_credits; /* # ACK/DONE msg credits */ + int ibc_comms_error; /* set on comms error */ /* connections queue depth */ - u16 ibc_queue_depth; + u16 ibc_queue_depth; /* connections max frags */ - u16 ibc_max_frags; - unsigned int ibc_nrx:16; /* receive buffers owned */ - unsigned int ibc_scheduled:1; /* scheduled for attention */ - unsigned int ibc_ready:1; /* CQ callback fired */ + u16 ibc_max_frags; + unsigned int ibc_nrx:16; /* receive buffers owned */ + unsigned int ibc_scheduled:1;/* scheduled for attention */ + unsigned int ibc_ready:1; /* CQ callback fired */ ktime_t ibc_last_send; /* time of last send */ - struct list_head ibc_connd_list; /* link chain for */ - /* kiblnd_check_conns only */ - struct list_head ibc_early_rxs; /* rxs completed before ESTABLISHED */ - struct list_head ibc_tx_noops; /* IBLND_MSG_NOOPs for */ - /* IBLND_MSG_VERSION_1 */ - struct list_head ibc_tx_queue; /* sends that need a credit */ - struct list_head ibc_tx_queue_nocred; /* sends that don't need a */ - /* credit */ - struct list_head ibc_tx_queue_rsrvd; /* sends that need to */ - /* reserve an ACK/DONE msg */ - struct list_head ibc_active_txs; /* active tx awaiting completion */ - spinlock_t ibc_lock; /* serialise */ - struct kib_rx *ibc_rxs; /* the rx descs */ - struct kib_pages *ibc_rx_pages; /* premapped rx msg pages */ - - struct rdma_cm_id *ibc_cmid; /* CM id */ - struct ib_cq *ibc_cq; /* completion queue */ + struct list_head ibc_connd_list; /* link chain for */ + /* kiblnd_check_conns only */ + struct list_head ibc_early_rxs; /* rxs completed before ESTABLISHED */ + struct list_head ibc_tx_noops; /* IBLND_MSG_NOOPs for */ + /* IBLND_MSG_VERSION_1 */ + struct list_head ibc_tx_queue; /* sends that need a credit */ + struct list_head ibc_tx_queue_nocred; /* sends that don't need a */ + /* credit */ + struct list_head ibc_tx_queue_rsrvd; /* sends that need to */ + /* reserve an ACK/DONE msg */ + struct list_head ibc_active_txs; /* active tx awaiting completion */ + spinlock_t ibc_lock; /* serialise */ + struct kib_rx *ibc_rxs; /* the rx descs */ + struct kib_pages *ibc_rx_pages; /* premapped rx msg pages */ + + struct rdma_cm_id *ibc_cmid; /* CM id */ + struct ib_cq *ibc_cq; /* completion queue */ struct kib_connvars *ibc_connvars; /* in-progress connection state */ }; -#define IBLND_CONN_INIT 0 /* being initialised */ -#define IBLND_CONN_ACTIVE_CONNECT 1 /* active sending req */ -#define IBLND_CONN_PASSIVE_WAIT 2 /* passive waiting for rtu */ -#define IBLND_CONN_ESTABLISHED 3 /* connection established */ -#define IBLND_CONN_CLOSING 4 /* being closed */ -#define IBLND_CONN_DISCONNECTED 5 /* disconnected */ +#define IBLND_CONN_INIT 0 /* being initialised */ +#define IBLND_CONN_ACTIVE_CONNECT 1 /* active sending req */ +#define IBLND_CONN_PASSIVE_WAIT 2 /* passive waiting for rtu */ +#define IBLND_CONN_ESTABLISHED 3 /* connection established */ +#define IBLND_CONN_CLOSING 4 /* being closed */ +#define IBLND_CONN_DISCONNECTED 5 /* disconnected */ struct kib_peer_ni { - struct list_head ibp_list; /* stash on global peer_ni list */ - lnet_nid_t ibp_nid; /* who's on the other end(s) */ - struct lnet_ni *ibp_ni; /* LNet interface */ - struct list_head ibp_conns; /* all active connections */ - struct kib_conn *ibp_next_conn; /* next connection to send on for - * round robin */ - struct list_head ibp_tx_queue; /* msgs waiting for a conn */ - u64 ibp_incarnation; /* incarnation of peer_ni */ + struct list_head ibp_list; /* stash on global peer_ni list */ + lnet_nid_t ibp_nid; /* who's on the other end(s) */ + struct lnet_ni *ibp_ni; /* LNet interface */ + struct list_head ibp_conns; /* all active connections */ + struct kib_conn *ibp_next_conn; /* next connection to send on for + * round robin */ + struct list_head ibp_tx_queue; /* msgs waiting for a conn */ + u64 ibp_incarnation; /* incarnation of peer_ni */ /* when (in seconds) I was last alive */ time64_t ibp_last_alive; /* # users */ @@ -604,11 +606,11 @@ struct kib_peer_ni { /* # consecutive reconnection attempts to this peer_ni */ unsigned int ibp_reconnected; /* errno on closing this peer_ni */ - int ibp_error; + int ibp_error; /* max map_on_demand */ - u16 ibp_max_frags; + u16 ibp_max_frags; /* max_peer_credits */ - u16 ibp_queue_depth; + u16 ibp_queue_depth; }; extern struct kib_data kiblnd_data; @@ -647,11 +649,11 @@ struct kib_peer_ni { return dev->ibd_can_failover; } -#define kiblnd_conn_addref(conn) \ -do { \ - CDEBUG(D_NET, "conn[%p] (%d)++\n", \ - (conn), atomic_read(&(conn)->ibc_refcount)); \ - atomic_inc(&(conn)->ibc_refcount); \ +#define kiblnd_conn_addref(conn) \ +do { \ + CDEBUG(D_NET, "conn[%p] (%d)++\n", \ + (conn), atomic_read(&(conn)->ibc_refcount)); \ + atomic_inc(&(conn)->ibc_refcount); \ } while (0) #define kiblnd_conn_decref(conn) \ @@ -665,27 +667,27 @@ struct kib_peer_ni { spin_lock_irqsave(&kiblnd_data.kib_connd_lock, flags); \ list_add_tail(&(conn)->ibc_list, \ &kiblnd_data.kib_connd_zombies); \ - wake_up(&kiblnd_data.kib_connd_waitq); \ + wake_up(&kiblnd_data.kib_connd_waitq); \ spin_unlock_irqrestore(&kiblnd_data.kib_connd_lock, flags);\ } \ } while (0) -#define kiblnd_peer_addref(peer_ni) \ -do { \ - CDEBUG(D_NET, "peer_ni[%p] -> %s (%d)++\n", \ - (peer_ni), libcfs_nid2str((peer_ni)->ibp_nid), \ - atomic_read(&(peer_ni)->ibp_refcount)); \ - atomic_inc(&(peer_ni)->ibp_refcount); \ +#define kiblnd_peer_addref(peer_ni) \ +do { \ + CDEBUG(D_NET, "peer_ni[%p] -> %s (%d)++\n", \ + (peer_ni), libcfs_nid2str((peer_ni)->ibp_nid), \ + atomic_read(&(peer_ni)->ibp_refcount)); \ + atomic_inc(&(peer_ni)->ibp_refcount); \ } while (0) -#define kiblnd_peer_decref(peer_ni) \ -do { \ - CDEBUG(D_NET, "peer_ni[%p] -> %s (%d)--\n", \ - (peer_ni), libcfs_nid2str((peer_ni)->ibp_nid), \ - atomic_read(&(peer_ni)->ibp_refcount)); \ - LASSERT_ATOMIC_POS(&(peer_ni)->ibp_refcount); \ - if (atomic_dec_and_test(&(peer_ni)->ibp_refcount)) \ - kiblnd_destroy_peer(peer_ni); \ +#define kiblnd_peer_decref(peer_ni) \ +do { \ + CDEBUG(D_NET, "peer_ni[%p] -> %s (%d)--\n", \ + (peer_ni), libcfs_nid2str((peer_ni)->ibp_nid), \ + atomic_read(&(peer_ni)->ibp_refcount)); \ + LASSERT_ATOMIC_POS(&(peer_ni)->ibp_refcount); \ + if (atomic_dec_and_test(&(peer_ni)->ibp_refcount)) \ + kiblnd_destroy_peer(peer_ni); \ } while (0) static inline bool @@ -812,12 +814,12 @@ struct kib_peer_ni { /* CAVEAT EMPTOR: We rely on descriptor alignment to allow us to use the */ /* lowest bits of the work request id to stash the work item type. */ -#define IBLND_WID_INVAL 0 -#define IBLND_WID_TX 1 -#define IBLND_WID_RX 2 -#define IBLND_WID_RDMA 3 -#define IBLND_WID_MR 4 -#define IBLND_WID_MASK 7UL +#define IBLND_WID_INVAL 0 +#define IBLND_WID_TX 1 +#define IBLND_WID_RX 2 +#define IBLND_WID_RDMA 3 +#define IBLND_WID_MR 4 +#define IBLND_WID_MASK 7UL static inline u64 kiblnd_ptr2wreqid(void *ptr, int type) @@ -852,14 +854,14 @@ struct kib_peer_ni { kiblnd_init_msg(struct kib_msg *msg, int type, int body_nob) { msg->ibm_type = type; - msg->ibm_nob = offsetof(struct kib_msg, ibm_u) + body_nob; + msg->ibm_nob = offsetof(struct kib_msg, ibm_u) + body_nob; } static inline int kiblnd_rd_size(struct kib_rdma_desc *rd) { - int i; - int size; + int i; + int size; for (i = size = 0; i < rd->rd_nfrags; i++) size += rd->rd_frags[i].rf_nob; @@ -890,7 +892,7 @@ struct kib_peer_ni { { if (nob < rd->rd_frags[index].rf_nob) { rd->rd_frags[index].rf_addr += nob; - rd->rd_frags[index].rf_nob -= nob; + rd->rd_frags[index].rf_nob -= nob; } else { index++; } @@ -929,8 +931,8 @@ static inline void kiblnd_dma_unmap_single(struct ib_device *dev, ib_dma_unmap_single(dev, addr, size, direction); } -#define KIBLND_UNMAP_ADDR_SET(p, m, a) do {} while (0) -#define KIBLND_UNMAP_ADDR(p, m, a) (a) +#define KIBLND_UNMAP_ADDR_SET(p, m, a) do {} while (0) +#define KIBLND_UNMAP_ADDR(p, m, a) (a) static inline int kiblnd_dma_map_sg(struct ib_device *dev, struct scatterlist *sg, int nents, @@ -962,34 +964,34 @@ static inline unsigned int kiblnd_sg_dma_len(struct ib_device *dev, /* right because OFED1.2 defines it as const, to use it we have to add */ /* (void *) cast to overcome "const" */ -#define KIBLND_CONN_PARAM(e) ((e)->param.conn.private_data) -#define KIBLND_CONN_PARAM_LEN(e) ((e)->param.conn.private_data_len) +#define KIBLND_CONN_PARAM(e) ((e)->param.conn.private_data) +#define KIBLND_CONN_PARAM_LEN(e) ((e)->param.conn.private_data_len) void kiblnd_map_rx_descs(struct kib_conn *conn); void kiblnd_unmap_rx_descs(struct kib_conn *conn); void kiblnd_pool_free_node(struct kib_pool *pool, struct list_head *node); struct list_head *kiblnd_pool_alloc_node(struct kib_poolset *ps); -int kiblnd_fmr_pool_map(struct kib_fmr_poolset *fps, struct kib_tx *tx, - struct kib_rdma_desc *rd, u32 nob, u64 iov, - struct kib_fmr *fmr); +int kiblnd_fmr_pool_map(struct kib_fmr_poolset *fps, struct kib_tx *tx, + struct kib_rdma_desc *rd, u32 nob, u64 iov, + struct kib_fmr *fmr); void kiblnd_fmr_pool_unmap(struct kib_fmr *fmr, int status); int kiblnd_tunables_setup(struct lnet_ni *ni); void kiblnd_tunables_init(void); -int kiblnd_connd(void *arg); -int kiblnd_scheduler(void *arg); -int kiblnd_thread_start(int (*fn)(void *arg), void *arg, char *name); -int kiblnd_failover_thread(void *arg); +int kiblnd_connd(void *arg); +int kiblnd_scheduler(void *arg); +int kiblnd_thread_start(int (*fn)(void *arg), void *arg, char *name); +int kiblnd_failover_thread(void *arg); -int kiblnd_alloc_pages(struct kib_pages **pp, int cpt, int npages); +int kiblnd_alloc_pages(struct kib_pages **pp, int cpt, int npages); -int kiblnd_cm_callback(struct rdma_cm_id *cmid, - struct rdma_cm_event *event); -int kiblnd_translate_mtu(int value); +int kiblnd_cm_callback(struct rdma_cm_id *cmid, + struct rdma_cm_event *event); +int kiblnd_translate_mtu(int value); -int kiblnd_dev_failover(struct kib_dev *dev); +int kiblnd_dev_failover(struct kib_dev *dev); int kiblnd_create_peer(struct lnet_ni *ni, struct kib_peer_ni **peerp, lnet_nid_t nid); void kiblnd_destroy_peer(struct kib_peer_ni *peer_ni); @@ -997,9 +999,9 @@ int kiblnd_create_peer(struct lnet_ni *ni, struct kib_peer_ni **peerp, void kiblnd_destroy_dev(struct kib_dev *dev); void kiblnd_unlink_peer_locked(struct kib_peer_ni *peer_ni); struct kib_peer_ni *kiblnd_find_peer_locked(struct lnet_ni *ni, lnet_nid_t nid); -int kiblnd_close_stale_conns_locked(struct kib_peer_ni *peer_ni, - int version, u64 incarnation); -int kiblnd_close_peer_conns_locked(struct kib_peer_ni *peer_ni, int why); +int kiblnd_close_stale_conns_locked(struct kib_peer_ni *peer_ni, + int version, u64 incarnation); +int kiblnd_close_peer_conns_locked(struct kib_peer_ni *peer_ni, int why); struct kib_conn *kiblnd_create_conn(struct kib_peer_ni *peer_ni, struct rdma_cm_id *cmid, @@ -1017,8 +1019,8 @@ struct kib_conn *kiblnd_create_conn(struct kib_peer_ni *peer_ni, void kiblnd_pack_msg(struct lnet_ni *ni, struct kib_msg *msg, int version, int credits, lnet_nid_t dstnid, u64 dststamp); -int kiblnd_unpack_msg(struct kib_msg *msg, int nob); -int kiblnd_post_rx(struct kib_rx *rx, int credit); +int kiblnd_unpack_msg(struct kib_msg *msg, int nob); +int kiblnd_post_rx(struct kib_rx *rx, int credit); int kiblnd_send(struct lnet_ni *ni, void *private, struct lnet_msg *lntmsg); int kiblnd_recv(struct lnet_ni *ni, void *private, struct lnet_msg *lntmsg, diff --git a/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c b/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c index 48f2814..ad17260 100644 --- a/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c +++ b/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c @@ -167,14 +167,14 @@ static int kiblnd_init_rdma(struct kib_conn *conn, struct kib_tx *tx, int type, credit == IBLND_POSTRX_PEER_CREDIT || credit == IBLND_POSTRX_RSRVD_CREDIT); - rx->rx_sge.lkey = conn->ibc_hdev->ibh_pd->local_dma_lkey; - rx->rx_sge.addr = rx->rx_msgaddr; + rx->rx_sge.lkey = conn->ibc_hdev->ibh_pd->local_dma_lkey; + rx->rx_sge.addr = rx->rx_msgaddr; rx->rx_sge.length = IBLND_MSG_SIZE; - rx->rx_wrq.next = NULL; + rx->rx_wrq.next = NULL; rx->rx_wrq.sg_list = &rx->rx_sge; rx->rx_wrq.num_sge = 1; - rx->rx_wrq.wr_id = kiblnd_ptr2wreqid(rx, IBLND_WID_RX); + rx->rx_wrq.wr_id = kiblnd_ptr2wreqid(rx, IBLND_WID_RX); LASSERT(conn->ibc_state >= IBLND_CONN_INIT); LASSERT(rx->rx_nob >= 0); /* not posted */ @@ -528,10 +528,10 @@ static int kiblnd_init_rdma(struct kib_conn *conn, struct kib_tx *tx, int type, kiblnd_handle_rx(rx); return; - failed: +failed: CDEBUG(D_NET, "rx %p conn %p\n", rx, conn); kiblnd_close_conn(conn, err); - ignore: +ignore: kiblnd_drop_rx(rx); /* Don't re-post rx. */ } @@ -1068,17 +1068,17 @@ static int kiblnd_map_tx(struct lnet_ni *ni, struct kib_tx *tx, kiblnd_init_msg(tx->tx_msg, type, body_nob); - sge->lkey = hdev->ibh_pd->local_dma_lkey; - sge->addr = tx->tx_msgaddr; + sge->lkey = hdev->ibh_pd->local_dma_lkey; + sge->addr = tx->tx_msgaddr; sge->length = nob; memset(wrq, 0, sizeof(*wrq)); - wrq->wr.next = NULL; - wrq->wr.wr_id = kiblnd_ptr2wreqid(tx, IBLND_WID_TX); - wrq->wr.sg_list = sge; - wrq->wr.num_sge = 1; - wrq->wr.opcode = IB_WR_SEND; + wrq->wr.next = NULL; + wrq->wr.wr_id = kiblnd_ptr2wreqid(tx, IBLND_WID_TX); + wrq->wr.sg_list = sge; + wrq->wr.num_sge = 1; + wrq->wr.opcode = IB_WR_SEND; wrq->wr.send_flags = IB_SEND_SIGNALED; tx->tx_nwrq++; @@ -1133,8 +1133,8 @@ static int kiblnd_map_tx(struct lnet_ni *ni, struct kib_tx *tx, (u32)resid); sge = &tx->tx_sge[tx->tx_nsge]; - sge->addr = kiblnd_rd_frag_addr(srcrd, srcidx); - sge->lkey = kiblnd_rd_frag_key(srcrd, srcidx); + sge->addr = kiblnd_rd_frag_addr(srcrd, srcidx); + sge->lkey = kiblnd_rd_frag_key(srcrd, srcidx); sge->length = sge_nob; if (wrq_sge == 0) { @@ -1329,12 +1329,12 @@ static int kiblnd_resolve_addr(struct rdma_cm_id *cmid, return; - failed2: +failed2: kiblnd_peer_connect_failed(peer_ni, 1, rc); kiblnd_peer_decref(peer_ni); /* cmid's ref */ rdma_destroy_id(cmid); return; - failed: +failed: kiblnd_peer_connect_failed(peer_ni, 1, rc); } @@ -1397,7 +1397,7 @@ static int kiblnd_resolve_addr(struct rdma_cm_id *cmid, rwlock_t *g_lock = &kiblnd_data.kib_global_lock; unsigned long flags; int rc; - int i; + int i; struct lnet_ioctl_config_o2iblnd_tunables *tunables; /* @@ -1529,7 +1529,7 @@ static int kiblnd_resolve_addr(struct rdma_cm_id *cmid, unsigned int payload_nob = lntmsg->msg_len; struct iov_iter from; struct kib_msg *ibmsg; - struct kib_rdma_desc *rd; + struct kib_rdma_desc *rd; struct kib_tx *tx; int nob; int rc; @@ -1747,9 +1747,9 @@ static int kiblnd_resolve_addr(struct rdma_cm_id *cmid, kiblnd_queue_tx(tx, rx->rx_conn); return; - failed_1: +failed_1: kiblnd_tx_done(tx); - failed_0: +failed_0: lnet_finalize(lntmsg, -EIO); } @@ -1797,7 +1797,7 @@ static int kiblnd_resolve_addr(struct rdma_cm_id *cmid, case IBLND_MSG_PUT_REQ: { u64 ibprm_cookie = rxmsg->ibm_u.putreq.ibprm_cookie; - struct kib_msg *txmsg; + struct kib_msg *txmsg; struct kib_rdma_desc *rd; if (!iov_iter_count(to)) { @@ -2193,15 +2193,15 @@ static int kiblnd_resolve_addr(struct rdma_cm_id *cmid, peer_ni->ibp_accepting--; if (!peer_ni->ibp_version) { - peer_ni->ibp_version = conn->ibc_version; + peer_ni->ibp_version = conn->ibc_version; peer_ni->ibp_incarnation = conn->ibc_incarnation; } - if (peer_ni->ibp_version != conn->ibc_version || + if (peer_ni->ibp_version != conn->ibc_version || peer_ni->ibp_incarnation != conn->ibc_incarnation) { kiblnd_close_stale_conns_locked(peer_ni, conn->ibc_version, conn->ibc_incarnation); - peer_ni->ibp_version = conn->ibc_version; + peer_ni->ibp_version = conn->ibc_version; peer_ni->ibp_incarnation = conn->ibc_incarnation; } @@ -2431,13 +2431,13 @@ static int kiblnd_resolve_addr(struct rdma_cm_id *cmid, peer2 = kiblnd_find_peer_locked(ni, nid); if (peer2) { if (!peer2->ibp_version) { - peer2->ibp_version = version; + peer2->ibp_version = version; peer2->ibp_incarnation = reqmsg->ibm_srcstamp; } /* not the guy I've talked with */ if (peer2->ibp_incarnation != reqmsg->ibm_srcstamp || - peer2->ibp_version != version) { + peer2->ibp_version != version) { kiblnd_close_peer_conns_locked(peer2, -ESTALE); if (kiblnd_peer_active(peer2)) { @@ -2506,8 +2506,8 @@ static int kiblnd_resolve_addr(struct rdma_cm_id *cmid, LASSERT(!peer_ni->ibp_version && !peer_ni->ibp_incarnation); - peer_ni->ibp_accepting = 1; - peer_ni->ibp_version = version; + peer_ni->ibp_accepting = 1; + peer_ni->ibp_version = version; peer_ni->ibp_incarnation = reqmsg->ibm_srcstamp; /* I have a ref on ni that prevents it being shutdown */ @@ -2532,8 +2532,8 @@ static int kiblnd_resolve_addr(struct rdma_cm_id *cmid, * conn now "owns" cmid, so I return success from here on to ensure the * CM callback doesn't destroy cmid. */ - conn->ibc_incarnation = reqmsg->ibm_srcstamp; - conn->ibc_credits = conn->ibc_queue_depth; + conn->ibc_incarnation = reqmsg->ibm_srcstamp; + conn->ibc_credits = conn->ibc_queue_depth; conn->ibc_reserved_credits = conn->ibc_queue_depth; LASSERT(conn->ibc_credits + conn->ibc_reserved_credits + IBLND_OOB_MSGS(version) <= IBLND_RX_MSGS(conn)); @@ -2564,7 +2564,7 @@ static int kiblnd_resolve_addr(struct rdma_cm_id *cmid, if (rc) { CERROR("Can't accept %s: %d\n", libcfs_nid2str(nid), rc); rej.ibr_version = version; - rej.ibr_why = IBLND_REJECT_FATAL; + rej.ibr_why = IBLND_REJECT_FATAL; kiblnd_reject(cmid, &rej); kiblnd_connreq_done(conn, rc); @@ -2574,14 +2574,14 @@ static int kiblnd_resolve_addr(struct rdma_cm_id *cmid, lnet_ni_decref(ni); return 0; - failed: +failed: if (ni) { rej.ibr_cp.ibcp_queue_depth = kiblnd_msg_queue_size(version, ni); rej.ibr_cp.ibcp_max_frags = IBLND_MAX_RDMA_FRAGS; lnet_ni_decref(ni); } - rej.ibr_version = version; + rej.ibr_version = version; kiblnd_reject(cmid, &rej); return -ECONNREFUSED; @@ -2789,7 +2789,7 @@ static int kiblnd_resolve_addr(struct rdma_cm_id *cmid, break; } - if (rej->ibr_why == IBLND_REJECT_FATAL && + if (rej->ibr_why == IBLND_REJECT_FATAL && rej->ibr_version == IBLND_MSG_VERSION_1) { CDEBUG(D_NET, "rejected by old version peer_ni %s: %x\n", @@ -2927,7 +2927,7 @@ static int kiblnd_resolve_addr(struct rdma_cm_id *cmid, kiblnd_connreq_done(conn, 0); return; - failed: +failed: /* * NB My QP has already established itself, so I handle anything going * wrong here by setting ibc_comms_error. @@ -2985,12 +2985,12 @@ static int kiblnd_resolve_addr(struct rdma_cm_id *cmid, memset(&cp, 0, sizeof(cp)); cp.private_data = msg; - cp.private_data_len = msg->ibm_nob; + cp.private_data_len = msg->ibm_nob; cp.responder_resources = 0; /* No atomic ops or RDMA reads */ - cp.initiator_depth = 0; - cp.flow_control = 1; - cp.retry_count = *kiblnd_tunables.kib_retry_count; - cp.rnr_retry_count = *kiblnd_tunables.kib_rnr_retry_count; + cp.initiator_depth = 0; + cp.flow_control = 1; + cp.retry_count = *kiblnd_tunables.kib_retry_count; + cp.rnr_retry_count = *kiblnd_tunables.kib_rnr_retry_count; LASSERT(cmid->context == (void *)conn); LASSERT(conn->ibc_cmid == cmid); @@ -3217,11 +3217,11 @@ static int kiblnd_resolve_addr(struct rdma_cm_id *cmid, static int kiblnd_conn_timed_out_locked(struct kib_conn *conn) { - return kiblnd_check_txs_locked(conn, &conn->ibc_tx_queue) || - kiblnd_check_txs_locked(conn, &conn->ibc_tx_noops) || - kiblnd_check_txs_locked(conn, &conn->ibc_tx_queue_rsrvd) || - kiblnd_check_txs_locked(conn, &conn->ibc_tx_queue_nocred) || - kiblnd_check_txs_locked(conn, &conn->ibc_active_txs); + return kiblnd_check_txs_locked(conn, &conn->ibc_tx_queue) || + kiblnd_check_txs_locked(conn, &conn->ibc_tx_noops) || + kiblnd_check_txs_locked(conn, &conn->ibc_tx_queue_rsrvd) || + kiblnd_check_txs_locked(conn, &conn->ibc_tx_queue_nocred) || + kiblnd_check_txs_locked(conn, &conn->ibc_active_txs); } static void @@ -3561,9 +3561,9 @@ static int kiblnd_resolve_addr(struct rdma_cm_id *cmid, { /* * NB I'm not allowed to schedule this conn once its refcount has - * reached 0. Since fundamentally I'm racing with scheduler threads + * reached 0. Since fundamentally I'm racing with scheduler threads * consuming my CQ I could be called after all completions have - * occurred. But in this case, !ibc_nrx && !ibc_nsends_posted + * occurred. But in this case, !ibc_nrx && !ibc_nsends_posted * and this CQ is about to be destroyed so I NOOP. */ struct kib_conn *conn = arg; @@ -3793,8 +3793,7 @@ static int kiblnd_resolve_addr(struct rdma_cm_id *cmid, add_wait_queue(&kiblnd_data.kib_failover_waitq, &wait); write_unlock_irqrestore(glock, flags); - rc = schedule_timeout(long_sleep ? 10 * HZ : - HZ); + rc = schedule_timeout(long_sleep ? 10 * HZ : HZ); remove_wait_queue(&kiblnd_data.kib_failover_waitq, &wait); write_lock_irqsave(glock, flags); diff --git a/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_modparams.c b/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_modparams.c index 47e8a60..9fb1357 100644 --- a/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_modparams.c +++ b/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_modparams.c @@ -183,17 +183,17 @@ MODULE_PARM_DESC(wrq_sge, "# scatter/gather element per work request"); struct kib_tunables kiblnd_tunables = { - .kib_dev_failover = &dev_failover, - .kib_service = &service, - .kib_cksum = &cksum, - .kib_timeout = &timeout, - .kib_keepalive = &keepalive, - .kib_default_ipif = &ipif_name, - .kib_retry_count = &retry_count, - .kib_rnr_retry_count = &rnr_retry_count, - .kib_ib_mtu = &ib_mtu, - .kib_require_priv_port = &require_privileged_port, - .kib_use_priv_port = &use_privileged_port, + .kib_dev_failover = &dev_failover, + .kib_service = &service, + .kib_cksum = &cksum, + .kib_timeout = &timeout, + .kib_keepalive = &keepalive, + .kib_default_ipif = &ipif_name, + .kib_retry_count = &retry_count, + .kib_rnr_retry_count = &rnr_retry_count, + .kib_ib_mtu = &ib_mtu, + .kib_require_priv_port = &require_privileged_port, + .kib_use_priv_port = &use_privileged_port, .kib_nscheds = &nscheds, .kib_wrq_sge = &wrq_sge, .kib_use_fastreg_gaps = &use_fastreg_gaps, -- 1.8.3.1 From jsimmons at infradead.org Thu Jan 31 17:46:14 2019 From: jsimmons at infradead.org (James Simmons) Date: Thu, 31 Jan 2019 17:46:14 +0000 (GMT) Subject: [lustre-devel] LibCFS and LNET module versions In-Reply-To: <41616FC6-B2B4-4B72-B7D6-69D1B5713653@amazon.com> References: <41616FC6-B2B4-4B72-B7D6-69D1B5713653@amazon.com> Message-ID: > All Lustre modules uses the Lustre version as their module version except for lnet and libcfs modules. Is there a specific > reason to that? The idea here is that lnet/libcfs is really an independent layer from lustre. In theory other sub systems could use it. Its true we don't really have a numbering system. Suggestions? > These version are hardcoded and never change. Tools like dkms could think some libcfs modules are the same because the version > is the same but actually it changed a lot. > > Until we decide to properly manage a real version for these modules, could it be possible to also use Lustre version for them?