[PATCH 11/33] tests/ext*: refactor open-coded _scratch_mkfs_sized calls

Darrick J. Wong
2025-10-29T01:23:18Z

Refactor these open-coded calls so that we can use the standard
formatting helper functions and thereby get the correct fs feature set.

Signed-off-by: "Darrick J. Wong" <djwong@kernel.org>
---
tests/ext4/003 | 3 +--
tests/ext4/035 | 2 +-
tests/ext4/306 | 2 +-
3 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/tests/ext4/003 b/tests/ext4/003
index e752a769603f78..7f09c65c29af1f 100755
--- a/tests/ext4/003
+++ b/tests/ext4/003
@@ -31,8 +31,7 @@ features=bigalloc
if echo "${MOUNT_OPTIONS}" | grep -q 'test_dummy_encryption' ; then
features+=",encrypt"
fi
-$MKFS_EXT4_PROG -F -b $BLOCK_SIZE -O $features -C $(($BLOCK_SIZE * 16)) -g 256 $SCRATCH_DEV 512m \
- >> $seqres.full 2>&1
+_scratch_mkfs_sized $((512 * 1048576)) $BLOCK_SIZE -O $features -C $((BLOCK_SIZE * 16)) -g 256 >> $seqres.full 2>&1
_scratch_mount

$XFS_IO_PROG -f -c "pwrite 0 256m -b 1M" $SCRATCH_MNT/testfile 2>&1 | \
diff --git a/tests/ext4/035 b/tests/ext4/035
index fe2a74680f01d8..3f4f13817e8746 100755
--- a/tests/ext4/035
+++ b/tests/ext4/035
@@ -29,7 +29,7 @@ encrypt=
if echo "${MOUNT_OPTIONS}" | grep -q 'test_dummy_encryption' ; then
encrypt="-O encrypt"
fi
-$MKFS_EXT4_PROG -F -b 1024 -E "resize=262144" $encrypt $SCRATCH_DEV 32768 >> $seqres.full 2>&1
+_scratch_mkfs_sized $((32768 * 1024)) 1024 -E "resize=262144" $encrypt >> $seqres.full 2>&1
if [ $? -ne 0 ]; then
_notrun "Can't make file system with a block size of 1024"
fi
diff --git a/tests/ext4/306 b/tests/ext4/306
index b0e08f65ea243d..5717ec1606cc59 100755
--- a/tests/ext4/306
+++ b/tests/ext4/306
@@ -39,7 +39,7 @@ fi

blksz=$(_get_page_size)

-$MKFS_EXT4_PROG -F -b $blksz -O "$features" $SCRATCH_DEV 512m >> $seqres.full 2>&1
+_scratch_mkfs_sized $((512 * 1048576)) $blksz -O "$features" >> $seqres.full 2>&1
_scratch_mount

# Create a small non-extent-based file