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:
parent
14d53ce450
commit
610a37ed0b
|
@ -288,10 +288,8 @@ int raid56_recov(int nr_devs, size_t stripe_len, u64 profile, int dest1,
|
||||||
int min_devs;
|
int min_devs;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
if (profile & BTRFS_BLOCK_GROUP_RAID5)
|
if (profile & BTRFS_BLOCK_GROUP_RAID56_MASK)
|
||||||
min_devs = 2;
|
min_devs = btrfs_bg_type_to_devs_min(profile);
|
||||||
else if (profile & BTRFS_BLOCK_GROUP_RAID6)
|
|
||||||
min_devs = 3;
|
|
||||||
else
|
else
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
if (nr_devs < min_devs)
|
if (nr_devs < min_devs)
|
||||||
|
|
Loading…
Reference in New Issue