提交 bde8bd8a 编写于 作者: S Sasikantha babu 提交者: Linus Torvalds

mm/vmstat.c: remove debug fs entries on failure of file creation and made...

mm/vmstat.c: remove debug fs entries on failure of file creation and made extfrag_debug_root dentry local

Remove debug fs files and directory on failure.  Since no one is using
"extfrag_debug_root" dentry outside of extfrag_debug_init(), make it
local to the function.
Signed-off-by: NSasikantha babu <sasikanth.v19@gmail.com>
Acked-by: NDavid Rientjes <rientjes@google.com>
Acked-by: NMel Gorman <mel@csn.ul.ie>
Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
上级 7edc8b0a
...@@ -1223,7 +1223,6 @@ module_init(setup_vmstat) ...@@ -1223,7 +1223,6 @@ module_init(setup_vmstat)
#if defined(CONFIG_DEBUG_FS) && defined(CONFIG_COMPACTION) #if defined(CONFIG_DEBUG_FS) && defined(CONFIG_COMPACTION)
#include <linux/debugfs.h> #include <linux/debugfs.h>
static struct dentry *extfrag_debug_root;
/* /*
* Return an index indicating how much of the available free memory is * Return an index indicating how much of the available free memory is
...@@ -1361,19 +1360,24 @@ static const struct file_operations extfrag_file_ops = { ...@@ -1361,19 +1360,24 @@ static const struct file_operations extfrag_file_ops = {
static int __init extfrag_debug_init(void) static int __init extfrag_debug_init(void)
{ {
struct dentry *extfrag_debug_root;
extfrag_debug_root = debugfs_create_dir("extfrag", NULL); extfrag_debug_root = debugfs_create_dir("extfrag", NULL);
if (!extfrag_debug_root) if (!extfrag_debug_root)
return -ENOMEM; return -ENOMEM;
if (!debugfs_create_file("unusable_index", 0444, if (!debugfs_create_file("unusable_index", 0444,
extfrag_debug_root, NULL, &unusable_file_ops)) extfrag_debug_root, NULL, &unusable_file_ops))
return -ENOMEM; goto fail;
if (!debugfs_create_file("extfrag_index", 0444, if (!debugfs_create_file("extfrag_index", 0444,
extfrag_debug_root, NULL, &extfrag_file_ops)) extfrag_debug_root, NULL, &extfrag_file_ops))
return -ENOMEM; goto fail;
return 0; return 0;
fail:
debugfs_remove_recursive(extfrag_debug_root);
return -ENOMEM;
} }
module_init(extfrag_debug_init); module_init(extfrag_debug_init);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册