ocfs2: further debugfs cleanups
There is no need to check return value of debugfs_create functions, but the last sweep through ocfs missed a number of places where this was happening. There is also no need to save the individual dentries for the debugfs files, as everything is can just be removed at once when the directory is removed. By getting rid of the file dentries for the debugfs entries, a bit of local memory can be saved as well. [colin.king@canonical.com: ensure ret is set to zero before returning] Link: http://lkml.kernel.org/r/20190807121929.28918-1-colin.king@canonical.com Link: http://lkml.kernel.org/r/20190731132119.GA12603@kroah.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Colin Ian King <colin.king@canonical.com> Reviewed-by: Joseph Qi <joseph.qi@linux.alibaba.com> Cc: Mark Fasheh <mark@fasheh.com> Cc: Joel Becker <jlbec@evilplan.org> Cc: Jia Guo <guojia12@huawei.com> Cc: Junxiao Bi <junxiao.bi@oracle.com> Cc: Changwei Ge <gechangwei@live.cn> Cc: Gang He <ghe@suse.com> Cc: Jun Piao <piaojun@huawei.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:

committed by
Linus Torvalds

parent
963abb9aeb
commit
5e7a3ed9f1
@@ -3012,8 +3012,6 @@ struct ocfs2_dlm_debug *ocfs2_new_dlm_debug(void)
|
||||
|
||||
kref_init(&dlm_debug->d_refcnt);
|
||||
INIT_LIST_HEAD(&dlm_debug->d_lockres_tracking);
|
||||
dlm_debug->d_locking_state = NULL;
|
||||
dlm_debug->d_locking_filter = NULL;
|
||||
dlm_debug->d_filter_secs = 0;
|
||||
out:
|
||||
return dlm_debug;
|
||||
@@ -3282,27 +3280,19 @@ static void ocfs2_dlm_init_debug(struct ocfs2_super *osb)
|
||||
{
|
||||
struct ocfs2_dlm_debug *dlm_debug = osb->osb_dlm_debug;
|
||||
|
||||
dlm_debug->d_locking_state = debugfs_create_file("locking_state",
|
||||
S_IFREG|S_IRUSR,
|
||||
osb->osb_debug_root,
|
||||
osb,
|
||||
&ocfs2_dlm_debug_fops);
|
||||
debugfs_create_file("locking_state", S_IFREG|S_IRUSR,
|
||||
osb->osb_debug_root, osb, &ocfs2_dlm_debug_fops);
|
||||
|
||||
dlm_debug->d_locking_filter = debugfs_create_u32("locking_filter",
|
||||
0600,
|
||||
osb->osb_debug_root,
|
||||
&dlm_debug->d_filter_secs);
|
||||
debugfs_create_u32("locking_filter", 0600, osb->osb_debug_root,
|
||||
&dlm_debug->d_filter_secs);
|
||||
}
|
||||
|
||||
static void ocfs2_dlm_shutdown_debug(struct ocfs2_super *osb)
|
||||
{
|
||||
struct ocfs2_dlm_debug *dlm_debug = osb->osb_dlm_debug;
|
||||
|
||||
if (dlm_debug) {
|
||||
debugfs_remove(dlm_debug->d_locking_state);
|
||||
debugfs_remove(dlm_debug->d_locking_filter);
|
||||
if (dlm_debug)
|
||||
ocfs2_put_dlm_debug(dlm_debug);
|
||||
}
|
||||
}
|
||||
|
||||
int ocfs2_dlm_init(struct ocfs2_super *osb)
|
||||
|
Reference in New Issue
Block a user