lsunit isn't always set when running _log_sunit, so give it a default value.
[xfstests-dev.git] / 016
diff --git a/016 b/016
index 50d3752a2c25db07b24c2458a110d5efd97191ce..49546041e0c1aadffe8282ca9a616fd8943917e9 100755 (executable)
--- a/016
+++ b/016
@@ -5,7 +5,7 @@
 # test end of log overwrite bug #796141
 #
 #-----------------------------------------------------------------------
-# Copyright (c) 2000-2002 Silicon Graphics, Inc.  All Rights Reserved.
+# Copyright (c) 2000-2003 Silicon Graphics, Inc.  All Rights Reserved.
 # 
 # This program is free software; you can redistribute it and/or modify it
 # under the terms of version 2 of the GNU General Public License as
@@ -78,15 +78,10 @@ _init()
     echo "*** reset partition"
     $here/src/devzero -b 2048 -n 50 -v 198 $SCRATCH_DEV
     echo "*** mkfs"
-    lsize=2097152
-    dsize=50m
-    echo mkfs_xfs -dsize=$dsize -lsize=$lsize $SCRATCH_DEV >>$seq.full
-    if ! mkfs_xfs -dsize=$dsize -lsize=$lsize $SCRATCH_DEV >>$seq.full 2>&1
-    then
-        echo "failed to mkfs $SCRATCH_DEV" >>$seq.full
-        _notrun "mkfs cannot create scratch fs, probably too small log"
-        exit 1
-    fi
+    force_opts="-dsize=50m -lsize=2097152"
+    echo mkfs_xfs $force_opts $SCRATCH_DEV >>$seq.full
+    mkfs_xfs $force_opts $SCRATCH_DEV | _filter_mkfs >/dev/null 2>$tmp.mkfs
+    source $tmp.mkfs
 }
 
 _log_traffic()
@@ -139,6 +134,18 @@ _log_head()
     '
 }
 
+# Get log stripe unit for v2 logs; if none specified,
+# (or v1 log) just return "1" block
+
+_log_sunit()
+{
+    if [ ${lsunit:-0} -eq 0 ]; then
+        echo $dbsize
+    else
+        expr $lsunit \* $dbsize
+    fi
+}    
+
 _after_log()
 {
     xfs_db -r $1 -c "sb" -c "print" | $AWK_PROG '
@@ -179,11 +186,13 @@ size=`_log_size`
 echo "log size = $size BB"                      >>$seq.full
 head=`_log_head`
 echo "log position = $head"                     >>$seq.full
+lsunit=`_log_sunit`
+echo "log sunit = $lsunit"                     >>$seq.full
 
 [ $size -eq 4096 ] || \
     _fail "!!! unexpected log size $size"
-[ $head -eq 2 ] || \
-    _fail "!!! unexpected initial log position $head"
+[ $head -eq 2 -o $head -eq $((lsunit/512)) ] || \
+    _fail "!!! unexpected initial log position $head vs. $((lsunit/512))"
 
 echo "    lots of traffic"                      >>$seq.full
 _log_traffic 850