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:
Darrick J. Wong
2017-10-27 13:21:46 -07:00
committed by Eryu Guan
parent 4b69106b60
commit 5cd65cb761
5 changed files with 42 additions and 31 deletions
+3 -3
View File
@@ -88,9 +88,9 @@ Preparing system for tests:
run xfs_repair -n to check the filesystem; xfs_repair to rebuild
metadata indexes; and xfs_repair -n (a third time) to check the
results of the rebuilding.
- set TEST_XFS_SCRUB=1 to have _check_xfs_filesystem run
xfs_scrub -vd to scrub the filesystem metadata online before
unmounting to run the offline check.
- xfs_scrub, if present, will always check the test and scratch
filesystems if they are still online at the end of the test.
It is no longer necessary to set TEST_XFS_SCRUB.
- setenv LOGWRITES_DEV to a block device to use for power fail
testing.