common/xfs: extract minimum log size message from mkfs correctly
authorDarrick J. Wong <darrick.wong@oracle.com>
Tue, 15 Sep 2020 01:44:24 +0000 (18:44 -0700)
committerEryu Guan <guaneryu@gmail.com>
Sun, 20 Sep 2020 16:59:42 +0000 (00:59 +0800)
Modify the command that searches for the minimum log size message from
mkfs to handle external log devices correctly.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Zorro Lang <zlang@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
common/xfs

index f4a47df..6520ad2 100644 (file)
@@ -103,7 +103,7 @@ _scratch_find_xfs_min_logblocks()
        # try again without MKFS_OPTIONS because that's what _scratch_do_mkfs
        # will do if we pass in the log size option.
        if [ $mkfs_status -ne 0 ] &&
-          ! grep -q 'log size.*too small, minimum' $tmp.mkfserr; then
+          ! egrep -q '(log size.*too small, minimum|external log device.*too small, must be)' $tmp.mkfserr; then
                eval "$mkfs_cmd $extra_mkfs_options $SCRATCH_DEV" \
                        2>$tmp.mkfserr 1>$tmp.mkfsstd
                mkfs_status=$?
@@ -126,6 +126,12 @@ _scratch_find_xfs_min_logblocks()
                rm -f $tmp.mkfsstd $tmp.mkfserr
                return
        fi
+       if grep -q 'external log device.*too small, must be' $tmp.mkfserr; then
+               grep 'external log device.*too small, must be' $tmp.mkfserr | \
+                       sed -e 's/^.*must be at least \([0-9]*\) blocks/\1/g'
+               rm -f $tmp.mkfsstd $tmp.mkfserr
+               return
+       fi
 
        # Don't know what to do, so fail
        echo "Cannot determine minimum log size" >&2