From fa08092d9a1554dc733640b6328fcaf3e85fec36 Mon Sep 17 00:00:00 2001 From: Arshad Hussain Date: Thu, 22 Feb 2024 14:53:39 +0530 Subject: [PATCH] LU-6142 llite: Fix style issues under lustre/llite This patch fixes issues reported by checkpatch for all files under folder lustre/llite Test-Parameters: trivial Signed-off-by: Arshad Hussain Change-Id: I5906f10d4704d844103b3a75f1ed1f4bb0effcd4 Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/54138 Tested-by: jenkins Tested-by: Maloo Reviewed-by: Andreas Dilger Reviewed-by: Timothy Day Reviewed-by: Oleg Drokin --- lustre/llite/dcache.c | 38 +++++++++-------- lustre/llite/dir.c | 102 +++++++++++++++++++++++++-------------------- lustre/llite/glimpse.c | 3 +- lustre/llite/statahead.c | 7 ++-- lustre/llite/super25.c | 7 ++-- lustre/llite/vvp_object.c | 1 - lustre/llite/vvp_page.c | 3 +- lustre/llite/xattr_cache.c | 16 +++---- 8 files changed, 97 insertions(+), 80 deletions(-) diff --git a/lustre/llite/dcache.c b/lustre/llite/dcache.c index 03a8dcd..9fdd487 100644 --- a/lustre/llite/dcache.c +++ b/lustre/llite/dcache.c @@ -52,12 +52,13 @@ static void free_dentry_data(struct rcu_head *head) /* should NOT be called with the dcache lock, see fs/dcache.c */ static void ll_release(struct dentry *de) { - struct ll_dentry_data *lld; - ENTRY; - LASSERT(de != NULL); - lld = ll_d2d(de); - if (lld == NULL) /* NFS copies the de->d_op methods (bug 4655) */ - RETURN_EXIT; + struct ll_dentry_data *lld; + + ENTRY; + LASSERT(de != NULL); + lld = ll_d2d(de); + if (lld == NULL) /* NFS copies the de->d_op methods (bug 4655) */ + RETURN_EXIT; de->d_fsdata = NULL; call_rcu(&lld->lld_rcu_head, free_dentry_data); @@ -197,7 +198,8 @@ void ll_intent_drop_lock(struct lookup_intent *it) ldlm_lock_decref(&handle, it->it_lock_mode); /* bug 494: intent_release may be called multiple times, from - * this thread and we don't want to double-decref this lock */ + * this thread and we don't want to double-decref this lock + */ it->it_lock_mode = 0; if (it->it_remote_lock_mode != 0) { handle.cookie = it->it_remote_lock_handle; @@ -214,12 +216,12 @@ void ll_intent_drop_lock(struct lookup_intent *it) void ll_intent_release(struct lookup_intent *it) { - ENTRY; + ENTRY; - CDEBUG(D_INFO, "intent %p released\n", it); - ll_intent_drop_lock(it); - /* We are still holding extra reference on a request, need to free it */ - if (it_disposition(it, DISP_ENQ_OPEN_REF)) + CDEBUG(D_INFO, "intent %p released\n", it); + ll_intent_drop_lock(it); + /* We are still holding extra reference on a request, need to free it */ + if (it_disposition(it, DISP_ENQ_OPEN_REF)) ptlrpc_req_finished(it->it_request); /* ll_file_open */ if (it_disposition(it, DISP_ENQ_CREATE_REF)) /* create rec */ @@ -234,6 +236,7 @@ void ll_intent_release(struct lookup_intent *it) void ll_prune_aliases(struct inode *inode) { struct dentry *dentry; + ENTRY; LASSERT(inode != NULL); @@ -248,7 +251,7 @@ void ll_prune_aliases(struct inode *inode) d_prune_aliases(inode); - EXIT; + EXIT; } int ll_revalidate_it_finish(struct ptlrpc_request *request, @@ -259,7 +262,7 @@ int ll_revalidate_it_finish(struct ptlrpc_request *request, __u64 bits = 0; int rc = 0; - ENTRY; + ENTRY; if (!request) RETURN(0); @@ -321,9 +324,10 @@ static int ll_revalidate_dentry(struct dentry *dentry, if (rc != 1) return rc; - /* If this is intermediate component path lookup and we were able to get - * to this dentry, then its lock has not been revoked and the - * path component is valid. */ + /* If this is intermediate component path lookup and were able to get to + * this dentry, then its lock has not been revoked and the + * path component is valid. + */ if (lookup_flags & (LOOKUP_CONTINUE | LOOKUP_PARENT)) { if (dentry->d_inode && S_ISDIR(dentry->d_inode->i_mode)) { parent = dget_parent(dentry); diff --git a/lustre/llite/dir.c b/lustre/llite/dir.c index 04d7999..a570b23 100644 --- a/lustre/llite/dir.c +++ b/lustre/llite/dir.c @@ -166,7 +166,8 @@ void ll_release_page(struct inode *inode, struct page *page, kunmap(page); /* Always remove the page for striped dir, because the page is - * built from temporarily in LMV layer */ + * built from temporarily in LMV layer + */ if (inode && ll_dir_striped(inode)) { __free_page(page); return; @@ -198,6 +199,7 @@ int ll_dir_read(struct inode *inode, __u64 *ppos, struct md_op_data *op_data, bool done = false; struct llcrypt_str lltr = LLTR_INIT(NULL, 0); int rc = 0; + ENTRY; if (IS_ENCRYPTED(inode)) { @@ -246,7 +248,8 @@ int ll_dir_read(struct inode *inode, __u64 *ppos, struct md_op_data *op_data, type = S_DT(lu_dirent_type_get(ent)); /* For ll_nfs_get_name_filldir(), it will try to access * 'ent' through 'lde_name', so the parameter 'name' - * for 'filldir()' must be part of the 'ent'. */ + * for 'filldir()' must be part of the 'ent'. + */ #ifdef HAVE_DIR_CONTEXT ctx->pos = lhash; if (!IS_ENCRYPTED(inode)) { @@ -363,8 +366,7 @@ static int ll_readdir(struct file *filp, void *cookie, filldir_t filldir) } dput(parent); - /* If it can not find in cache, do lookup .. on the master - * object */ + /* If it can not find in cache, do lookup on the master obj */ if (fid_is_zero(&pfid)) { rc = ll_dir_get_parent_fid(inode, &pfid); if (rc != 0) @@ -421,7 +423,7 @@ out: RETURN(rc); } -/** +/* * Create striped directory with specified stripe(@lump) * * \param[in] dparent the parent of the directory. @@ -530,7 +532,8 @@ static int ll_dir_setdirstripe(struct dentry *dparent, struct lmv_user_md *lump, if (test_bit(LL_SBI_FILE_SECCTX, sbi->ll_flags)) { /* selinux_dentry_init_security() uses dentry->d_parent and name * to determine the security context for the file. So our fake - * dentry should be real enough for this purpose. */ + * dentry should be real enough for this purpose. + */ err = ll_dentry_init_security(&dentry, mode, &dentry.d_name, &op_data->op_file_secctx_name, &op_data->op_file_secctx_name_size, @@ -600,8 +603,8 @@ int ll_dir_setstripe(struct inode *inode, struct lov_user_md *lump, struct ptlrpc_request *req = NULL; int rc = 0; int lum_size; - ENTRY; + ENTRY; if (lump != NULL) { switch (lump->lmm_magic) { case LOV_USER_MAGIC_V1: @@ -832,7 +835,7 @@ out: return rc; } -/** +/* * This function will be used to get default LOV/LMV/Default LMV * @valid will be used to indicate which stripe it will retrieve. * If the directory does not have its own default layout, then the @@ -852,8 +855,8 @@ int ll_dir_getstripe_default(struct inode *inode, void **plmm, int *plmm_size, struct lov_mds_md *lmm = NULL; int lmm_size = 0; int rc = 0; - ENTRY; + ENTRY; rc = ll_dir_get_default_layout(inode, (void **)&lmm, &lmm_size, &req, valid, 0); if (rc == -ENODATA && !fid_is_root(ll_inode2fid(inode)) && @@ -874,7 +877,7 @@ int ll_dir_getstripe_default(struct inode *inode, void **plmm, int *plmm_size, RETURN(rc); } -/** +/* * This function will be used to get default LOV/LMV/Default LMV * @valid will be used to indicate which stripe it will retrieve * OBD_MD_MEA LMV stripe EA @@ -889,8 +892,8 @@ int ll_dir_getstripe(struct inode *inode, void **plmm, int *plmm_size, struct lov_mds_md *lmm = NULL; int lmm_size = 0; int rc = 0; - ENTRY; + ENTRY; rc = ll_dir_get_default_layout(inode, (void **)&lmm, &lmm_size, &req, valid, 0); @@ -903,11 +906,11 @@ int ll_dir_getstripe(struct inode *inode, void **plmm, int *plmm_size, int ll_get_mdt_idx_by_fid(struct ll_sb_info *sbi, const struct lu_fid *fid) { - struct md_op_data *op_data; - int rc; - int mdt_index; - ENTRY; + struct md_op_data *op_data; + int rc; + int mdt_index; + ENTRY; OBD_ALLOC_PTR(op_data); if (op_data == NULL) RETURN(-ENOMEM); @@ -931,7 +934,7 @@ int ll_get_mdt_idx(struct inode *inode) return ll_get_mdt_idx_by_fid(ll_i2sbi(inode), ll_inode2fid(inode)); } -/** +/* * Generic handler to do any pre-copy work. * * It sends a first hsm_progress (with extent length == 0) to coordinator as a @@ -944,12 +947,12 @@ 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; - int rc = 0; - int rc2; - ENTRY; + struct ll_sb_info *sbi = ll_s2sbi(sb); + struct hsm_progress_kernel hpk; + int rc = 0; + int rc2; + ENTRY; /* Forge a hsm_progress based on data from copy. */ hpk.hpk_fid = copy->hc_hai.hai_fid; hpk.hpk_cookie = copy->hc_hai.hai_cookie; @@ -990,7 +993,8 @@ static int ll_ioc_copy_start(struct super_block *sb, struct hsm_copy *copy) } /* Store in the hsm_copy for later copytool use. - * Always modified even if no lsm. */ + * Always modified even if no lsm. + */ copy->hc_data_version = data_version; } @@ -1006,7 +1010,7 @@ progress: RETURN(rc != 0 ? rc : rc2); } -/** +/* * Generic handler to do any post-copy work. * * It will send the last hsm_progress update to coordinator to inform it @@ -1023,12 +1027,12 @@ progress: */ 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; - int rc = 0; - int rc2; - ENTRY; + struct ll_sb_info *sbi = ll_s2sbi(sb); + struct hsm_progress_kernel hpk; + int rc = 0; + int rc2; + ENTRY; /* If you modify the logic here, also check llapi_hsm_copy_end(). */ /* Take care: copy->hc_hai.hai_action, len, gid and data are not * initialized if copy_end was called with copy == NULL. @@ -1073,11 +1077,13 @@ static int ll_ioc_copy_end(struct super_block *sb, struct hsm_copy *copy) } /* Store in the hsm_copy for later copytool use. - * Always modified even if no lsm. */ + * Always modified even if no lsm. + */ hpk.hpk_data_version = data_version; /* File could have been stripped during archiving, so we need - * to check anyway. */ + * to check anyway. + */ if ((copy->hc_hai.hai_action == HSMA_ARCHIVE) && (copy->hc_data_version != data_version)) { CDEBUG(D_HSM, "File data version mismatched. " @@ -1090,7 +1096,8 @@ static int ll_ioc_copy_end(struct super_block *sb, struct hsm_copy *copy) * the cdt will loop on retried archive requests. * The policy engine will ask for a new archive later * when the file will not be modified for some tunable - * time */ + * time + */ hpk.hpk_flags &= ~HP_FLAG_RETRY; rc = -EBUSY; /* hpk_errval must be >= 0 */ @@ -1798,8 +1805,8 @@ static int ll_rmfid(struct file *file, void __user *arg) unsigned int nr; bool lfa_flag = false; /* lfa already free'ed */ size_t size; - ENTRY; + ENTRY; if (!capable(CAP_DAC_READ_SEARCH) && !test_bit(LL_SBI_USER_FID2PATH, ll_i2sbi(inode)->ll_flags)) RETURN(-EPERM); @@ -1918,9 +1925,9 @@ free_lfa: RETURN(rc); } -/* This function tries to get a single name component, - * to send to the server. No actual path traversal involved, - * so we limit to NAME_MAX */ +/* This function tries to get a single name component, to send to the server. + * No actual path traversal involved, so we limit to NAME_MAX + */ static char *ll_getname(const char __user *filename) { int ret = 0, len; @@ -1956,8 +1963,8 @@ static long ll_dir_ioctl(struct file *file, unsigned int cmd, unsigned long arg) struct obd_ioctl_data *data = NULL; void __user *uarg = (void __user *)arg; int rc = 0; - ENTRY; + ENTRY; CDEBUG(D_VFSTRACE|D_IOCTL, "VFS Op:inode="DFID"(%pK) cmd=%x arg=%lx\n", PFID(ll_inode2fid(inode)), inode, cmd, arg); @@ -2145,7 +2152,8 @@ out: max_stripe_count = lum.lum_stripe_count; /* lum_magic will indicate which stripe the ioctl will like * to get, LMV_MAGIC_V1 is for normal LMV stripe, LMV_USER_MAGIC - * is for default LMV stripe */ + * is for default LMV stripe + */ if (lum.lum_magic == LMV_MAGIC_V1) valid |= OBD_MD_MEA; else if (lum.lum_magic == LMV_USER_MAGIC) @@ -2244,15 +2252,16 @@ finish_req: return rc; } case LL_IOC_REMOVE_ENTRY: { - char *filename = NULL; - int namelen = 0; - int rc; + char *filename = NULL; + int namelen = 0; + int rc; /* Here is a little hack to avoid sending REINT_RMENTRY to * unsupported server, which might crash the server(LU-2730), * Because both LVB_TYPE and REINT_RMENTRY will be supported * on 2.4, we use OBD_CONNECT_LVB_TYPE to detect whether the - * server will support REINT_RMENTRY XXX*/ + * server will support REINT_RMENTRY XXX + */ if (!(exp_connect_flags(sbi->ll_md_exp) & OBD_CONNECT_LVB_TYPE)) RETURN(-EOPNOTSUPP); @@ -2353,7 +2362,8 @@ out_rmdir: if (lmmsize == 0) { /* If the file has no striping then zero out *lump so - * that the caller isn't confused by garbage. */ + * that the caller isn't confused by garbage. + */ if (clear_user(lump, sizeof(*lump))) GOTO(out_req, rc = -EFAULT); } else if (copy_to_user(lump, lmm, lmmsize)) { @@ -2427,7 +2437,8 @@ out_rmdir: * set, also set ext4 equivalent to please statx */ if (body->mbo_flags & LUSTRE_ENCRYPT_FL) - stx.stx_attributes |= STATX_ATTR_ENCRYPTED; + stx.stx_attributes |= + STATX_ATTR_ENCRYPTED; } /* For a striped directory, the size and blocks returned @@ -2614,7 +2625,8 @@ out_hur: hpk.hpk_data_version = 0; /* File may not exist in Lustre; all progress - * reported to Lustre root */ + * reported to Lustre root + */ rc = obd_iocontrol(cmd, sbi->ll_md_exp, sizeof(hpk), &hpk, NULL); RETURN(rc); @@ -2806,8 +2818,8 @@ static loff_t ll_dir_seek(struct file *file, loff_t offset, int origin) struct ll_sb_info *sbi = ll_i2sbi(inode); int api32 = ll_need_32bit_api(sbi); loff_t ret = -EINVAL; - ENTRY; + ENTRY; ll_inode_lock(inode); switch (origin) { case SEEK_SET: diff --git a/lustre/llite/glimpse.c b/lustre/llite/glimpse.c index 5c1919c..275bf99 100644 --- a/lustre/llite/glimpse.c +++ b/lustre/llite/glimpse.c @@ -101,7 +101,8 @@ int cl_glimpse_lock(const struct lu_env *env, struct cl_io *io, * if there were no conflicting locks. If there * were conflicting locks, enqueuing or waiting * fails with -ENAVAIL, but valid inode - * attributes are returned anyway. */ + * attributes are returned anyway. + */ *descr = whole_file; descr->cld_obj = clob; descr->cld_mode = CLM_READ; diff --git a/lustre/llite/statahead.c b/lustre/llite/statahead.c index f798e3b..e2c835e 100644 --- a/lustre/llite/statahead.c +++ b/lustre/llite/statahead.c @@ -1246,7 +1246,8 @@ static int ll_statahead_by_list(struct dentry *parent) while (({set_current_state(TASK_IDLE); /* matches smp_store_release() in - * ll_deauthorize_statahead() */ + * ll_deauthorize_statahead() + */ smp_load_acquire(&sai->sai_task); })) { long timeout; @@ -2018,7 +2019,7 @@ sa_pattern_fname_detect(struct inode *dir, struct dentry *dchild) int ret; while (--i >= 0 && isdigit(name[i])) - /* do nothing */; + ; /* do nothing */ i++; ret = kstrtol(&name[i], 0, &num); if (ret) @@ -2133,7 +2134,7 @@ static int start_statahead_thread(struct inode *dir, struct dentry *dentry, i = dname->len; while (--i >= 0 && isdigit(name[i])) - /* do nothing */; + ; /* do nothing */ i++; memcpy(sai->sai_fname, dname->name, i); diff --git a/lustre/llite/super25.c b/lustre/llite/super25.c index be22b7d..5e23bf7 100644 --- a/lustre/llite/super25.c +++ b/lustre/llite/super25.c @@ -72,6 +72,7 @@ static void ll_inode_destroy_callback(struct rcu_head *head) { struct inode *inode = container_of(head, struct inode, i_rcu); struct ll_inode_info *ptr = ll_i2info(inode); + llcrypt_free_inode(inode); OBD_SLAB_FREE_PTR(ptr, ll_inode_cachep); } @@ -97,8 +98,7 @@ static int ll_drop_inode(struct inode *inode) } /* exported operations */ -const struct super_operations lustre_super_operations = -{ +const struct super_operations lustre_super_operations = { .alloc_inode = ll_alloc_inode, .destroy_inode = ll_destroy_inode, .drop_inode = ll_drop_inode, @@ -237,7 +237,8 @@ static int __init lustre_init(void) /* print an address of _any_ initialized kernel symbol from this * module, to allow debugging with gdb that doesn't support data - * symbols from modules.*/ + * symbols from modules. + */ CDEBUG(D_INFO, "Lustre client module (%p).\n", &lustre_super_operations); diff --git a/lustre/llite/vvp_object.c b/lustre/llite/vvp_object.c index b03ba1f..feb1868 100644 --- a/lustre/llite/vvp_object.c +++ b/lustre/llite/vvp_object.c @@ -157,7 +157,6 @@ static int vvp_prune(const struct lu_env *env, struct cl_object *obj) int rc; ENTRY; - rc = cl_sync_file_range(inode, 0, OBD_OBJECT_EOF, CL_FSYNC_LOCAL, 1); if (rc < 0) { CDEBUG(D_VFSTRACE, DFID ": writeback failed: %d\n", diff --git a/lustre/llite/vvp_page.c b/lustre/llite/vvp_page.c index a900bbb..a91a176 100644 --- a/lustre/llite/vvp_page.c +++ b/lustre/llite/vvp_page.c @@ -92,8 +92,7 @@ static void vvp_page_delete(const struct lu_env *env, ClearPageUptodate(vmpage); write_sequnlock(&ll_i2info(inode)->lli_page_inv_lock); } - /* - * The reference from vmpage to cl_page is removed, + /* The reference from vmpage to cl_page is removed, * but the reference back is still here. It is removed * later in cl_page_free(). */ diff --git a/lustre/llite/xattr_cache.c b/lustre/llite/xattr_cache.c index df3d11f..5b1d917 100644 --- a/lustre/llite/xattr_cache.c +++ b/lustre/llite/xattr_cache.c @@ -43,11 +43,11 @@ * using a hash or a tree structure instead of list for faster lookups. */ struct ll_xattr_entry { - struct list_head xe_list; /* protect by lli_xattrs_list_rwsem */ - char *xe_name; /* xattr name, \0-terminated */ - char *xe_value; /* xattr value */ - unsigned int xe_namelen; /* strlen(xe_name) + 1 */ - unsigned int xe_vallen; /* xattr value length */ + struct list_head xe_list; /* protected by lli_xattrs_list_rwsem */ + char *xe_name; /* xattr name, \0-terminated */ + char *xe_value; /* xattr value */ + unsigned int xe_namelen; /* strlen(xe_name) + 1 */ + unsigned int xe_vallen; /* xattr value length */ }; static struct kmem_cache *xattr_kmem; @@ -72,7 +72,7 @@ void ll_xattr_fini(void) lu_kmem_fini(xattr_caches); } -/** +/* * Initializes xattr cache for an inode. * * This initializes the xattr list and marks cache presence. @@ -292,7 +292,7 @@ static int ll_xattr_cache_destroy_locked(struct ll_inode_info *lli) RETURN(0); while (ll_xattr_cache_del(&lli->lli_xattrs, NULL) == 0) - /* empty loop */; + ; /* empty loop */ clear_bit(LLIF_XATTR_CACHE_FILLED, &lli->lli_flags); clear_bit(LLIF_XATTR_CACHE, &lli->lli_flags); @@ -314,7 +314,7 @@ int ll_xattr_cache_destroy(struct inode *inode) RETURN(rc); } -/** +/* * ll_xattr_cache_empty - empty xattr cache for @ino * * Similar to ll_xattr_cache_destroy(), but preserves encryption context. -- 1.8.3.1