Commit b2588c4b authored by Akinobu Mita's avatar Akinobu Mita Committed by Linus Torvalds

fail_page_alloc: simplify debugfs initialization

Now cleanup_fault_attr_dentries() recursively removes a directory, So we
can simplify the error handling in the initialization code and no need
to hold dentry structs for each debugfs file.
Signed-off-by: default avatarAkinobu Mita <akinobu.mita@gmail.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 810f09b8
...@@ -1370,21 +1370,12 @@ struct page *buffered_rmqueue(struct zone *preferred_zone, ...@@ -1370,21 +1370,12 @@ struct page *buffered_rmqueue(struct zone *preferred_zone,
#ifdef CONFIG_FAIL_PAGE_ALLOC #ifdef CONFIG_FAIL_PAGE_ALLOC
static struct fail_page_alloc_attr { static struct {
struct fault_attr attr; struct fault_attr attr;
u32 ignore_gfp_highmem; u32 ignore_gfp_highmem;
u32 ignore_gfp_wait; u32 ignore_gfp_wait;
u32 min_order; u32 min_order;
#ifdef CONFIG_FAULT_INJECTION_DEBUG_FS
struct dentry *ignore_gfp_highmem_file;
struct dentry *ignore_gfp_wait_file;
struct dentry *min_order_file;
#endif /* CONFIG_FAULT_INJECTION_DEBUG_FS */
} fail_page_alloc = { } fail_page_alloc = {
.attr = FAULT_ATTR_INITIALIZER, .attr = FAULT_ATTR_INITIALIZER,
.ignore_gfp_wait = 1, .ignore_gfp_wait = 1,
...@@ -1424,30 +1415,24 @@ static int __init fail_page_alloc_debugfs(void) ...@@ -1424,30 +1415,24 @@ static int __init fail_page_alloc_debugfs(void)
"fail_page_alloc"); "fail_page_alloc");
if (err) if (err)
return err; return err;
dir = fail_page_alloc.attr.dir; dir = fail_page_alloc.attr.dir;
fail_page_alloc.ignore_gfp_wait_file = if (!debugfs_create_bool("ignore-gfp-wait", mode, dir,
debugfs_create_bool("ignore-gfp-wait", mode, dir, &fail_page_alloc.ignore_gfp_wait))
&fail_page_alloc.ignore_gfp_wait); goto fail;
if (!debugfs_create_bool("ignore-gfp-highmem", mode, dir,
fail_page_alloc.ignore_gfp_highmem_file = &fail_page_alloc.ignore_gfp_highmem))
debugfs_create_bool("ignore-gfp-highmem", mode, dir, goto fail;
&fail_page_alloc.ignore_gfp_highmem); if (!debugfs_create_u32("min-order", mode, dir,
fail_page_alloc.min_order_file = &fail_page_alloc.min_order))
debugfs_create_u32("min-order", mode, dir, goto fail;
&fail_page_alloc.min_order);
return 0;
if (!fail_page_alloc.ignore_gfp_wait_file || fail:
!fail_page_alloc.ignore_gfp_highmem_file || cleanup_fault_attr_dentries(&fail_page_alloc.attr);
!fail_page_alloc.min_order_file) {
err = -ENOMEM;
debugfs_remove(fail_page_alloc.ignore_gfp_wait_file);
debugfs_remove(fail_page_alloc.ignore_gfp_highmem_file);
debugfs_remove(fail_page_alloc.min_order_file);
cleanup_fault_attr_dentries(&fail_page_alloc.attr);
}
return err; return -ENOMEM;
} }
late_initcall(fail_page_alloc_debugfs); late_initcall(fail_page_alloc_debugfs);
......
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