summaryrefslogtreecommitdiffstats
path: root/fs/btrfs/sysfs.c
diff options
context:
space:
mode:
authorAnand Jain <Anand.Jain@oracle.com>2015-03-10 06:38:28 +0800
committerDavid Sterba <dsterba@suse.cz>2015-05-27 12:27:20 +0200
commit00c921c23f9155597ff4ac1263a6ff46dc9e2206 (patch)
tree297db5d4fca867f374ade1fa852e9afe7c39ed4c /fs/btrfs/sysfs.c
parent0dd2906f7229186424cdc80be8654b2c21d9c04c (diff)
downloadop-kernel-dev-00c921c23f9155597ff4ac1263a6ff46dc9e2206.zip
op-kernel-dev-00c921c23f9155597ff4ac1263a6ff46dc9e2206.tar.gz
Btrfs: sysfs: separate device kobject and its attribute creation
Separate device kobject and its attribute creation so that device kobject can be created from the device discovery thread. Signed-off-by: Anand Jain <anand.jain@oracle.com> Signed-off-by: David Sterba <dsterba@suse.cz>
Diffstat (limited to 'fs/btrfs/sysfs.c')
-rw-r--r--fs/btrfs/sysfs.c21
1 files changed, 15 insertions, 6 deletions
diff --git a/fs/btrfs/sysfs.c b/fs/btrfs/sysfs.c
index 11fa8e6..e71da32 100644
--- a/fs/btrfs/sysfs.c
+++ b/fs/btrfs/sysfs.c
@@ -645,13 +645,8 @@ int btrfs_kobj_rm_device(struct btrfs_fs_info *fs_info,
return 0;
}
-int btrfs_kobj_add_device(struct btrfs_fs_info *fs_info,
- struct btrfs_device *one_device)
+int btrfs_sysfs_add_device(struct btrfs_fs_info *fs_info)
{
- int error = 0;
- struct btrfs_fs_devices *fs_devices = fs_info->fs_devices;
- struct btrfs_device *dev;
-
if (!fs_info->device_dir_kobj)
fs_info->device_dir_kobj = kobject_create_and_add("devices",
&fs_info->super_kobj);
@@ -659,6 +654,20 @@ int btrfs_kobj_add_device(struct btrfs_fs_info *fs_info,
if (!fs_info->device_dir_kobj)
return -ENOMEM;
+ return 0;
+}
+
+int btrfs_kobj_add_device(struct btrfs_fs_info *fs_info,
+ struct btrfs_device *one_device)
+{
+ int error = 0;
+ struct btrfs_fs_devices *fs_devices = fs_info->fs_devices;
+ struct btrfs_device *dev;
+
+ error = btrfs_sysfs_add_device(fs_info);
+ if (error)
+ return error;
+
list_for_each_entry(dev, &fs_devices->devices, dev_list) {
struct hd_struct *disk;
struct kobject *disk_kobj;
OpenPOWER on IntegriCloud