From: Naohiro Aota <naohiro.aota@wdc.com>
To: David Sterba <dsterba@suse.com>
Cc: linux-btrfs@vger.kernel.org, Naohiro Aota <naohiro.aota@wdc.com>
Subject: [PATCH 10/12] btrfs-progs: drop alloc_chunk_ctl::stripe_len
Date: Tue, 6 Apr 2021 17:05:52 +0900 [thread overview]
Message-ID: <82254413cb8815ee384550bd306ad0cc3c69fdc6.1617694997.git.naohiro.aota@wdc.com> (raw)
In-Reply-To: <cover.1617694997.git.naohiro.aota@wdc.com>
Since commit b9444efb6658 ("btrfs-progs: don't pretend RAID56 has a
different stripe length"), alloc_chunk_ctl::stripe_len is always fixed to
BTRFS_STRIPE_LEN. Let's replace alloc_chunk_ctl::stripe_len with
BTRFS_STRIPE_LEN, like in the kernel code.
Signed-off-by: Naohiro Aota <naohiro.aota@wdc.com>
---
kernel-shared/volumes.c | 19 ++++++++-----------
1 file changed, 8 insertions(+), 11 deletions(-)
diff --git a/kernel-shared/volumes.c b/kernel-shared/volumes.c
index d01d825c67ce..280537f6549d 100644
--- a/kernel-shared/volumes.c
+++ b/kernel-shared/volumes.c
@@ -159,7 +159,6 @@ struct alloc_chunk_ctl {
u64 min_stripe_size;
u64 num_bytes;
u64 max_chunk_size;
- int stripe_len;
int total_devs;
u64 dev_offset;
};
@@ -1057,7 +1056,6 @@ static void init_alloc_chunk_ctl(struct btrfs_fs_info *info,
ctl->calc_size = SZ_8M;
ctl->min_stripe_size = SZ_1M;
ctl->max_chunk_size = 4 * ctl->calc_size;
- ctl->stripe_len = BTRFS_STRIPE_LEN;
ctl->total_devs = btrfs_super_num_devices(info->super_copy);
ctl->dev_offset = 0;
@@ -1098,13 +1096,13 @@ static int decide_stripe_size_regular(struct alloc_chunk_ctl *ctl)
if (chunk_size > ctl->max_chunk_size) {
ctl->calc_size = ctl->max_chunk_size;
ctl->calc_size /= ctl->num_stripes;
- ctl->calc_size = round_down(ctl->calc_size, ctl->stripe_len);
+ ctl->calc_size = round_down(ctl->calc_size, BTRFS_STRIPE_LEN);
}
/* we don't want tiny stripes */
ctl->calc_size = max_t(u64, ctl->calc_size, ctl->min_stripe_size);
/* Align to the stripe length */
- ctl->calc_size = round_down(ctl->calc_size, ctl->stripe_len);
+ ctl->calc_size = round_down(ctl->calc_size, BTRFS_STRIPE_LEN);
return 0;
}
@@ -1206,17 +1204,17 @@ static int create_chunk(struct btrfs_trans_handle *trans,
/* key was set above */
btrfs_set_stack_chunk_length(chunk, ctl->num_bytes);
btrfs_set_stack_chunk_owner(chunk, extent_root->root_key.objectid);
- btrfs_set_stack_chunk_stripe_len(chunk, ctl->stripe_len);
+ btrfs_set_stack_chunk_stripe_len(chunk, BTRFS_STRIPE_LEN);
btrfs_set_stack_chunk_type(chunk, ctl->type);
btrfs_set_stack_chunk_num_stripes(chunk, ctl->num_stripes);
- btrfs_set_stack_chunk_io_align(chunk, ctl->stripe_len);
- btrfs_set_stack_chunk_io_width(chunk, ctl->stripe_len);
+ btrfs_set_stack_chunk_io_align(chunk, BTRFS_STRIPE_LEN);
+ btrfs_set_stack_chunk_io_width(chunk, BTRFS_STRIPE_LEN);
btrfs_set_stack_chunk_sector_size(chunk, info->sectorsize);
btrfs_set_stack_chunk_sub_stripes(chunk, ctl->sub_stripes);
map->sector_size = info->sectorsize;
- map->stripe_len = ctl->stripe_len;
- map->io_align = ctl->stripe_len;
- map->io_width = ctl->stripe_len;
+ map->stripe_len = BTRFS_STRIPE_LEN;
+ map->io_align = BTRFS_STRIPE_LEN;
+ map->io_width = BTRFS_STRIPE_LEN;
map->type = ctl->type;
map->num_stripes = ctl->num_stripes;
map->sub_stripes = ctl->sub_stripes;
@@ -1369,7 +1367,6 @@ int btrfs_alloc_data_chunk(struct btrfs_trans_handle *trans,
ctl.min_stripe_size = num_bytes;
ctl.num_bytes = num_bytes;
ctl.max_chunk_size = num_bytes;
- ctl.stripe_len = BTRFS_STRIPE_LEN;
ctl.total_devs = btrfs_super_num_devices(info->super_copy);
ctl.dev_offset = *start;
--
2.31.1
next prev parent reply other threads:[~2021-04-06 8:08 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-04-06 8:05 [PATCH 00/12] btrfs-progs: refactor and generalize chunk/dev_extent allocation Naohiro Aota
2021-04-06 8:05 ` [PATCH 01/12] btrfs-progs: introduce chunk allocation policy Naohiro Aota
2021-04-06 8:05 ` [PATCH 02/12] btrfs-progs: refactor find_free_dev_extent_start() Naohiro Aota
2021-04-06 8:05 ` [PATCH 03/12] btrfs-progs: convert type of alloc_chunk_ctl::type Naohiro Aota
2021-04-06 8:05 ` [PATCH 04/12] btrfs-progs: consolidate parameter initialization of regular allocator Naohiro Aota
2021-04-06 8:05 ` [PATCH 05/12] btrfs-progs: factor out decide_stripe_size() Naohiro Aota
2021-04-06 8:05 ` [PATCH 06/12] btrfs-progs: factor out create_chunk() Naohiro Aota
2021-04-06 8:05 ` [PATCH 07/12] btrfs-progs: rewrite btrfs_alloc_data_chunk() using create_chunk() Naohiro Aota
2021-04-06 8:05 ` [PATCH 08/12] btrfs-progs: fix to use half the available space for DUP profile Naohiro Aota
2021-04-06 8:05 ` [PATCH 09/12] btrfs-progs: use round_down for allocation calcs Naohiro Aota
2021-04-06 8:05 ` Naohiro Aota [this message]
2021-04-06 8:05 ` [PATCH 11/12] btrfs-progs: simplify arguments of chunk_bytes_by_type() Naohiro Aota
2021-04-06 8:05 ` [PATCH 12/12] btrfs-progs: rename calc_size to stripe_size Naohiro Aota
2021-04-06 8:28 ` [PATCH 00/12] btrfs-progs: refactor and generalize chunk/dev_extent allocation Johannes Thumshirn
2021-04-06 10:54 ` Su Yue
2021-04-06 13:24 ` Naohiro Aota
2021-04-06 14:40 ` Su Yue
2021-04-29 14:20 ` 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=82254413cb8815ee384550bd306ad0cc3c69fdc6.1617694997.git.naohiro.aota@wdc.com \
--to=naohiro.aota@wdc.com \
--cc=dsterba@suse.com \
--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.