For the two simple "RAID" profiles single and dup, we can simply fallback
to a table lookup to get num_stripes.
Signed-off-by: Johannes Thumshirn <johannes.thumshirn@xxxxxxx>
---
volumes.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/volumes.c b/volumes.c
index 24e6d151c313..80b4b373f012 100644
--- a/volumes.c
+++ b/volumes.c
@@ -1100,7 +1100,7 @@ int btrfs_alloc_chunk(struct btrfs_trans_handle *trans,
}
ctl.type = btrfs_bg_flags_to_raid_index(type);
- ctl.num_stripes = 1;
+ ctl.num_stripes = btrfs_raid_profile_table[ctl.type].num_stripes;
ctl.max_stripes = 0;
ctl.min_stripes = btrfs_raid_profile_table[ctl.type].min_stripes;
ctl.sub_stripes = btrfs_raid_profile_table[ctl.type].sub_stripes;
@@ -1136,9 +1136,6 @@ int btrfs_alloc_chunk(struct btrfs_trans_handle *trans,
if (ctl.num_stripes < ctl.min_stripes)
return -ENOSPC;
}
- if (ctl.type == BTRFS_RAID_DUP) {
- ctl.num_stripes = 2;
- }
if (ctl.type == BTRFS_RAID_RAID0) {
ctl.num_stripes = min(ctl.max_stripes, ctl.total_devs);
ctl.min_stripes = btrfs_raid_profile_table[ctl.type].min_stripes;
--
2.26.2