Btrfs: sysfs: introduce function btrfs_sysfs_add_fsid() to create sysfs fsid
authorAnand Jain <Anand.Jain@oracle.com>
Mon, 9 Mar 2015 22:38:26 +0000 (06:38 +0800)
committerDavid Sterba <dsterba@suse.cz>
Wed, 27 May 2015 10:27:20 +0000 (12:27 +0200)
We need it in a seperate function so that it can be called from the
device discovery thread as well.

Signed-off-by: Anand Jain <anand.jain@oracle.com>
Signed-off-by: David Sterba <dsterba@suse.cz>
fs/btrfs/sysfs.c

index 8b6eff48268ace15e3cf1bf4cf6e8625f7177c85..83c0c5d5368bcfd7d75b8c40d943dec12c73e542 100644 (file)
@@ -690,7 +690,12 @@ static struct dentry *btrfs_debugfs_root_dentry;
 /* Debugging tunables and exported data */
 u64 btrfs_debugfs_test;
 
-int btrfs_sysfs_add_one(struct btrfs_fs_info *fs_info)
+/*
+ * Can be called by the device discovery thread.
+ * And parent can be specified for seed device
+ */
+int btrfs_sysfs_add_fsid(struct btrfs_fs_info *fs_info,
+                               struct kobject *parent)
 {
        int error;
 
@@ -698,6 +703,14 @@ int btrfs_sysfs_add_one(struct btrfs_fs_info *fs_info)
        fs_info->super_kobj.kset = btrfs_kset;
        error = kobject_init_and_add(&fs_info->super_kobj, &btrfs_ktype, NULL,
                                     "%pU", fs_info->fsid);
+       return error;
+}
+
+int btrfs_sysfs_add_one(struct btrfs_fs_info *fs_info)
+{
+       int error;
+
+       error = btrfs_sysfs_add_fsid(fs_info, NULL);
        if (error)
                return error;