@@ -241,6 +241,10 @@ Misc:
this option is supported for all filesystems currently only -overlay is
expected to run without issues. For other filesystems additional patches
and fixes to the test suite might be needed.
+ - If MKFS_OPTIONS contains block size, the value must be an integer number of
+ bytes without units. And the variable FS_BLOCK_SIZE will be created.
+ For example, set MKFS_OPTIONS="-b 4096" but not "-b 4k", then
+ FS_BLOCK_SIZE=4096.
______________________
USING THE FSQA SUITE
@@ -623,6 +623,34 @@ _check_device()
esac
}
+# Check block size in $MKFS_OPTIONS is a valid integer
+# And then set the value in $FS_BLOCK_SIZE
+_check_mkfs_block_options()
+{
+ # Avoid that FS_BLOCK_SIZE is different from MKFS_OPTIONS
+ # Otherwise it will cause confusion
+ unset FS_BLOCK_SIZE
+
+ case $FSTYP in
+ xfs)
+ FS_BLOCK_SIZE=`echo $MKFS_OPTIONS | sed -rn 's/.*-b ?size= ?+([0-9]+[a-zA-Z]?).*/\1/p'`
+ ;;
+ btrfs)
+ FS_BLOCK_SIZE=`echo $MKFS_OPTIONS | sed -rn 's/.*-s ?+([0-9]+[a-zA-Z]?).*/\1/p'`
+ ;;
+ ext2|ext3|ext4|ext4dev|udf|reiser4|ocfs2|reiserfs)
+ FS_BLOCK_SIZE=`echo $MKFS_OPTIONS | sed -rn 's/.*-b ?+([0-9]+[a-zA-Z]?).*/\1/p'`
+ ;;
+ jfs)
+ FS_BLOCK_SIZE=4096
+ ;;
+ esac
+
+ if [ -n "$FS_BLOCK_SIZE" ] && ! [[ $FS_BLOCK_SIZE =~ ^[0-9]+$ ]] ; then
+ _fatal "\$MKFS_OPTIONS: block size \"$FS_BLOCK_SIZE\" not an integer."
+ fi
+}
+
# check and return a canonical mount point path
_canonicalize_mountpoint()
{
@@ -896,5 +924,7 @@ else
fi
fi
+_check_mkfs_block_options
+
# make sure this script returns success
/bin/true
Add a helper to check MKFS_OPTIONS to use pure integer in bytes, and create variable FS_BLOCK_SIZE=blocksize. For example, set MKFS_OPTIONS="-b 4096" but not "-b 4k", then FS_BLOCK_SIZE=4096. Signed-off-by: An Long <lan@suse.com> --- README | 4 ++++ common/config | 30 ++++++++++++++++++++++++++++++ 2 files changed, 34 insertions(+)