Make sure we take into account newly reserved blocks as introduced
authorDave Chinner <dgc@sgi.com>
Thu, 28 Jun 2007 15:57:56 +0000 (15:57 +0000)
committerDave Chinner <dgc@sgi.com>
Thu, 28 Jun 2007 15:57:56 +0000 (15:57 +0000)
in 964468.
Merge of master-melb:xfs-cmds:29013a by kenmcd.

004

diff --git a/004 b/004
index bba61751550426211061583dd067e73e835ca1a4..100ba802dc30121a677ab74984be76db103a7b8b 100755 (executable)
--- a/004
+++ b/004
@@ -67,21 +67,36 @@ xfs_db -r -c "freesp -s" $SCRATCH_DEV >$tmp.xfs_db
 echo "xfs_db for $SCRATCH_DEV" >>$seq.full
 cat $tmp.xfs_db >>$seq.full
 
+eval `$XFS_IO_PROG -x -c resblks $SCRATCH_MNT 2>&1 \
+       | $AWK_PROG '/available/ { printf "resblks=%u\n", $5 }'`
+echo "resblks gave: resblks=$resblks" >>$seq.full
+
 # check the 'blocks' field from freesp command is OK
 # since 2.6.18, df does not report the 4 blocks per AG that cannot
 # be allocated, hence we check for that exact mismatch.
+# since ~2.6.22, reserved blocks are used by default and df does
+# not report them, hence check for an exact mismatch.
 perl -ne '
-           BEGIN       { $avail ='$avail' * 512;
-                         $answer="(no xfs_db free blocks line?)" }
-           /free blocks (\d+)$/        || next;
-           $freesp = $1 * '$dbsize';
-           if ($freesp == $avail)      { $answer = "yes"; }
-           else {
+       BEGIN   { $avail ='$avail' * 512;
+                 $answer="(no xfs_db free blocks line?)" }
+       /free blocks (\d+)$/    || next;
+       $freesp = $1 * '$dbsize';
+       if ($freesp == $avail) {
+               $answer = "yes";
+       } else {
                $avail = $avail + (('$agcount' + 1) * '$dbsize' * 4);
-               if ($freesp == $avail)  { $answer = "yes"; }
-               else                    { $answer = "no ($freesp != $avail)"; }
-           }
-           END { print "$answer\n" }
+               if ($freesp == $avail) {
+                       $answer = "yes";
+               } else {
+                       $avail = $avail + ('$resblks' * '$dbsize');
+                       if ($freesp == $avail) {
+                               $answer = "yes";
+                       } else {
+                               $answer = "no ($freesp != $avail)";
+                       }
+               }
+       }
+       END     { print "$answer\n" }
        ' <$tmp.xfs_db >$tmp.ans
 ans="`cat $tmp.ans`"
 echo "Checking blocks column same as df: $ans"