summaryrefslogtreecommitdiffstats
path: root/fs/btrfs/extent-tree.c
diff options
context:
space:
mode:
authorDavid Sterba <dsterba@suse.com>2019-05-17 11:43:20 +0200
committerDavid Sterba <dsterba@suse.com>2019-07-01 13:34:56 +0200
commit9fa02ac75ba14683b341ec7430202cccfc8c3fab (patch)
tree6b174c6df52e323bfee99551ea245e116b0f8af3 /fs/btrfs/extent-tree.c
parentbtrfs: remove mapping tree structures indirection (diff)
downloadlinux-9fa02ac75ba14683b341ec7430202cccfc8c3fab.tar.xz
linux-9fa02ac75ba14683b341ec7430202cccfc8c3fab.zip
btrfs: use raid_attr table in get_profile_num_devs
The dev_max constraints are defined in the raid_attr table, use it instead of open-coding it. Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'fs/btrfs/extent-tree.c')
-rw-r--r--fs/btrfs/extent-tree.c10
1 files changed, 2 insertions, 8 deletions
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c
index cbe6a7278008..326fd8660efb 100644
--- a/fs/btrfs/extent-tree.c
+++ b/fs/btrfs/extent-tree.c
@@ -4336,15 +4336,9 @@ static u64 get_profile_num_devs(struct btrfs_fs_info *fs_info, u64 type)
{
u64 num_dev;
- if (type & (BTRFS_BLOCK_GROUP_RAID10 |
- BTRFS_BLOCK_GROUP_RAID0 |
- BTRFS_BLOCK_GROUP_RAID5 |
- BTRFS_BLOCK_GROUP_RAID6))
+ num_dev = btrfs_raid_array[btrfs_bg_flags_to_raid_index(type)].devs_max;
+ if (!num_dev)
num_dev = fs_info->fs_devices->rw_devices;
- else if (type & BTRFS_BLOCK_GROUP_RAID1)
- num_dev = 2;
- else
- num_dev = 1; /* DUP or single */
return num_dev;
}