common/xfs: refactor agcount calculation for mounted filesystems
[xfstests-dev.git] / tests / xfs / 087
index 625ed355af9c6ada437ca643327dcfa9c8a77887..b3d3bca9606ff8c6c8f321023fab2733a7560df5 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"
@@ -75,17 +75,16 @@ for ag in $(seq 1 $((agcount - 1))) 0; do
        _scratch_xfs_db -x -c "agi ${ag}" -c "agi ${ag}" -c "stack" -c "blocktrash -x 32 -o +64 -y 4096 -z ${FUZZ_ARGS}" >> $seqres.full 2>&1
 done
 
-echo "+ mount image"
+echo "+ mount image && modify files"
+broken=1
 if _try_scratch_mount >> $seqres.full 2>&1; then
 
-       echo "+ modify files"
-       broken=0
        for x in `seq 65 70`; do
-               touch "${TESTFILE}.${x}" 2> /dev/null || broken=1
+               touch "${TESTFILE}.${x}" 2> /dev/null && broken=0
        done
-       echo "broken: ${broken}"
        umount "${SCRATCH_MNT}"
 fi
+echo "broken: ${broken}"
 
 echo "+ repair fs"
 _scratch_xfs_repair >> $seqres.full 2>&1