btrfs-progs: kernel-lib: simplify raid56_recov

Use raid table helper to find the minimum number of devices instead of
opencoding the values.

Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
David Sterba 2021-10-07 00:20:26 +02:00
parent 14d53ce450
commit 610a37ed0b
1 changed files with 2 additions and 4 deletions

View File

@ -288,10 +288,8 @@ int raid56_recov(int nr_devs, size_t stripe_len, u64 profile, int dest1,
int min_devs;
int ret;
if (profile & BTRFS_BLOCK_GROUP_RAID5)
min_devs = 2;
else if (profile & BTRFS_BLOCK_GROUP_RAID6)
min_devs = 3;
if (profile & BTRFS_BLOCK_GROUP_RAID56_MASK)
min_devs = btrfs_bg_type_to_devs_min(profile);
else
return -EINVAL;
if (nr_devs < min_devs)