From: Naohiro Aota <naohiro.aota@wdc.com>
To: linux-btrfs@vger.kernel.org
Cc: Naohiro Aota <naohiro.aota@wdc.com>
Subject: [PATCH 00/12] btrfs-progs: zoned: support zone capacity and
Date: Mon, 17 Feb 2025 11:37:30 +0900 [thread overview]
Message-ID: <cover.1739756953.git.naohiro.aota@wdc.com> (raw)
Running mkfs.btrfs on a null_blk device with the following setup fails
as below.
- zone size: 64MB
- zone capacity: 64MB
- number of conventional zones: 6
- storage size: 2048MB
+ /home/naota/src/btrfs-progs/mkfs.btrfs -d single -m dup -f /dev/nullb0
btrfs-progs v6.10
See https://btrfs.readthedocs.io for more information.
zoned: /dev/nullb0: host-managed device detected, setting zoned feature
Resetting device zones /dev/nullb0 (32 zones) ...
NOTE: several default settings have changed in version 5.15, please make sure
this does not affect your deployments:
- DUP for metadata (-m dup)
- enabled no-holes (-O no-holes)
- enabled free-space-tree (-R free-space-tree)
bad tree block 268435456, bytenr mismatch, want=268435456, have=0
kernel-shared/disk-io.c:485: write_tree_block: BUG_ON `1` triggered, value 1
/home/naota/src/btrfs-progs/mkfs.btrfs(+0x290ca) [0x55603cf7e0ca]
/home/naota/src/btrfs-progs/mkfs.btrfs(write_tree_block+0xa7) [0x55603cf80417]
/home/naota/src/btrfs-progs/mkfs.btrfs(__commit_transaction+0xe8) [0x55603cf9b7d8]
/home/naota/src/btrfs-progs/mkfs.btrfs(btrfs_commit_transaction+0x176) [0x55603cf9ba66]
/home/naota/src/btrfs-progs/mkfs.btrfs(main+0x2831) [0x55603cf67291]
/usr/lib64/libc.so.6(+0x271ee) [0x7f5ab706f1ee]
/usr/lib64/libc.so.6(__libc_start_main+0x89) [0x7f5ab706f2a9]
/home/naota/src/btrfs-progs/mkfs.btrfs(_start+0x25) [0x55603cf6a135]
/home/naota/tmp/test-mkfs.sh: line 13: 821886 Aborted (core dumped)
The crash happens because btrfs-progs failed to set proper allocation
pointer when a DUP block group is created over a conventional zone and a
sequential write required zone. In that case, the write pointer is
recovered from the last allocated extent in the block group. That
functionality is not well implemented in btrfs-progs side.
Implementing that functionality is relatively trivial because we can
copy the code from the kernel side. However, the code is quite out of
sync between the kernel side and user space side. So, this series first
refactors btrfs_load_block_group_zone_info() to make it easy to
integrate the code from the kernel side.
The main part is the last patch, which fixes allocation pointer
calculation for all the profiles.
While at it, this series also adds support for zone capacity and zone
activeness. But, zone activeness support is currently limited. It does
not attempt to check the zone active limit on the extent allocation,
because mkfs.btrfs should work without hitting the limit.
Naohiro Aota (12):
btrfs-progs: introduce min_not_zero()
btrfs-progs: zoned: introduce a zone_info struct in
btrfs_load_block_group_zone_info
btrfs-progs: zoned: support zone capacity
btrfs-progs: zoned: load zone activeness
btrfs-progs: zoned: activate block group on loading
btrfs-progs: factor out btrfs_load_zone_info()
btrfs-progs: zoned: factor out SINGLE zone info loading
btrfs-progs: zoned: implement DUP zone info loading
btrfs-progs: zoned: implement RAID1 zone info loading
btrfs-progs: zoned: implement RAID0 zone info loading
btrfs-progs: implement RAID10 zone info loading
btrfs-progs: zoned: fix alloc_offset calculation for partly
conventional block groups
include/kerncompat.h | 10 +
kernel-shared/ctree.h | 3 +
kernel-shared/extent-tree.c | 2 +-
kernel-shared/zoned.c | 458 +++++++++++++++++++++++++++++++-----
kernel-shared/zoned.h | 3 +
5 files changed, 414 insertions(+), 62 deletions(-)
--
2.48.1
next reply other threads:[~2025-02-17 2:37 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-17 2:37 Naohiro Aota [this message]
2025-02-17 2:37 ` [PATCH 01/12] btrfs-progs: introduce min_not_zero() Naohiro Aota
2025-02-17 2:37 ` [PATCH 02/12] btrfs-progs: zoned: introduce a zone_info struct in btrfs_load_block_group_zone_info Naohiro Aota
2025-02-17 2:37 ` [PATCH 03/12] btrfs-progs: zoned: support zone capacity Naohiro Aota
2025-02-17 2:37 ` [PATCH 04/12] btrfs-progs: zoned: load zone activeness Naohiro Aota
2025-02-17 2:37 ` [PATCH 05/12] btrfs-progs: zoned: activate block group on loading Naohiro Aota
2025-02-17 2:37 ` [PATCH 06/12] btrfs-progs: factor out btrfs_load_zone_info() Naohiro Aota
2025-02-17 2:37 ` [PATCH 07/12] btrfs-progs: zoned: factor out SINGLE zone info loading Naohiro Aota
2025-02-17 17:12 ` Johannes Thumshirn
2025-02-17 17:16 ` Johannes Thumshirn
2025-02-17 2:37 ` [PATCH 08/12] btrfs-progs: zoned: implement DUP " Naohiro Aota
2025-02-17 2:37 ` [PATCH 09/12] btrfs-progs: zoned: implement RAID1 " Naohiro Aota
2025-02-17 2:37 ` [PATCH 10/12] btrfs-progs: zoned: implement RAID0 " Naohiro Aota
2025-02-17 2:37 ` [PATCH 11/12] btrfs-progs: implement RAID10 " Naohiro Aota
2025-02-17 2:37 ` [PATCH 12/12] btrfs-progs: zoned: fix alloc_offset calculation for partly conventional block groups Naohiro Aota
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=cover.1739756953.git.naohiro.aota@wdc.com \
--to=naohiro.aota@wdc.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