From: Naohiro Aota <naohiro.aota@wdc.com>
To: linux-btrfs@vger.kernel.org
Cc: Naohiro Aota <naohiro.aota@wdc.com>
Subject: [PATCH 0/2] btrfs-progs: zoned: check existence of SB zone, not LBA
Date: Thu, 12 Oct 2023 23:19:28 +0900 [thread overview]
Message-ID: <cover.1697104952.git.naohiro.aota@wdc.com> (raw)
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
next reply other threads:[~2023-10-12 14:19 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-10-12 14:19 Naohiro Aota [this message]
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
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.1697104952.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