diff mbox series

[2/4] btrfs-progs: use minimal number of stripes from btrfs_raid_attr

Message ID 20200623141019.23991-3-jth@kernel.org (mailing list archive)
State New, archived
Headers show
Series btrfs-progs: get rid of btrfs_raid_profile_table | expand

Commit Message

Johannes Thumshirn June 23, 2020, 2:10 p.m. UTC
From: Johannes Thumshirn <johannes.thumshirn@wdc.com>

Both btrfs_raid_attr and btrfs_raid_profile define the minimal number of
stripes for each raid profile.

The difference is in btrfs_raid_attr the number of stripes is called
devs_min and in btrfs_raid_profile its called min_stripes.

Signed-off-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
---
 volumes.c | 15 ++++-----------
 1 file changed, 4 insertions(+), 11 deletions(-)
diff mbox series

Patch

diff --git a/volumes.c b/volumes.c
index 9d0eeed5..82d7a872 100644
--- a/volumes.c
+++ b/volumes.c
@@ -1001,52 +1001,42 @@  error:
 static const struct btrfs_raid_profile {
 	int	num_stripes;
 	int	max_stripes;
-	int	min_stripes;
 } btrfs_raid_profile_table[BTRFS_NR_RAID_TYPES] = {
 	[BTRFS_RAID_RAID10] = {
 		.num_stripes = 0,
 		.max_stripes = 0,
-		.min_stripes = 4,
 	},
 	[BTRFS_RAID_RAID1] = {
 		.num_stripes = 0,
 		.max_stripes = 0,
-		.min_stripes = 2,
 	},
 	[BTRFS_RAID_RAID1C3] = {
 		.num_stripes = 0,
 		.max_stripes = 0,
-		.min_stripes = 3,
 	},
 	[BTRFS_RAID_RAID1C4] = {
 		.num_stripes = 0,
 		.max_stripes = 0,
-		.min_stripes = 4,
 	},
 	[BTRFS_RAID_DUP] = {
 		.num_stripes = 2,
 		.max_stripes = 0,
-		.min_stripes = 2,
 	},
 	[BTRFS_RAID_RAID0] = {
 		.num_stripes = 0,
 		.max_stripes = 0,
-		.min_stripes = 2,
 	},
 	[BTRFS_RAID_SINGLE] = {
 		.num_stripes = 1,
 		.max_stripes = 0,
-		.min_stripes = 1,
 	},
 	[BTRFS_RAID_RAID5] = {
 		.num_stripes = 0,
 		.max_stripes = 0,
-		.min_stripes = 2,
 	},
 	[BTRFS_RAID_RAID6] = {
 		.num_stripes = 0,
 		.max_stripes = 0,
-		.min_stripes = 3,
 	},
 };
 
@@ -1056,11 +1046,14 @@  static void init_alloc_chunk_ctl(struct btrfs_fs_info *info,
 	int type = ctl->type;
 
 	ctl->num_stripes = btrfs_raid_profile_table[type].num_stripes;
-	ctl->min_stripes = btrfs_raid_profile_table[type].min_stripes;
+	ctl->min_stripes = btrfs_raid_array[type].devs_min;
 	ctl->sub_stripes = btrfs_raid_array[type].sub_stripes;
 	ctl->stripe_len = BTRFS_STRIPE_LEN;
 
 	switch (type) {
+	case BTRFS_RAID_DUP:
+		ctl->min_stripes = 2;
+		break;
 	case BTRFS_RAID_RAID1:
 	case BTRFS_RAID_RAID1C3:
 	case BTRFS_RAID_RAID1C4: