common: mkfs.btrfs now requires --mixed for small filesystems
authorZhao Lei <zhaolei@cn.fujitsu.com>
Mon, 21 Dec 2015 06:10:32 +0000 (17:10 +1100)
committerDave Chinner <david@fromorbit.com>
Mon, 21 Dec 2015 06:10:32 +0000 (17:10 +1100)
generic/077 fails on btrfs progs v4.3:
 # ./check generic/077
 FSTYP         -- btrfs
 PLATFORM      -- Linux/x86_64 lenovo 4.4.0-rc2_HEAD_1ec218373b8ebda821aec00bb156a9c94fad9cd4_
 MKFS_OPTIONS  -- /dev/sdb6
 MOUNT_OPTIONS -- /dev/sdb6 /var/ltf/tester/scratch_mnt

 generic/077 344s ... [failed, exit status 1] - output mismatch (see /var/lib/xfstests/results//generic/077.out.bad)
     --- tests/generic/077.out   2015-11-23 17:06:27.144983112 +0800
     +++ /var/lib/xfstests/results//generic/077.out.bad  2015-11-23 17:41:25.187062895 +0800
     @@ -1,7 +1,5 @@
      QA output created by 077
      *** create filesystem
     -*** set default ACL
     -*** populate filesystem, pass #1
     -*** populate filesystem, pass #2
     -*** all done
     +mkfs failed
     +(see /var/lib/xfstests/results//generic/077.full for details)
      *** unmount
 Ran: generic/077
 Failures: generic/077
 Failed 1 of 1 tests

Reason:
 btrfs progs v4.3 use non-mixed blockgroup for small volume as default,
 it need at least 100M to build a filesystem.

Fix:
 Force mixed mode for small-size fs, to make mkfs success.

Suggested-by: Dave Chinner <david@fromorbit.com>
Signed-off-by: Zhao Lei <zhaolei@cn.fujitsu.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
common/rc

index 5b78b7b8a0abb3c140e56e2764ed7b44dff8e680..d901aaa1b75cf982f40dc5cd01a0568325e3f673 100644 (file)
--- a/common/rc
+++ b/common/rc
@@ -732,7 +732,9 @@ _scratch_mkfs_sized()
        $MKFS_UDF_PROG $MKFS_OPTIONS -b $blocksize $SCRATCH_DEV $blocks
        ;;
     btrfs)
-       $MKFS_BTRFS_PROG $MKFS_OPTIONS -b $fssize $SCRATCH_DEV
+       local mixed_opt=
+       (( fssize <= 100 * 1024 * 1024 )) && mixed_opt='--mixed'
+       $MKFS_BTRFS_PROG $MKFS_OPTIONS $mixed_opt -b $fssize $SCRATCH_DEV
        ;;
     reiser4)
        # mkfs.resier4 requires size in KB as input for creating filesystem