]> git.apps.os.sepia.ceph.com Git - xfstests-dev.git/commitdiff
common/rc: Further improve gfs2 support
authorAndreas Gruenbacher <agruenba@redhat.com>
Wed, 4 Oct 2017 18:20:09 +0000 (20:20 +0200)
committerEryu Guan <eguan@redhat.com>
Mon, 9 Oct 2017 07:30:46 +0000 (15:30 +0800)
Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
common/rc

index 53bbb1187f8104c4a99922c8e381c8db73830164..95d4306eb611339e5ece117d19d2117fb4ff2613 100644 (file)
--- a/common/rc
+++ b/common/rc
@@ -1056,7 +1056,19 @@ _scratch_mkfs_sized()
        ${MKFS_PROG}.$FSTYP -F $MKFS_OPTIONS -b $blocksize $SCRATCH_DEV $blocks
        ;;
     gfs2)
-       yes | ${MKFS_PROG}.$FSTYP $MKFS_OPTIONS -b $blocksize $SCRATCH_DEV $blocks
+       # mkfs.gfs2 doesn't automatically shrink journal files on small
+       # filesystems, so the journal files may end up being bigger than the
+       # filesystem, which will cause mkfs.gfs2 to fail.  Until that's fixed,
+       # shrink the journal size to at most one eigth of the filesystem and at
+       # least 8 MiB, the minimum size allowed.
+       MIN_JOURNAL_SIZE=8
+       DEFAULT_JOURNAL_SIZE=128
+       if (( fssize/8 / (1024*1024) < DEFAULT_JOURNAL_SIZE )); then
+           (( JOURNAL_SIZE = fssize/8 / (1024*1024) ))
+           (( JOURNAL_SIZE >= MIN_JOURNAL_SIZE )) || JOURNAL_SIZE=$MIN_JOURNAL_SIZE
+           MKFS_OPTIONS="-J $JOURNAL_SIZE $MKFS_OPTIONS"
+       fi
+       ${MKFS_PROG}.$FSTYP $MKFS_OPTIONS -O -b $blocksize $SCRATCH_DEV $blocks
        ;;
     ocfs2)
        yes | ${MKFS_PROG}.$FSTYP -F $MKFS_OPTIONS -b $blocksize $SCRATCH_DEV $blocks
@@ -1143,7 +1155,7 @@ _scratch_mkfs_blocksized()
        ${MKFS_PROG}.$FSTYP -F $MKFS_OPTIONS -b $blocksize $SCRATCH_DEV
        ;;
     gfs2)
-       yes | ${MKFS_PROG}.$FSTYP $MKFS_OPTIONS -b $blocksize $SCRATCH_DEV
+       ${MKFS_PROG}.$FSTYP $MKFS_OPTIONS -O -b $blocksize $SCRATCH_DEV
        ;;
     ocfs2)
        yes | ${MKFS_PROG}.$FSTYP -F $MKFS_OPTIONS -b $blocksize -C $blocksize $SCRATCH_DEV