xfs: add xfs_mount sysfs kobject
Embed a base kobject into xfs_mount. This creates a kobject associated with each XFS mount and a subdirectory in sysfs with the name of the filesystem. The subdirectory lifecycle matches that of the mount. Also add the new xfs_sysfs.[c,h] source files with some XFS sysfs infrastructure to facilitate attribute creation. Note that there are currently no attributes exported as part of the xfs_mount kobject. It exists solely to serve as a per-mount container for child objects. Signed-off-by: Brian Foster <bfoster@redhat.com> Reviewed-by: Dave Chinner <dchinner@redhat.com> Signed-off-by: Dave Chinner <david@fromorbit.com>
This commit is contained in:

committed by
Dave Chinner

parent
3d8712265c
commit
a31b1d3d89
@@ -42,6 +42,7 @@
|
||||
#include "xfs_trace.h"
|
||||
#include "xfs_icache.h"
|
||||
#include "xfs_dinode.h"
|
||||
#include "xfs_sysfs.h"
|
||||
|
||||
|
||||
#ifdef HAVE_PERCPU_SB
|
||||
@@ -60,6 +61,8 @@ static DEFINE_MUTEX(xfs_uuid_table_mutex);
|
||||
static int xfs_uuid_table_size;
|
||||
static uuid_t *xfs_uuid_table;
|
||||
|
||||
extern struct kset *xfs_kset;
|
||||
|
||||
/*
|
||||
* See if the UUID is unique among mounted XFS filesystems.
|
||||
* Mount fails if UUID is nil or a FS with the same UUID is already mounted.
|
||||
@@ -731,10 +734,15 @@ xfs_mountfs(
|
||||
|
||||
xfs_set_maxicount(mp);
|
||||
|
||||
error = xfs_uuid_mount(mp);
|
||||
mp->m_kobj.kobject.kset = xfs_kset;
|
||||
error = xfs_sysfs_init(&mp->m_kobj, &xfs_mp_ktype, NULL, mp->m_fsname);
|
||||
if (error)
|
||||
goto out;
|
||||
|
||||
error = xfs_uuid_mount(mp);
|
||||
if (error)
|
||||
goto out_remove_sysfs;
|
||||
|
||||
/*
|
||||
* Set the minimum read and write sizes
|
||||
*/
|
||||
@@ -989,6 +997,8 @@ xfs_mountfs(
|
||||
xfs_da_unmount(mp);
|
||||
out_remove_uuid:
|
||||
xfs_uuid_unmount(mp);
|
||||
out_remove_sysfs:
|
||||
xfs_sysfs_del(&mp->m_kobj);
|
||||
out:
|
||||
return error;
|
||||
}
|
||||
@@ -1071,6 +1081,8 @@ xfs_unmountfs(
|
||||
xfs_errortag_clearall(mp, 0);
|
||||
#endif
|
||||
xfs_free_perag(mp);
|
||||
|
||||
xfs_sysfs_del(&mp->m_kobj);
|
||||
}
|
||||
|
||||
int
|
||||
|
Reference in New Issue
Block a user