Commit 3d871226 authored by Brian Foster's avatar Brian Foster Committed by Dave Chinner

xfs: add a sysfs kset

Create a sysfs kset to contain all sub-objects associated with the XFS
module. The kset is created and removed on module initialization and
removal respectively. The kset uses fs_obj as a parent. This leads to
the creation of a /sys/fs/xfs directory when the kset exists.
Signed-off-by: default avatarBrian Foster <bfoster@redhat.com>
Reviewed-by: default avatarDave Chinner <dchinner@redhat.com>
Signed-off-by: default avatarDave Chinner <david@fromorbit.com>
parent a70a4fa5
...@@ -61,6 +61,7 @@ ...@@ -61,6 +61,7 @@
static const struct super_operations xfs_super_operations; static const struct super_operations xfs_super_operations;
static kmem_zone_t *xfs_ioend_zone; static kmem_zone_t *xfs_ioend_zone;
mempool_t *xfs_ioend_pool; mempool_t *xfs_ioend_pool;
struct kset *xfs_kset;
#define MNTOPT_LOGBUFS "logbufs" /* number of XFS log buffers */ #define MNTOPT_LOGBUFS "logbufs" /* number of XFS log buffers */
#define MNTOPT_LOGBSIZE "logbsize" /* size of XFS log buffers */ #define MNTOPT_LOGBSIZE "logbsize" /* size of XFS log buffers */
...@@ -1761,9 +1762,15 @@ init_xfs_fs(void) ...@@ -1761,9 +1762,15 @@ init_xfs_fs(void)
if (error) if (error)
goto out_cleanup_procfs; goto out_cleanup_procfs;
xfs_kset = kset_create_and_add("xfs", NULL, fs_kobj);
if (!xfs_kset) {
error = -ENOMEM;
goto out_sysctl_unregister;;
}
error = xfs_qm_init(); error = xfs_qm_init();
if (error) if (error)
goto out_sysctl_unregister; goto out_kset_unregister;
error = register_filesystem(&xfs_fs_type); error = register_filesystem(&xfs_fs_type);
if (error) if (error)
...@@ -1772,6 +1779,8 @@ init_xfs_fs(void) ...@@ -1772,6 +1779,8 @@ init_xfs_fs(void)
out_qm_exit: out_qm_exit:
xfs_qm_exit(); xfs_qm_exit();
out_kset_unregister:
kset_unregister(xfs_kset);
out_sysctl_unregister: out_sysctl_unregister:
xfs_sysctl_unregister(); xfs_sysctl_unregister();
out_cleanup_procfs: out_cleanup_procfs:
...@@ -1793,6 +1802,7 @@ exit_xfs_fs(void) ...@@ -1793,6 +1802,7 @@ exit_xfs_fs(void)
{ {
xfs_qm_exit(); xfs_qm_exit();
unregister_filesystem(&xfs_fs_type); unregister_filesystem(&xfs_fs_type);
kset_unregister(xfs_kset);
xfs_sysctl_unregister(); xfs_sysctl_unregister();
xfs_cleanup_procfs(); xfs_cleanup_procfs();
xfs_buf_terminate(); xfs_buf_terminate();
......
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