common/xfs: refactor agcount calculation for mounted filesystems

Create a helper function to return the number of AGs of a mounted
filesystem so that we can get rid of the open-coded versions in various
tests.  The new helper will be used in a subsequent patch.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Brian Foster <bfoster@redhat.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
This commit is contained in:
Darrick J. Wong
2019-07-31 18:43:04 -07:00
committed by Eryu Guan
parent a5a31b7913
commit 0c92d38b7b
12 changed files with 17 additions and 11 deletions
+1 -1
View File
@@ -43,7 +43,7 @@ _scratch_mkfs_xfs > /dev/null
echo "+ mount fs image"
_scratch_mount
blksz="$(stat -f -c '%s' "${SCRATCH_MNT}")"
agcount="$($XFS_INFO_PROG "${SCRATCH_MNT}" | grep agcount= | sed -e 's/^.*agcount=\([0-9]*\),.*$/\1/g')"
agcount="$(_xfs_mount_agcount $SCRATCH_MNT)"
echo "+ make some files"
_pwrite_byte 0x62 0 $((blksz * 64)) "${SCRATCH_MNT}/file0" >> "$seqres.full"