btrfs: factor out sysfs code for deleting block group and space infos
The helpers to create block group and space info directories already live in sysfs.c, move the deletion part there too. Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
@@ -7539,8 +7539,6 @@ int btrfs_free_block_groups(struct btrfs_fs_info *info)
|
||||
btrfs_release_global_block_rsv(info);
|
||||
|
||||
while (!list_empty(&info->space_info)) {
|
||||
int i;
|
||||
|
||||
space_info = list_entry(info->space_info.next,
|
||||
struct btrfs_space_info,
|
||||
list);
|
||||
@@ -7554,17 +7552,7 @@ int btrfs_free_block_groups(struct btrfs_fs_info *info)
|
||||
space_info->bytes_may_use > 0))
|
||||
btrfs_dump_space_info(info, space_info, 0, 0);
|
||||
list_del(&space_info->list);
|
||||
for (i = 0; i < BTRFS_NR_RAID_TYPES; i++) {
|
||||
struct kobject *kobj;
|
||||
kobj = space_info->block_group_kobjs[i];
|
||||
space_info->block_group_kobjs[i] = NULL;
|
||||
if (kobj) {
|
||||
kobject_del(kobj);
|
||||
kobject_put(kobj);
|
||||
}
|
||||
}
|
||||
kobject_del(&space_info->kobj);
|
||||
kobject_put(&space_info->kobj);
|
||||
btrfs_sysfs_remove_space_info(space_info);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
Reference in New Issue
Block a user