Skip to content

btrfs-progs: zoned: check existence of SB zone, not LBA

Naohiro Aota linux-btrfs 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest2 patches 1 replyIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2btrfs-progs: zoned: introduce sb_bytenr_to_sb_zone()kernel-shared/zoned.c+16 -120 replies
2/2btrfs-progs: zoned: check SB zone existence properlykernel-shared/disk-io.c kernel-shared/zoned.c kernel-shared/zoned.h+22 -10 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH 0/2] btrfs-progs: zoned: check existence of SB zone, not LBA

Running btrfs check can fail on a certain zoned decice setup (e.g, zone size = 128MB, device size = 16GB):

(from generic/330)
yes|/usr/local/bin/btrfs check --repair --force /dev/nullb1
[1/7] checking root items
Fixed 0 roots.
[2/7] checking extents
ERROR: zoned: failed to read zone info of 4096 and 4097: Invalid argument
ERROR: failed to write super block for devid 1: write error: Input/output error failed to write new super block err -5
failed to repair damaged filesystem, aborting

This happens because write_dev_supers() is comparing the original superblock location vs the device size to check if it can write out a superblock copy or not.

For the above example, since the first copy location (64MB) < device size (16GB), it tries to write out the copy. But, the copy must be written into zone 4096 (512G / zone size (128M) = 4096), which is out of the device.

To address the issue, this series introduces check_sb_location() to check if a SB copy can be written out.

The patch 1 is a preparation to factor out logic of converting the original superblock location to SB log writing superblock zone. And, the second one implements check_sb_location() to write_dev_supers().

Naohiro Aota (2):
btrfs-progs: zoned: introduce sb_bytenr_to_sb_zone()
btrfs-progs: zoned: check SB zone existence properly

 kernel-shared/disk-io.c |  9 ++++++++-
 kernel-shared/zoned.c   | 36 ++++++++++++++++++++++++------------
 kernel-shared/zoned.h   |  6 ++++++
 3 files changed, 38 insertions(+), 13 deletions(-)
Signature · 1 line
2.42.0