diff options
author | David Sterba <dsterba@suse.com> | 2019-08-01 18:50:16 +0200 |
---|---|---|
committer | David Sterba <dsterba@suse.com> | 2019-09-09 14:59:06 +0200 |
commit | b882327a774041d5710e37da3286e25278a1947f (patch) | |
tree | 59ee6d29373db7b60f471600e40a2ddb7ecdede8 /fs/btrfs/space-info.c | |
parent | btrfs: sysfs: unexport btrfs_raid_ktype (diff) | |
download | linux-b882327a774041d5710e37da3286e25278a1947f.tar.xz linux-b882327a774041d5710e37da3286e25278a1947f.zip |
btrfs: factor out sysfs code for creating space infos
Move creation of data/metadata/system space info directories to sysfs.c.
Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'fs/btrfs/space-info.c')
-rw-r--r-- | fs/btrfs/space-info.c | 25 |
1 files changed, 2 insertions, 23 deletions
diff --git a/fs/btrfs/space-info.c b/fs/btrfs/space-info.c index 9dbb9c5f82b1..e9406b2133d1 100644 --- a/fs/btrfs/space-info.c +++ b/fs/btrfs/space-info.c @@ -34,23 +34,6 @@ void btrfs_clear_space_info_full(struct btrfs_fs_info *info) rcu_read_unlock(); } -static const char *alloc_name(u64 flags) -{ - switch (flags) { - case BTRFS_BLOCK_GROUP_METADATA|BTRFS_BLOCK_GROUP_DATA: - return "mixed"; - case BTRFS_BLOCK_GROUP_METADATA: - return "metadata"; - case BTRFS_BLOCK_GROUP_DATA: - return "data"; - case BTRFS_BLOCK_GROUP_SYSTEM: - return "system"; - default: - WARN_ON(1); - return "invalid-combination"; - }; -} - static int create_space_info(struct btrfs_fs_info *info, u64 flags) { @@ -80,13 +63,9 @@ static int create_space_info(struct btrfs_fs_info *info, u64 flags) INIT_LIST_HEAD(&space_info->tickets); INIT_LIST_HEAD(&space_info->priority_tickets); - ret = kobject_init_and_add(&space_info->kobj, &space_info_ktype, - info->space_info_kobj, "%s", - alloc_name(space_info->flags)); - if (ret) { - kobject_put(&space_info->kobj); + ret = btrfs_sysfs_add_space_info_type(info, space_info); + if (ret) return ret; - } list_add_rcu(&space_info->list, &info->space_info); if (flags & BTRFS_BLOCK_GROUP_DATA) |