From: Darrick J. Wong Date: Tue, 9 Mar 2021 04:39:17 +0000 (-0800) Subject: common: move _scratch_metadump to common/xfs X-Git-Tag: v2022.05.01~513 X-Git-Url: http://git.apps.os.sepia.ceph.com/?p=xfstests-dev.git;a=commitdiff_plain;h=45b9734b9816b93ae010f895e4ff3e7bca2b5a29 common: move _scratch_metadump to common/xfs _scratch_metadump is really an xfs-specific dump helper, so move it to common/xfs, add 'xfs' to the name, and convert all users. Signed-off-by: Darrick J. Wong --- diff --git a/common/populate b/common/populate index f4ad8669..4e5b645f 100644 --- a/common/populate +++ b/common/populate @@ -866,7 +866,7 @@ _scratch_populate_cached() { "xfs") _scratch_xfs_populate $@ _scratch_xfs_populate_check - _scratch_metadump "${POPULATE_METADUMP}" -a -o + _scratch_xfs_metadump "${POPULATE_METADUMP}" ;; "ext2"|"ext3"|"ext4") _scratch_ext4_populate $@ diff --git a/common/rc b/common/rc index 9fdbcd14..b0241b0a 100644 --- a/common/rc +++ b/common/rc @@ -489,18 +489,6 @@ _scratch_do_mkfs() return $mkfs_status } -_scratch_metadump() -{ - local dumpfile=$1 - shift - local options= - - [ "$USE_EXTERNAL" = yes -a ! -z "$SCRATCH_LOGDEV" ] && \ - options="-l $SCRATCH_LOGDEV" - - $XFS_METADUMP_PROG $options "$@" $SCRATCH_DEV $dumpfile -} - _setup_large_ext4_fs() { local fs_size=$1 diff --git a/common/xfs b/common/xfs index b30d289f..fe4dea99 100644 --- a/common/xfs +++ b/common/xfs @@ -453,6 +453,19 @@ _xfs_metadump() { return $res } +# Snapshot the metadata on the scratch device +_scratch_xfs_metadump() +{ + local metadump=$1 + shift + local logdev=none + + [ "$USE_EXTERNAL" = yes -a ! -z "$SCRATCH_LOGDEV" ] && \ + logdev=$SCRATCH_LOGDEV + + _xfs_metadump "$metadump" "$SCRATCH_DEV" "$logdev" nocompress "$@" +} + # run xfs_check and friends on a FS. _check_xfs_filesystem() { diff --git a/tests/xfs/129 b/tests/xfs/129 index 78baf5c4..513d2fdd 100755 --- a/tests/xfs/129 +++ b/tests/xfs/129 @@ -56,7 +56,7 @@ done echo "Create metadump file" _scratch_unmount -_scratch_metadump $metadump_file +_scratch_xfs_metadump $metadump_file # Now restore the obfuscated one back and take a look around echo "Restore metadump" diff --git a/tests/xfs/234 b/tests/xfs/234 index 14172c3d..a3a57f2d 100755 --- a/tests/xfs/234 +++ b/tests/xfs/234 @@ -56,7 +56,7 @@ done echo "Create metadump file" _scratch_unmount -_scratch_metadump $metadump_file +_scratch_xfs_metadump $metadump_file # Now restore the obfuscated one back and take a look around echo "Restore metadump" diff --git a/tests/xfs/253 b/tests/xfs/253 index 9d967a50..fb7fc80b 100755 --- a/tests/xfs/253 +++ b/tests/xfs/253 @@ -156,7 +156,7 @@ ls -R | od -c >> $seqres.full cd $here _scratch_unmount -_scratch_metadump $METADUMP_FILE +_scratch_xfs_metadump $METADUMP_FILE # Now restore the obfuscated one back and take a look around xfs_mdrestore "${METADUMP_FILE}" "${SCRATCH_DEV}" diff --git a/tests/xfs/284 b/tests/xfs/284 index dbfd752b..cc9d723a 100755 --- a/tests/xfs/284 +++ b/tests/xfs/284 @@ -50,12 +50,12 @@ COPY_FILE="${TEST_DIR}/${seq}_copyfile" # xfs_metadump should refuse to dump a mounted device _scratch_mkfs >> $seqres.full 2>&1 _scratch_mount -_scratch_metadump $METADUMP_FILE 2>&1 | filter_mounted +_scratch_xfs_metadump $METADUMP_FILE 2>&1 | filter_mounted _scratch_unmount # Test restore to a mounted device # xfs_mdrestore should refuse to restore to a mounted device -_scratch_metadump $METADUMP_FILE +_scratch_xfs_metadump $METADUMP_FILE _scratch_mount xfs_mdrestore $METADUMP_FILE $SCRATCH_DEV 2>&1 | filter_mounted _scratch_unmount diff --git a/tests/xfs/291 b/tests/xfs/291 index 6a507d58..c906f248 100755 --- a/tests/xfs/291 +++ b/tests/xfs/291 @@ -105,7 +105,7 @@ _scratch_xfs_check >> $seqres.full 2>&1 || _fail "xfs_check failed" # Yes they can! Now... # Can xfs_metadump cope with this monster? -_scratch_metadump $tmp.metadump || _fail "xfs_metadump failed" +_scratch_xfs_metadump $tmp.metadump || _fail "xfs_metadump failed" xfs_mdrestore $tmp.metadump $tmp.img || _fail "xfs_mdrestore failed" [ "$USE_EXTERNAL" = yes ] && [ -n "$SCRATCH_RTDEV" ] && \ rt_repair_opts="-r $SCRATCH_RTDEV" diff --git a/tests/xfs/336 b/tests/xfs/336 index a006938d..b35be8a0 100755 --- a/tests/xfs/336 +++ b/tests/xfs/336 @@ -66,7 +66,7 @@ _scratch_cycle_mount echo "Create metadump file" _scratch_unmount -_scratch_metadump $metadump_file +_scratch_xfs_metadump $metadump_file # Now restore the obfuscated one back and take a look around echo "Restore metadump" diff --git a/tests/xfs/432 b/tests/xfs/432 index f41ecfdb..7df74234 100755 --- a/tests/xfs/432 +++ b/tests/xfs/432 @@ -91,7 +91,7 @@ echo "qualifying extent: $extlen blocks" >> $seqres.full test -n "$extlen" || _notrun "could not create dir extent > 1000 blocks" echo "Try to metadump" -_scratch_metadump $metadump_file -w +_scratch_xfs_metadump $metadump_file -w xfs_mdrestore $metadump_file $metadump_img echo "Check restored metadump image" diff --git a/tests/xfs/503 b/tests/xfs/503 index edf546a2..20d9c83d 100755 --- a/tests/xfs/503 +++ b/tests/xfs/503 @@ -47,16 +47,16 @@ metadump_file_ag=${metadump_file}.ag copy_file=$testdir/copy.img echo metadump -_scratch_metadump $metadump_file >> $seqres.full +_scratch_xfs_metadump $metadump_file >> $seqres.full echo metadump a -_scratch_metadump $metadump_file_a -a >> $seqres.full +_scratch_xfs_metadump $metadump_file_a -a >> $seqres.full echo metadump g -_scratch_metadump $metadump_file_g -g >> $seqres.full +_scratch_xfs_metadump $metadump_file_g -g >> $seqres.full echo metadump ag -_scratch_metadump $metadump_file_ag -a -g >> $seqres.full +_scratch_xfs_metadump $metadump_file_ag -a -g >> $seqres.full echo copy $XFS_COPY_PROG $SCRATCH_DEV $copy_file >> $seqres.full