From 610a37ed0bdddf17f1d8a03450ad8a8bdebb5740 Mon Sep 17 00:00:00 2001 From: David Sterba Date: Thu, 7 Oct 2021 00:20:26 +0200 Subject: [PATCH] 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 --- kernel-lib/raid56.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/kernel-lib/raid56.c b/kernel-lib/raid56.c index d1a507b4..a94a60ed 100644 --- a/kernel-lib/raid56.c +++ b/kernel-lib/raid56.c @@ -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)