xfs: refactor calls to xfs_admin
authorDarrick J. Wong <darrick.wong@oracle.com>
Wed, 4 Mar 2020 02:46:40 +0000 (18:46 -0800)
committerEryu Guan <guaneryu@gmail.com>
Sun, 8 Mar 2020 15:40:42 +0000 (23:40 +0800)
Create a helper to run xfs_admin on the scratch device, then
refactor all tests to use it.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Zorro Lang <zlang@redhat.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
common/config
common/xfs
tests/xfs/287

index 9a9c77602b5405a220be52a9be0babf6a9704000..1116cb9955d3f90a8309a6d34b98d55e65da6961 100644 (file)
@@ -154,6 +154,7 @@ MKSWAP_PROG="$MKSWAP_PROG -f"
 export XFS_LOGPRINT_PROG="$(type -P xfs_logprint)"
 export XFS_REPAIR_PROG="$(type -P xfs_repair)"
 export XFS_DB_PROG="$(type -P xfs_db)"
 export XFS_LOGPRINT_PROG="$(type -P xfs_logprint)"
 export XFS_REPAIR_PROG="$(type -P xfs_repair)"
 export XFS_DB_PROG="$(type -P xfs_db)"
+export XFS_ADMIN_PROG="$(type -P xfs_admin)"
 export XFS_GROWFS_PROG=$(type -P xfs_growfs)
 export XFS_SPACEMAN_PROG="$(type -P xfs_spaceman)"
 export XFS_SCRUB_PROG="$(type -P xfs_scrub)"
 export XFS_GROWFS_PROG=$(type -P xfs_growfs)
 export XFS_SPACEMAN_PROG="$(type -P xfs_spaceman)"
 export XFS_SCRUB_PROG="$(type -P xfs_scrub)"
index 706ddf8511d0d19691e0d02009ec2ac473cad03c..d9a9784f2fb9557a5747db88d3817a4a5947eae3 100644 (file)
@@ -218,6 +218,14 @@ _scratch_xfs_db()
        $XFS_DB_PROG "$@" $(_scratch_xfs_db_options)
 }
 
        $XFS_DB_PROG "$@" $(_scratch_xfs_db_options)
 }
 
+_scratch_xfs_admin()
+{
+       local options=("$SCRATCH_DEV")
+       [ "$USE_EXTERNAL" = yes -a ! -z "$SCRATCH_LOGDEV" ] && \
+               options+=("$SCRATCH_LOGDEV")
+       $XFS_ADMIN_PROG "$@" "${options[@]}"
+}
+
 _scratch_xfs_logprint()
 {
        SCRATCH_OPTIONS=""
 _scratch_xfs_logprint()
 {
        SCRATCH_OPTIONS=""
index 8dc754a5842d2cb09ba6a3b942a8d9fbf93cdd0d..f77ed2f1ee63b51e4c1b11a238067581461192a8 100755 (executable)
@@ -70,7 +70,7 @@ $XFS_IO_PROG -r -c "lsproj" $dir/32bit
 _scratch_unmount
 
 # Now, enable projid32bit support by xfs_admin
 _scratch_unmount
 
 # Now, enable projid32bit support by xfs_admin
-xfs_admin -p $SCRATCH_DEV >> $seqres.full 2>&1 || _fail "xfs_admin failed"
+_scratch_xfs_admin -p >> $seqres.full 2>&1 || _fail "xfs_admin failed"
 
 # Now mount the fs, 32bit project quotas shall be supported, now
 _qmount_option "pquota"
 
 # Now mount the fs, 32bit project quotas shall be supported, now
 _qmount_option "pquota"