common/xfs: refactor agcount calculation for mounted filesystems
[xfstests-dev.git] / tests / xfs / 093
index 2b16020c3a91653681aaf4f4e4ffa390fae4ad16..4c4fbdc422df5baf3367c585b3a97f5b5630a4b1 100755 (executable)
@@ -64,7 +64,7 @@ for x in `seq 2 64`; do
        touch "${TESTFILE}.${x}"
 done
 inode="$(stat -c '%i' "${TESTFILE}.1")"
-agcount="$($XFS_INFO_PROG "${SCRATCH_MNT}" | grep agcount= | sed -e 's/^.*agcount=\([0-9]*\),.*$/\1/g')"
+agcount="$(_xfs_mount_agcount $SCRATCH_MNT)"
 umount "${SCRATCH_MNT}"
 
 echo "+ check fs"
@@ -97,6 +97,9 @@ $CHATTR_PROG -R -f -i "${SCRATCH_MNT}/"
 
 echo "+ modify files (2)"
 broken=0
+# Make sure that we still have the scratch directory after repairing our
+# corrupted filesystem, because repair could have nuked it.
+mkdir -p "${TESTDIR}"
 for x in `seq 65 70`; do
        touch "${TESTFILE}.${x}" || broken=1
 done