diff options
author | Anand Jain <anand.jain@oracle.com> | 2015-03-10 06:38:32 +0800 |
---|---|---|
committer | David Sterba <dsterba@suse.cz> | 2015-05-27 12:27:21 +0200 |
commit | 2e3e12815a296f263261b17b3a5781cbd517f7f3 (patch) | |
tree | ea5c83263d4ebda973473c8b02d4ff255c0b4154 /fs/btrfs | |
parent | 5a13f4308c5b4af28c01ca9cacdd8a6db777dfcb (diff) | |
download | op-kernel-dev-2e3e12815a296f263261b17b3a5781cbd517f7f3.zip op-kernel-dev-2e3e12815a296f263261b17b3a5781cbd517f7f3.tar.gz |
Btrfs: sysfs: provide framework to remove all fsid sysfs kobject
Just a helper function to clean up the sysfs fsid kobjects.
Signed-off-by: Anand Jain <anand.jain@oracle.com>
Signed-off-by: David Sterba <dsterba@suse.cz>
Diffstat (limited to 'fs/btrfs')
-rw-r--r-- | fs/btrfs/sysfs.c | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/fs/btrfs/sysfs.c b/fs/btrfs/sysfs.c index 4b9a8df..333ed08 100644 --- a/fs/btrfs/sysfs.c +++ b/fs/btrfs/sysfs.c @@ -515,7 +515,7 @@ static int addrm_unknown_feature_attrs(struct btrfs_fs_info *fs_info, bool add) return 0; } -static void btrfs_sysfs_remove_fsid(struct btrfs_fs_devices *fs_devs) +static void __btrfs_sysfs_remove_fsid(struct btrfs_fs_devices *fs_devs) { if (fs_devs->device_dir_kobj) { kobject_del(fs_devs->device_dir_kobj); @@ -528,6 +528,21 @@ static void btrfs_sysfs_remove_fsid(struct btrfs_fs_devices *fs_devs) wait_for_completion(&fs_devs->kobj_unregister); } +/* when fs_devs is NULL it will remove all fsid kobject */ +static void btrfs_sysfs_remove_fsid(struct btrfs_fs_devices *fs_devs) +{ + struct list_head *fs_uuids = btrfs_get_fs_uuids(); + + if (fs_devs) { + __btrfs_sysfs_remove_fsid(fs_devs); + return; + } + + list_for_each_entry(fs_devs, fs_uuids, list) { + __btrfs_sysfs_remove_fsid(fs_devs); + } +} + void btrfs_sysfs_remove_one(struct btrfs_fs_info *fs_info) { btrfs_reset_fs_info_ptr(fs_info); |