mirror of
https://github.com/linux-apfs/apfstests.git
synced 2026-05-01 15:01:44 -07:00
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:
committed by
Eryu Guan
parent
a5a31b7913
commit
0c92d38b7b
@@ -878,3 +878,9 @@ _force_xfsv4_mount_options()
|
|||||||
fi
|
fi
|
||||||
echo "MOUNT_OPTIONS = $MOUNT_OPTIONS" >>$seqres.full
|
echo "MOUNT_OPTIONS = $MOUNT_OPTIONS" >>$seqres.full
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Find AG count of mounted filesystem
|
||||||
|
_xfs_mount_agcount()
|
||||||
|
{
|
||||||
|
$XFS_INFO_PROG "$1" | grep agcount= | sed -e 's/^.*agcount=\([0-9]*\),.*$/\1/g'
|
||||||
|
}
|
||||||
|
|||||||
+1
-1
@@ -63,7 +63,7 @@ for x in `seq 2 64`; do
|
|||||||
touch "${TESTFILE}.${x}"
|
touch "${TESTFILE}.${x}"
|
||||||
done
|
done
|
||||||
inode="$(stat -c '%i' "${TESTFILE}.1")"
|
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}"
|
umount "${SCRATCH_MNT}"
|
||||||
|
|
||||||
echo "+ check fs"
|
echo "+ check fs"
|
||||||
|
|||||||
+1
-1
@@ -64,7 +64,7 @@ for x in `seq 2 64`; do
|
|||||||
touch "${TESTFILE}.${x}"
|
touch "${TESTFILE}.${x}"
|
||||||
done
|
done
|
||||||
inode="$(stat -c '%i' "${TESTFILE}.1")"
|
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)"
|
||||||
test "${agcount}" -gt 1 || _notrun "Single-AG XFS not supported"
|
test "${agcount}" -gt 1 || _notrun "Single-AG XFS not supported"
|
||||||
umount "${SCRATCH_MNT}"
|
umount "${SCRATCH_MNT}"
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -64,7 +64,7 @@ for x in `seq 2 64`; do
|
|||||||
touch "${TESTFILE}.${x}"
|
touch "${TESTFILE}.${x}"
|
||||||
done
|
done
|
||||||
inode="$(stat -c '%i' "${TESTFILE}.1")"
|
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}"
|
umount "${SCRATCH_MNT}"
|
||||||
|
|
||||||
echo "+ check fs"
|
echo "+ check fs"
|
||||||
|
|||||||
+1
-1
@@ -64,7 +64,7 @@ for x in `seq 2 64`; do
|
|||||||
touch "${TESTFILE}.${x}"
|
touch "${TESTFILE}.${x}"
|
||||||
done
|
done
|
||||||
inode="$(stat -c '%i' "${TESTFILE}.1")"
|
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}"
|
umount "${SCRATCH_MNT}"
|
||||||
|
|
||||||
echo "+ check fs"
|
echo "+ check fs"
|
||||||
|
|||||||
+1
-1
@@ -64,7 +64,7 @@ for x in `seq 2 64`; do
|
|||||||
touch "${TESTFILE}.${x}"
|
touch "${TESTFILE}.${x}"
|
||||||
done
|
done
|
||||||
inode="$(stat -c '%i' "${TESTFILE}.1")"
|
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}"
|
umount "${SCRATCH_MNT}"
|
||||||
|
|
||||||
echo "+ check fs"
|
echo "+ check fs"
|
||||||
|
|||||||
+1
-1
@@ -64,7 +64,7 @@ for x in `seq 2 64`; do
|
|||||||
touch "${TESTFILE}.${x}"
|
touch "${TESTFILE}.${x}"
|
||||||
done
|
done
|
||||||
inode="$(stat -c '%i' "${TESTFILE}.1")"
|
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}"
|
umount "${SCRATCH_MNT}"
|
||||||
|
|
||||||
echo "+ check fs"
|
echo "+ check fs"
|
||||||
|
|||||||
+1
-1
@@ -64,7 +64,7 @@ for x in `seq 2 64`; do
|
|||||||
touch "${TESTFILE}.${x}"
|
touch "${TESTFILE}.${x}"
|
||||||
done
|
done
|
||||||
inode="$(stat -c '%i' "${TESTFILE}.1")"
|
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}"
|
umount "${SCRATCH_MNT}"
|
||||||
|
|
||||||
echo "+ check fs"
|
echo "+ check fs"
|
||||||
|
|||||||
+1
-1
@@ -67,7 +67,7 @@ for x in `seq 2 64`; do
|
|||||||
touch "${TESTFILE}.${x}"
|
touch "${TESTFILE}.${x}"
|
||||||
done
|
done
|
||||||
inode="$(stat -c '%i' "${TESTFILE}.1")"
|
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}"
|
umount "${SCRATCH_MNT}"
|
||||||
|
|
||||||
echo "+ check fs"
|
echo "+ check fs"
|
||||||
|
|||||||
+1
-1
@@ -43,7 +43,7 @@ _scratch_mkfs_xfs > /dev/null
|
|||||||
echo "+ mount fs image"
|
echo "+ mount fs image"
|
||||||
_scratch_mount
|
_scratch_mount
|
||||||
blksz="$(stat -f -c '%s' "${SCRATCH_MNT}")"
|
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"
|
echo "+ make some files"
|
||||||
_pwrite_byte 0x62 0 $((blksz * 64)) "${SCRATCH_MNT}/file0" >> "$seqres.full"
|
_pwrite_byte 0x62 0 $((blksz * 64)) "${SCRATCH_MNT}/file0" >> "$seqres.full"
|
||||||
|
|||||||
+1
-1
@@ -41,7 +41,7 @@ _scratch_mkfs_xfs > /dev/null
|
|||||||
echo "+ mount fs image"
|
echo "+ mount fs image"
|
||||||
_scratch_mount
|
_scratch_mount
|
||||||
blksz=$(stat -f -c '%s' ${SCRATCH_MNT})
|
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"
|
echo "+ make some files"
|
||||||
_pwrite_byte 0x62 0 $((blksz * 64)) ${SCRATCH_MNT}/file0 >> $seqres.full
|
_pwrite_byte 0x62 0 $((blksz * 64)) ${SCRATCH_MNT}/file0 >> $seqres.full
|
||||||
|
|||||||
+1
-1
@@ -37,7 +37,7 @@ echo "Format and mount"
|
|||||||
_scratch_mkfs > "$seqres.full" 2>&1
|
_scratch_mkfs > "$seqres.full" 2>&1
|
||||||
_scratch_mount
|
_scratch_mount
|
||||||
|
|
||||||
agcount=$($XFS_INFO_PROG $SCRATCH_MNT | grep agcount= | sed -e 's/^.*agcount=\([0-9]*\),.*$/\1/g')
|
agcount=$(_xfs_mount_agcount $SCRATCH_MNT)
|
||||||
|
|
||||||
echo "Get fsmap" | tee -a $seqres.full
|
echo "Get fsmap" | tee -a $seqres.full
|
||||||
$XFS_IO_PROG -c 'fsmap -v' $SCRATCH_MNT > $TEST_DIR/fsmap
|
$XFS_IO_PROG -c 'fsmap -v' $SCRATCH_MNT > $TEST_DIR/fsmap
|
||||||
|
|||||||
Reference in New Issue
Block a user