Commit cd514eac authored by Greg Kroah-Hartman's avatar Greg Kroah-Hartman

staging: lustre: remove ldebugfs_register_stats() 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.

Cc: Oleg Drokin <oleg.drokin@intel.com>
Cc: Andreas Dilger <andreas.dilger@intel.com>
Cc: James Simmons <jsimmons@infradead.org>
Cc: Ben Evans <bevans@cray.com>
Cc: Quentin Bouget <quentin.bouget@cea.fr>
Cc: NeilBrown <neilb@suse.com>
Cc: Arushi Singhal <arushisinghal19971997@gmail.com>
Cc: Arvind Yadav <arvind.yadav.cs@gmail.com>
Cc: Patrick Farrell <paf@cray.com>
Cc: Aliaksei Karaliou <akaraliou.dev@gmail.com>
Cc: Aastha Gupta <aastha.gupta4104@gmail.com>
Cc: Dafna Hirschfeld <dafna3@gmail.com>
Cc: Mathias Rav <mathiasrav@gmail.com>
Cc: "Gustavo A. R. Silva" <garsilva@embeddedor.com>
Cc: Bob Glosman <bob.glossman@intel.com>
Cc: lustre-devel@lists.lustre.org
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 460c9a86
...@@ -447,9 +447,7 @@ void lprocfs_counter_init(struct lprocfs_stats *stats, int index, ...@@ -447,9 +447,7 @@ void lprocfs_counter_init(struct lprocfs_stats *stats, int index,
const char *units); const char *units);
struct obd_export; struct obd_export;
int lprocfs_exp_cleanup(struct obd_export *exp); int lprocfs_exp_cleanup(struct obd_export *exp);
int ldebugfs_register_stats(struct dentry *parent, extern const struct file_operations lprocfs_stats_seq_fops;
const char *name,
struct lprocfs_stats *stats);
/* lprocfs_status.c */ /* lprocfs_status.c */
int ldebugfs_add_vars(struct dentry *parent, int ldebugfs_add_vars(struct dentry *parent,
......
...@@ -627,8 +627,8 @@ static int ldlm_pool_debugfs_init(struct ldlm_pool *pl) ...@@ -627,8 +627,8 @@ static int ldlm_pool_debugfs_init(struct ldlm_pool *pl)
lprocfs_counter_init(pl->pl_stats, LDLM_POOL_TIMING_STAT, lprocfs_counter_init(pl->pl_stats, LDLM_POOL_TIMING_STAT,
LPROCFS_CNTR_AVGMINMAX | LPROCFS_CNTR_STDDEV, LPROCFS_CNTR_AVGMINMAX | LPROCFS_CNTR_STDDEV,
"recalc_timing", "sec"); "recalc_timing", "sec");
rc = ldebugfs_register_stats(pl->pl_debugfs_entry, "stats", debugfs_create_file("stats", 0644, pl->pl_debugfs_entry, pl->pl_stats,
pl->pl_stats); &lprocfs_stats_seq_fops);
out_free_name: out_free_name:
kfree(var_name); kfree(var_name);
......
...@@ -1209,10 +1209,9 @@ int ldebugfs_register_mountpoint(struct dentry *parent, ...@@ -1209,10 +1209,9 @@ int ldebugfs_register_mountpoint(struct dentry *parent,
(type & LPROCFS_CNTR_AVGMINMAX), (type & LPROCFS_CNTR_AVGMINMAX),
llite_opcode_table[id].opname, ptr); llite_opcode_table[id].opname, ptr);
} }
err = ldebugfs_register_stats(sbi->ll_debugfs_entry, "stats",
sbi->ll_stats); debugfs_create_file("stats", 0644, sbi->ll_debugfs_entry, sbi->ll_stats,
if (err) &lprocfs_stats_seq_fops);
goto out;
sbi->ll_ra_stats = lprocfs_alloc_stats(ARRAY_SIZE(ra_stat_string), sbi->ll_ra_stats = lprocfs_alloc_stats(ARRAY_SIZE(ra_stat_string),
LPROCFS_STATS_FLAG_NONE); LPROCFS_STATS_FLAG_NONE);
...@@ -1225,10 +1224,8 @@ int ldebugfs_register_mountpoint(struct dentry *parent, ...@@ -1225,10 +1224,8 @@ int ldebugfs_register_mountpoint(struct dentry *parent,
lprocfs_counter_init(sbi->ll_ra_stats, id, 0, lprocfs_counter_init(sbi->ll_ra_stats, id, 0,
ra_stat_string[id], "pages"); ra_stat_string[id], "pages");
err = ldebugfs_register_stats(sbi->ll_debugfs_entry, "read_ahead_stats", debugfs_create_file("stats", 0644, sbi->ll_debugfs_entry,
sbi->ll_ra_stats); sbi->ll_ra_stats, &lprocfs_stats_seq_fops);
if (err)
goto out;
err = ldebugfs_add_vars(sbi->ll_debugfs_entry, err = ldebugfs_add_vars(sbi->ll_debugfs_entry,
lprocfs_llite_obd_vars, sb); lprocfs_llite_obd_vars, sb);
......
...@@ -1315,7 +1315,7 @@ static int lprocfs_stats_seq_open(struct inode *inode, struct file *file) ...@@ -1315,7 +1315,7 @@ static int lprocfs_stats_seq_open(struct inode *inode, struct file *file)
return 0; return 0;
} }
static const struct file_operations lprocfs_stats_seq_fops = { const struct file_operations lprocfs_stats_seq_fops = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.open = lprocfs_stats_seq_open, .open = lprocfs_stats_seq_open,
.read = seq_read, .read = seq_read,
...@@ -1323,19 +1323,7 @@ static const struct file_operations lprocfs_stats_seq_fops = { ...@@ -1323,19 +1323,7 @@ static const struct file_operations lprocfs_stats_seq_fops = {
.llseek = seq_lseek, .llseek = seq_lseek,
.release = lprocfs_seq_release, .release = lprocfs_seq_release,
}; };
EXPORT_SYMBOL_GPL(lprocfs_stats_seq_fops);
int ldebugfs_register_stats(struct dentry *parent, const char *name,
struct lprocfs_stats *stats)
{
struct dentry *entry;
LASSERT(!IS_ERR_OR_NULL(parent));
entry = debugfs_create_file(name, 0644, parent, stats,
&lprocfs_stats_seq_fops);
return 0;
}
EXPORT_SYMBOL_GPL(ldebugfs_register_stats);
void lprocfs_counter_init(struct lprocfs_stats *stats, int index, void lprocfs_counter_init(struct lprocfs_stats *stats, int index,
unsigned int conf, const char *name, unsigned int conf, const char *name,
......
...@@ -185,7 +185,7 @@ ptlrpc_ldebugfs_register(struct dentry *root, char *dir, ...@@ -185,7 +185,7 @@ ptlrpc_ldebugfs_register(struct dentry *root, char *dir,
{ {
struct dentry *svc_debugfs_entry; struct dentry *svc_debugfs_entry;
struct lprocfs_stats *svc_stats; struct lprocfs_stats *svc_stats;
int i, rc; int i;
unsigned int svc_counter_config = LPROCFS_CNTR_AVGMINMAX | unsigned int svc_counter_config = LPROCFS_CNTR_AVGMINMAX |
LPROCFS_CNTR_STDDEV; LPROCFS_CNTR_STDDEV;
...@@ -241,16 +241,11 @@ ptlrpc_ldebugfs_register(struct dentry *root, char *dir, ...@@ -241,16 +241,11 @@ ptlrpc_ldebugfs_register(struct dentry *root, char *dir,
ll_opcode2str(opcode), "usec"); ll_opcode2str(opcode), "usec");
} }
rc = ldebugfs_register_stats(svc_debugfs_entry, name, svc_stats); debugfs_create_file("stats", 0644, svc_debugfs_entry, svc_stats,
if (rc < 0) { &lprocfs_stats_seq_fops);
if (dir) if (dir)
ldebugfs_remove(&svc_debugfs_entry); *debugfs_root_ret = svc_debugfs_entry;
lprocfs_free_stats(&svc_stats); *stats_ret = svc_stats;
} else {
if (dir)
*debugfs_root_ret = svc_debugfs_entry;
*stats_ret = svc_stats;
}
} }
static int static int
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment