]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
btrfs: tests: prepare extent map tests for strict alignment checks
authorQu Wenruo <wqu@suse.com>
Wed, 21 Jan 2026 23:07:59 +0000 (09:37 +1030)
committerDavid Sterba <dsterba@suse.com>
Tue, 3 Feb 2026 06:56:19 +0000 (07:56 +0100)
commit385c65f8274b8caff75102474c4c9e8a95e6ec4c
tree41d85773669d7b2dc99d05be7f0519a67bf93d87
parentd77b90cfe08f4cf20dbbc255f8ef13bee831be63
btrfs: tests: prepare extent map tests for strict alignment checks

Currently the extent map self tests have the following points that will
cause false alerts for the incoming strict extent map alignment checks:

- Incorrect inlined extent map size

  Which is not following what the kernel is doing for inlined extents,
  as btrfs_extent_item_to_extent_map() always uses the fs block size as
  the length, not the ram_bytes.

  Fix it by using SZ_4K as extent map's length.

- Incorrect btrfs_fs_info::sectorsize

  As we always use PAGE_SIZE, which can be values larger than 4K.
  Meanwhile all the immediate numbers used are based on 4K fs block size
  in the test case.

  Fix it by using fixed SZ_4K fs block size when allocating the dummy
  btrfs_fs_info.

Reviewed-by: Filipe Manana <fdmanana@suse.com>
Signed-off-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/tests/extent-map-tests.c