提交 9e92054e 编写于 作者: E Eric Sandeen 提交者: Dave Chinner

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: NEric Sandeen <sandeen@redhat.com>
Reviewed-by: NBrian Foster <bfoster@redhat.com>
Signed-off-by: NDave Chinner <david@fromorbit.com>
上级 ff6d6af2
...@@ -165,41 +165,29 @@ int ...@@ -165,41 +165,29 @@ int
xfs_init_procfs(void) xfs_init_procfs(void)
{ {
if (!proc_mkdir("fs/xfs", NULL)) if (!proc_mkdir("fs/xfs", NULL))
goto out; return -ENOMEM;
if (!proc_symlink("fs/xfs/stat", NULL, if (!proc_symlink("fs/xfs/stat", NULL,
"/sys/fs/xfs/stats/stats")) "/sys/fs/xfs/stats/stats"))
goto out_remove_xfs_dir; goto out;
#ifdef CONFIG_XFS_QUOTA #ifdef CONFIG_XFS_QUOTA
if (!proc_create("fs/xfs/xqmstat", 0, NULL, if (!proc_create("fs/xfs/xqmstat", 0, NULL,
&xqmstat_proc_fops)) &xqmstat_proc_fops))
goto out_remove_stat_file; goto out;
if (!proc_create("fs/xfs/xqm", 0, NULL, if (!proc_create("fs/xfs/xqm", 0, NULL,
&xqm_proc_fops)) &xqm_proc_fops))
goto out_remove_xqmstat_file; goto out;
#endif #endif
return 0; return 0;
#ifdef CONFIG_XFS_QUOTA out:
out_remove_xqmstat_file: remove_proc_subtree("fs/xfs", NULL);
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:
return -ENOMEM; return -ENOMEM;
} }
void void
xfs_cleanup_procfs(void) xfs_cleanup_procfs(void)
{ {
#ifdef CONFIG_XFS_QUOTA remove_proc_subtree("fs/xfs", NULL);
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);
} }
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册