mirror of
https://github.com/linux-apfs/apfstests.git
synced 2026-05-01 15:01:44 -07:00
common/xfs: refactor xfs_scrub presence testing
Move all the requirements checking for xfs_scrub into a helper function. Make sure the helper properly detects the presence of the scrub ioctl and situations where we can't run scrub (e.g. norecovery). Refactor the existing three xfs_scrub call sites to use the helper to check if it's appropriate to run scrub. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> Reviewed-by: Eryu Guan <eguan@redhat.com> Signed-off-by: Eryu Guan <eguan@redhat.com>
This commit is contained in:
committed by
Eryu Guan
parent
4b69106b60
commit
5cd65cb761
+2
-10
@@ -136,10 +136,8 @@ echo "Test XFS online scrub, if applicable"
|
||||
|
||||
# Only run this on xfs if xfs_scrub is available and has the unicode checker
|
||||
check_xfs_scrub() {
|
||||
# Ignore non-XFS fs or no scrub program...
|
||||
if [ "${FSTYP}" != "xfs" ] || [ ! -x "${XFS_SCRUB_PROG}" ]; then
|
||||
return 1
|
||||
fi
|
||||
[ "$FSTYP" == "xfs" ] || return 1
|
||||
_supports_xfs_scrub "$SCRATCH_MNT" "$SCRATCH_DEV" || return 1
|
||||
|
||||
# We only care if xfs_scrub has unicode string support...
|
||||
if ! type ldd > /dev/null 2>&1 || \
|
||||
@@ -147,12 +145,6 @@ check_xfs_scrub() {
|
||||
return 1
|
||||
fi
|
||||
|
||||
# Does the ioctl work?
|
||||
if $XFS_IO_PROG -x -c "scrub probe 0" $SCRATCH_MNT 2>&1 | \
|
||||
grep -q "Inappropriate ioctl"; then
|
||||
return 1
|
||||
fi
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user