Skip to content

btrfs-progs: zoned: support zone capacity and

Naohiro Aota linux-btrfs 2 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest12 patches 4 repliesIn review
  2. v112 patches 2 repliesSuperseded

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/12btrfs-progs: introduce min_not_zero()include/kerncompat.h+10 -00 replies
2/12btrfs-progs: zoned: introduce a zone_info struct in btrfs_load_block_group_zone_infokernel-shared/zoned.c+24 -220 replies
3/12btrfs-progs: zoned: support zone capacitykernel-shared/ctree.h kernel-shared/extent-tree.c kernel-shared/zoned.c+10 -20 replies
4/12btrfs-progs: zoned: load zone activenesskernel-shared/ctree.h kernel-shared/zoned.c kernel-shared/zoned.h+75 -60 replies
5/12btrfs-progs: zoned: activate block group on loadingkernel-shared/ctree.h kernel-shared/zoned.c+16 -00 replies
6/12btrfs-progs: factor out btrfs_load_zone_info()kernel-shared/zoned.c+71 -530 replies
7/12btrfs-progs: zoned: factor out SINGLE zone info loadingkernel-shared/zoned.c+43 -40 replies
8/12btrfs-progs: zoned: implement DUP zone info loadingkernel-shared/zoned.c+42 -00 replies
9/12btrfs-progs: zoned: implement RAID1 zone info loadingkernel-shared/zoned.c+46 -00 replies
10/12btrfs-progs: zoned: implement RAID0 zone info loadingkernel-shared/zoned.c+32 -00 replies
11/12btrfs-progs: implement RAID10 zone info loadingkernel-shared/zoned.c+35 -20 replies
12/12btrfs-progs: zoned: fix alloc_offset calculation for partly conventional block groupskernel-shared/zoned.c+51 -142 replies

Reviews trailers per patch

None of the 12 patches has a Reviewed-by or Acked-by of their own; the series has one for all of them.

PatchJohannes Thumshirn
SeriesR-b
1/12
2/12
3/12
4/12
5/12
6/12
7/12
8/12
9/12
10/12
11/12
12/12

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v2 thread

Cover letter [PATCH v2 00/12] btrfs-progs: zoned: support zone capacity and

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.

- v2
- Temporarily fails some profiles while adding supports in the patch series.
- v1: https://lore.kernel.org/linux-btrfs/[email protected]/

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