From: Nikolay Borisov <nborisov@suse.com>
To: linux-btrfs@vger.kernel.org
Cc: Nikolay Borisov <nborisov@suse.com>
Subject: [PATCH 1/3] btrfs-progs: Initialize sub_stripes to 1 in btrfs_alloc_data_chunk
Date: Wed, 30 Oct 2019 14:22:25 +0200 [thread overview]
Message-ID: <20191030122227.28496-2-nborisov@suse.com> (raw)
In-Reply-To: <20191030122227.28496-1-nborisov@suse.com>
sub_stripe variables is by default initialized to 0 and it's overriden
only in case we have RAID10 mode. This leads to the following (minor)
artifacts on a freshly created filesystem:
item 3 key (FIRST_CHUNK_TREE CHUNK_ITEM 30408704) itemoff 15863 itemsize 112
length 1073741824 owner 2 stripe_len 65536 type METADATA|RAID1
io_align 65536 io_width 65536 sector_size 4096
num_stripes 2 sub_stripes 0
stripe 0 devid 2 offset 9437184
dev_uuid a020fc2f-b526-4800-9278-156f2f431fe9
stripe 1 devid 1 offset 30408704
dev_uuid 0f78aa72-4626-4057-a8f2-285f46b2c664
After balance resulting chunk item is:
item 3 key (FIRST_CHUNK_TREE CHUNK_ITEM 3251634176) itemoff 15863 itemsize 112
length 268435456 owner 2 stripe_len 65536 type METADATA|RAID1
io_align 65536 io_width 65536 sector_size 4096
num_stripes 2 sub_stripes 1
stripe 0 devid 2 offset 3230662656
dev_uuid a020fc2f-b526-4800-9278-156f2f431fe9
stripe 1 devid 1 offset 3251634176
dev_uuid 0f78aa72-4626-4057-a8f2-285f46b2c664
Kernel code usually initializes it to 1, since it takes the value from
the raid description table which has it set to 1 for all but RAID10 types.
In userspace it has be statically initialized by 1 since we don't have
btrfs_bg_flags_to_raid_index. Eventually the kernel/userspace needs
to be merged but for now it wouldn't bring much value if this function
is copied.
Signed-off-by: Nikolay Borisov <nborisov@suse.com>
---
volumes.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/volumes.c b/volumes.c
index fbbc22b5b1b3..1d088d93e788 100644
--- a/volumes.c
+++ b/volumes.c
@@ -993,7 +993,7 @@ int btrfs_alloc_chunk(struct btrfs_trans_handle *trans,
int num_stripes = 1;
int max_stripes = 0;
int min_stripes = 1;
- int sub_stripes = 0;
+ int sub_stripes = 1;
int looped = 0;
int ret;
int index;
@@ -1258,7 +1258,7 @@ int btrfs_alloc_data_chunk(struct btrfs_trans_handle *trans,
struct map_lookup *map;
u64 calc_size = SZ_8M;
int num_stripes = 1;
- int sub_stripes = 0;
+ int sub_stripes = 1;
int ret;
int index;
int stripe_len = BTRFS_STRIPE_LEN;
--
2.7.4
next prev parent reply other threads:[~2019-10-30 12:23 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-10-30 12:22 [PATCH 0/3] Misc btrfs-progs fixes Nikolay Borisov
2019-10-30 12:22 ` Nikolay Borisov [this message]
2019-10-30 12:42 ` [PATCH 1/3] btrfs-progs: Initialize sub_stripes to 1 in btrfs_alloc_data_chunk Qu Wenruo
2019-10-30 12:22 ` [PATCH 2/3] btrfs-progs: Remove type argument from btrfs_alloc_data_chunk Nikolay Borisov
2019-10-30 12:42 ` Qu Wenruo
2019-10-30 12:22 ` [PATCH 3/3] btrfs-progs: Remove convert param " Nikolay Borisov
2019-10-30 12:45 ` Qu Wenruo
2019-11-15 12:22 ` [PATCH 0/3] Misc btrfs-progs fixes 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=20191030122227.28496-2-nborisov@suse.com \
--to=nborisov@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox