]> git.apps.os.sepia.ceph.com Git - xfstests-dev.git/commitdiff
xfs: be compatible with older mkfs.xfs which has no v5 support
authorEryu Guan <eguan@redhat.com>
Tue, 26 May 2015 02:51:57 +0000 (12:51 +1000)
committerDave Chinner <david@fromorbit.com>
Tue, 26 May 2015 02:51:57 +0000 (12:51 +1000)
With the change to CRCs by default, some tests are updated to call mkfs
with "-m crc=0" option directly, and this breaks testings on older
distros where mkfs.xfs doesn't have crc support.

Introduce a new variable to tell if mkfs.xfs supports v5 xfs and do
tweaks in _scratch_mkfs_xfs_opts() based on it.

Signed-off-by: Eryu Guan <eguan@redhat.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
common/config
common/rc
tests/xfs/073

index 37322874c9015b730042535c36b566bc6da1d67b..8e21c2865f844760ba69e79952be4194ad265cb6 100644 (file)
@@ -239,6 +239,17 @@ if [ -x /usr/sbin/selinuxenabled ] && /usr/sbin/selinuxenabled; then
        export SELINUX_MOUNT_OPTIONS
 fi
 
+# check if mkfs.xfs supports v5 xfs
+XFS_MKFS_HAS_NO_META_SUPPORT=""
+touch /tmp/crc_check.img
+$MKFS_XFS_PROG -N -d file,name=/tmp/crc_check.img,size=32m -m crc=0 \
+       >/dev/null 2>&1;
+if [ $? -ne 0 ]; then
+       XFS_MKFS_HAS_NO_META_SUPPORT=true
+fi
+rm -f /tmp/crc_check.img
+export XFS_MKFS_HAS_NO_META_SUPPORT
+
 _mount_opts()
 {
        case $FSTYP in
index c3f609025dba67690bbd6af6de8b2035147889e5..900b6e557e45cc3231dbed43e289304d3d36e447 100644 (file)
--- a/common/rc
+++ b/common/rc
@@ -308,6 +308,11 @@ _scratch_mkfs_xfs_opts()
 {
        mkfs_opts=$*
 
+       # remove crc related mkfs options if mkfs.xfs doesn't support v5 xfs
+       if [ -n "$XFS_MKFS_HAS_NO_META_SUPPORT" ]; then
+               mkfs_opts=`echo $mkfs_opts | sed "s/-m\s\+crc=.//"`
+       fi
+
        _scratch_options mkfs
 
        $MKFS_XFS_PROG $SCRATCH_OPTIONS $mkfs_opts $SCRATCH_DEV
index 45a3fdf6acadf05b293be0faf496cd15ead07de4..32faffdfaf0626e934f7a5cb3215c051678c5b77 100755 (executable)
@@ -156,7 +156,12 @@ _verify_copy $imgs.image $SCRATCH_DEV $SCRATCH_MNT
 
 echo 
 echo === copying scratch device to single target, large ro device
-${MKFS_XFS_PROG} -m crc=0 -dfile,name=$imgs.source,size=100g | _filter_mkfs 2>/dev/null
+mkfs_crc_opts="-m crc=0"
+if [ -n "$XFS_MKFS_HAS_NO_META_SUPPORT" ]; then
+       mkfs_crc_opts=""
+fi
+${MKFS_XFS_PROG} $mkfs_crc_opts -dfile,name=$imgs.source,size=100g \
+       | _filter_mkfs 2>/dev/null
 rmdir $imgs.source_dir 2>/dev/null
 mkdir $imgs.source_dir