diff options
author | Eric Sandeen <sandeen@redhat.com> | 2015-10-12 09:21:22 +0200 |
---|---|---|
committer | Dave Chinner <david@fromorbit.com> | 2015-10-12 09:21:22 +0200 |
commit | 9e92054e8e049f8f4c64d2c6961b2a7e3e13977f (patch) | |
tree | fb22b5dc75b8049a663990e5238a2ebcf3e7b79a /fs/xfs/xfs_stats.c | |
parent | xfs: per-filesystem stats counter implementation (diff) | |
download | linux-9e92054e8e049f8f4c64d2c6961b2a7e3e13977f.tar.xz linux-9e92054e8e049f8f4c64d2c6961b2a7e3e13977f.zip |
xfs: simplify /proc teardown & error handling
remove_proc_subtree() was added in 3.9, and can be
used to simplify our procfile creation error handling
and cleanup, removing the nested gotos. It simply
removes fs/xfs and everything created under it.
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Reviewed-by: Brian Foster <bfoster@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
Diffstat (limited to 'fs/xfs/xfs_stats.c')
-rw-r--r-- | fs/xfs/xfs_stats.c | 26 |
1 files changed, 7 insertions, 19 deletions
diff --git a/fs/xfs/xfs_stats.c b/fs/xfs/xfs_stats.c index 3348b0b6177d..bd50619fa8c9 100644 --- a/fs/xfs/xfs_stats.c +++ b/fs/xfs/xfs_stats.c @@ -165,41 +165,29 @@ int xfs_init_procfs(void) { if (!proc_mkdir("fs/xfs", NULL)) - goto out; + return -ENOMEM; if (!proc_symlink("fs/xfs/stat", NULL, "/sys/fs/xfs/stats/stats")) - goto out_remove_xfs_dir; + goto out; #ifdef CONFIG_XFS_QUOTA if (!proc_create("fs/xfs/xqmstat", 0, NULL, &xqmstat_proc_fops)) - goto out_remove_stat_file; + goto out; if (!proc_create("fs/xfs/xqm", 0, NULL, &xqm_proc_fops)) - goto out_remove_xqmstat_file; + goto out; #endif return 0; -#ifdef CONFIG_XFS_QUOTA - out_remove_xqmstat_file: - remove_proc_entry("fs/xfs/xqmstat", NULL); - out_remove_stat_file: - remove_proc_entry("fs/xfs/stat", NULL); -#endif - out_remove_xfs_dir: - remove_proc_entry("fs/xfs", NULL); - out: +out: + remove_proc_subtree("fs/xfs", NULL); return -ENOMEM; } void xfs_cleanup_procfs(void) { -#ifdef CONFIG_XFS_QUOTA - remove_proc_entry("fs/xfs/xqm", NULL); - remove_proc_entry("fs/xfs/xqmstat", NULL); -#endif - remove_proc_entry("fs/xfs/stat", NULL); - remove_proc_entry("fs/xfs", NULL); + remove_proc_subtree("fs/xfs", NULL); } |