Report errors for missing files and check for correct file sizes
authorLachlan McIlroy <lachlan@sgi.com>
Thu, 30 Aug 2007 16:09:49 +0000 (16:09 +0000)
committerLachlan McIlroy <lachlan@sgi.com>
Thu, 30 Aug 2007 16:09:49 +0000 (16:09 +0000)
Merge of master-melb:xfs-cmds:29557a by kenmcd.

  Report errors for missing files and check for correct file sizes

179
180

diff --git a/179 b/179
index b0bd1816686802d4f38b7e8227fdee7e70efd5fa..3a285ece1876d137942443d07d7c4260c67c4174 100644 (file)
--- a/179
+++ b/179
@@ -44,11 +44,11 @@ _check_files()
        while [ $i -lt 1000 ]
        do
                file=$SCRATCH_MNT/$i
-               # if file does not exist, the create was not logged, skip it
+               # if file is missing then fsync failed
                if [ -e $file ]
                then
-                       # if file size is zero then fsync failed
-                       if [ -s $file ]
+                       # if file size is not 32k then fsync failed
+                       if [ `stat -c %s $file` -eq 32768 ]
                        then
                                # if file has non-zero size but no extents then it's contents will be NULLs, bad.
                                if xfs_bmap $file | grep 'no extents' > /dev/null
@@ -58,8 +58,10 @@ _check_files()
                                        rm -f $file
                                fi
                        else
-                               echo file $file has zero size - sync failed
+                               echo file $file has incorrect size - fsync failed
                        fi
+               else
+                       echo file $file missing - fsync failed
                fi
                i=`expr $i + 1`
        done
diff --git a/180 b/180
index c95962ef1d7da710c9970665e3ba3a07e591ffec..e81d42fd41709e08c6993d5c51bf1c52cd4fb31f 100644 (file)
--- a/180
+++ b/180
@@ -1,5 +1,5 @@
 #! /bin/sh
-# FSQA Test No. 179
+# FSQA Test No. 180
 #
 # Test for NULL files problem
 # test inode size is on disk after sync
@@ -44,11 +44,11 @@ _check_files()
        while [ $i -lt 1000 ]
        do
                file=$SCRATCH_MNT/$i
-               # if file does not exist, the create was not logged, skip it
+               # if file is missing then sync failed
                if [ -e $file ]
                then
-                       # if file size is zero then fsync failed
-                       if [ -s $file ]
+                       # if file size is not 32k then sync failed
+                       if [ `stat -c %s $file` -eq 32768 ]
                        then
                                # if file has non-zero size but no extents then it's contents will be NULLs, bad.
                                if xfs_bmap $file | grep 'no extents' > /dev/null
@@ -58,8 +58,10 @@ _check_files()
                                        rm -f $file
                                fi
                        else
-                               echo file $file has zero size - sync failed
+                               echo file $file has incorrect size - sync failed
                        fi
+               else
+                       echo file $file missing - sync failed
                fi
                i=`expr $i + 1`
        done