Skip to contentSkip to conversation

fstests: btrfs/131: remove deprecated v1 space cache tests

PATCH In review Qu Wenruo 3 participants 3 messages Dec 23, 2025 – Dec 25, 2025 Btrfs file system

lore
Share & tools
lore

Qu Wenruo

author
#0 lore raw

PATCH 1/1 fstests: btrfs/131: remove deprecated v1 space cache tests

Since upstream kernel commit 1e7bec1f7d65 ("btrfs: emit a warning about space cache v1 being deprecated"), v1 space cache is deprecated and we're considering to remove the support soon.

This means soon v1 space cache mount option will no longer be accepted, and the test case will fail due to such change.

Update the test case to remove all v1 cache usage, so we only support two cache modes, either nospace_cache or space_cache=v2.

This also allows bs < ps btrfs to be tested for this test case which has no v1 space cache from day 1.

---
 tests/btrfs/131     | 34 ++++++++++------------------------
 tests/btrfs/131.out |  7 ++-----
 2 files changed, 12 insertions(+), 29 deletions(-)
tests/btrfs/131 +10 -24
index b4756a5f..d2b4b91d 100755
@@ -14,21 +14,15 @@ _begin_fstest auto quick
 _require_scratch
 _require_btrfs_command inspect-internal dump-super
 _require_btrfs_fs_feature free_space_tree
-# Zoned btrfs does not support space_cache(v1)
-_require_non_zoned_device "${SCRATCH_DEV}"
 # Block group tree does not support space_cache(v1)
 _require_btrfs_no_block_group_tree
 
-_scratch_mkfs >/dev/null 2>&1
-[ "$(_get_page_size)" -gt "$(_scratch_btrfs_sectorsize)" ] && \
-	_notrun "cannot run with subpage sectorsize"
-
-mkfs_v1()
+mkfs_nocache()
 {
 	_scratch_mkfs >/dev/null 2>&1
 	# Future proof against btrfs-progs making space_cache=v2 filesystems by
 	# default.
-	_scratch_mount -o clear_cache,space_cache=v1
+	_scratch_mount -o clear_cache,nospace_cache
 	_scratch_unmount
 }
 
@@ -54,41 +48,39 @@ check_fst_compat()
 export MOUNT_OPTIONS=""
 
 # When the free space tree is not enabled:
-# -o space_cache=v1: keep using the old free space cache
+# -o nospace_cache: keep no space cache
 # -o space_cache=v2: enable the free space tree
 # -o clear_cache,space_cache=v2: clear the free space cache and enable the free space tree
 # We don't check the no options case or plain space_cache as that will change
 # in the future to turn on space_cache=v2.
 
-mkfs_v1
-echo "Using free space cache"
-_scratch_mount -o space_cache=v1
+mkfs_nocache
+echo "Using no space cache"
+_scratch_mount -o nospace_cache
 check_fst_compat
 _scratch_unmount
 
-mkfs_v1
+mkfs_nocache
 echo "Enabling free space tree"
 _scratch_mount -o space_cache=v2
 check_fst_compat
 _scratch_unmount
 
-mkfs_v1
-echo "Disabling free space cache and enabling free space tree"
+mkfs_nocache
+echo "Clearing free space cache and enabling free space tree"
 _scratch_mount -o clear_cache,space_cache=v2
 check_fst_compat
 _scratch_unmount
 
 # When the free space tree is enabled:
-# -o nospace_cache, -o space_cache=v1: error
+# -o nospace_cache: error
 # no options, -o space_cache=v2: keep using the free space tree
 # -o clear_cache, -o clear_cache,space_cache=v2: clear and recreate the free space tree
 # -o clear_cache,nospace_cache: clear the free space tree
-# -o clear_cache,space_cache=v1: clear the free space tree, enable the free space cache
 
 mkfs_v2
 echo "Trying to mount without free space tree"
 _try_scratch_mount -o nospace_cache >/dev/null 2>&1 || echo "mount failed"
-_try_scratch_mount -o space_cache=v1 >/dev/null 2>&1 || echo "mount failed"
 
 mkfs_v2
 echo "Mounting existing free space tree"
@@ -115,12 +107,6 @@ _scratch_mount -o clear_cache,nospace_cache
 check_fst_compat
 _scratch_unmount
 
-mkfs_v2
-echo "Reverting to free space cache"
-_scratch_mount -o clear_cache,space_cache=v1
-check_fst_compat
-_scratch_unmount
-
 # success, all done
 status=0
 exit
tests/btrfs/131.out +2 -5
index aaa4a70a..97769dc7 100644
@@ -1,13 +1,12 @@
 QA output created by 131
-Using free space cache
+Using no space cache
 free space tree is disabled
 Enabling free space tree
 free space tree is enabled
-Disabling free space cache and enabling free space tree
+Clearing free space cache and enabling free space tree
 free space tree is enabled
 Trying to mount without free space tree
 mount failed
-mount failed
 Mounting existing free space tree
 free space tree is enabled
 free space tree is enabled
@@ -16,5 +15,3 @@ free space tree is enabled
 free space tree is enabled
 Disabling free space tree
 free space tree is disabled
-Reverting to free space cache
-free space tree is disabled
Signature · 1 line
2.51.2
#1 lore raw
Quoted 4 lines · Qu Wenruo

Since upstream kernel commit 1e7bec1f7d65 ("btrfs: emit a warning about space cache v1 being deprecated"), v1 space cache is deprecated and we're considering to remove the support soon.

Quoted 8 lines

This means soon v1 space cache mount option will no longer be accepted, and the test case will fail due to such change.

Update the test case to remove all v1 cache usage, so we only support two cache modes, either nospace_cache or space_cache=v2.

This also allows bs < ps btrfs to be tested for this test case which has no v1 space cache from day 1.

We need testing space_cache=v1 for LTS kernels for its maintenance.

So why not duplicate this test case: one for kernels that support both space_cache=v1 and FST, and another for kernels with FST support only? Kernels would then either run or _notrun each test case accordingly.

tests/btrfs/131 check_fst_compat()

Quoted 5 lines
tests/btrfs/131 +2 -2
-mkfs_v1
-echo "Disabling free space cache and enabling free space tree"
+mkfs_nocache
 
+echo "Clearing free space cache and enabling free space tree"

The message should be “Clearing no space cache..”. ?

-Anand

#2 lore raw
Quoted 16 lines · Anand Jain
Quoted 4 lines · Qu Wenruo

Since upstream kernel commit 1e7bec1f7d65 ("btrfs: emit a warning about space cache v1 being deprecated"), v1 space cache is deprecated and we're considering to remove the support soon.

Quoted 8 lines

This means soon v1 space cache mount option will no longer be accepted, and the test case will fail due to such change.

Update the test case to remove all v1 cache usage, so we only support two cache modes, either nospace_cache or space_cache=v2.

This also allows bs < ps btrfs to be tested for this test case which has no v1 space cache from day 1.

Quoted 6 lines

We need testing space_cache=v1 for LTS kernels for its maintenance.

So why not duplicate this test case: one for kernels that support both space_cache=v1 and FST, and another for kernels with FST support only? Kernels would then either run or _notrun each test case accordingly.

I'm fine with that solution, although it will introduce some duplicated code between the two test cases.

Quoted 8 lines

tests/btrfs/131 check_fst_compat()

Quoted 6 lines
tests/btrfs/131 +2 -2
-mkfs_v1
-echo "Disabling free space cache and enabling free space tree"
+mkfs_nocache
 
+echo "Clearing free space cache and enabling free space tree"

The message should be “Clearing no space cache..”. ?

Will be changed to something like "Enabling free space tree on no space cache space fs".

Thanks,
Qu

Quoted 4 lines

-Anand