From: Mr NeilBrown Date: Thu, 27 Feb 2020 05:00:32 +0000 (+1100) Subject: LU-6142 lustre: remove ldebugfs_seq_create wrapper function X-Git-Tag: 2.13.54~217 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=refs%2Fchanges%2F45%2F37745%2F5;p=fs%2Flustre-release.git LU-6142 lustre: remove ldebugfs_seq_create wrapper function It was just calling debugfs_create_file() so unwind things and just call the real function instead. This ends up saving a number of lines as there was never any error handling happening anyway, so that all can be removed as well. Test-Parameters: trivial Signed-off-by: Greg Kroah-Hartman Signed-off-by: Mr NeilBrown Change-Id: I7103ef2a44348f28b958730413e93e0878eba4d2 Reviewed-on: https://review.whamcloud.com/37745 Reviewed-by: Andreas Dilger Reviewed-by: Shaun Tancheff Reviewed-by: James Simmons Tested-by: jenkins Tested-by: Maloo --- diff --git a/lustre/fid/fid_handler.c b/lustre/fid/fid_handler.c index 2f2018b..c56df2c 100644 --- a/lustre/fid/fid_handler.c +++ b/lustre/fid/fid_handler.c @@ -461,9 +461,8 @@ static void seq_server_debugfs_fini(struct lu_server_seq *seq) debugfs_remove_recursive(seq->lss_debugfs_entry); } -static int seq_server_debugfs_init(struct lu_server_seq *seq) +static void seq_server_debugfs_init(struct lu_server_seq *seq) { - int rc; ENTRY; seq->lss_debugfs_entry = debugfs_create_dir(seq->lss_name, @@ -472,21 +471,9 @@ static int seq_server_debugfs_init(struct lu_server_seq *seq) ldebugfs_add_vars(seq->lss_debugfs_entry, seq_server_debugfs_list, seq); - if (seq->lss_type == LUSTRE_SEQ_CONTROLLER) { - rc = ldebugfs_seq_create(seq->lss_debugfs_entry, "fldb", 0644, - &seq_fld_debugfs_seq_fops, seq); - if (rc) { - CERROR("%s: Can't create fldb for sequence manager debugfs: rc = %d\n", - seq->lss_name, rc); - GOTO(out_cleanup, rc); - } - } - - RETURN(0); - -out_cleanup: - seq_server_debugfs_fini(seq); - return rc; + if (seq->lss_type == LUSTRE_SEQ_CONTROLLER) + debugfs_create_file("fldb", 0644, seq->lss_debugfs_entry, + seq, &seq_fld_debugfs_seq_fops); } int seq_server_init(const struct lu_env *env, @@ -567,9 +554,7 @@ int seq_server_init(const struct lu_env *env, lu_seq_range_is_sane(&seq->lss_space)); } - rc = seq_server_debugfs_init(seq); - if (rc) - GOTO(out, rc); + seq_server_debugfs_init(seq); EXIT; out: diff --git a/lustre/fld/fld_handler.c b/lustre/fld/fld_handler.c index f8a7f5a..583f050 100644 --- a/lustre/fld/fld_handler.c +++ b/lustre/fld/fld_handler.c @@ -405,20 +405,14 @@ static void fld_server_debugfs_fini(struct lu_server_fld *fld) debugfs_remove_recursive(fld->lsf_debugfs_entry); } -static int fld_server_debugfs_init(struct lu_server_fld *fld) +static void fld_server_debugfs_init(struct lu_server_fld *fld) { - int rc = 0; - ENTRY; fld->lsf_debugfs_entry = debugfs_create_dir(fld->lsf_name, fld_debugfs_dir); - rc = ldebugfs_seq_create(fld->lsf_debugfs_entry, "fldb", 0444, - &fld_debugfs_seq_fops, fld); - if (rc) - debugfs_remove_recursive(fld->lsf_debugfs_entry); - - RETURN(rc); + debugfs_create_file("fldb", 0444, fld->lsf_debugfs_entry, fld, + &fld_debugfs_seq_fops); } int fld_server_init(const struct lu_env *env, struct lu_server_fld *fld, @@ -448,17 +442,13 @@ int fld_server_init(const struct lu_env *env, struct lu_server_fld *fld, if (rc) GOTO(out_cache, rc); - rc = fld_server_debugfs_init(fld); - if (rc) - GOTO(out_index, rc); + fld_server_debugfs_init(fld); fld->lsf_control_exp = NULL; fld->lsf_seq_lookup = fld_server_lookup; fld->lsf_seq_lookup = fld_server_lookup; RETURN(0); -out_index: - fld_index_fini(env, fld); out_cache: fld_cache_fini(fld->lsf_cache); return rc; diff --git a/lustre/include/lprocfs_status.h b/lustre/include/lprocfs_status.h index 63ee9a8..485cab9 100644 --- a/lustre/include/lprocfs_status.h +++ b/lustre/include/lprocfs_status.h @@ -540,8 +540,6 @@ extern int lprocfs_obd_cleanup(struct obd_device *obd); extern const struct file_operations lprocfs_evict_client_fops; #endif -int ldebugfs_seq_create(struct dentry *parent, const char *name, umode_t mode, - const struct file_operations *seq_fops, void *data); extern int lprocfs_seq_create(struct proc_dir_entry *parent, const char *name, mode_t mode, const struct file_operations *seq_fops, @@ -637,7 +635,7 @@ extern int lprocfs_seq_release(struct inode *, struct file *); /* write the name##_seq_show function, call LDEBUGFS_SEQ_FOPS_RO for read-only * debugfs entries; otherwise, you will define name##_seq_write function also * for a read-write debugfs entry, and then call LDEBUGFS_SEQ_FOPS instead. - * Finally, call ldebugfs_seq_create(obd, filename, 0444, &name#_fops, data); + * Finally, call debugfs_create_file(filename, 0444, obd, data, &name#_fops); */ #define __LDEBUGFS_SEQ_FOPS(name, custom_seq_write) \ static int name##_single_open(struct inode *inode, struct file *file) \ diff --git a/lustre/llite/lproc_llite.c b/lustre/llite/lproc_llite.c index 3e5310d..d202ce0 100644 --- a/lustre/llite/lproc_llite.c +++ b/lustre/llite/lproc_llite.c @@ -1628,7 +1628,7 @@ int ll_debugfs_register_super(struct super_block *sb, const char *name) { struct lustre_sb_info *lsi = s2lsi(sb); struct ll_sb_info *sbi = ll_s2sbi(sb); - int err, id, rc; + int err, id; ENTRY; LASSERT(sbi); @@ -1639,26 +1639,18 @@ int ll_debugfs_register_super(struct super_block *sb, const char *name) sbi->ll_debugfs_entry = debugfs_create_dir(name, llite_root); ldebugfs_add_vars(sbi->ll_debugfs_entry, lprocfs_llite_obd_vars, sb); - rc = ldebugfs_seq_create(sbi->ll_debugfs_entry, "dump_page_cache",0444, - &vvp_dump_pgcache_file_ops, sbi); - if (rc) - CWARN("Error adding the dump_page_cache file\n"); + debugfs_create_file("dump_page_cache", 0444, sbi->ll_debugfs_entry, sbi, + &vvp_dump_pgcache_file_ops); - rc = ldebugfs_seq_create(sbi->ll_debugfs_entry, "extents_stats", 0644, - &ll_rw_extents_stats_fops, sbi); - if (rc) - CWARN("Error adding the extent_stats file\n"); + debugfs_create_file("extents_stats", 0644, sbi->ll_debugfs_entry, sbi, + &ll_rw_extents_stats_fops); - rc = ldebugfs_seq_create(sbi->ll_debugfs_entry, - "extents_stats_per_process", 0644, - &ll_rw_extents_stats_pp_fops, sbi); - if (rc) - CWARN("Error adding the extents_stats_per_process file\n"); + debugfs_create_file("extents_stats_per_process", 0644, + sbi->ll_debugfs_entry, sbi, + &ll_rw_extents_stats_pp_fops); - rc = ldebugfs_seq_create(sbi->ll_debugfs_entry, "offset_stats", 0644, - &ll_rw_offset_stats_fops, sbi); - if (rc) - CWARN("Error adding the offset_stats file\n"); + debugfs_create_file("offset_stats", 0644, sbi->ll_debugfs_entry, sbi, + &ll_rw_offset_stats_fops); /* File operations stats */ sbi->ll_stats = lprocfs_alloc_stats(LPROC_LL_FILE_OPCODES, diff --git a/lustre/mgs/lproc_mgs.c b/lustre/mgs/lproc_mgs.c index 5a5c70b..62d98e3 100644 --- a/lustre/mgs/lproc_mgs.c +++ b/lustre/mgs/lproc_mgs.c @@ -272,15 +272,11 @@ int lproc_mgs_setup(struct mgs_device *mgs, const char *osd_name) if (rc != 0) GOTO(out, rc); - rc = ldebugfs_seq_create(obd->obd_debugfs_entry, "filesystems", 0444, - &mgs_fs_fops, obd); - if (rc != 0) - GOTO(out, rc); + debugfs_create_file("filesystems", 0444, obd->obd_debugfs_entry, obd, + &mgs_fs_fops); - rc = ldebugfs_seq_create(obd->obd_debugfs_entry, "srpc_rules", 0400, - &mgsself_srpc_fops, obd); - if (rc != 0) - GOTO(out, rc); + debugfs_create_file("srpc_rules", 0400, obd->obd_debugfs_entry, obd, + &mgsself_srpc_fops); mgs->mgs_proc_live = lprocfs_register("live", obd->obd_proc_entry, NULL, NULL); diff --git a/lustre/obdclass/lprocfs_status.c b/lustre/obdclass/lprocfs_status.c index b25968d..2564467 100644 --- a/lustre/obdclass/lprocfs_status.c +++ b/lustre/obdclass/lprocfs_status.c @@ -1861,22 +1861,6 @@ char *lprocfs_find_named_value(const char *buffer, const char *name, } EXPORT_SYMBOL(lprocfs_find_named_value); -int ldebugfs_seq_create(struct dentry *parent, const char *name, umode_t mode, - const struct file_operations *seq_fops, void *data) -{ - struct dentry *entry; - - /* Disallow secretly (un)writable entries. */ - LASSERT((!seq_fops->write) == (!(mode & 0222))); - - entry = debugfs_create_file(name, mode, parent, data, seq_fops); - if (IS_ERR_OR_NULL(entry)) - return entry ? PTR_ERR(entry) : -ENOMEM; - - return 0; -} -EXPORT_SYMBOL_GPL(ldebugfs_seq_create); - int lprocfs_seq_create(struct proc_dir_entry *parent, const char *name, mode_t mode, diff --git a/lustre/ptlrpc/lproc_ptlrpc.c b/lustre/ptlrpc/lproc_ptlrpc.c index 35672a7..8920d43 100644 --- a/lustre/ptlrpc/lproc_ptlrpc.c +++ b/lustre/ptlrpc/lproc_ptlrpc.c @@ -1219,8 +1219,6 @@ void ptlrpc_ldebugfs_register_service(struct dentry *entry, .release = lprocfs_seq_release, }; - int rc; - ptlrpc_ldebugfs_register(entry, svc->srv_name, "stats", &svc->srv_debugfs_entry, &svc->srv_stats); if (!svc->srv_debugfs_entry) @@ -1228,10 +1226,8 @@ void ptlrpc_ldebugfs_register_service(struct dentry *entry, ldebugfs_add_vars(svc->srv_debugfs_entry, lproc_vars, NULL); - rc = ldebugfs_seq_create(svc->srv_debugfs_entry, "req_history", - 0400, &req_history_fops, svc); - if (rc) - CWARN("Error adding the req_history file\n"); + debugfs_create_file("req_history", 0400, svc->srv_debugfs_entry, svc, + &req_history_fops); } void ptlrpc_lprocfs_register_obd(struct obd_device *obd) diff --git a/lustre/ptlrpc/sec_lproc.c b/lustre/ptlrpc/sec_lproc.c index 4111644..2f06143 100644 --- a/lustre/ptlrpc/sec_lproc.c +++ b/lustre/ptlrpc/sec_lproc.c @@ -207,8 +207,6 @@ LPROC_SEQ_FOPS_WR_ONLY(srpc, sptlrpc_sepol); int sptlrpc_lprocfs_cliobd_attach(struct obd_device *obd) { - int rc; - if (strcmp(obd->obd_type->typ_name, LUSTRE_OSC_NAME) != 0 && strcmp(obd->obd_type->typ_name, LUSTRE_MDC_NAME) != 0 && strcmp(obd->obd_type->typ_name, LUSTRE_MGC_NAME) != 0 && @@ -219,29 +217,14 @@ int sptlrpc_lprocfs_cliobd_attach(struct obd_device *obd) return -EINVAL; } - rc = ldebugfs_seq_create(obd->obd_debugfs_entry, "srpc_info", 0444, - &sptlrpc_info_lprocfs_fops, obd); - if (rc) { - CERROR("create proc entry srpc_info for %s: %d\n", - obd->obd_name, rc); - return rc; - } + debugfs_create_file("srpc_info", 0444, obd->obd_debugfs_entry, obd, + &sptlrpc_info_lprocfs_fops); - rc = ldebugfs_seq_create(obd->obd_debugfs_entry, "srpc_contexts", - 0444, &sptlrpc_ctxs_lprocfs_fops, obd); - if (rc) { - CERROR("create proc entry srpc_contexts for %s: %d\n", - obd->obd_name, rc); - return rc; - } + debugfs_create_file("srpc_contexts", 0444, obd->obd_debugfs_entry, obd, + &sptlrpc_ctxs_lprocfs_fops); - rc = ldebugfs_seq_create(obd->obd_debugfs_entry, "srpc_sepol", - 0200, &srpc_sptlrpc_sepol_fops, obd); - if (rc) { - CERROR("create proc entry srpc_sepol for %s: %d\n", - obd->obd_name, rc); - return rc; - } + debugfs_create_file("srpc_sepol", 0200, obd->obd_debugfs_entry, obd, + &srpc_sptlrpc_sepol_fops); return 0; }