aboutsummaryrefslogtreecommitdiffstats
path: root/mm/page_alloc.c
diff options
context:
space:
mode:
authorAkinobu Mita <akinobu.mita@gmail.com>2011-07-26 19:09:03 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2011-07-26 19:49:46 -0400
commitb2588c4b4c3c075e9b45d61065d86c60de2b6441 (patch)
tree66942e8a252101aaa7e1f0a2ee2c3d8288dda659 /mm/page_alloc.c
parent810f09b87b75d7cc3906ffffe4311003f37caa2a (diff)
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: Akinobu Mita <akinobu.mita@gmail.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm/page_alloc.c')
-rw-r--r--mm/page_alloc.c47
1 files changed, 16 insertions, 31 deletions
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 72c6820a345c..1dbcf8888f14 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -1370,21 +1370,12 @@ failed:
1370 1370
1371#ifdef CONFIG_FAIL_PAGE_ALLOC 1371#ifdef CONFIG_FAIL_PAGE_ALLOC
1372 1372
1373static struct fail_page_alloc_attr { 1373static struct {
1374 struct fault_attr attr; 1374 struct fault_attr attr;
1375 1375
1376 u32 ignore_gfp_highmem; 1376 u32 ignore_gfp_highmem;
1377 u32 ignore_gfp_wait; 1377 u32 ignore_gfp_wait;
1378 u32 min_order; 1378 u32 min_order;
1379
1380#ifdef CONFIG_FAULT_INJECTION_DEBUG_FS
1381
1382 struct dentry *ignore_gfp_highmem_file;
1383 struct dentry *ignore_gfp_wait_file;
1384 struct dentry *min_order_file;
1385
1386#endif /* CONFIG_FAULT_INJECTION_DEBUG_FS */
1387
1388} fail_page_alloc = { 1379} fail_page_alloc = {
1389 .attr = FAULT_ATTR_INITIALIZER, 1380 .attr = FAULT_ATTR_INITIALIZER,
1390 .ignore_gfp_wait = 1, 1381 .ignore_gfp_wait = 1,
@@ -1424,30 +1415,24 @@ static int __init fail_page_alloc_debugfs(void)
1424 "fail_page_alloc"); 1415 "fail_page_alloc");
1425 if (err) 1416 if (err)
1426 return err; 1417 return err;
1418
1427 dir = fail_page_alloc.attr.dir; 1419 dir = fail_page_alloc.attr.dir;
1428 1420
1429 fail_page_alloc.ignore_gfp_wait_file = 1421 if (!debugfs_create_bool("ignore-gfp-wait", mode, dir,
1430 debugfs_create_bool("ignore-gfp-wait", mode, dir, 1422 &fail_page_alloc.ignore_gfp_wait))
1431 &fail_page_alloc.ignore_gfp_wait); 1423 goto fail;
1432 1424 if (!debugfs_create_bool("ignore-gfp-highmem", mode, dir,
1433 fail_page_alloc.ignore_gfp_highmem_file = 1425 &fail_page_alloc.ignore_gfp_highmem))
1434 debugfs_create_bool("ignore-gfp-highmem", mode, dir, 1426 goto fail;
1435 &fail_page_alloc.ignore_gfp_highmem); 1427 if (!debugfs_create_u32("min-order", mode, dir,
1436 fail_page_alloc.min_order_file = 1428 &fail_page_alloc.min_order))
1437 debugfs_create_u32("min-order", mode, dir, 1429 goto fail;
1438 &fail_page_alloc.min_order); 1430
1439 1431 return 0;
1440 if (!fail_page_alloc.ignore_gfp_wait_file || 1432fail:
1441 !fail_page_alloc.ignore_gfp_highmem_file || 1433 cleanup_fault_attr_dentries(&fail_page_alloc.attr);
1442 !fail_page_alloc.min_order_file) {
1443 err = -ENOMEM;
1444 debugfs_remove(fail_page_alloc.ignore_gfp_wait_file);
1445 debugfs_remove(fail_page_alloc.ignore_gfp_highmem_file);
1446 debugfs_remove(fail_page_alloc.min_order_file);
1447 cleanup_fault_attr_dentries(&fail_page_alloc.attr);
1448 }
1449 1434
1450 return err; 1435 return -ENOMEM;
1451} 1436}
1452 1437
1453late_initcall(fail_page_alloc_debugfs); 1438late_initcall(fail_page_alloc_debugfs);