All of lore.kernel.org
 help / color / mirror / Atom feed
From: Johannes Thumshirn <johannes.thumshirn@wdc.com>
To: David Sterba <dsterba@suse.cz>
Cc: linux-btrfs@vger.kernel.org,
	Johannes Thumshirn <johannes.thumshirn@wdc.com>
Subject: [PATCH 08/15] btrfs-progs: consolidate assignment of sub_stripes
Date: Wed, 10 Jun 2020 21:32:51 +0900	[thread overview]
Message-ID: <20200610123258.12382-9-johannes.thumshirn@wdc.com> (raw)
In-Reply-To: <20200610123258.12382-1-johannes.thumshirn@wdc.com>

Now that we have a table holding the sub_stripes value we can consolidate
all setting of alloc_chunk_ctl::sub_stripes to a signle table lookup.

Signed-off-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
---
 volumes.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/volumes.c b/volumes.c
index 9076f055f6bd..32d3dfe0decd 100644
--- a/volumes.c
+++ b/volumes.c
@@ -1103,7 +1103,7 @@ int btrfs_alloc_chunk(struct btrfs_trans_handle *trans,
 	ctl.num_stripes = 1;
 	ctl.max_stripes = 0;
 	ctl.min_stripes = btrfs_raid_profile_table[ctl.type].min_stripes;
-	ctl.sub_stripes = 1;
+	ctl.sub_stripes = btrfs_raid_profile_table[ctl.type].sub_stripes;
 	ctl.stripe_len = BTRFS_STRIPE_LEN;
 	ctl.total_devs = btrfs_super_num_devices(info->super_copy);
 
@@ -1160,7 +1160,6 @@ int btrfs_alloc_chunk(struct btrfs_trans_handle *trans,
 		if (ctl.num_stripes < ctl.min_stripes)
 			return -ENOSPC;
 		ctl.num_stripes &= ~(u32)1;
-		ctl.sub_stripes = 2;
 	}
 	if (ctl.type == BTRFS_RAID_RAID5) {
 		ctl.min_stripes = btrfs_raid_profile_table[ctl.type].min_stripes;
-- 
2.26.2


  parent reply	other threads:[~2020-06-10 12:33 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-10 12:32 [PATCH 00/15] btrfs-progs: simplify chunk allocation a bit Johannes Thumshirn
2020-06-10 12:32 ` [PATCH 01/15] btrfs-progs: simplify minimal stripe number checking Johannes Thumshirn
2020-06-23  5:58   ` Qu Wenruo
2020-06-10 12:32 ` [PATCH 02/15] btrfs-progs: simplify assignment of number of RAID stripes Johannes Thumshirn
2020-06-10 12:32 ` [PATCH 03/15] btrfs-progs: introduce alloc_chunk_ctl structure Johannes Thumshirn
2020-06-10 12:32 ` [PATCH 04/15] btrfs-progs: cache number of devices for chunk allocation Johannes Thumshirn
2020-06-10 12:32 ` [PATCH 05/15] btrfs-progs: pass alloc_chunk_ctl to chunk_bytes_by_type Johannes Thumshirn
2020-06-10 12:32 ` [PATCH 06/15] btrfs-progs: introduce raid profile table for chunk allocation Johannes Thumshirn
2020-06-11 13:39   ` David Sterba
2020-06-12  7:44     ` Johannes Thumshirn
2020-06-10 12:32 ` [PATCH 07/15] btrfs-progs: consolidate assignment of minimal stripe number Johannes Thumshirn
2020-06-10 12:32 ` Johannes Thumshirn [this message]
2020-06-10 12:32 ` [PATCH 09/15] btrfs-progs: consolidate setting of RAID1 stripes Johannes Thumshirn
2020-06-10 12:32 ` [PATCH 10/15] btrfs-progs: do table lookup for simple RAID profiles' num_stripes Johannes Thumshirn
2020-06-10 12:32 ` [PATCH 11/15] btrfs-progs: consolidate num_stripes sanity check Johannes Thumshirn
2020-06-10 12:32 ` [PATCH 12/15] btrfs-progs: compactify num_stripe setting in btrfs_alloc_chunk Johannes Thumshirn
2020-06-10 12:32 ` [PATCH 13/15] btrfs-progs: introduce init_alloc_chunk_ctl Johannes Thumshirn
2020-06-23  6:02   ` Qu Wenruo
2020-06-10 12:32 ` [PATCH 14/15] btrfs-progs: don't pretend RAID56 has a different stripe length Johannes Thumshirn
2020-06-10 12:32 ` [PATCH 15/15] btrfs-progs: consolidate num_stripes setting for striping RAID levels Johannes Thumshirn
2020-06-11 13:44 ` [PATCH 00/15] btrfs-progs: simplify chunk allocation a bit David Sterba
2020-06-23  6:33 ` Qu Wenruo
2020-06-23  8:01   ` Johannes Thumshirn

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=20200610123258.12382-9-johannes.thumshirn@wdc.com \
    --to=johannes.thumshirn@wdc.com \
    --cc=dsterba@suse.cz \
    --cc=linux-btrfs@vger.kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.