From: David Sterba <dsterba@suse.cz>
To: Qu Wenruo <wqu@suse.com>
Cc: linux-btrfs@vger.kernel.org
Subject: Re: [PATCH v2 0/6] btrfs-progs: introduce "btrfs rescue fix-data-checksum"
Date: Fri, 30 May 2025 13:07:53 +0200 [thread overview]
Message-ID: <20250530110753.GP4037@twin.jikos.cz> (raw)
In-Reply-To: <cover.1747295965.git.wqu@suse.com>
On Thu, May 15, 2025 at 05:30:15PM +0930, Qu Wenruo wrote:
> [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
Thanks, this is certainly useful and is a reasonable compromise to have
a way to fix the checksums. I did some conding style fixups in the devel
branch, I'll comment under the patches.
next prev parent reply other threads:[~2025-05-30 11:07 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-05-15 8:00 [PATCH v2 0/6] btrfs-progs: introduce "btrfs rescue fix-data-checksum" Qu Wenruo
2025-05-15 8:00 ` [PATCH v2 1/6] " 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 ` David Sterba [this message]
2025-05-31 16:58 ` [PATCH v2 0/6] btrfs-progs: introduce "btrfs rescue fix-data-checksum" 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=20250530110753.GP4037@twin.jikos.cz \
--to=dsterba@suse.cz \
--cc=linux-btrfs@vger.kernel.org \
--cc=wqu@suse.com \
/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