aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/sysfs.c
diff options
context:
space:
mode:
authorAnand Jain <Anand.Jain@oracle.com>2014-06-02 23:36:00 -0400
committerChris Mason <clm@fb.com>2014-06-28 16:48:42 -0400
commit99994cde9c59c2b8bb67d46d531b26cc73e39747 (patch)
tree5d676af068a4e365412f6fd615892dda91843b77 /fs/btrfs/sysfs.c
parent9b4eaf43f4b0207b5d1ca8b8d22df88ea9e142fe (diff)
btrfs: dev delete should remove sysfs entry
when we delete the device from the mounted btrfs, we would need its corresponding sysfs enty to be removed as well. 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.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/fs/btrfs/sysfs.c b/fs/btrfs/sysfs.c
index 1395efbffa2d..401677b11045 100644
--- a/fs/btrfs/sysfs.c
+++ b/fs/btrfs/sysfs.c
@@ -605,6 +605,26 @@ static void init_feature_attrs(void)
605 } 605 }
606} 606}
607 607
608int btrfs_kobj_rm_device(struct btrfs_fs_info *fs_info,
609 struct btrfs_device *one_device)
610{
611 struct hd_struct *disk;
612 struct kobject *disk_kobj;
613
614 if (!fs_info->device_dir_kobj)
615 return -EINVAL;
616
617 if (one_device) {
618 disk = one_device->bdev->bd_part;
619 disk_kobj = &part_to_dev(disk)->kobj;
620
621 sysfs_remove_link(fs_info->device_dir_kobj,
622 disk_kobj->name);
623 }
624
625 return 0;
626}
627
608static int btrfs_kobj_add_device(struct btrfs_fs_info *fs_info) 628static int btrfs_kobj_add_device(struct btrfs_fs_info *fs_info)
609{ 629{
610 int error = 0; 630 int error = 0;