@@ -1899,31 +1899,23 @@ _require_scratch_ext4_crc()
_scratch_unmount
}
-# Check the specified feature whether it is available in mkfs.ext4 or not.
-_require_ext4_mkfs_feature()
+# Check whether the specified feature whether it is supported by
+# mkfs.ext4 and the kernel.
+_require_scratch_ext4_feature()
{
- local feature=$1
- local testfile=/tmp/$$.ext4_mkfs
+ local feature="$1"
+ local sz="$2"
if [ -z "$feature" ]; then
- echo "Usage: _require_ext4_mkfs_feature feature"
+ echo "Usage: _require_scratch_ext4_feature feature [size]"
exit 1
fi
- touch $testfile
- local result=$($MKFS_EXT4_PROG -F -O $feature -n $testfile 512m 2>&1)
- rm -f $testfile
- echo $result | grep -q "Invalid filesystem option" && \
- _notrun "mkfs.ext4 doesn't support $feature feature"
-}
-
-# this test requires the ext4 kernel support bigalloc feature
-#
-_require_ext4_bigalloc()
-{
- $MKFS_EXT4_PROG -F -O bigalloc $SCRATCH_DEV 512m >/dev/null 2>&1
+ $MKFS_EXT4_PROG -F $MKFS_OPTIONS -O "$feature" \
+ $SCRATCH_DEV $sz >>$seqres.full 2>&1 \
+ || _notrun "mkfs.ext4 doesn't support $feature feature"
_scratch_mount >/dev/null 2>&1 \
- || _notrun "Ext4 kernel doesn't support bigalloc feature"
+ || _notrun "Kernel doesn't support the ext4 feature: $feature"
_scratch_unmount
}
@@ -38,8 +38,7 @@ _supported_fs ext4
_supported_os Linux
_require_scratch
-_require_ext4_mkfs_feature "bigalloc"
-_require_ext4_bigalloc
+_require_scratch_ext4_feature "bigalloc" "512m"
rm -f $seqres.full
@@ -48,10 +48,9 @@ _supported_fs ext4
_supported_os Linux
_require_scratch_nocheck
_require_command "$DEBUGFS_PROG" debugfs
-_require_ext4_mkfs_feature "bigalloc,meta_bg,^resize_inode"
+_require_scratch_ext4_feature "bigalloc,meta_bg,^resize_inode"
echo "Create ext4 fs and modify first_meta_bg's value"
-_scratch_mkfs "-O bigalloc,meta_bg,^resize_inode" >> $seqres.full 2>&1
# set a big enough first_meta_bg to trigger buffer overrun
# 842150400 is from original fuzzed ext4 image in bug report
@@ -50,9 +50,8 @@ _supported_fs ext4
_supported_os Linux
_require_scratch
_require_attrs
-_require_ext4_mkfs_feature ea_inode
+_require_scratch_ext4_feature "ea_inode"
-_scratch_mkfs_ext4 -O ea_inode >/dev/null 2>&1
_scratch_mount
# Sets an extended attribute on a file.
@@ -44,12 +44,15 @@ _supported_fs ext4
_supported_os Linux
_require_scratch
-_require_ext4_mkfs_feature "64bit"
rm -f $seqres.full
# Make a small ext4 fs with extents disabled & mount it
-$MKFS_EXT4_PROG -F -O ^extents,^64bit $SCRATCH_DEV 512m >> $seqres.full 2>&1
+features="^extents"
+if grep -q 64bit /etc/mke2fs.conf ; then
+ features="^extents,^64bit"
+fi
+$MKFS_EXT4_PROG -F -O "$features" $SCRATCH_DEV 512m >> $seqres.full 2>&1
_scratch_mount || _fail "couldn't mount fs"
# Create a small non-extent-based file