summaryrefslogtreecommitdiff
path: root/fs/btrfs/sysfs.c
diff options
context:
space:
mode:
authorAnand Jain <Anand.Jain@oracle.com>2014-06-03 07:36:01 +0400
committerChris Mason <clm@fb.com>2014-06-29 00:48:43 +0400
commit0d39376aa28eba6d63d0120ccc399735842abc8e (patch)
treed588573634e0af59e6fc330d32ead6d53a18ac2c /fs/btrfs/sysfs.c
parent99994cde9c59c2b8bb67d46d531b26cc73e39747 (diff)
downloadlinux-0d39376aa28eba6d63d0120ccc399735842abc8e.tar.xz
btrfs: dev add should add its sysfs entry
we would need the device links to be created, when device is added. Signed-off-by: Anand Jain <Anand.Jain@oracle.com> Reviewed-by: David Sterba <dsterba@suse.cz> Signed-off-by: Chris Mason <clm@fb.com>
Diffstat (limited to 'fs/btrfs/sysfs.c')
-rw-r--r--fs/btrfs/sysfs.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/fs/btrfs/sysfs.c b/fs/btrfs/sysfs.c
index 401677b11045..78699364f537 100644
--- a/fs/btrfs/sysfs.c
+++ b/fs/btrfs/sysfs.c
@@ -625,14 +625,17 @@ int btrfs_kobj_rm_device(struct btrfs_fs_info *fs_info,
return 0;
}
-static int btrfs_kobj_add_device(struct btrfs_fs_info *fs_info)
+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;
- fs_info->device_dir_kobj = kobject_create_and_add("devices",
+ if (!fs_info->device_dir_kobj)
+ fs_info->device_dir_kobj = kobject_create_and_add("devices",
&fs_info->super_kobj);
+
if (!fs_info->device_dir_kobj)
return -ENOMEM;
@@ -643,6 +646,9 @@ static int btrfs_kobj_add_device(struct btrfs_fs_info *fs_info)
if (!dev->bdev)
continue;
+ if (one_device && one_device != dev)
+ continue;
+
disk = dev->bdev->bd_part;
disk_kobj = &part_to_dev(disk)->kobj;
@@ -686,7 +692,7 @@ int btrfs_sysfs_add_one(struct btrfs_fs_info *fs_info)
if (error)
goto failure;
- error = btrfs_kobj_add_device(fs_info);
+ error = btrfs_kobj_add_device(fs_info, NULL);
if (error)
goto failure;