]> git-server-git.apps.pok.os.sepia.ceph.com Git - xfstests-dev.git/commit
fstests: btrfs/131: add explicit v1 space cache requirement
authorQu Wenruo <wqu@suse.com>
Thu, 25 Dec 2025 22:15:52 +0000 (08:45 +1030)
committerZorro Lang <zlang@kernel.org>
Sun, 25 Jan 2026 16:05:29 +0000 (00:05 +0800)
commit8d2e1bd3d2947689921c9496b3aebb3f2a09851c
treebc063bb820a3538dfdf6275124ba05a28d5d2ef8
parentfacf3325d90dd6b650983b2cae2369c837d92bf8
fstests: btrfs/131: add explicit v1 space cache requirement

The test case is utilizing v1 space cache, meanwhile v1 space cache
is already marked deprecated for a while since kernel commit
1e7bec1f7d65 ("btrfs: emit a warning about space cache v1 being
deprecated").

Furthermore quite some features are not compatible with v1 cache,
including the soon-to-be-default block-group-tree, and hardware
dependent zoned features.

Currently we reject those features for btrfs/131, but what we really
want is to only run the test case for supported features/kernels.
The current way to reject will not handle future kernels that completely
rejects v1 space cache.

Add a new helper, _require_btrfs_v1_cache() to do the check, which
checks the following criteria:

- "space_cache=v1" mount option is supported
  And to handle default v2 cache behavior, also add "clear_cache".
  If the kernel has completely dropped v1 cache support, such mount
  should fail.

- Check if FREE_SPACE_TREE feature exists after above mount
  For bs != ps cases, v2 cache is enforced to replace v1 cache, thus
  we need to double check to make sure above mount didn't result v2
  cache.

- Check if cache generation is correct
  If v1 cache is working, the cache_generation should be some valid
  value other than 0 nor (u64)-1.

And replace the existing checks on zoned and block-group-tree with the
new one.

Signed-off-by: Qu Wenruo <wqu@suse.com>
Reviewed-by: Zorro Lang <zlang@redhat.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
common/btrfs
tests/btrfs/131