Commit 062d4d1f authored by Qu Wenruo's avatar Qu Wenruo Committed by David Sterba

btrfs: Refactor parameter of BTRFS_MAX_DEVS() from root to fs_info

Signed-off-by: default avatarQu Wenruo <wqu@suse.com>
Reviewed-by: default avatarAnand Jain <anand.jain@oracle.com>
Reviewed-by: default avatarNikolay Borisov <nborisov@suse.com>
Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
parent af2679e4
...@@ -4672,7 +4672,7 @@ static void check_raid56_incompat_flag(struct btrfs_fs_info *info, u64 type) ...@@ -4672,7 +4672,7 @@ static void check_raid56_incompat_flag(struct btrfs_fs_info *info, u64 type)
btrfs_set_fs_incompat(info, RAID56); btrfs_set_fs_incompat(info, RAID56);
} }
#define BTRFS_MAX_DEVS(r) ((BTRFS_MAX_ITEM_SIZE(r->fs_info) \ #define BTRFS_MAX_DEVS(info) ((BTRFS_MAX_ITEM_SIZE(info) \
- sizeof(struct btrfs_chunk)) \ - sizeof(struct btrfs_chunk)) \
/ sizeof(struct btrfs_stripe) + 1) / sizeof(struct btrfs_stripe) + 1)
...@@ -4729,7 +4729,7 @@ static int __btrfs_alloc_chunk(struct btrfs_trans_handle *trans, ...@@ -4729,7 +4729,7 @@ static int __btrfs_alloc_chunk(struct btrfs_trans_handle *trans,
max_stripe_size = SZ_1G; max_stripe_size = SZ_1G;
max_chunk_size = 10 * max_stripe_size; max_chunk_size = 10 * max_stripe_size;
if (!devs_max) if (!devs_max)
devs_max = BTRFS_MAX_DEVS(info->chunk_root); devs_max = BTRFS_MAX_DEVS(info);
} else if (type & BTRFS_BLOCK_GROUP_METADATA) { } else if (type & BTRFS_BLOCK_GROUP_METADATA) {
/* for larger filesystems, use larger metadata chunks */ /* for larger filesystems, use larger metadata chunks */
if (fs_devices->total_rw_bytes > 50ULL * SZ_1G) if (fs_devices->total_rw_bytes > 50ULL * SZ_1G)
...@@ -4738,7 +4738,7 @@ static int __btrfs_alloc_chunk(struct btrfs_trans_handle *trans, ...@@ -4738,7 +4738,7 @@ static int __btrfs_alloc_chunk(struct btrfs_trans_handle *trans,
max_stripe_size = SZ_256M; max_stripe_size = SZ_256M;
max_chunk_size = max_stripe_size; max_chunk_size = max_stripe_size;
if (!devs_max) if (!devs_max)
devs_max = BTRFS_MAX_DEVS(info->chunk_root); devs_max = BTRFS_MAX_DEVS(info);
} else if (type & BTRFS_BLOCK_GROUP_SYSTEM) { } else if (type & BTRFS_BLOCK_GROUP_SYSTEM) {
max_stripe_size = SZ_32M; max_stripe_size = SZ_32M;
max_chunk_size = 2 * max_stripe_size; max_chunk_size = 2 * max_stripe_size;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment