Linux Btrfs filesystem development
 help / color / mirror / Atom feed
* [PATCH 0/2] btrfs-progs: zoned: check existence of SB zone, not LBA
@ 2023-10-12 14:19 Naohiro Aota
  2023-10-12 14:19 ` [PATCH 1/2] btrfs-progs: zoned: introduce sb_bytenr_to_sb_zone() Naohiro Aota
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Naohiro Aota @ 2023-10-12 14:19 UTC (permalink / raw)
  To: linux-btrfs; +Cc: Naohiro Aota

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(-)

-- 
2.42.0


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-10-12 16:32 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-10-12 14:19 [PATCH 0/2] btrfs-progs: zoned: check existence of SB zone, not LBA Naohiro Aota
2023-10-12 14:19 ` [PATCH 1/2] btrfs-progs: zoned: introduce sb_bytenr_to_sb_zone() Naohiro Aota
2023-10-12 14:19 ` [PATCH 2/2] btrfs-progs: zoned: check SB zone existence properly Naohiro Aota
2023-10-12 16:25 ` [PATCH 0/2] btrfs-progs: zoned: check existence of SB zone, not LBA David Sterba

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox