Linux Btrfs filesystem development
 help / color / mirror / Atom feed
From: Johannes Thumshirn <jth@kernel.org>
To: David Sterba <dsterba@suse.com>
Cc: linux-btrfs@vger.kernel.org, Qu Wenruo <wqu@suse.com>,
	Johannes Thumshirn <johannes.thumshirn@wdc.com>
Subject: [PATCH 2/4] btrfs-progs: use minimal number of stripes from btrfs_raid_attr
Date: Tue, 23 Jun 2020 16:10:17 +0200	[thread overview]
Message-ID: <20200623141019.23991-3-jth@kernel.org> (raw)
In-Reply-To: <20200623141019.23991-1-jth@kernel.org>

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 --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:
-- 
2.26.2


  parent reply	other threads:[~2020-06-23 14:10 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-23 14:10 [PATCH 0/4] btrfs-progs: get rid of btrfs_raid_profile_table Johannes Thumshirn
2020-06-23 14:10 ` [PATCH 1/4] btrfs-progs: use sub_stripes property from btrfs_raid_attr Johannes Thumshirn
2020-06-23 14:10 ` Johannes Thumshirn [this message]
2020-06-23 14:10 ` [PATCH 3/4] btrfs-progs: remove unused btrfs_raid_profile::max_stripes Johannes Thumshirn
2020-06-23 14:10 ` [PATCH 4/4] btrfs-progs: remove btrfs_raid_profile_table Johannes Thumshirn
2020-06-23 15:45 ` [PATCH 0/4] btrfs-progs: get rid of btrfs_raid_profile_table David Sterba

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200623141019.23991-3-jth@kernel.org \
    --to=jth@kernel.org \
    --cc=dsterba@suse.com \
    --cc=johannes.thumshirn@wdc.com \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=wqu@suse.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox