Linux Btrfs filesystem development
 help / color / mirror / Atom feed
From: Qu Wenruo <wqu@suse.com>
To: linux-btrfs@vger.kernel.org, fstests@vger.kernel.org
Subject: [PATCH] fstests: btrfs/131: remove deprecated v1 space cache tests
Date: Tue, 23 Dec 2025 18:09:39 +1030	[thread overview]
Message-ID: <20251223073939.128157-1-wqu@suse.com> (raw)

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.

Signed-off-by: Qu Wenruo <wqu@suse.com>
---
 tests/btrfs/131     | 34 ++++++++++------------------------
 tests/btrfs/131.out |  7 ++-----
 2 files changed, 12 insertions(+), 29 deletions(-)

diff --git a/tests/btrfs/131 b/tests/btrfs/131
index b4756a5f..d2b4b91d 100755
--- a/tests/btrfs/131
+++ b/tests/btrfs/131
@@ -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
diff --git a/tests/btrfs/131.out b/tests/btrfs/131.out
index aaa4a70a..97769dc7 100644
--- a/tests/btrfs/131.out
+++ b/tests/btrfs/131.out
@@ -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
-- 
2.51.2


             reply	other threads:[~2025-12-23  7:40 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-23  7:39 Qu Wenruo [this message]
2025-12-25 10:36 ` [PATCH] fstests: btrfs/131: remove deprecated v1 space cache tests Anand Jain
2025-12-25 20:20   ` Qu Wenruo

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=20251223073939.128157-1-wqu@suse.com \
    --to=wqu@suse.com \
    --cc=fstests@vger.kernel.org \
    --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