From: Qu Wenruo <wqu@suse.com>
To: linux-btrfs@vger.kernel.org
Subject: [PATCH v2 0/6] btrfs-progs: introduce "btrfs rescue fix-data-checksum"
Date: Thu, 15 May 2025 17:30:15 +0930 [thread overview]
Message-ID: <cover.1747295965.git.wqu@suse.com> (raw)
[CHANGELOG]
v2:
- Rename the subcommand to "fix-data-checksum"
It's better to use full name in the command name
- Remove unused members inside corrupted_block
The old @extent_bytenr and @extent_len is no longer needed, even for
the future file-deletion action.
- Fix the bitmap size off-by-1 bug
We must use the bit 0 to represent mirror 1, or the bitmap size will
exceed num_mirrors.
- Introduce -i|--interactive mode
Will ask the user for the action on the corrupted block, including:
* Ignore
The default behavior if no command is provided
* Use specified mirror to update the data checksum item
The user must input a number inside range [1, num_mirrors].
- Introduce -m|--mirror <num> mode
Use specified mirror for all corrupted blocks.
The value <num> must be >= 1. And if the value is larger than the
actual max mirror number, the real mirror number will be
`num % (num_mirror + 1)`.
We have a long history of data csum mismatch, caused by direct IO and
buffered being modified during writeback.
Although the problem is worked around in v6.15 (and being backported),
for the affected fs there is no good way to fix them, other than complex
manually find out which files are affected and delete them.
This series introduce the initial implementation of "btrfs rescue
fix-data-checksum", which is designed to fix such problem by either:
- Update the csum items using the data from specified copy
The subcommand has 3 modes so far:
- Readonly mode
Only report all corrupted blocks and affected files, no repair is
done.
- Interactive mode
Ask for what to do, including
* Ignore (the default)
* Use certain mirror to update the checksum item
- Mirror mode
Use specified mirror to update the checksum item, the batch mode of
the interactive one.
In the future, there will be one more mode:
- Delete mode
Delete all involved files.
There are still some points to address before implementing this mode.
Qu Wenruo (6):
btrfs-progs: introduce "btrfs rescue fix-data-checksum"
btrfs-progs: fix a bug in btrfs_find_item()
btrfs-progs: fix-data-checksum: show affected files
btrfs-progs: fix-data-checksum: introduce interactive mode
btrfs-progs: fix-data-checksum: update csum items to fix csum mismatch
btrfs-progs: fix-data-checksum: introduce -m|--mirror option
Documentation/btrfs-rescue.rst | 28 ++
Makefile | 2 +-
cmds/rescue-fix-data-checksum.c | 511 ++++++++++++++++++++++++++++++++
cmds/rescue.c | 65 ++++
cmds/rescue.h | 10 +
kernel-shared/ctree.c | 17 +-
kernel-shared/file-item.c | 2 +-
kernel-shared/file-item.h | 5 +
8 files changed, 635 insertions(+), 5 deletions(-)
create mode 100644 cmds/rescue-fix-data-checksum.c
--
2.49.0
next reply other threads:[~2025-05-15 8:00 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-05-15 8:00 Qu Wenruo [this message]
2025-05-15 8:00 ` [PATCH v2 1/6] btrfs-progs: introduce "btrfs rescue fix-data-checksum" Qu Wenruo
2025-05-30 11:10 ` David Sterba
2025-05-15 8:00 ` [PATCH v2 2/6] btrfs-progs: fix a bug in btrfs_find_item() Qu Wenruo
2025-05-30 11:11 ` David Sterba
2025-05-15 8:00 ` [PATCH v2 3/6] btrfs-progs: fix-data-checksum: show affected files Qu Wenruo
2025-05-30 11:14 ` David Sterba
2025-05-15 8:00 ` [PATCH v2 4/6] btrfs-progs: fix-data-checksum: introduce interactive mode Qu Wenruo
2025-05-30 11:18 ` David Sterba
2025-05-15 8:00 ` [PATCH v2 5/6] btrfs-progs: fix-data-checksum: update csum items to fix csum mismatch Qu Wenruo
2025-05-30 11:19 ` David Sterba
2025-05-30 22:23 ` Qu Wenruo
2025-05-15 8:00 ` [PATCH v2 6/6] btrfs-progs: fix-data-checksum: introduce -m|--mirror option Qu Wenruo
2025-05-30 11:07 ` [PATCH v2 0/6] btrfs-progs: introduce "btrfs rescue fix-data-checksum" David Sterba
2025-05-31 16:58 ` Goffredo Baroncelli
2025-05-31 22:07 ` Qu Wenruo
2025-06-02 17:28 ` Goffredo Baroncelli
2025-06-02 22:55 ` Qu Wenruo
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.1747295965.git.wqu@suse.com \
--to=wqu@suse.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