public inbox for linux-btrfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Qu Wenruo <wqu@suse.com>
To: linux-btrfs@vger.kernel.org
Subject: [PATCH 0/3] btrfs: apply strict alignment checks to extent maps
Date: Sun, 18 Jan 2026 15:59:57 +1030	[thread overview]
Message-ID: <cover.1768714131.git.wqu@suse.com> (raw)

Although we already have strict checks on file extent items from
tree-checker, we never do proper alignment checks for extent maps.

The reason is mostly due to the failure of self tests and how hard it is
to touch them, especially for the inode self tests.

I have to say the inode self test is really something, the extent maps
of the self test makes no sense, and would be rejected by tree-checker if
they show up in the real world.
Thankfully only the first few ones are invalid, the remaining ones are
totally fine.

The comments are not any better, after the first line, there are no more
aligned number at all, and the numbers are not offset by 1, but 3 or
even more.
Considering we're using decimals for most of our dump-tree and comments,
no one is really going to note the wrong numbers until one throw them
into python or whatever calculator one prefers.

The series will mostly rework the inode self tests file extent item
layout so that they represent the real world better, and update the
comments and make the poor person who needs to update that selftest
suffer less in the future.

Then address the minor problem in the extent-map selftest where
fs_info->sectorsize is never properly populated for the 4K based self
test.

With all those done, we can finally put a proper alignment check into 
validate_extent_map() which is called for every new, merged or replaced
extent map.

Qu Wenruo (3):
  btrfs: tests: remove invalid file extent map tests
  btrfs: tests: prepare extent map tests for strict alignment checks
  btrfs: add strict extent map alignment checks

 fs/btrfs/extent_map.c             |  12 ++++
 fs/btrfs/tests/extent-map-tests.c |  16 +++--
 fs/btrfs/tests/inode-tests.c      | 111 +++++++++++++++++-------------
 3 files changed, 87 insertions(+), 52 deletions(-)

-- 
2.52.0


             reply	other threads:[~2026-01-18  5:30 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-18  5:29 Qu Wenruo [this message]
2026-01-18  5:29 ` [PATCH 1/3] btrfs: tests: remove invalid file extent map tests Qu Wenruo
2026-01-21 17:09   ` Filipe Manana
2026-01-21 21:04     ` Qu Wenruo
2026-01-21 21:27       ` Filipe Manana
2026-01-18  5:29 ` [PATCH 2/3] btrfs: tests: prepare extent map tests for strict alignment checks Qu Wenruo
2026-01-21 17:12   ` Filipe Manana
2026-01-18  5:30 ` [PATCH 3/3] btrfs: add strict extent map " Qu Wenruo
2026-01-21 17:19   ` Filipe Manana

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.1768714131.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