On 3/19/24 23:42, David Sterba wrote:
From: Josef Bacik <josef@xxxxxxxxxxxxxx>
A new disk format option will make the no-holes option a requirement, so
add a helper to make sure that we aren't creating a fs with
BLOCK_GROUP_TREE by default, and skip the tests that require turning off
no-holes.
Signed-off-by: Josef Bacik <josef@xxxxxxxxxxxxxx>
looks good.
Reviewed-by: Anand Jain <anand.jain@xxxxxxxxxx>
Thanks.
---
common/btrfs | 10 ++++++++++
tests/btrfs/131 | 2 ++
tests/btrfs/172 | 3 +++
tests/btrfs/206 | 3 +++
4 files changed, 18 insertions(+)
diff --git a/common/btrfs b/common/btrfs
index aa344706cd5f81..c1c3c4683a6fe6 100644
--- a/common/btrfs
+++ b/common/btrfs
@@ -148,6 +148,16 @@ _require_btrfs_free_space_tree()
fi
}
+_require_btrfs_no_block_group_tree()
+{
+ _scratch_mkfs > /dev/null 2>&1
+ if $BTRFS_UTIL_PROG inspect-internal dump-super $SCRATCH_DEV | \
+ grep -q "BLOCK_GROUP_TREE"
+ then
+ _notrun "This test requires no block-group-tree"
+ fi
+}
+
_check_btrfs_filesystem()
{
device=$1
diff --git a/tests/btrfs/131 b/tests/btrfs/131
index 529ee3e80f87eb..d34fc8d53801b3 100755
--- a/tests/btrfs/131
+++ b/tests/btrfs/131
@@ -20,6 +20,8 @@ _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)" ] && \
diff --git a/tests/btrfs/172 b/tests/btrfs/172
index f2997c047effb0..964251b449de20 100755
--- a/tests/btrfs/172
+++ b/tests/btrfs/172
@@ -32,6 +32,9 @@ _require_scratch
_require_log_writes
_require_xfs_io_command "sync_range"
+# block-group-tree requires no-holes
+_require_btrfs_no_block_group_tree
+
_log_writes_init $SCRATCH_DEV
_log_writes_mkfs "-O ^no-holes" >> $seqres.full 2>&1
diff --git a/tests/btrfs/206 b/tests/btrfs/206
index 6ac3d27bbde375..02a5082046f4a5 100755
--- a/tests/btrfs/206
+++ b/tests/btrfs/206
@@ -33,6 +33,9 @@ _require_log_writes
_require_xfs_io_command "falloc" "-k"
_require_xfs_io_command "fpunch"
+# block-group-tree requires no-holes
+_require_btrfs_no_block_group_tree
+
_log_writes_init $SCRATCH_DEV
_log_writes_mkfs "-O ^no-holes" >> $seqres.full 2>&1