common: move _scratch_metadump to common/xfs
authorDarrick J. Wong <djwong@kernel.org>
Tue, 9 Mar 2021 04:39:17 +0000 (20:39 -0800)
committerEryu Guan <guaneryu@gmail.com>
Sun, 21 Mar 2021 13:31:32 +0000 (21:31 +0800)
_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 <djwong@kernel.org>
common/populate
common/rc
common/xfs
tests/xfs/129
tests/xfs/234
tests/xfs/253
tests/xfs/284
tests/xfs/291
tests/xfs/336
tests/xfs/432
tests/xfs/503

index f4ad8669c7d1c579a08bf98d09993fcb705dc8ba..4e5b645f22fb1df9e6fd04a242af29459754025d 100644 (file)
@@ -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 $@
index 9fdbcd1427d5355d8ec24587c02578f96f991428..b0241b0a5876286dd01bb1ae45eb53085d051bed 100644 (file)
--- 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
index b30d289ff6db47131bf9fd306ebd8bb1215d3ed3..fe4dea996c6be400281d2edc94ad91915f3039f9 100644 (file)
@@ -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()
 {
index 78baf5c41952feedd495dc7d91d0600002895f33..513d2fdd146f9b425127d2c9af5bd8d7a92df4f8 100755 (executable)
@@ -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"
index 14172c3df8ac9bc8ff58a3bc4d26f29024929d47..a3a57f2dac750dd15a6ba842c3f076e9656b6268 100755 (executable)
@@ -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"
index 9d967a50c9155093322bf7cf7e76ed2ef371a534..fb7fc80b372e8048705e127bb316fc076cd5b1de 100755 (executable)
@@ -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}"
index dbfd752befc12abc57136e643f5f11996252d475..cc9d723ad648a9e2b8d364304f877d390c76573c 100755 (executable)
@@ -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
index 6a507d5802ef9075dd55b169de60830421b680e3..c906f248a99337cbe92b87ab4db6f7c1302cceac 100755 (executable)
@@ -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"
index a006938d66a86a768e45af8c949a70975c388aa2..b35be8a0888193341f63ccbdd0903190b5c5327d 100755 (executable)
@@ -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"
index f41ecfdb38d3647cc9d9ddaac20e21f112594cce..7df7423459c6b8de8ae10a6e7c1c65f4aeade99a 100755 (executable)
@@ -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"
index edf546a2162d24d0b51f6cbda6f1c8d44b5725dc..20d9c83d52bfc3e4df44193dbfb83a1860d692a3 100755 (executable)
@@ -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