* [PATCH 04/13] staging: vc04_services: no need to check debugfs return values
[not found] <20180529142947.3250-1-gregkh@linuxfoundation.org>
@ 2018-05-29 14:29 ` Greg Kroah-Hartman
2018-05-30 19:51 ` Eric Anholt
2018-05-29 14:29 ` [lustre-devel] [PATCH 05/13] staging: lustre: " Greg Kroah-Hartman
` (8 subsequent siblings)
9 siblings, 1 reply; 12+ messages in thread
From: Greg Kroah-Hartman @ 2018-05-29 14:29 UTC (permalink / raw)
To: linux-arm-kernel
When calling debugfs functions, there is no need to ever check the
return value. The function can work or not, but the code logic should
never do something different based on this.
Clean up the vchiq_arm code by not caring about the value of debugfs
calls. This ends up removing a number of lines of code that are not
needed.
Cc: Eric Anholt <eric@anholt.net>
Cc: Stefan Wahren <stefan.wahren@i2se.com>
Cc: Kees Cook <keescook@chromium.org>
Cc: Dan Carpenter <dan.carpenter@oracle.com>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Keerthi Reddy <keerthigd4990@gmail.com>
Cc: linux-rpi-kernel at lists.infradead.org
Cc: linux-arm-kernel at lists.infradead.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
.../interface/vchiq_arm/vchiq_arm.c | 13 +---
.../interface/vchiq_arm/vchiq_debugfs.c | 72 +++----------------
.../interface/vchiq_arm/vchiq_debugfs.h | 4 +-
3 files changed, 15 insertions(+), 74 deletions(-)
diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
index aaa264f3b598..bc05c69383b8 100644
--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
+++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
@@ -2018,7 +2018,6 @@ vchiq_open(struct inode *inode, struct file *file)
vchiq_log_info(vchiq_arm_log_level, "vchiq_open");
switch (dev) {
case VCHIQ_MINOR: {
- int ret;
VCHIQ_STATE_T *state = vchiq_get_state();
VCHIQ_INSTANCE_T instance;
@@ -2035,11 +2034,7 @@ vchiq_open(struct inode *inode, struct file *file)
instance->state = state;
instance->pid = current->tgid;
- ret = vchiq_debugfs_add_instance(instance);
- if (ret != 0) {
- kfree(instance);
- return ret;
- }
+ vchiq_debugfs_add_instance(instance);
sema_init(&instance->insert_event, 0);
sema_init(&instance->remove_event, 0);
@@ -3630,9 +3625,7 @@ static int vchiq_probe(struct platform_device *pdev)
goto failed_device_create;
/* create debugfs entries */
- err = vchiq_debugfs_init();
- if (err != 0)
- goto failed_debugfs_init;
+ vchiq_debugfs_init();
vchiq_log_info(vchiq_arm_log_level,
"vchiq: initialised - version %d (min %d), device %d.%d",
@@ -3645,8 +3638,6 @@ static int vchiq_probe(struct platform_device *pdev)
return 0;
-failed_debugfs_init:
- device_destroy(vchiq_class, vchiq_devid);
failed_device_create:
class_destroy(vchiq_class);
failed_class_create:
diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_debugfs.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_debugfs.c
index 766b4fe5f32c..103fec955e2c 100644
--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_debugfs.c
+++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_debugfs.c
@@ -158,15 +158,12 @@ static const struct file_operations debugfs_log_fops = {
};
/* create an entry under <debugfs>/vchiq/log for each log category */
-static int vchiq_debugfs_create_log_entries(struct dentry *top)
+static void vchiq_debugfs_create_log_entries(struct dentry *top)
{
struct dentry *dir;
size_t i;
- int ret = 0;
dir = debugfs_create_dir("log", vchiq_debugfs_top());
- if (!dir)
- return -ENOMEM;
debugfs_info.log_categories = dir;
for (i = 0; i < n_log_entries; i++) {
@@ -177,14 +174,8 @@ static int vchiq_debugfs_create_log_entries(struct dentry *top)
debugfs_info.log_categories,
levp,
&debugfs_log_fops);
- if (!dir) {
- ret = -ENOMEM;
- break;
- }
-
vchiq_debugfs_log_entries[i].dir = dir;
}
- return ret;
}
static int debugfs_usecount_show(struct seq_file *f, void *offset)
@@ -268,43 +259,22 @@ static const struct file_operations debugfs_trace_fops = {
};
/* add an instance (process) to the debugfs entries */
-int vchiq_debugfs_add_instance(VCHIQ_INSTANCE_T instance)
+void vchiq_debugfs_add_instance(VCHIQ_INSTANCE_T instance)
{
char pidstr[16];
- struct dentry *top, *use_count, *trace;
+ struct dentry *top;
struct dentry *clients = vchiq_clients_top();
snprintf(pidstr, sizeof(pidstr), "%d",
vchiq_instance_get_pid(instance));
top = debugfs_create_dir(pidstr, clients);
- if (!top)
- goto fail_top;
-
- use_count = debugfs_create_file("use_count",
- 0444, top,
- instance,
- &debugfs_usecount_fops);
- if (!use_count)
- goto fail_use_count;
-
- trace = debugfs_create_file("trace",
- 0644, top,
- instance,
- &debugfs_trace_fops);
- if (!trace)
- goto fail_trace;
-
- vchiq_instance_get_debugfs_node(instance)->dentry = top;
- return 0;
+ debugfs_create_file("use_count", 0444, top, instance,
+ &debugfs_usecount_fops);
+ debugfs_create_file("trace", 0644, top, instance, &debugfs_trace_fops);
-fail_trace:
- debugfs_remove(use_count);
-fail_use_count:
- debugfs_remove(top);
-fail_top:
- return -ENOMEM;
+ vchiq_instance_get_debugfs_node(instance)->dentry = top;
}
void vchiq_debugfs_remove_instance(VCHIQ_INSTANCE_T instance)
@@ -314,31 +284,13 @@ void vchiq_debugfs_remove_instance(VCHIQ_INSTANCE_T instance)
debugfs_remove_recursive(node->dentry);
}
-int vchiq_debugfs_init(void)
+void vchiq_debugfs_init(void)
{
- BUG_ON(debugfs_info.vchiq_cfg_dir != NULL);
-
debugfs_info.vchiq_cfg_dir = debugfs_create_dir("vchiq", NULL);
- if (debugfs_info.vchiq_cfg_dir == NULL)
- goto fail;
-
debugfs_info.clients = debugfs_create_dir("clients",
vchiq_debugfs_top());
- if (!debugfs_info.clients)
- goto fail;
- if (vchiq_debugfs_create_log_entries(vchiq_debugfs_top()) != 0)
- goto fail;
-
- return 0;
-
-fail:
- vchiq_debugfs_deinit();
- vchiq_log_error(vchiq_arm_log_level,
- "%s: failed to create debugfs directory",
- __func__);
-
- return -ENOMEM;
+ vchiq_debugfs_create_log_entries(vchiq_debugfs_top());
}
/* remove all the debugfs entries */
@@ -360,18 +312,16 @@ static struct dentry *vchiq_debugfs_top(void)
#else /* CONFIG_DEBUG_FS */
-int vchiq_debugfs_init(void)
+void vchiq_debugfs_init(void)
{
- return 0;
}
void vchiq_debugfs_deinit(void)
{
}
-int vchiq_debugfs_add_instance(VCHIQ_INSTANCE_T instance)
+void vchiq_debugfs_add_instance(VCHIQ_INSTANCE_T instance)
{
- return 0;
}
void vchiq_debugfs_remove_instance(VCHIQ_INSTANCE_T instance)
diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_debugfs.h b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_debugfs.h
index 1d95e3d70621..3af6397ada19 100644
--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_debugfs.h
+++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_debugfs.h
@@ -40,11 +40,11 @@ typedef struct vchiq_debugfs_node_struct {
struct dentry *dentry;
} VCHIQ_DEBUGFS_NODE_T;
-int vchiq_debugfs_init(void);
+void vchiq_debugfs_init(void);
void vchiq_debugfs_deinit(void);
-int vchiq_debugfs_add_instance(VCHIQ_INSTANCE_T instance);
+void vchiq_debugfs_add_instance(VCHIQ_INSTANCE_T instance);
void vchiq_debugfs_remove_instance(VCHIQ_INSTANCE_T instance);
--
2.17.0
^ permalink raw reply related [flat|nested] 12+ messages in thread* [PATCH 04/13] staging: vc04_services: no need to check debugfs return values
2018-05-29 14:29 ` [PATCH 04/13] staging: vc04_services: no need to check debugfs return values Greg Kroah-Hartman
@ 2018-05-30 19:51 ` Eric Anholt
2018-06-01 11:09 ` Greg Kroah-Hartman
0 siblings, 1 reply; 12+ messages in thread
From: Eric Anholt @ 2018-05-30 19:51 UTC (permalink / raw)
To: linux-arm-kernel
Greg Kroah-Hartman <gregkh@linuxfoundation.org> writes:
> When calling debugfs functions, there is no need to ever check the
> return value. The function can work or not, but the code logic should
> never do something different based on this.
>
> Clean up the vchiq_arm code by not caring about the value of debugfs
> calls. This ends up removing a number of lines of code that are not
> needed.
>
> Cc: Eric Anholt <eric@anholt.net>
> Cc: Stefan Wahren <stefan.wahren@i2se.com>
> Cc: Kees Cook <keescook@chromium.org>
> Cc: Dan Carpenter <dan.carpenter@oracle.com>
> Cc: Arnd Bergmann <arnd@arndb.de>
> Cc: Keerthi Reddy <keerthigd4990@gmail.com>
> Cc: linux-rpi-kernel at lists.infradead.org
> Cc: linux-arm-kernel at lists.infradead.org
> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> ---
> .../interface/vchiq_arm/vchiq_arm.c | 13 +---
> .../interface/vchiq_arm/vchiq_debugfs.c | 72 +++----------------
> .../interface/vchiq_arm/vchiq_debugfs.h | 4 +-
> 3 files changed, 15 insertions(+), 74 deletions(-)
>
> diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_debugfs.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_debugfs.c
> index 766b4fe5f32c..103fec955e2c 100644
> --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_debugfs.c
> +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_debugfs.c
> @@ -314,31 +284,13 @@ void vchiq_debugfs_remove_instance(VCHIQ_INSTANCE_T instance)
> debugfs_remove_recursive(node->dentry);
> }
>
> -int vchiq_debugfs_init(void)
> +void vchiq_debugfs_init(void)
> {
> - BUG_ON(debugfs_info.vchiq_cfg_dir != NULL);
> -
> debugfs_info.vchiq_cfg_dir = debugfs_create_dir("vchiq", NULL);
> - if (debugfs_info.vchiq_cfg_dir == NULL)
> - goto fail;
> -
I think now that we allow successful probe with this value NULL, module
remove could vchiq_debugfs_deinit() -> vchiq_debugfs_top() -> BUG_ON().
I think the right solution would be to just drop that BUG_ON(). With
that change (and probably just garbage-collecting that function), this
will be enthusiastically:
Reviewed-by: Eric Anholt <eric@anholt.net>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 832 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20180530/2fb101af/attachment-0001.sig>
^ permalink raw reply [flat|nested] 12+ messages in thread* [PATCH 04/13] staging: vc04_services: no need to check debugfs return values
2018-05-30 19:51 ` Eric Anholt
@ 2018-06-01 11:09 ` Greg Kroah-Hartman
0 siblings, 0 replies; 12+ messages in thread
From: Greg Kroah-Hartman @ 2018-06-01 11:09 UTC (permalink / raw)
To: linux-arm-kernel
On Wed, May 30, 2018 at 12:51:12PM -0700, Eric Anholt wrote:
> Greg Kroah-Hartman <gregkh@linuxfoundation.org> writes:
>
> > When calling debugfs functions, there is no need to ever check the
> > return value. The function can work or not, but the code logic should
> > never do something different based on this.
> >
> > Clean up the vchiq_arm code by not caring about the value of debugfs
> > calls. This ends up removing a number of lines of code that are not
> > needed.
> >
> > Cc: Eric Anholt <eric@anholt.net>
> > Cc: Stefan Wahren <stefan.wahren@i2se.com>
> > Cc: Kees Cook <keescook@chromium.org>
> > Cc: Dan Carpenter <dan.carpenter@oracle.com>
> > Cc: Arnd Bergmann <arnd@arndb.de>
> > Cc: Keerthi Reddy <keerthigd4990@gmail.com>
> > Cc: linux-rpi-kernel at lists.infradead.org
> > Cc: linux-arm-kernel at lists.infradead.org
> > Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> > ---
> > .../interface/vchiq_arm/vchiq_arm.c | 13 +---
> > .../interface/vchiq_arm/vchiq_debugfs.c | 72 +++----------------
> > .../interface/vchiq_arm/vchiq_debugfs.h | 4 +-
> > 3 files changed, 15 insertions(+), 74 deletions(-)
> >
>
> > diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_debugfs.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_debugfs.c
> > index 766b4fe5f32c..103fec955e2c 100644
> > --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_debugfs.c
> > +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_debugfs.c
>
> > @@ -314,31 +284,13 @@ void vchiq_debugfs_remove_instance(VCHIQ_INSTANCE_T instance)
> > debugfs_remove_recursive(node->dentry);
> > }
> >
> > -int vchiq_debugfs_init(void)
> > +void vchiq_debugfs_init(void)
> > {
> > - BUG_ON(debugfs_info.vchiq_cfg_dir != NULL);
> > -
> > debugfs_info.vchiq_cfg_dir = debugfs_create_dir("vchiq", NULL);
> > - if (debugfs_info.vchiq_cfg_dir == NULL)
> > - goto fail;
> > -
>
> I think now that we allow successful probe with this value NULL, module
> remove could vchiq_debugfs_deinit() -> vchiq_debugfs_top() -> BUG_ON().
> I think the right solution would be to just drop that BUG_ON(). With
> that change (and probably just garbage-collecting that function), this
> will be enthusiastically:
>
> Reviewed-by: Eric Anholt <eric@anholt.net>
Much better idea, I just did that and will send out the patch series
now. The end result is nicer:
3 files changed, 42 insertions(+), 140 deletions(-)
thanks for the suggestion.
greg k-h
^ permalink raw reply [flat|nested] 12+ messages in thread
* [lustre-devel] [PATCH 05/13] staging: lustre: no need to check debugfs return values
[not found] <20180529142947.3250-1-gregkh@linuxfoundation.org>
2018-05-29 14:29 ` [PATCH 04/13] staging: vc04_services: no need to check debugfs return values Greg Kroah-Hartman
@ 2018-05-29 14:29 ` Greg Kroah-Hartman
2018-05-29 14:29 ` [lustre-devel] [PATCH 06/13] staging: lustre: remove ldebugfs_add_simple() wrapper Greg Kroah-Hartman
` (7 subsequent siblings)
9 siblings, 0 replies; 12+ messages in thread
From: Greg Kroah-Hartman @ 2018-05-29 14:29 UTC (permalink / raw)
To: lustre-devel
When calling debugfs functions, there is no need to ever check the
return value. The function can work or not, but the code logic should
never do something different based on this.
Clean up the lustre core code by not caring about the value of debugfs
calls. This ends up removing a number of lines of code that are not
needed.
Note, more work is needed to remove the unneeded debugfs wrapper
functions in the future.
Cc: Oleg Drokin <oleg.drokin@intel.com>
Cc: Andreas Dilger <andreas.dilger@intel.com>
Cc: James Simmons <jsimmons@infradead.org>
Cc: NeilBrown <neilb@suse.com>
Cc: Ben Evans <bevans@cray.com>
Cc: Arvind Yadav <arvind.yadav.cs@gmail.com>
Cc: "John L. Hammond" <john.hammond@intel.com>
Cc: Dafna Hirschfeld <dafna3@gmail.com>
Cc: Mathias Rav <mathiasrav@gmail.com>
Cc: "Gustavo A. R. Silva" <garsilva@embeddedor.com>
Cc: lustre-devel at lists.lustre.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
.../lustre/obdclass/linux/linux-module.c | 19 ++-----------------
.../lustre/lustre/obdclass/lprocfs_status.c | 11 -----------
2 files changed, 2 insertions(+), 28 deletions(-)
diff --git a/drivers/staging/lustre/lustre/obdclass/linux/linux-module.c b/drivers/staging/lustre/lustre/obdclass/linux/linux-module.c
index d3196439985b..9c800580053b 100644
--- a/drivers/staging/lustre/lustre/obdclass/linux/linux-module.c
+++ b/drivers/staging/lustre/lustre/obdclass/linux/linux-module.c
@@ -481,7 +481,6 @@ static const struct attribute_group lustre_attr_group = {
int class_procfs_init(void)
{
int rc = -ENOMEM;
- struct dentry *file;
lustre_kobj = kobject_create_and_add("lustre", fs_kobj);
if (!lustre_kobj)
@@ -495,23 +494,9 @@ int class_procfs_init(void)
}
debugfs_lustre_root = debugfs_create_dir("lustre", NULL);
- if (IS_ERR_OR_NULL(debugfs_lustre_root)) {
- rc = debugfs_lustre_root ? PTR_ERR(debugfs_lustre_root)
- : -ENOMEM;
- debugfs_lustre_root = NULL;
- sysfs_remove_group(lustre_kobj, &lustre_attr_group);
- kobject_put(lustre_kobj);
- goto out;
- }
- file = debugfs_create_file("devices", 0444, debugfs_lustre_root, NULL,
- &obd_device_list_fops);
- if (IS_ERR_OR_NULL(file)) {
- rc = file ? PTR_ERR(file) : -ENOMEM;
- sysfs_remove_group(lustre_kobj, &lustre_attr_group);
- kobject_put(lustre_kobj);
- goto out;
- }
+ debugfs_create_file("devices", 0444, debugfs_lustre_root, NULL,
+ &obd_device_list_fops);
out:
return rc;
}
diff --git a/drivers/staging/lustre/lustre/obdclass/lprocfs_status.c b/drivers/staging/lustre/lustre/obdclass/lprocfs_status.c
index eb6396add78d..c3f57b025f10 100644
--- a/drivers/staging/lustre/lustre/obdclass/lprocfs_status.c
+++ b/drivers/staging/lustre/lustre/obdclass/lprocfs_status.c
@@ -315,10 +315,6 @@ struct dentry *ldebugfs_add_simple(struct dentry *root,
if (fops->write)
mode |= 0200;
entry = debugfs_create_file(name, mode, root, data, fops);
- if (IS_ERR_OR_NULL(entry)) {
- CERROR("LprocFS: No memory to create <debugfs> entry %s\n", name);
- return entry ?: ERR_PTR(-ENOMEM);
- }
return entry;
}
EXPORT_SYMBOL_GPL(ldebugfs_add_simple);
@@ -348,8 +344,6 @@ int ldebugfs_add_vars(struct dentry *parent,
list->data ?: data,
list->fops ?: &lprocfs_generic_fops
);
- if (IS_ERR_OR_NULL(entry))
- return entry ? PTR_ERR(entry) : -ENOMEM;
list++;
}
return 0;
@@ -1358,9 +1352,6 @@ int ldebugfs_register_stats(struct dentry *parent, const char *name,
entry = debugfs_create_file(name, 0644, parent, stats,
&lprocfs_stats_seq_fops);
- if (IS_ERR_OR_NULL(entry))
- return entry ? PTR_ERR(entry) : -ENOMEM;
-
return 0;
}
EXPORT_SYMBOL_GPL(ldebugfs_register_stats);
@@ -1588,8 +1579,6 @@ int ldebugfs_seq_create(struct dentry *parent, const char *name,
LASSERT((!seq_fops->write) == ((mode & 0222) == 0));
entry = debugfs_create_file(name, mode, parent, data, seq_fops);
- if (IS_ERR_OR_NULL(entry))
- return entry ? PTR_ERR(entry) : -ENOMEM;
return 0;
}
--
2.17.0
^ permalink raw reply related [flat|nested] 12+ messages in thread* [lustre-devel] [PATCH 06/13] staging: lustre: remove ldebugfs_add_simple() wrapper
[not found] <20180529142947.3250-1-gregkh@linuxfoundation.org>
2018-05-29 14:29 ` [PATCH 04/13] staging: vc04_services: no need to check debugfs return values Greg Kroah-Hartman
2018-05-29 14:29 ` [lustre-devel] [PATCH 05/13] staging: lustre: " Greg Kroah-Hartman
@ 2018-05-29 14:29 ` Greg Kroah-Hartman
2018-05-29 14:29 ` [lustre-devel] [PATCH 07/13] staging: lustre: remove ldebugfs_register_stats() wrapper function Greg Kroah-Hartman
` (6 subsequent siblings)
9 siblings, 0 replies; 12+ messages in thread
From: Greg Kroah-Hartman @ 2018-05-29 14:29 UTC (permalink / raw)
To: lustre-devel
It was only being called in one place, and is an unneeded wrapper
function around debugfs_create_file() so just call the real debugfs
function instead. This ends up cleaning up some unneeded error handling
logic that was never needed as well.
Cc: Oleg Drokin <oleg.drokin@intel.com>
Cc: Andreas Dilger <andreas.dilger@intel.com>
Cc: James Simmons <jsimmons@infradead.org>
Cc: Quentin Bouget <quentin.bouget@cea.fr>
Cc: Ben Evans <bevans@cray.com>
Cc: NeilBrown <neilb@suse.com>
Cc: Arvind Yadav <arvind.yadav.cs@gmail.com>
Cc: Arushi Singhal <arushisinghal19971997@gmail.com>
Cc: Dafna Hirschfeld <dafna3@gmail.com>
Cc: Mathias Rav <mathiasrav@gmail.com>
Cc: "Gustavo A. R. Silva" <garsilva@embeddedor.com>
Cc: lustre-devel at lists.lustre.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
.../lustre/lustre/include/lprocfs_status.h | 5 -----
drivers/staging/lustre/lustre/lov/lov_pool.c | 21 +++++--------------
.../lustre/lustre/obdclass/lprocfs_status.c | 19 -----------------
3 files changed, 5 insertions(+), 40 deletions(-)
diff --git a/drivers/staging/lustre/lustre/include/lprocfs_status.h b/drivers/staging/lustre/lustre/include/lprocfs_status.h
index 1322ecffda13..9eac7dac8c7b 100644
--- a/drivers/staging/lustre/lustre/include/lprocfs_status.h
+++ b/drivers/staging/lustre/lustre/include/lprocfs_status.h
@@ -447,11 +447,6 @@ void lprocfs_counter_init(struct lprocfs_stats *stats, int index,
const char *units);
struct obd_export;
int lprocfs_exp_cleanup(struct obd_export *exp);
-struct dentry *ldebugfs_add_simple(struct dentry *root,
- char *name,
- void *data,
- const struct file_operations *fops);
-
int ldebugfs_register_stats(struct dentry *parent,
const char *name,
struct lprocfs_stats *stats);
diff --git a/drivers/staging/lustre/lustre/lov/lov_pool.c b/drivers/staging/lustre/lustre/lov/lov_pool.c
index 6d2dec9266b6..9ce7038c9b0e 100644
--- a/drivers/staging/lustre/lustre/lov/lov_pool.c
+++ b/drivers/staging/lustre/lustre/lov/lov_pool.c
@@ -80,7 +80,6 @@ void lov_pool_putref(struct pool_desc *pool)
CDEBUG(D_INFO, "pool %p\n", pool);
if (atomic_dec_and_test(&pool->pool_refcount)) {
LASSERT(list_empty(&pool->pool_list));
- LASSERT(!pool->pool_debugfs_entry);
lov_ost_pool_free(&pool->pool_obds);
kfree_rcu(pool, rcu);
}
@@ -377,18 +376,11 @@ int lov_pool_new(struct obd_device *obd, char *poolname)
/* get ref for debugfs file */
lov_pool_getref(new_pool);
- new_pool->pool_debugfs_entry = ldebugfs_add_simple(
+
+ new_pool->pool_debugfs_entry = debugfs_create_file(poolname, 0444,
lov->lov_pool_debugfs_entry,
- poolname, new_pool,
+ new_pool,
&pool_proc_operations);
- if (IS_ERR_OR_NULL(new_pool->pool_debugfs_entry)) {
- CWARN("Cannot add debugfs pool entry " LOV_POOLNAMEF "\n",
- poolname);
- new_pool->pool_debugfs_entry = NULL;
- lov_pool_putref(new_pool);
- }
- CDEBUG(D_INFO, "pool %p - proc %p\n",
- new_pool, new_pool->pool_debugfs_entry);
spin_lock(&obd->obd_dev_lock);
list_add_tail(&new_pool->pool_list, &lov->lov_pool_list);
@@ -443,11 +435,8 @@ int lov_pool_del(struct obd_device *obd, char *poolname)
if (!pool)
return -ENOENT;
- if (!IS_ERR_OR_NULL(pool->pool_debugfs_entry)) {
- CDEBUG(D_INFO, "proc entry %p\n", pool->pool_debugfs_entry);
- ldebugfs_remove(&pool->pool_debugfs_entry);
- lov_pool_putref(pool);
- }
+ ldebugfs_remove(&pool->pool_debugfs_entry);
+ lov_pool_putref(pool);
spin_lock(&obd->obd_dev_lock);
list_del_init(&pool->pool_list);
diff --git a/drivers/staging/lustre/lustre/obdclass/lprocfs_status.c b/drivers/staging/lustre/lustre/obdclass/lprocfs_status.c
index c3f57b025f10..68e85f46a146 100644
--- a/drivers/staging/lustre/lustre/obdclass/lprocfs_status.c
+++ b/drivers/staging/lustre/lustre/obdclass/lprocfs_status.c
@@ -300,25 +300,6 @@ EXPORT_SYMBOL(lprocfs_seq_release);
/* lprocfs API calls */
-struct dentry *ldebugfs_add_simple(struct dentry *root,
- char *name, void *data,
- const struct file_operations *fops)
-{
- struct dentry *entry;
- umode_t mode = 0;
-
- if (!root || !name || !fops)
- return ERR_PTR(-EINVAL);
-
- if (fops->read)
- mode = 0444;
- if (fops->write)
- mode |= 0200;
- entry = debugfs_create_file(name, mode, root, data, fops);
- return entry;
-}
-EXPORT_SYMBOL_GPL(ldebugfs_add_simple);
-
static const struct file_operations lprocfs_generic_fops = { };
int ldebugfs_add_vars(struct dentry *parent,
--
2.17.0
^ permalink raw reply related [flat|nested] 12+ messages in thread* [lustre-devel] [PATCH 07/13] staging: lustre: remove ldebugfs_register_stats() wrapper function
[not found] <20180529142947.3250-1-gregkh@linuxfoundation.org>
` (2 preceding siblings ...)
2018-05-29 14:29 ` [lustre-devel] [PATCH 06/13] staging: lustre: remove ldebugfs_add_simple() wrapper Greg Kroah-Hartman
@ 2018-05-29 14:29 ` Greg Kroah-Hartman
2018-05-29 14:29 ` [lustre-devel] [PATCH 08/13] staging: lustre: remove ldebugfs_seq_create() " Greg Kroah-Hartman
` (5 subsequent siblings)
9 siblings, 0 replies; 12+ messages in thread
From: Greg Kroah-Hartman @ 2018-05-29 14:29 UTC (permalink / raw)
To: lustre-devel
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 at lists.lustre.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
.../lustre/lustre/include/lprocfs_status.h | 4 +---
drivers/staging/lustre/lustre/ldlm/ldlm_pool.c | 4 ++--
.../staging/lustre/lustre/llite/lproc_llite.c | 13 +++++--------
.../lustre/lustre/obdclass/lprocfs_status.c | 16 ++--------------
.../staging/lustre/lustre/ptlrpc/lproc_ptlrpc.c | 17 ++++++-----------
5 files changed, 16 insertions(+), 38 deletions(-)
diff --git a/drivers/staging/lustre/lustre/include/lprocfs_status.h b/drivers/staging/lustre/lustre/include/lprocfs_status.h
index 9eac7dac8c7b..7aafe873cb39 100644
--- a/drivers/staging/lustre/lustre/include/lprocfs_status.h
+++ b/drivers/staging/lustre/lustre/include/lprocfs_status.h
@@ -447,9 +447,7 @@ void lprocfs_counter_init(struct lprocfs_stats *stats, int index,
const char *units);
struct obd_export;
int lprocfs_exp_cleanup(struct obd_export *exp);
-int ldebugfs_register_stats(struct dentry *parent,
- const char *name,
- struct lprocfs_stats *stats);
+extern const struct file_operations lprocfs_stats_seq_fops;
/* lprocfs_status.c */
int ldebugfs_add_vars(struct dentry *parent,
diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_pool.c b/drivers/staging/lustre/lustre/ldlm/ldlm_pool.c
index 53b8f33e54b5..b83e93256cd1 100644
--- a/drivers/staging/lustre/lustre/ldlm/ldlm_pool.c
+++ b/drivers/staging/lustre/lustre/ldlm/ldlm_pool.c
@@ -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_CNTR_AVGMINMAX | LPROCFS_CNTR_STDDEV,
"recalc_timing", "sec");
- rc = ldebugfs_register_stats(pl->pl_debugfs_entry, "stats",
- pl->pl_stats);
+ debugfs_create_file("stats", 0644, pl->pl_debugfs_entry, pl->pl_stats,
+ &lprocfs_stats_seq_fops);
out_free_name:
kfree(var_name);
diff --git a/drivers/staging/lustre/lustre/llite/lproc_llite.c b/drivers/staging/lustre/lustre/llite/lproc_llite.c
index 164fe4d6b6b8..2297a14f00ca 100644
--- a/drivers/staging/lustre/lustre/llite/lproc_llite.c
+++ b/drivers/staging/lustre/lustre/llite/lproc_llite.c
@@ -1209,10 +1209,9 @@ int ldebugfs_register_mountpoint(struct dentry *parent,
(type & LPROCFS_CNTR_AVGMINMAX),
llite_opcode_table[id].opname, ptr);
}
- err = ldebugfs_register_stats(sbi->ll_debugfs_entry, "stats",
- sbi->ll_stats);
- if (err)
- goto out;
+
+ debugfs_create_file("stats", 0644, sbi->ll_debugfs_entry, sbi->ll_stats,
+ &lprocfs_stats_seq_fops);
sbi->ll_ra_stats = lprocfs_alloc_stats(ARRAY_SIZE(ra_stat_string),
LPROCFS_STATS_FLAG_NONE);
@@ -1225,10 +1224,8 @@ int ldebugfs_register_mountpoint(struct dentry *parent,
lprocfs_counter_init(sbi->ll_ra_stats, id, 0,
ra_stat_string[id], "pages");
- err = ldebugfs_register_stats(sbi->ll_debugfs_entry, "read_ahead_stats",
- sbi->ll_ra_stats);
- if (err)
- goto out;
+ debugfs_create_file("stats", 0644, sbi->ll_debugfs_entry,
+ sbi->ll_ra_stats, &lprocfs_stats_seq_fops);
err = ldebugfs_add_vars(sbi->ll_debugfs_entry,
lprocfs_llite_obd_vars, sb);
diff --git a/drivers/staging/lustre/lustre/obdclass/lprocfs_status.c b/drivers/staging/lustre/lustre/obdclass/lprocfs_status.c
index 68e85f46a146..089a3d74f3ea 100644
--- a/drivers/staging/lustre/lustre/obdclass/lprocfs_status.c
+++ b/drivers/staging/lustre/lustre/obdclass/lprocfs_status.c
@@ -1315,7 +1315,7 @@ static int lprocfs_stats_seq_open(struct inode *inode, struct file *file)
return 0;
}
-static const struct file_operations lprocfs_stats_seq_fops = {
+const struct file_operations lprocfs_stats_seq_fops = {
.owner = THIS_MODULE,
.open = lprocfs_stats_seq_open,
.read = seq_read,
@@ -1323,19 +1323,7 @@ static const struct file_operations lprocfs_stats_seq_fops = {
.llseek = seq_lseek,
.release = lprocfs_seq_release,
};
-
-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);
+EXPORT_SYMBOL_GPL(lprocfs_stats_seq_fops);
void lprocfs_counter_init(struct lprocfs_stats *stats, int index,
unsigned int conf, const char *name,
diff --git a/drivers/staging/lustre/lustre/ptlrpc/lproc_ptlrpc.c b/drivers/staging/lustre/lustre/ptlrpc/lproc_ptlrpc.c
index 36eea50a77e7..6022246c4459 100644
--- a/drivers/staging/lustre/lustre/ptlrpc/lproc_ptlrpc.c
+++ b/drivers/staging/lustre/lustre/ptlrpc/lproc_ptlrpc.c
@@ -185,7 +185,7 @@ ptlrpc_ldebugfs_register(struct dentry *root, char *dir,
{
struct dentry *svc_debugfs_entry;
struct lprocfs_stats *svc_stats;
- int i, rc;
+ int i;
unsigned int svc_counter_config = LPROCFS_CNTR_AVGMINMAX |
LPROCFS_CNTR_STDDEV;
@@ -241,16 +241,11 @@ ptlrpc_ldebugfs_register(struct dentry *root, char *dir,
ll_opcode2str(opcode), "usec");
}
- rc = ldebugfs_register_stats(svc_debugfs_entry, name, svc_stats);
- if (rc < 0) {
- if (dir)
- ldebugfs_remove(&svc_debugfs_entry);
- lprocfs_free_stats(&svc_stats);
- } else {
- if (dir)
- *debugfs_root_ret = svc_debugfs_entry;
- *stats_ret = svc_stats;
- }
+ debugfs_create_file("stats", 0644, svc_debugfs_entry, svc_stats,
+ &lprocfs_stats_seq_fops);
+ if (dir)
+ *debugfs_root_ret = svc_debugfs_entry;
+ *stats_ret = svc_stats;
}
static int
--
2.17.0
^ permalink raw reply related [flat|nested] 12+ messages in thread* [lustre-devel] [PATCH 08/13] staging: lustre: remove ldebugfs_seq_create() wrapper function
[not found] <20180529142947.3250-1-gregkh@linuxfoundation.org>
` (3 preceding siblings ...)
2018-05-29 14:29 ` [lustre-devel] [PATCH 07/13] staging: lustre: remove ldebugfs_register_stats() wrapper function Greg Kroah-Hartman
@ 2018-05-29 14:29 ` Greg Kroah-Hartman
2018-05-29 14:29 ` [lustre-devel] [PATCH 09/13] staging: lustre: remove ldebugfs_obd_seq_create() " Greg Kroah-Hartman
` (4 subsequent siblings)
9 siblings, 0 replies; 12+ messages in thread
From: Greg Kroah-Hartman @ 2018-05-29 14:29 UTC (permalink / raw)
To: lustre-devel
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: Quentin Bouget <quentin.bouget@cea.fr>
Cc: NeilBrown <neilb@suse.com>
Cc: Ben Evans <bevans@cray.com>
Cc: Arushi Singhal <arushisinghal19971997@gmail.com>
Cc: Arvind Yadav <arvind.yadav.cs@gmail.com>
Cc: "John L. Hammond" <john.hammond@intel.com>
Cc: Vitaly Fertman <vitaly.fertman@seagate.com>
Cc: Julia Lawall <julia.lawall@lip6.fr>
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 at lists.lustre.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
.../lustre/lustre/include/lprocfs_status.h | 5 ----
.../staging/lustre/lustre/llite/lproc_llite.c | 30 ++++++-------------
drivers/staging/lustre/lustre/lmv/lmv_obd.c | 7 ++---
drivers/staging/lustre/lustre/lov/lov_obd.c | 6 ++--
.../lustre/lustre/obdclass/lprocfs_status.c | 19 ++----------
drivers/staging/lustre/lustre/osc/lproc_osc.c | 9 +++---
.../lustre/lustre/ptlrpc/lproc_ptlrpc.c | 8 ++---
7 files changed, 21 insertions(+), 63 deletions(-)
diff --git a/drivers/staging/lustre/lustre/include/lprocfs_status.h b/drivers/staging/lustre/lustre/include/lprocfs_status.h
index 7aafe873cb39..54abcc2eaeb6 100644
--- a/drivers/staging/lustre/lustre/include/lprocfs_status.h
+++ b/drivers/staging/lustre/lustre/include/lprocfs_status.h
@@ -465,11 +465,6 @@ int lprocfs_obd_setup(struct obd_device *obd, struct lprocfs_vars *list,
const struct attribute_group *attrs);
int lprocfs_obd_cleanup(struct obd_device *obd);
-int ldebugfs_seq_create(struct dentry *parent,
- const char *name,
- umode_t mode,
- const struct file_operations *seq_fops,
- void *data);
int ldebugfs_obd_seq_create(struct obd_device *dev,
const char *name,
umode_t mode,
diff --git a/drivers/staging/lustre/lustre/llite/lproc_llite.c b/drivers/staging/lustre/lustre/llite/lproc_llite.c
index 2297a14f00ca..1f122f8a54dc 100644
--- a/drivers/staging/lustre/lustre/llite/lproc_llite.c
+++ b/drivers/staging/lustre/lustre/llite/lproc_llite.c
@@ -1139,7 +1139,7 @@ int ldebugfs_register_mountpoint(struct dentry *parent,
struct obd_device *obd;
struct dentry *dir;
char name[MAX_STRING_SIZE + 1], *ptr;
- int err, id, len, rc;
+ int err, id, len;
name[MAX_STRING_SIZE] = '\0';
@@ -1165,26 +1165,14 @@ int ldebugfs_register_mountpoint(struct dentry *parent,
}
sbi->ll_debugfs_entry = dir;
- 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");
-
- 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");
-
- 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");
-
- 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("dump_page_cache", 0444, dir, sbi,
+ &vvp_dump_pgcache_file_ops);
+ debugfs_create_file("extents_stats", 0644, dir, sbi,
+ &ll_rw_extents_stats_fops);
+ debugfs_create_file("extents_stats_per_process", 0644,
+ dir, sbi, &ll_rw_extents_stats_pp_fops);
+ debugfs_create_file("offset_stats", 0644, dir, sbi,
+ &ll_rw_offset_stats_fops);
/* File operations stats */
sbi->ll_stats = lprocfs_alloc_stats(LPROC_LL_FILE_OPCODES,
diff --git a/drivers/staging/lustre/lustre/lmv/lmv_obd.c b/drivers/staging/lustre/lustre/lmv/lmv_obd.c
index 60cdba99e4a4..85b6e8392759 100644
--- a/drivers/staging/lustre/lustre/lmv/lmv_obd.c
+++ b/drivers/staging/lustre/lustre/lmv/lmv_obd.c
@@ -1264,11 +1264,8 @@ static int lmv_setup(struct obd_device *obd, struct lustre_cfg *lcfg)
lprocfs_lmv_init_vars(&lvars);
lprocfs_obd_setup(obd, lvars.obd_vars, lvars.sysfs_vars);
- rc = ldebugfs_seq_create(obd->obd_debugfs_entry, "target_obd",
- 0444, &lmv_proc_target_fops, obd);
- if (rc)
- CWARN("%s: error adding LMV target_obd file: rc = %d\n",
- obd->obd_name, rc);
+ debugfs_create_file("target_obd", 0444, obd->obd_debugfs_entry, obd,
+ &lmv_proc_target_fops);
rc = fld_client_init(&lmv->lmv_fld, obd->obd_name,
LUSTRE_CLI_FLD_HASH_DHT);
if (rc) {
diff --git a/drivers/staging/lustre/lustre/lov/lov_obd.c b/drivers/staging/lustre/lustre/lov/lov_obd.c
index 7123972d4d5b..a2a5f59dfc7a 100644
--- a/drivers/staging/lustre/lustre/lov/lov_obd.c
+++ b/drivers/staging/lustre/lustre/lov/lov_obd.c
@@ -806,10 +806,8 @@ int lov_setup(struct obd_device *obd, struct lustre_cfg *lcfg)
lprocfs_lov_init_vars(&lvars);
lprocfs_obd_setup(obd, lvars.obd_vars, lvars.sysfs_vars);
- rc = ldebugfs_seq_create(obd->obd_debugfs_entry, "target_obd",
- 0444, &lov_proc_target_fops, obd);
- if (rc)
- CWARN("Error adding the target_obd file\n");
+ debugfs_create_file("target_obd", 0444, obd->obd_debugfs_entry, obd,
+ &lov_proc_target_fops);
lov->lov_pool_debugfs_entry = ldebugfs_register("pools",
obd->obd_debugfs_entry,
diff --git a/drivers/staging/lustre/lustre/obdclass/lprocfs_status.c b/drivers/staging/lustre/lustre/obdclass/lprocfs_status.c
index 089a3d74f3ea..6e0ea4e76a1b 100644
--- a/drivers/staging/lustre/lustre/obdclass/lprocfs_status.c
+++ b/drivers/staging/lustre/lustre/obdclass/lprocfs_status.c
@@ -1538,29 +1538,14 @@ 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) == 0));
-
- entry = debugfs_create_file(name, mode, parent, data, seq_fops);
-
- return 0;
-}
-EXPORT_SYMBOL_GPL(ldebugfs_seq_create);
-
int ldebugfs_obd_seq_create(struct obd_device *dev,
const char *name,
umode_t mode,
const struct file_operations *seq_fops,
void *data)
{
- return ldebugfs_seq_create(dev->obd_debugfs_entry, name,
- mode, seq_fops, data);
+ debugfs_create_file(name, mode, dev->obd_debugfs_entry, data, seq_fops);
+ return 0;
}
EXPORT_SYMBOL_GPL(ldebugfs_obd_seq_create);
diff --git a/drivers/staging/lustre/lustre/osc/lproc_osc.c b/drivers/staging/lustre/lustre/osc/lproc_osc.c
index dc76c35ae801..31f49f3fca59 100644
--- a/drivers/staging/lustre/lustre/osc/lproc_osc.c
+++ b/drivers/staging/lustre/lustre/osc/lproc_osc.c
@@ -805,11 +805,10 @@ int lproc_osc_attach_seqstat(struct obd_device *dev)
{
int rc;
- rc = ldebugfs_seq_create(dev->obd_debugfs_entry, "osc_stats", 0644,
- &osc_stats_fops, dev);
- if (rc == 0)
- rc = ldebugfs_obd_seq_create(dev, "rpc_stats", 0644,
- &osc_rpc_stats_fops, dev);
+ debugfs_create_file("osc_stats", 0644, dev->obd_debugfs_entry, dev,
+ &osc_stats_fops);
+ rc = ldebugfs_obd_seq_create(dev, "rpc_stats", 0644,
+ &osc_rpc_stats_fops, dev);
return rc;
}
diff --git a/drivers/staging/lustre/lustre/ptlrpc/lproc_ptlrpc.c b/drivers/staging/lustre/lustre/ptlrpc/lproc_ptlrpc.c
index 6022246c4459..eb21a8dd3708 100644
--- a/drivers/staging/lustre/lustre/ptlrpc/lproc_ptlrpc.c
+++ b/drivers/staging/lustre/lustre/ptlrpc/lproc_ptlrpc.c
@@ -1099,8 +1099,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);
@@ -1110,10 +1108,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 *obddev)
--
2.17.0
^ permalink raw reply related [flat|nested] 12+ messages in thread* [lustre-devel] [PATCH 09/13] staging: lustre: remove ldebugfs_obd_seq_create() wrapper function
[not found] <20180529142947.3250-1-gregkh@linuxfoundation.org>
` (4 preceding siblings ...)
2018-05-29 14:29 ` [lustre-devel] [PATCH 08/13] staging: lustre: remove ldebugfs_seq_create() " Greg Kroah-Hartman
@ 2018-05-29 14:29 ` Greg Kroah-Hartman
2018-05-29 14:29 ` [lustre-devel] [PATCH 10/13] staging: lustre: unwrap some ldebugfs_register() calls Greg Kroah-Hartman
` (3 subsequent siblings)
9 siblings, 0 replies; 12+ messages in thread
From: Greg Kroah-Hartman @ 2018-05-29 14:29 UTC (permalink / raw)
To: lustre-devel
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: Quentin Bouget <quentin.bouget@cea.fr>
Cc: Ben Evans <bevans@cray.com>
Cc: NeilBrown <neilb@suse.com>
Cc: Arushi Singhal <arushisinghal19971997@gmail.com>
Cc: Arvind Yadav <arvind.yadav.cs@gmail.com>
Cc: Julia Lawall <julia.lawall@lip6.fr>
Cc: Dafna Hirschfeld <dafna3@gmail.com>
Cc: Mathias Rav <mathiasrav@gmail.com>
Cc: "Gustavo A. R. Silva" <garsilva@embeddedor.com>
Cc: Roman Storozhenko <romeusmeister@gmail.com>
Cc: lustre-devel at lists.lustre.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
.../lustre/lustre/include/lprocfs_status.h | 6 ------
.../lustre/lustre/obdclass/lprocfs_status.c | 11 ----------
drivers/staging/lustre/lustre/osc/lproc_osc.c | 10 +++------
.../staging/lustre/lustre/osc/osc_internal.h | 2 +-
.../staging/lustre/lustre/ptlrpc/sec_lproc.c | 21 ++++---------------
5 files changed, 8 insertions(+), 42 deletions(-)
diff --git a/drivers/staging/lustre/lustre/include/lprocfs_status.h b/drivers/staging/lustre/lustre/include/lprocfs_status.h
index 54abcc2eaeb6..cc230c520189 100644
--- a/drivers/staging/lustre/lustre/include/lprocfs_status.h
+++ b/drivers/staging/lustre/lustre/include/lprocfs_status.h
@@ -465,12 +465,6 @@ int lprocfs_obd_setup(struct obd_device *obd, struct lprocfs_vars *list,
const struct attribute_group *attrs);
int lprocfs_obd_cleanup(struct obd_device *obd);
-int ldebugfs_obd_seq_create(struct obd_device *dev,
- const char *name,
- umode_t mode,
- const struct file_operations *seq_fops,
- void *data);
-
/* Generic callbacks */
int lprocfs_rd_uint(struct seq_file *m, void *data);
diff --git a/drivers/staging/lustre/lustre/obdclass/lprocfs_status.c b/drivers/staging/lustre/lustre/obdclass/lprocfs_status.c
index 6e0ea4e76a1b..6e306cafa95a 100644
--- a/drivers/staging/lustre/lustre/obdclass/lprocfs_status.c
+++ b/drivers/staging/lustre/lustre/obdclass/lprocfs_status.c
@@ -1538,17 +1538,6 @@ char *lprocfs_find_named_value(const char *buffer, const char *name,
}
EXPORT_SYMBOL(lprocfs_find_named_value);
-int ldebugfs_obd_seq_create(struct obd_device *dev,
- const char *name,
- umode_t mode,
- const struct file_operations *seq_fops,
- void *data)
-{
- debugfs_create_file(name, mode, dev->obd_debugfs_entry, data, seq_fops);
- return 0;
-}
-EXPORT_SYMBOL_GPL(ldebugfs_obd_seq_create);
-
void lprocfs_oh_tally(struct obd_histogram *oh, unsigned int value)
{
if (value >= OBD_HIST_MAX)
diff --git a/drivers/staging/lustre/lustre/osc/lproc_osc.c b/drivers/staging/lustre/lustre/osc/lproc_osc.c
index 31f49f3fca59..6a705bc5420c 100644
--- a/drivers/staging/lustre/lustre/osc/lproc_osc.c
+++ b/drivers/staging/lustre/lustre/osc/lproc_osc.c
@@ -801,16 +801,12 @@ static ssize_t osc_stats_seq_write(struct file *file,
LPROC_SEQ_FOPS(osc_stats);
-int lproc_osc_attach_seqstat(struct obd_device *dev)
+void lproc_osc_attach_seqstat(struct obd_device *dev)
{
- int rc;
-
debugfs_create_file("osc_stats", 0644, dev->obd_debugfs_entry, dev,
&osc_stats_fops);
- rc = ldebugfs_obd_seq_create(dev, "rpc_stats", 0644,
- &osc_rpc_stats_fops, dev);
-
- return rc;
+ debugfs_create_file("rpc_stats", 0644, dev->obd_debugfs_entry, dev,
+ &osc_rpc_stats_fops);
}
static struct attribute *osc_attrs[] = {
diff --git a/drivers/staging/lustre/lustre/osc/osc_internal.h b/drivers/staging/lustre/lustre/osc/osc_internal.h
index fca020568c19..4ddba1354bef 100644
--- a/drivers/staging/lustre/lustre/osc/osc_internal.h
+++ b/drivers/staging/lustre/lustre/osc/osc_internal.h
@@ -141,7 +141,7 @@ unsigned long osc_ldlm_weigh_ast(struct ldlm_lock *dlmlock);
int osc_setup(struct obd_device *obd, struct lustre_cfg *lcfg);
-int lproc_osc_attach_seqstat(struct obd_device *dev);
+void lproc_osc_attach_seqstat(struct obd_device *dev);
void lprocfs_osc_init_vars(struct lprocfs_static_vars *lvars);
extern struct lu_device_type osc_device_type;
diff --git a/drivers/staging/lustre/lustre/ptlrpc/sec_lproc.c b/drivers/staging/lustre/lustre/ptlrpc/sec_lproc.c
index fd609b63d2de..cd1bb3dabb63 100644
--- a/drivers/staging/lustre/lustre/ptlrpc/sec_lproc.c
+++ b/drivers/staging/lustre/lustre/ptlrpc/sec_lproc.c
@@ -133,8 +133,6 @@ LPROC_SEQ_FOPS_RO(sptlrpc_ctxs_lprocfs);
int sptlrpc_lprocfs_cliobd_attach(struct obd_device *dev)
{
- int rc;
-
if (strcmp(dev->obd_type->typ_name, LUSTRE_OSC_NAME) != 0 &&
strcmp(dev->obd_type->typ_name, LUSTRE_MDC_NAME) != 0 &&
strcmp(dev->obd_type->typ_name, LUSTRE_MGC_NAME) != 0) {
@@ -143,21 +141,10 @@ int sptlrpc_lprocfs_cliobd_attach(struct obd_device *dev)
return -EINVAL;
}
- rc = ldebugfs_obd_seq_create(dev, "srpc_info", 0444,
- &sptlrpc_info_lprocfs_fops, dev);
- if (rc) {
- CERROR("create proc entry srpc_info for %s: %d\n",
- dev->obd_name, rc);
- return rc;
- }
-
- rc = ldebugfs_obd_seq_create(dev, "srpc_contexts", 0444,
- &sptlrpc_ctxs_lprocfs_fops, dev);
- if (rc) {
- CERROR("create proc entry srpc_contexts for %s: %d\n",
- dev->obd_name, rc);
- return rc;
- }
+ debugfs_create_file("srpc_info", 0444, dev->obd_debugfs_entry, dev,
+ &sptlrpc_info_lprocfs_fops);
+ debugfs_create_file("srpc_contexts", 0444, dev->obd_debugfs_entry, dev,
+ &sptlrpc_ctxs_lprocfs_fops);
return 0;
}
--
2.17.0
^ permalink raw reply related [flat|nested] 12+ messages in thread* [lustre-devel] [PATCH 10/13] staging: lustre: unwrap some ldebugfs_register() calls
[not found] <20180529142947.3250-1-gregkh@linuxfoundation.org>
` (5 preceding siblings ...)
2018-05-29 14:29 ` [lustre-devel] [PATCH 09/13] staging: lustre: remove ldebugfs_obd_seq_create() " Greg Kroah-Hartman
@ 2018-05-29 14:29 ` Greg Kroah-Hartman
2018-05-29 14:29 ` [lustre-devel] [PATCH 11/13] staging: lustre: remove last two users of ldebugfs_register() Greg Kroah-Hartman
` (2 subsequent siblings)
9 siblings, 0 replies; 12+ messages in thread
From: Greg Kroah-Hartman @ 2018-05-29 14:29 UTC (permalink / raw)
To: lustre-devel
When the third option (list) to ldebugfs_register() is NULL, it's the
same as just calling debugfs_create_dir(). So unwind this and call
debugfs_create_dir() directly.
This ends up saving lots of code as we do not need to do any error
checking of the return value (because it does not matter).
The ldebugfs_register() call will be removed in a later patch when it is
fully removed, right now there are 2 outstanding users of it in the
tree.
Cc: Oleg Drokin <oleg.drokin@intel.com>
Cc: Andreas Dilger <andreas.dilger@intel.com>
Cc: James Simmons <jsimmons@infradead.org>
Cc: NeilBrown <neilb@suse.com>
Cc: Aastha Gupta <aastha.gupta4104@gmail.com>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Quentin Bouget <quentin.bouget@cea.fr>
Cc: Patrick Farrell <paf@cray.com>
Cc: Aliaksei Karaliou <akaraliou.dev@gmail.com>
Cc: "John L. Hammond" <john.hammond@intel.com>
Cc: Mathias Rav <mathiasrav@gmail.com>
Cc: Andriy Skulysh <andriy.skulysh@seagate.com>
Cc: Ben Evans <bevans@cray.com>
Cc: Bob Glosman <bob.glossman@intel.com>
Cc: lustre-devel at lists.lustre.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
.../staging/lustre/lustre/fid/fid_request.c | 20 +++--------
.../staging/lustre/lustre/fld/fld_request.c | 20 +++--------
.../staging/lustre/lustre/ldlm/ldlm_pool.c | 9 +----
.../lustre/lustre/ldlm/ldlm_resource.c | 34 +++----------------
.../staging/lustre/lustre/llite/lproc_llite.c | 7 +---
drivers/staging/lustre/lustre/lov/lov_obd.c | 5 ++-
.../staging/lustre/lustre/obdclass/genops.c | 11 ++----
.../lustre/lustre/ptlrpc/lproc_ptlrpc.c | 11 ++----
8 files changed, 24 insertions(+), 93 deletions(-)
diff --git a/drivers/staging/lustre/lustre/fid/fid_request.c b/drivers/staging/lustre/lustre/fid/fid_request.c
index c674652af03a..dfcac0afa106 100644
--- a/drivers/staging/lustre/lustre/fid/fid_request.c
+++ b/drivers/staging/lustre/lustre/fid/fid_request.c
@@ -299,17 +299,8 @@ static int seq_client_debugfs_init(struct lu_client_seq *seq)
{
int rc;
- seq->lcs_debugfs_entry = ldebugfs_register(seq->lcs_name,
- seq_debugfs_dir,
- NULL, NULL);
-
- if (IS_ERR_OR_NULL(seq->lcs_debugfs_entry)) {
- CERROR("%s: LdebugFS failed in seq-init\n", seq->lcs_name);
- rc = seq->lcs_debugfs_entry ? PTR_ERR(seq->lcs_debugfs_entry)
- : -ENOMEM;
- seq->lcs_debugfs_entry = NULL;
- return rc;
- }
+ seq->lcs_debugfs_entry = debugfs_create_dir(seq->lcs_name,
+ seq_debugfs_dir);
rc = ldebugfs_add_vars(seq->lcs_debugfs_entry,
seq_client_debugfs_list, seq);
@@ -424,10 +415,9 @@ static int __init fid_init(void)
if (rc)
return rc;
- seq_debugfs_dir = ldebugfs_register(LUSTRE_SEQ_NAME,
- debugfs_lustre_root,
- NULL, NULL);
- return PTR_ERR_OR_ZERO(seq_debugfs_dir);
+ seq_debugfs_dir = debugfs_create_dir(LUSTRE_SEQ_NAME,
+ debugfs_lustre_root);
+ return 0;
}
static void __exit fid_exit(void)
diff --git a/drivers/staging/lustre/lustre/fld/fld_request.c b/drivers/staging/lustre/lustre/fld/fld_request.c
index 7b7ba93a4db6..409850379fc3 100644
--- a/drivers/staging/lustre/lustre/fld/fld_request.c
+++ b/drivers/staging/lustre/lustre/fld/fld_request.c
@@ -221,17 +221,8 @@ static int fld_client_debugfs_init(struct lu_client_fld *fld)
{
int rc;
- fld->lcf_debugfs_entry = ldebugfs_register(fld->lcf_name,
- fld_debugfs_dir,
- NULL, NULL);
-
- if (IS_ERR_OR_NULL(fld->lcf_debugfs_entry)) {
- CERROR("%s: LdebugFS failed in fld-init\n", fld->lcf_name);
- rc = fld->lcf_debugfs_entry ? PTR_ERR(fld->lcf_debugfs_entry)
- : -ENOMEM;
- fld->lcf_debugfs_entry = NULL;
- return rc;
- }
+ fld->lcf_debugfs_entry = debugfs_create_dir(fld->lcf_name,
+ fld_debugfs_dir);
rc = ldebugfs_add_vars(fld->lcf_debugfs_entry,
fld_client_debugfs_list, fld);
@@ -455,10 +446,9 @@ static int __init fld_init(void)
if (rc)
return rc;
- fld_debugfs_dir = ldebugfs_register(LUSTRE_FLD_NAME,
- debugfs_lustre_root,
- NULL, NULL);
- return PTR_ERR_OR_ZERO(fld_debugfs_dir);
+ fld_debugfs_dir = debugfs_create_dir(LUSTRE_FLD_NAME,
+ debugfs_lustre_root);
+ return 0;
}
static void __exit fld_exit(void)
diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_pool.c b/drivers/staging/lustre/lustre/ldlm/ldlm_pool.c
index b83e93256cd1..146b348ca312 100644
--- a/drivers/staging/lustre/lustre/ldlm/ldlm_pool.c
+++ b/drivers/staging/lustre/lustre/ldlm/ldlm_pool.c
@@ -572,14 +572,7 @@ static int ldlm_pool_debugfs_init(struct ldlm_pool *pl)
rc = -EINVAL;
goto out_free_name;
}
- pl->pl_debugfs_entry = ldebugfs_register("pool", debugfs_ns_parent,
- NULL, NULL);
- if (IS_ERR(pl->pl_debugfs_entry)) {
- CERROR("LdebugFS failed in ldlm-pool-init\n");
- rc = PTR_ERR(pl->pl_debugfs_entry);
- pl->pl_debugfs_entry = NULL;
- goto out_free_name;
- }
+ pl->pl_debugfs_entry = debugfs_create_dir("pool", debugfs_ns_parent);
var_name[MAX_STRING_SIZE] = '\0';
memset(pool_vars, 0, sizeof(pool_vars));
diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_resource.c b/drivers/staging/lustre/lustre/ldlm/ldlm_resource.c
index 28cd8398d4ce..691899ef8044 100644
--- a/drivers/staging/lustre/lustre/ldlm/ldlm_resource.c
+++ b/drivers/staging/lustre/lustre/ldlm/ldlm_resource.c
@@ -110,34 +110,13 @@ int ldlm_debugfs_setup(void)
{
int rc;
- ldlm_debugfs_dir = ldebugfs_register(OBD_LDLM_DEVICENAME,
- debugfs_lustre_root,
- NULL, NULL);
- if (IS_ERR_OR_NULL(ldlm_debugfs_dir)) {
- CERROR("LProcFS failed in ldlm-init\n");
- rc = ldlm_debugfs_dir ? PTR_ERR(ldlm_debugfs_dir) : -ENOMEM;
- goto err;
- }
+ ldlm_debugfs_dir = debugfs_create_dir(OBD_LDLM_DEVICENAME,
+ debugfs_lustre_root);
- ldlm_ns_debugfs_dir = ldebugfs_register("namespaces",
- ldlm_debugfs_dir,
- NULL, NULL);
- if (IS_ERR_OR_NULL(ldlm_ns_debugfs_dir)) {
- CERROR("LProcFS failed in ldlm-init\n");
- rc = ldlm_ns_debugfs_dir ? PTR_ERR(ldlm_ns_debugfs_dir)
- : -ENOMEM;
- goto err_type;
- }
+ ldlm_ns_debugfs_dir = debugfs_create_dir("namespaces",
+ ldlm_debugfs_dir);
- ldlm_svc_debugfs_dir = ldebugfs_register("services",
- ldlm_debugfs_dir,
- NULL, NULL);
- if (IS_ERR_OR_NULL(ldlm_svc_debugfs_dir)) {
- CERROR("LProcFS failed in ldlm-init\n");
- rc = ldlm_svc_debugfs_dir ? PTR_ERR(ldlm_svc_debugfs_dir)
- : -ENOMEM;
- goto err_ns;
- }
+ ldlm_svc_debugfs_dir = debugfs_create_dir("services", ldlm_debugfs_dir);
rc = ldebugfs_add_vars(ldlm_debugfs_dir, ldlm_debugfs_list, NULL);
if (rc) {
@@ -149,11 +128,8 @@ int ldlm_debugfs_setup(void)
err_svc:
ldebugfs_remove(&ldlm_svc_debugfs_dir);
-err_ns:
ldebugfs_remove(&ldlm_ns_debugfs_dir);
-err_type:
ldebugfs_remove(&ldlm_debugfs_dir);
-err:
ldlm_svc_debugfs_dir = NULL;
ldlm_ns_debugfs_dir = NULL;
ldlm_debugfs_dir = NULL;
diff --git a/drivers/staging/lustre/lustre/llite/lproc_llite.c b/drivers/staging/lustre/lustre/llite/lproc_llite.c
index 1f122f8a54dc..1ac36c9ed455 100644
--- a/drivers/staging/lustre/lustre/llite/lproc_llite.c
+++ b/drivers/staging/lustre/lustre/llite/lproc_llite.c
@@ -1157,12 +1157,7 @@ int ldebugfs_register_mountpoint(struct dentry *parent,
snprintf(name, MAX_STRING_SIZE, "%.*s-%p", len,
lsi->lsi_lmd->lmd_profile, sb);
- dir = ldebugfs_register(name, parent, NULL, NULL);
- if (IS_ERR_OR_NULL(dir)) {
- err = dir ? PTR_ERR(dir) : -ENOMEM;
- sbi->ll_debugfs_entry = NULL;
- return err;
- }
+ dir = debugfs_create_dir(name, parent);
sbi->ll_debugfs_entry = dir;
debugfs_create_file("dump_page_cache", 0444, dir, sbi,
diff --git a/drivers/staging/lustre/lustre/lov/lov_obd.c b/drivers/staging/lustre/lustre/lov/lov_obd.c
index a2a5f59dfc7a..344ff4b20168 100644
--- a/drivers/staging/lustre/lustre/lov/lov_obd.c
+++ b/drivers/staging/lustre/lustre/lov/lov_obd.c
@@ -809,9 +809,8 @@ int lov_setup(struct obd_device *obd, struct lustre_cfg *lcfg)
debugfs_create_file("target_obd", 0444, obd->obd_debugfs_entry, obd,
&lov_proc_target_fops);
- lov->lov_pool_debugfs_entry = ldebugfs_register("pools",
- obd->obd_debugfs_entry,
- NULL, NULL);
+ lov->lov_pool_debugfs_entry = debugfs_create_dir("pools",
+ obd->obd_debugfs_entry);
return 0;
out:
diff --git a/drivers/staging/lustre/lustre/obdclass/genops.c b/drivers/staging/lustre/lustre/obdclass/genops.c
index af233b868742..3771452b836c 100644
--- a/drivers/staging/lustre/lustre/obdclass/genops.c
+++ b/drivers/staging/lustre/lustre/obdclass/genops.c
@@ -170,15 +170,8 @@ int class_register_type(struct obd_ops *dt_ops, struct md_ops *md_ops,
strcpy(type->typ_name, name);
spin_lock_init(&type->obd_type_lock);
- type->typ_debugfs_entry = ldebugfs_register(type->typ_name,
- debugfs_lustre_root,
- NULL, type);
- if (IS_ERR_OR_NULL(type->typ_debugfs_entry)) {
- rc = type->typ_debugfs_entry ? PTR_ERR(type->typ_debugfs_entry)
- : -ENOMEM;
- type->typ_debugfs_entry = NULL;
- goto failed;
- }
+ type->typ_debugfs_entry = debugfs_create_dir(type->typ_name,
+ debugfs_lustre_root);
type->typ_kobj = kobject_create_and_add(type->typ_name, lustre_kobj);
if (!type->typ_kobj) {
diff --git a/drivers/staging/lustre/lustre/ptlrpc/lproc_ptlrpc.c b/drivers/staging/lustre/lustre/ptlrpc/lproc_ptlrpc.c
index eb21a8dd3708..62404b08f390 100644
--- a/drivers/staging/lustre/lustre/ptlrpc/lproc_ptlrpc.c
+++ b/drivers/staging/lustre/lustre/ptlrpc/lproc_ptlrpc.c
@@ -197,15 +197,10 @@ ptlrpc_ldebugfs_register(struct dentry *root, char *dir,
if (!svc_stats)
return;
- if (dir) {
- svc_debugfs_entry = ldebugfs_register(dir, root, NULL, NULL);
- if (IS_ERR(svc_debugfs_entry)) {
- lprocfs_free_stats(&svc_stats);
- return;
- }
- } else {
+ if (dir)
+ svc_debugfs_entry = debugfs_create_dir(dir, root);
+ else
svc_debugfs_entry = root;
- }
lprocfs_counter_init(svc_stats, PTLRPC_REQWAIT_CNTR,
svc_counter_config, "req_waittime", "usec");
--
2.17.0
^ permalink raw reply related [flat|nested] 12+ messages in thread* [lustre-devel] [PATCH 11/13] staging: lustre: remove last two users of ldebugfs_register()
[not found] <20180529142947.3250-1-gregkh@linuxfoundation.org>
` (6 preceding siblings ...)
2018-05-29 14:29 ` [lustre-devel] [PATCH 10/13] staging: lustre: unwrap some ldebugfs_register() calls Greg Kroah-Hartman
@ 2018-05-29 14:29 ` Greg Kroah-Hartman
2018-05-29 14:29 ` [lustre-devel] [PATCH 12/13] staging: lustre: make ldebugfs_add_vars a void function Greg Kroah-Hartman
2018-05-29 14:29 ` [lustre-devel] [PATCH 13/13] staging: lustre: get rid of ldebugfs_remove() Greg Kroah-Hartman
9 siblings, 0 replies; 12+ messages in thread
From: Greg Kroah-Hartman @ 2018-05-29 14:29 UTC (permalink / raw)
To: lustre-devel
ldebugfs_register() is just a call to debugfs_create_dir() and
ldebugfs_add_vars() if the list option is set. Fix up the last two
users of this function to just call these two functions instead, and
delete the now unused ldebugfs_register() call.
This ends up cleaning up more code and making things smaller, always a
good thing.
Cc: Oleg Drokin <oleg.drokin@intel.com>
Cc: Andreas Dilger <andreas.dilger@intel.com>
Cc: James Simmons <jsimmons@infradead.org>
Cc: NeilBrown <neilb@suse.com>
Cc: Ben Evans <bevans@cray.com>
Cc: Quentin Bouget <quentin.bouget@cea.fr>
Cc: Arvind Yadav <arvind.yadav.cs@gmail.com>
Cc: Arushi Singhal <arushisinghal19971997@gmail.com>
Cc: Julia Lawall <julia.lawall@lip6.fr>
Cc: Mathias Rav <mathiasrav@gmail.com>
Cc: Dafna Hirschfeld <dafna3@gmail.com>
Cc: "Gustavo A. R. Silva" <garsilva@embeddedor.com>
Cc: Patrick Farrell <paf@cray.com>
Cc: Nadav Amit <namit@vmware.com>
Cc: lustre-devel at lists.lustre.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
.../lustre/lustre/include/lprocfs_status.h | 5 ---
.../lustre/lustre/obdclass/lprocfs_status.c | 39 ++-----------------
.../lustre/lustre/ptlrpc/ptlrpc_internal.h | 2 +-
drivers/staging/lustre/lustre/ptlrpc/sec.c | 6 +--
.../staging/lustre/lustre/ptlrpc/sec_lproc.c | 17 ++------
5 files changed, 8 insertions(+), 61 deletions(-)
diff --git a/drivers/staging/lustre/lustre/include/lprocfs_status.h b/drivers/staging/lustre/lustre/include/lprocfs_status.h
index cc230c520189..912c65b2f72b 100644
--- a/drivers/staging/lustre/lustre/include/lprocfs_status.h
+++ b/drivers/staging/lustre/lustre/include/lprocfs_status.h
@@ -454,11 +454,6 @@ int ldebugfs_add_vars(struct dentry *parent,
struct lprocfs_vars *var,
void *data);
-struct dentry *ldebugfs_register(const char *name,
- struct dentry *parent,
- struct lprocfs_vars *list,
- void *data);
-
void ldebugfs_remove(struct dentry **entryp);
int lprocfs_obd_setup(struct obd_device *obd, struct lprocfs_vars *list,
diff --git a/drivers/staging/lustre/lustre/obdclass/lprocfs_status.c b/drivers/staging/lustre/lustre/obdclass/lprocfs_status.c
index 6e306cafa95a..91af79facbc0 100644
--- a/drivers/staging/lustre/lustre/obdclass/lprocfs_status.c
+++ b/drivers/staging/lustre/lustre/obdclass/lprocfs_status.c
@@ -338,32 +338,6 @@ void ldebugfs_remove(struct dentry **entryp)
}
EXPORT_SYMBOL_GPL(ldebugfs_remove);
-struct dentry *ldebugfs_register(const char *name,
- struct dentry *parent,
- struct lprocfs_vars *list, void *data)
-{
- struct dentry *entry;
-
- entry = debugfs_create_dir(name, parent);
- if (IS_ERR_OR_NULL(entry)) {
- entry = entry ?: ERR_PTR(-ENOMEM);
- goto out;
- }
-
- if (!IS_ERR_OR_NULL(list)) {
- int rc;
-
- rc = ldebugfs_add_vars(entry, list, data);
- if (rc != 0) {
- debugfs_remove(entry);
- entry = ERR_PTR(rc);
- }
- }
-out:
- return entry;
-}
-EXPORT_SYMBOL_GPL(ldebugfs_register);
-
/* Generic callbacks */
static ssize_t uuid_show(struct kobject *kobj, struct attribute *attr,
char *buf)
@@ -1026,16 +1000,9 @@ int lprocfs_obd_setup(struct obd_device *obd, struct lprocfs_vars *list,
}
}
- obd->obd_debugfs_entry = ldebugfs_register(obd->obd_name,
- obd->obd_type->typ_debugfs_entry,
- list, obd);
- if (IS_ERR_OR_NULL(obd->obd_debugfs_entry)) {
- rc = obd->obd_debugfs_entry ? PTR_ERR(obd->obd_debugfs_entry)
- : -ENOMEM;
- CERROR("error %d setting up lprocfs for %s\n",
- rc, obd->obd_name);
- obd->obd_debugfs_entry = NULL;
- }
+ obd->obd_debugfs_entry = debugfs_create_dir(obd->obd_name,
+ obd->obd_type->typ_debugfs_entry);
+ ldebugfs_add_vars(obd->obd_debugfs_entry, list, obd);
return rc;
}
diff --git a/drivers/staging/lustre/lustre/ptlrpc/ptlrpc_internal.h b/drivers/staging/lustre/lustre/ptlrpc/ptlrpc_internal.h
index b7a8d7537a66..134b74234519 100644
--- a/drivers/staging/lustre/lustre/ptlrpc/ptlrpc_internal.h
+++ b/drivers/staging/lustre/lustre/ptlrpc/ptlrpc_internal.h
@@ -264,7 +264,7 @@ void sptlrpc_enc_pool_fini(void);
int sptlrpc_proc_enc_pool_seq_show(struct seq_file *m, void *v);
/* sec_lproc.c */
-int sptlrpc_lproc_init(void);
+void sptlrpc_lproc_init(void);
void sptlrpc_lproc_fini(void);
/* sec_gc.c */
diff --git a/drivers/staging/lustre/lustre/ptlrpc/sec.c b/drivers/staging/lustre/lustre/ptlrpc/sec.c
index 256421465bcd..e193f3346e6f 100644
--- a/drivers/staging/lustre/lustre/ptlrpc/sec.c
+++ b/drivers/staging/lustre/lustre/ptlrpc/sec.c
@@ -2352,14 +2352,10 @@ int sptlrpc_init(void)
if (rc)
goto out_null;
- rc = sptlrpc_lproc_init();
- if (rc)
- goto out_plain;
+ sptlrpc_lproc_init();
return 0;
-out_plain:
- sptlrpc_plain_fini();
out_null:
sptlrpc_null_fini();
out_pool:
diff --git a/drivers/staging/lustre/lustre/ptlrpc/sec_lproc.c b/drivers/staging/lustre/lustre/ptlrpc/sec_lproc.c
index cd1bb3dabb63..e8076dc7c950 100644
--- a/drivers/staging/lustre/lustre/ptlrpc/sec_lproc.c
+++ b/drivers/staging/lustre/lustre/ptlrpc/sec_lproc.c
@@ -158,21 +158,10 @@ static struct lprocfs_vars sptlrpc_lprocfs_vars[] = {
static struct dentry *sptlrpc_debugfs_dir;
-int sptlrpc_lproc_init(void)
+void sptlrpc_lproc_init(void)
{
- int rc;
-
- LASSERT(!sptlrpc_debugfs_dir);
-
- sptlrpc_debugfs_dir = ldebugfs_register("sptlrpc", debugfs_lustre_root,
- sptlrpc_lprocfs_vars, NULL);
- if (IS_ERR_OR_NULL(sptlrpc_debugfs_dir)) {
- rc = sptlrpc_debugfs_dir ? PTR_ERR(sptlrpc_debugfs_dir)
- : -ENOMEM;
- sptlrpc_debugfs_dir = NULL;
- return rc;
- }
- return 0;
+ sptlrpc_debugfs_dir = debugfs_create_dir("sptlrpc", debugfs_lustre_root);
+ ldebugfs_add_vars(sptlrpc_debugfs_dir, sptlrpc_lprocfs_vars, NULL);
}
void sptlrpc_lproc_fini(void)
--
2.17.0
^ permalink raw reply related [flat|nested] 12+ messages in thread* [lustre-devel] [PATCH 12/13] staging: lustre: make ldebugfs_add_vars a void function
[not found] <20180529142947.3250-1-gregkh@linuxfoundation.org>
` (7 preceding siblings ...)
2018-05-29 14:29 ` [lustre-devel] [PATCH 11/13] staging: lustre: remove last two users of ldebugfs_register() Greg Kroah-Hartman
@ 2018-05-29 14:29 ` Greg Kroah-Hartman
2018-05-29 14:29 ` [lustre-devel] [PATCH 13/13] staging: lustre: get rid of ldebugfs_remove() Greg Kroah-Hartman
9 siblings, 0 replies; 12+ messages in thread
From: Greg Kroah-Hartman @ 2018-05-29 14:29 UTC (permalink / raw)
To: lustre-devel
The call to ldebugfs_add_vars() can not really fail, so have it just
return nothing, which allows us to clean up a lot of unused error
handling code.
Cc: Oleg Drokin <oleg.drokin@intel.com>
Cc: Andreas Dilger <andreas.dilger@intel.com>
Cc: James Simmons <jsimmons@infradead.org>
Cc: NeilBrown <neilb@suse.com>
Cc: Roman Storozhenko <romeusmeister@gmail.com>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Quentin Bouget <quentin.bouget@cea.fr>
Cc: Aastha Gupta <aastha.gupta4104@gmail.com>
Cc: Ben Evans <bevans@cray.com>
Cc: Arvind Yadav <arvind.yadav.cs@gmail.com>
Cc: Arushi Singhal <arushisinghal19971997@gmail.com>
Cc: Frank Zago <fzago@cray.com>
Cc: Patrick Farrell <paf@cray.com>
Cc: Simo Koskinen <koskisoft@gmail.com>
Cc: Andriy Skulysh <andriy.skulysh@seagate.com>
Cc: "John L. Hammond" <john.hammond@intel.com>
Cc: Mathias Rav <mathiasrav@gmail.com>
Cc: Dafna Hirschfeld <dafna3@gmail.com>
Cc: "Gustavo A. R. Silva" <garsilva@embeddedor.com>
Cc: lustre-devel at lists.lustre.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
.../staging/lustre/lustre/fid/fid_request.c | 37 ++++---------------
.../staging/lustre/lustre/fld/fld_request.c | 30 +++------------
.../lustre/lustre/include/lprocfs_status.h | 5 +--
.../lustre/lustre/include/lustre_dlm.h | 2 +-
.../staging/lustre/lustre/ldlm/ldlm_lockd.c | 4 +-
.../lustre/lustre/ldlm/ldlm_resource.c | 21 +----------
.../staging/lustre/lustre/llite/lproc_llite.c | 5 +--
.../lustre/lustre/obdclass/lprocfs_status.c | 17 ++++-----
8 files changed, 27 insertions(+), 94 deletions(-)
diff --git a/drivers/staging/lustre/lustre/fid/fid_request.c b/drivers/staging/lustre/lustre/fid/fid_request.c
index dfcac0afa106..bc748ab6645d 100644
--- a/drivers/staging/lustre/lustre/fid/fid_request.c
+++ b/drivers/staging/lustre/lustre/fid/fid_request.c
@@ -295,26 +295,12 @@ static void seq_client_debugfs_fini(struct lu_client_seq *seq)
ldebugfs_remove(&seq->lcs_debugfs_entry);
}
-static int seq_client_debugfs_init(struct lu_client_seq *seq)
+static void seq_client_debugfs_init(struct lu_client_seq *seq)
{
- int rc;
-
seq->lcs_debugfs_entry = debugfs_create_dir(seq->lcs_name,
seq_debugfs_dir);
- rc = ldebugfs_add_vars(seq->lcs_debugfs_entry,
- seq_client_debugfs_list, seq);
- if (rc) {
- CERROR("%s: Can't init sequence manager debugfs, rc %d\n",
- seq->lcs_name, rc);
- goto out_cleanup;
- }
-
- return 0;
-
-out_cleanup:
- seq_client_debugfs_fini(seq);
- return rc;
+ ldebugfs_add_vars(seq->lcs_debugfs_entry, seq_client_debugfs_list, seq);
}
static void seq_client_fini(struct lu_client_seq *seq)
@@ -327,13 +313,9 @@ static void seq_client_fini(struct lu_client_seq *seq)
}
}
-static int seq_client_init(struct lu_client_seq *seq,
- struct obd_export *exp,
- enum lu_cli_type type,
- const char *prefix)
+static void seq_client_init(struct lu_client_seq *seq, struct obd_export *exp,
+ enum lu_cli_type type, const char *prefix)
{
- int rc;
-
LASSERT(seq);
LASSERT(prefix);
@@ -354,10 +336,7 @@ static int seq_client_init(struct lu_client_seq *seq,
snprintf(seq->lcs_name, sizeof(seq->lcs_name),
"cli-%s", prefix);
- rc = seq_client_debugfs_init(seq);
- if (rc)
- seq_client_fini(seq);
- return rc;
+ seq_client_debugfs_init(seq);
}
int client_fid_init(struct obd_device *obd,
@@ -380,12 +359,10 @@ int client_fid_init(struct obd_device *obd,
snprintf(prefix, MAX_OBD_NAME + 5, "cli-%s", obd->obd_name);
/* Init client side sequence-manager */
- rc = seq_client_init(cli->cl_seq, exp, type, prefix);
+ seq_client_init(cli->cl_seq, exp, type, prefix);
kfree(prefix);
- if (rc)
- goto out_free_seq;
- return rc;
+ return 0;
out_free_seq:
kfree(cli->cl_seq);
cli->cl_seq = NULL;
diff --git a/drivers/staging/lustre/lustre/fld/fld_request.c b/drivers/staging/lustre/lustre/fld/fld_request.c
index 409850379fc3..cb67fee19451 100644
--- a/drivers/staging/lustre/lustre/fld/fld_request.c
+++ b/drivers/staging/lustre/lustre/fld/fld_request.c
@@ -217,25 +217,12 @@ int fld_client_del_target(struct lu_client_fld *fld, __u64 idx)
static struct dentry *fld_debugfs_dir;
-static int fld_client_debugfs_init(struct lu_client_fld *fld)
+static void fld_client_debugfs_init(struct lu_client_fld *fld)
{
- int rc;
-
fld->lcf_debugfs_entry = debugfs_create_dir(fld->lcf_name,
fld_debugfs_dir);
- rc = ldebugfs_add_vars(fld->lcf_debugfs_entry,
- fld_client_debugfs_list, fld);
- if (rc) {
- CERROR("%s: Can't init FLD debufs, rc %d\n", fld->lcf_name, rc);
- goto out_cleanup;
- }
-
- return 0;
-
-out_cleanup:
- fld_client_debugfs_fini(fld);
- return rc;
+ ldebugfs_add_vars(fld->lcf_debugfs_entry, fld_client_debugfs_list, fld);
}
void fld_client_debugfs_fini(struct lu_client_fld *fld)
@@ -254,7 +241,7 @@ int fld_client_init(struct lu_client_fld *fld,
const char *prefix, int hash)
{
int cache_size, cache_threshold;
- int rc;
+ int rc = 0;
snprintf(fld->lcf_name, sizeof(fld->lcf_name),
"cli-%s", prefix);
@@ -284,15 +271,10 @@ int fld_client_init(struct lu_client_fld *fld,
goto out;
}
- rc = fld_client_debugfs_init(fld);
- if (rc)
- goto out;
+ fld_client_debugfs_init(fld);
out:
- if (rc)
- fld_client_fini(fld);
- else
- CDEBUG(D_INFO, "%s: Using \"%s\" hash\n",
- fld->lcf_name, fld->lcf_hash->fh_name);
+ CDEBUG(D_INFO, "%s: Using \"%s\" hash\n",
+ fld->lcf_name, fld->lcf_hash->fh_name);
return rc;
}
EXPORT_SYMBOL(fld_client_init);
diff --git a/drivers/staging/lustre/lustre/include/lprocfs_status.h b/drivers/staging/lustre/lustre/include/lprocfs_status.h
index 912c65b2f72b..b18bcb337504 100644
--- a/drivers/staging/lustre/lustre/include/lprocfs_status.h
+++ b/drivers/staging/lustre/lustre/include/lprocfs_status.h
@@ -450,9 +450,8 @@ int lprocfs_exp_cleanup(struct obd_export *exp);
extern const struct file_operations lprocfs_stats_seq_fops;
/* lprocfs_status.c */
-int ldebugfs_add_vars(struct dentry *parent,
- struct lprocfs_vars *var,
- void *data);
+void ldebugfs_add_vars(struct dentry *parent, struct lprocfs_vars *var,
+ void *data);
void ldebugfs_remove(struct dentry **entryp);
diff --git a/drivers/staging/lustre/lustre/include/lustre_dlm.h b/drivers/staging/lustre/lustre/include/lustre_dlm.h
index b3532adac31c..2c55241258cc 100644
--- a/drivers/staging/lustre/lustre/include/lustre_dlm.h
+++ b/drivers/staging/lustre/lustre/include/lustre_dlm.h
@@ -1185,7 +1185,7 @@ void ldlm_namespace_free_prior(struct ldlm_namespace *ns,
void ldlm_namespace_free_post(struct ldlm_namespace *ns);
void ldlm_namespace_get(struct ldlm_namespace *ns);
void ldlm_namespace_put(struct ldlm_namespace *ns);
-int ldlm_debugfs_setup(void);
+void ldlm_debugfs_setup(void);
void ldlm_debugfs_cleanup(void);
/* resource.c - internal */
diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_lockd.c b/drivers/staging/lustre/lustre/ldlm/ldlm_lockd.c
index b0a29f50c7d6..5963e90d0938 100644
--- a/drivers/staging/lustre/lustre/ldlm/ldlm_lockd.c
+++ b/drivers/staging/lustre/lustre/ldlm/ldlm_lockd.c
@@ -979,9 +979,7 @@ static int ldlm_setup(void)
goto out;
}
- rc = ldlm_debugfs_setup();
- if (rc != 0)
- goto out;
+ ldlm_debugfs_setup();
memset(&conf, 0, sizeof(conf));
conf = (typeof(conf)) {
diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_resource.c b/drivers/staging/lustre/lustre/ldlm/ldlm_resource.c
index 691899ef8044..6b94a2b2a0fc 100644
--- a/drivers/staging/lustre/lustre/ldlm/ldlm_resource.c
+++ b/drivers/staging/lustre/lustre/ldlm/ldlm_resource.c
@@ -106,10 +106,8 @@ static struct lprocfs_vars ldlm_debugfs_list[] = {
{ NULL }
};
-int ldlm_debugfs_setup(void)
+void ldlm_debugfs_setup(void)
{
- int rc;
-
ldlm_debugfs_dir = debugfs_create_dir(OBD_LDLM_DEVICENAME,
debugfs_lustre_root);
@@ -118,22 +116,7 @@ int ldlm_debugfs_setup(void)
ldlm_svc_debugfs_dir = debugfs_create_dir("services", ldlm_debugfs_dir);
- rc = ldebugfs_add_vars(ldlm_debugfs_dir, ldlm_debugfs_list, NULL);
- if (rc) {
- CERROR("LProcFS failed in ldlm-init\n");
- goto err_svc;
- }
-
- return 0;
-
-err_svc:
- ldebugfs_remove(&ldlm_svc_debugfs_dir);
- ldebugfs_remove(&ldlm_ns_debugfs_dir);
- ldebugfs_remove(&ldlm_debugfs_dir);
- ldlm_svc_debugfs_dir = NULL;
- ldlm_ns_debugfs_dir = NULL;
- ldlm_debugfs_dir = NULL;
- return rc;
+ ldebugfs_add_vars(ldlm_debugfs_dir, ldlm_debugfs_list, NULL);
}
void ldlm_debugfs_cleanup(void)
diff --git a/drivers/staging/lustre/lustre/llite/lproc_llite.c b/drivers/staging/lustre/lustre/llite/lproc_llite.c
index 1ac36c9ed455..d2f42c727ed4 100644
--- a/drivers/staging/lustre/lustre/llite/lproc_llite.c
+++ b/drivers/staging/lustre/lustre/llite/lproc_llite.c
@@ -1210,10 +1210,7 @@ int ldebugfs_register_mountpoint(struct dentry *parent,
debugfs_create_file("stats", 0644, sbi->ll_debugfs_entry,
sbi->ll_ra_stats, &lprocfs_stats_seq_fops);
- err = ldebugfs_add_vars(sbi->ll_debugfs_entry,
- lprocfs_llite_obd_vars, sb);
- if (err)
- goto out;
+ ldebugfs_add_vars(sbi->ll_debugfs_entry, lprocfs_llite_obd_vars, sb);
sbi->ll_kobj.kset = llite_kset;
init_completion(&sbi->ll_kobj_unregister);
diff --git a/drivers/staging/lustre/lustre/obdclass/lprocfs_status.c b/drivers/staging/lustre/lustre/obdclass/lprocfs_status.c
index 91af79facbc0..a8299a8cdad9 100644
--- a/drivers/staging/lustre/lustre/obdclass/lprocfs_status.c
+++ b/drivers/staging/lustre/lustre/obdclass/lprocfs_status.c
@@ -302,15 +302,13 @@ EXPORT_SYMBOL(lprocfs_seq_release);
static const struct file_operations lprocfs_generic_fops = { };
-int ldebugfs_add_vars(struct dentry *parent,
- struct lprocfs_vars *list,
- void *data)
+void ldebugfs_add_vars(struct dentry *parent, struct lprocfs_vars *list,
+ void *data)
{
if (IS_ERR_OR_NULL(parent) || IS_ERR_OR_NULL(list))
- return -EINVAL;
+ return;
while (list->name) {
- struct dentry *entry;
umode_t mode = 0;
if (list->proc_mode != 0000) {
@@ -321,13 +319,12 @@ int ldebugfs_add_vars(struct dentry *parent,
if (list->fops->write)
mode |= 0200;
}
- entry = debugfs_create_file(list->name, mode, parent,
- list->data ?: data,
- list->fops ?: &lprocfs_generic_fops
- );
+ debugfs_create_file(list->name, mode, parent,
+ list->data ?: data,
+ list->fops ?: &lprocfs_generic_fops);
list++;
}
- return 0;
+ return;
}
EXPORT_SYMBOL_GPL(ldebugfs_add_vars);
--
2.17.0
^ permalink raw reply related [flat|nested] 12+ messages in thread* [lustre-devel] [PATCH 13/13] staging: lustre: get rid of ldebugfs_remove()
[not found] <20180529142947.3250-1-gregkh@linuxfoundation.org>
` (8 preceding siblings ...)
2018-05-29 14:29 ` [lustre-devel] [PATCH 12/13] staging: lustre: make ldebugfs_add_vars a void function Greg Kroah-Hartman
@ 2018-05-29 14:29 ` Greg Kroah-Hartman
9 siblings, 0 replies; 12+ messages in thread
From: Greg Kroah-Hartman @ 2018-05-29 14:29 UTC (permalink / raw)
To: lustre-devel
It was just a dumb wrapper around debugfs_remove_recursive() so just
call the function properly. Also, there is no need to set the dentry to
NULL, it's gone, who cares about it anymore...
Cc: Oleg Drokin <oleg.drokin@intel.com>
Cc: Andreas Dilger <andreas.dilger@intel.com>
Cc: James Simmons <jsimmons@infradead.org>
Cc: NeilBrown <neilb@suse.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Roman Storozhenko <romeusmeister@gmail.com>
Cc: Aastha Gupta <aastha.gupta4104@gmail.com>
Cc: Ben Evans <bevans@cray.com>
Cc: Quentin Bouget <quentin.bouget@cea.fr>
Cc: Arvind Yadav <arvind.yadav.cs@gmail.com>
Cc: Arushi Singhal <arushisinghal19971997@gmail.com>
Cc: Patrick Farrell <paf@cray.com>
Cc: Aliaksei Karaliou <akaraliou.dev@gmail.com>
Cc: Mathias Rav <mathiasrav@gmail.com>
Cc: Andriy Skulysh <andriy.skulysh@seagate.com>
Cc: Dafna Hirschfeld <dafna3@gmail.com>
Cc: "Gustavo A. R. Silva" <garsilva@embeddedor.com>
Cc: Bob Glosman <bob.glossman@intel.com>
Cc: lustre-devel at lists.lustre.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
.../staging/lustre/lustre/fid/fid_request.c | 6 ++----
.../staging/lustre/lustre/fld/fld_request.c | 6 ++----
.../lustre/lustre/include/lprocfs_status.h | 2 --
.../staging/lustre/lustre/ldlm/ldlm_pool.c | 5 +----
.../lustre/lustre/ldlm/ldlm_resource.c | 21 ++++---------------
.../staging/lustre/lustre/llite/lproc_llite.c | 14 ++++++-------
drivers/staging/lustre/lustre/lov/lov_pool.c | 4 ++--
.../staging/lustre/lustre/obdclass/genops.c | 3 +--
.../lustre/lustre/obdclass/lprocfs_status.c | 10 +--------
.../lustre/lustre/ptlrpc/lproc_ptlrpc.c | 6 ++----
.../staging/lustre/lustre/ptlrpc/sec_lproc.c | 3 +--
11 files changed, 22 insertions(+), 58 deletions(-)
diff --git a/drivers/staging/lustre/lustre/fid/fid_request.c b/drivers/staging/lustre/lustre/fid/fid_request.c
index bc748ab6645d..a34fd90ca5e5 100644
--- a/drivers/staging/lustre/lustre/fid/fid_request.c
+++ b/drivers/staging/lustre/lustre/fid/fid_request.c
@@ -291,8 +291,7 @@ EXPORT_SYMBOL(seq_client_flush);
static void seq_client_debugfs_fini(struct lu_client_seq *seq)
{
- if (!IS_ERR_OR_NULL(seq->lcs_debugfs_entry))
- ldebugfs_remove(&seq->lcs_debugfs_entry);
+ debugfs_remove_recursive(seq->lcs_debugfs_entry);
}
static void seq_client_debugfs_init(struct lu_client_seq *seq)
@@ -399,8 +398,7 @@ static int __init fid_init(void)
static void __exit fid_exit(void)
{
- if (!IS_ERR_OR_NULL(seq_debugfs_dir))
- ldebugfs_remove(&seq_debugfs_dir);
+ debugfs_remove_recursive(seq_debugfs_dir);
}
MODULE_AUTHOR("OpenSFS, Inc. <http://www.lustre.org/>");
diff --git a/drivers/staging/lustre/lustre/fld/fld_request.c b/drivers/staging/lustre/lustre/fld/fld_request.c
index cb67fee19451..97f7ea632346 100644
--- a/drivers/staging/lustre/lustre/fld/fld_request.c
+++ b/drivers/staging/lustre/lustre/fld/fld_request.c
@@ -227,8 +227,7 @@ static void fld_client_debugfs_init(struct lu_client_fld *fld)
void fld_client_debugfs_fini(struct lu_client_fld *fld)
{
- if (!IS_ERR_OR_NULL(fld->lcf_debugfs_entry))
- ldebugfs_remove(&fld->lcf_debugfs_entry);
+ debugfs_remove_recursive(fld->lcf_debugfs_entry);
}
EXPORT_SYMBOL(fld_client_debugfs_fini);
@@ -435,8 +434,7 @@ static int __init fld_init(void)
static void __exit fld_exit(void)
{
- if (!IS_ERR_OR_NULL(fld_debugfs_dir))
- ldebugfs_remove(&fld_debugfs_dir);
+ debugfs_remove_recursive(fld_debugfs_dir);
}
MODULE_AUTHOR("OpenSFS, Inc. <http://www.lustre.org/>");
diff --git a/drivers/staging/lustre/lustre/include/lprocfs_status.h b/drivers/staging/lustre/lustre/include/lprocfs_status.h
index b18bcb337504..495e6f5f676b 100644
--- a/drivers/staging/lustre/lustre/include/lprocfs_status.h
+++ b/drivers/staging/lustre/lustre/include/lprocfs_status.h
@@ -453,8 +453,6 @@ extern const struct file_operations lprocfs_stats_seq_fops;
void ldebugfs_add_vars(struct dentry *parent, struct lprocfs_vars *var,
void *data);
-void ldebugfs_remove(struct dentry **entryp);
-
int lprocfs_obd_setup(struct obd_device *obd, struct lprocfs_vars *list,
const struct attribute_group *attrs);
int lprocfs_obd_cleanup(struct obd_device *obd);
diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_pool.c b/drivers/staging/lustre/lustre/ldlm/ldlm_pool.c
index 146b348ca312..36d14ee4e5b1 100644
--- a/drivers/staging/lustre/lustre/ldlm/ldlm_pool.c
+++ b/drivers/staging/lustre/lustre/ldlm/ldlm_pool.c
@@ -640,10 +640,7 @@ static void ldlm_pool_debugfs_fini(struct ldlm_pool *pl)
lprocfs_free_stats(&pl->pl_stats);
pl->pl_stats = NULL;
}
- if (pl->pl_debugfs_entry) {
- ldebugfs_remove(&pl->pl_debugfs_entry);
- pl->pl_debugfs_entry = NULL;
- }
+ debugfs_remove_recursive(pl->pl_debugfs_entry);
}
int ldlm_pool_init(struct ldlm_pool *pl, struct ldlm_namespace *ns,
diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_resource.c b/drivers/staging/lustre/lustre/ldlm/ldlm_resource.c
index 6b94a2b2a0fc..c93b019b8e37 100644
--- a/drivers/staging/lustre/lustre/ldlm/ldlm_resource.c
+++ b/drivers/staging/lustre/lustre/ldlm/ldlm_resource.c
@@ -121,18 +121,9 @@ void ldlm_debugfs_setup(void)
void ldlm_debugfs_cleanup(void)
{
- if (!IS_ERR_OR_NULL(ldlm_svc_debugfs_dir))
- ldebugfs_remove(&ldlm_svc_debugfs_dir);
-
- if (!IS_ERR_OR_NULL(ldlm_ns_debugfs_dir))
- ldebugfs_remove(&ldlm_ns_debugfs_dir);
-
- if (!IS_ERR_OR_NULL(ldlm_debugfs_dir))
- ldebugfs_remove(&ldlm_debugfs_dir);
-
- ldlm_svc_debugfs_dir = NULL;
- ldlm_ns_debugfs_dir = NULL;
- ldlm_debugfs_dir = NULL;
+ debugfs_remove_recursive(ldlm_svc_debugfs_dir);
+ debugfs_remove_recursive(ldlm_ns_debugfs_dir);
+ debugfs_remove_recursive(ldlm_debugfs_dir);
}
static ssize_t resource_count_show(struct kobject *kobj, struct attribute *attr,
@@ -358,11 +349,7 @@ static struct kobj_type ldlm_ns_ktype = {
static void ldlm_namespace_debugfs_unregister(struct ldlm_namespace *ns)
{
- if (IS_ERR_OR_NULL(ns->ns_debugfs_entry))
- CERROR("dlm namespace %s has no procfs dir?\n",
- ldlm_ns_name(ns));
- else
- ldebugfs_remove(&ns->ns_debugfs_entry);
+ debugfs_remove_recursive(ns->ns_debugfs_entry);
if (ns->ns_stats)
lprocfs_free_stats(&ns->ns_stats);
diff --git a/drivers/staging/lustre/lustre/llite/lproc_llite.c b/drivers/staging/lustre/lustre/llite/lproc_llite.c
index d2f42c727ed4..49bf1b7ee311 100644
--- a/drivers/staging/lustre/lustre/llite/lproc_llite.c
+++ b/drivers/staging/lustre/lustre/llite/lproc_llite.c
@@ -1234,7 +1234,7 @@ int ldebugfs_register_mountpoint(struct dentry *parent,
obd->obd_type->typ_name);
out:
if (err) {
- ldebugfs_remove(&sbi->ll_debugfs_entry);
+ debugfs_remove_recursive(sbi->ll_debugfs_entry);
lprocfs_free_stats(&sbi->ll_ra_stats);
lprocfs_free_stats(&sbi->ll_stats);
}
@@ -1243,13 +1243,11 @@ int ldebugfs_register_mountpoint(struct dentry *parent,
void ldebugfs_unregister_mountpoint(struct ll_sb_info *sbi)
{
- if (sbi->ll_debugfs_entry) {
- ldebugfs_remove(&sbi->ll_debugfs_entry);
- kobject_put(&sbi->ll_kobj);
- wait_for_completion(&sbi->ll_kobj_unregister);
- lprocfs_free_stats(&sbi->ll_ra_stats);
- lprocfs_free_stats(&sbi->ll_stats);
- }
+ debugfs_remove_recursive(sbi->ll_debugfs_entry);
+ kobject_put(&sbi->ll_kobj);
+ wait_for_completion(&sbi->ll_kobj_unregister);
+ lprocfs_free_stats(&sbi->ll_ra_stats);
+ lprocfs_free_stats(&sbi->ll_stats);
}
#undef MAX_STRING_SIZE
diff --git a/drivers/staging/lustre/lustre/lov/lov_pool.c b/drivers/staging/lustre/lustre/lov/lov_pool.c
index 9ce7038c9b0e..b2a88ba72eb2 100644
--- a/drivers/staging/lustre/lustre/lov/lov_pool.c
+++ b/drivers/staging/lustre/lustre/lov/lov_pool.c
@@ -410,7 +410,7 @@ int lov_pool_new(struct obd_device *obd, char *poolname)
list_del_init(&new_pool->pool_list);
lov->lov_pool_count--;
spin_unlock(&obd->obd_dev_lock);
- ldebugfs_remove(&new_pool->pool_debugfs_entry);
+ debugfs_remove_recursive(new_pool->pool_debugfs_entry);
lov_ost_pool_free(&new_pool->pool_obds);
kfree(new_pool);
@@ -435,7 +435,7 @@ int lov_pool_del(struct obd_device *obd, char *poolname)
if (!pool)
return -ENOENT;
- ldebugfs_remove(&pool->pool_debugfs_entry);
+ debugfs_remove_recursive(pool->pool_debugfs_entry);
lov_pool_putref(pool);
spin_lock(&obd->obd_dev_lock);
diff --git a/drivers/staging/lustre/lustre/obdclass/genops.c b/drivers/staging/lustre/lustre/obdclass/genops.c
index 3771452b836c..234f383ce6d9 100644
--- a/drivers/staging/lustre/lustre/obdclass/genops.c
+++ b/drivers/staging/lustre/lustre/obdclass/genops.c
@@ -224,8 +224,7 @@ int class_unregister_type(const char *name)
if (type->typ_kobj)
kobject_put(type->typ_kobj);
- if (!IS_ERR_OR_NULL(type->typ_debugfs_entry))
- ldebugfs_remove(&type->typ_debugfs_entry);
+ debugfs_remove_recursive(type->typ_debugfs_entry);
if (type->typ_lu)
lu_device_type_fini(type->typ_lu);
diff --git a/drivers/staging/lustre/lustre/obdclass/lprocfs_status.c b/drivers/staging/lustre/lustre/obdclass/lprocfs_status.c
index a8299a8cdad9..bdbe6f52031a 100644
--- a/drivers/staging/lustre/lustre/obdclass/lprocfs_status.c
+++ b/drivers/staging/lustre/lustre/obdclass/lprocfs_status.c
@@ -328,13 +328,6 @@ void ldebugfs_add_vars(struct dentry *parent, struct lprocfs_vars *list,
}
EXPORT_SYMBOL_GPL(ldebugfs_add_vars);
-void ldebugfs_remove(struct dentry **entryp)
-{
- debugfs_remove_recursive(*entryp);
- *entryp = NULL;
-}
-EXPORT_SYMBOL_GPL(ldebugfs_remove);
-
/* Generic callbacks */
static ssize_t uuid_show(struct kobject *kobj, struct attribute *attr,
char *buf)
@@ -1010,8 +1003,7 @@ int lprocfs_obd_cleanup(struct obd_device *obd)
if (!obd)
return -EINVAL;
- if (!IS_ERR_OR_NULL(obd->obd_debugfs_entry))
- ldebugfs_remove(&obd->obd_debugfs_entry);
+ debugfs_remove_recursive(obd->obd_debugfs_entry);
kobject_put(&obd->obd_kobj);
wait_for_completion(&obd->obd_kobj_unregister);
diff --git a/drivers/staging/lustre/lustre/ptlrpc/lproc_ptlrpc.c b/drivers/staging/lustre/lustre/ptlrpc/lproc_ptlrpc.c
index 62404b08f390..0b638837f88b 100644
--- a/drivers/staging/lustre/lustre/ptlrpc/lproc_ptlrpc.c
+++ b/drivers/staging/lustre/lustre/ptlrpc/lproc_ptlrpc.c
@@ -1158,8 +1158,7 @@ EXPORT_SYMBOL(ptlrpc_lprocfs_brw);
void ptlrpc_lprocfs_unregister_service(struct ptlrpc_service *svc)
{
- if (!IS_ERR_OR_NULL(svc->srv_debugfs_entry))
- ldebugfs_remove(&svc->srv_debugfs_entry);
+ debugfs_remove_recursive(svc->srv_debugfs_entry);
if (svc->srv_stats)
lprocfs_free_stats(&svc->srv_stats);
@@ -1167,8 +1166,7 @@ void ptlrpc_lprocfs_unregister_service(struct ptlrpc_service *svc)
void ptlrpc_lprocfs_unregister_obd(struct obd_device *obd)
{
- if (!IS_ERR_OR_NULL(obd->obd_svc_debugfs_entry))
- ldebugfs_remove(&obd->obd_svc_debugfs_entry);
+ debugfs_remove_recursive(obd->obd_svc_debugfs_entry);
if (obd->obd_svc_stats)
lprocfs_free_stats(&obd->obd_svc_stats);
diff --git a/drivers/staging/lustre/lustre/ptlrpc/sec_lproc.c b/drivers/staging/lustre/lustre/ptlrpc/sec_lproc.c
index e8076dc7c950..2bb75ebd5d98 100644
--- a/drivers/staging/lustre/lustre/ptlrpc/sec_lproc.c
+++ b/drivers/staging/lustre/lustre/ptlrpc/sec_lproc.c
@@ -166,6 +166,5 @@ void sptlrpc_lproc_init(void)
void sptlrpc_lproc_fini(void)
{
- if (!IS_ERR_OR_NULL(sptlrpc_debugfs_dir))
- ldebugfs_remove(&sptlrpc_debugfs_dir);
+ debugfs_remove_recursive(sptlrpc_debugfs_dir);
}
--
2.17.0
^ permalink raw reply related [flat|nested] 12+ messages in thread