Linux-BTRFS Archive mirror
 help / color / mirror / Atom feed
From: Qu Wenruo <wqu@suse.com>
To: linux-btrfs@vger.kernel.org
Subject: [PATCH 0/3] btrfs-progs: check: detect and repair ram_bytes mismatch for non-compressed data extents
Date: Thu,  2 May 2024 18:37:52 +0930	[thread overview]
Message-ID: <cover.1714640642.git.wqu@suse.com> (raw)

There are at least one kernel bug that makes on-disk
btrfs_file_extent_item::ram_bytes incorrect for non-compressed non-hole
data extents.

Thankfully kernel just doesn't care ram_bytes for non-compressed extents
at all, so it doesn't lead to any data corruption or whatever, and this
is really just a minor problem.

But for the sake of consistency and to follow the on-disk format, we
should still detect and repair such problems.

This patchset would implement detection and repair for both lowmem and
original mode, and a new hand crafted test case for it.

The reason why the test case is still handle crafted is, we do not have
the btrfs-corrupt-block support for corrupting ram_bytes to a specific
value yet.

I'd prefer to do the binary image migration to script in a dedicated
patchset in the future.

Qu Wenruo (3):
  btrfs-progs: check/lowmem: detect and repair mismatched ram_bytes
  btrfs-progs: check/original: detect and repair ram_bytes mismatch
  btrfs-progs: tests/fsck: add test case for ram_bytes detection and
    repair

 check/main.c                                  | 126 +++++++++++++++++-
 check/mode-lowmem.c                           |  69 ++++++++++
 check/mode-lowmem.h                           |   1 +
 check/mode-original.h                         |   8 ++
 .../default.img.xz                            | Bin 0 -> 2076 bytes
 5 files changed, 200 insertions(+), 4 deletions(-)
 create mode 100644 tests/fsck-tests/062-noncompressed-ram-bytes-mismatch/default.img.xz

--
2.45.0


             reply	other threads:[~2024-05-02  9:08 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-02  9:07 Qu Wenruo [this message]
2024-05-02  9:07 ` [PATCH 1/3] btrfs-progs: check/lowmem: detect and repair mismatched ram_bytes Qu Wenruo
2024-05-02  9:07 ` [PATCH 2/3] btrfs-progs: check/original: detect and repair ram_bytes mismatch Qu Wenruo
2024-05-02  9:07 ` [PATCH 3/3] btrfs-progs: tests/fsck: add test case for ram_bytes detection and repair Qu Wenruo
2024-05-03 13:29 ` [PATCH 0/3] btrfs-progs: check: detect and repair ram_bytes mismatch for non-compressed data extents 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.1714640642.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).