]> git-server-git.apps.pok.os.sepia.ceph.com Git - xfstests-dev.git/commitdiff
common/populate: move decompression code to _{xfs,ext4}_mdrestore
authorDarrick J. Wong <djwong@kernel.org>
Sat, 17 Dec 2022 08:18:34 +0000 (00:18 -0800)
committerZorro Lang <zlang@kernel.org>
Sat, 17 Dec 2022 10:38:27 +0000 (18:38 +0800)
Move the metadump decompression code to the per-filesystem mdrestore
commands so that everyone can take advantage of them.  This enables the
XFS and ext4 _mdrestore helpers to handle metadata dumps compressed with
their respective _metadump helpers.

In turn, this means that the xfs fuzz tests can now handle the
compressed metadumps created by the _scratch_populate_cached helper.
This is key to unbreaking fuzz testing for xfs.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Zorro Lang <zlang@redhat.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
common/ext4
common/populate
common/xfs

index dc2e4e59cc697c7318be9862b3e80566efed6eca..8fd6dbc6828f3ef129e1690b4572b7f540ddac64 100644 (file)
@@ -132,6 +132,16 @@ _ext4_mdrestore()
        shift; shift
        local options="$@"
 
+       # If we're configured for compressed dumps and there isn't already an
+       # uncompressed dump, see if we can use DUMP_COMPRESSOR to decompress
+       # something.
+       if [ ! -e "$metadump" ] && [ -n "$DUMP_COMPRESSOR" ]; then
+               for compr in "$metadump".*; do
+                       [ -e "$compr" ] && $DUMP_COMPRESSOR -d -f -k "$compr" && break
+               done
+       fi
+       test -r "$metadump" || return 1
+
        $E2IMAGE_PROG $options -r "${metadump}" "${SCRATCH_DEV}"
 }
 
index abfd39d3337102926d8dd7860ab0b48f01269082..44b4af16674bfa3a07175d8eb40bddd7d917bd75 100644 (file)
@@ -880,17 +880,6 @@ _scratch_populate_cache_tag() {
 _scratch_populate_restore_cached() {
        local metadump="$1"
 
-       # If we're configured for compressed dumps and there isn't already an
-       # uncompressed dump, see if we can use DUMP_COMPRESSOR to decompress
-       # something.
-       if [ -n "$DUMP_COMPRESSOR" ]; then
-               for compr in "$metadump".*; do
-                       [ -e "$compr" ] && $DUMP_COMPRESSOR -d -f -k "$compr" && break
-               done
-       fi
-
-       test -r "$metadump" || return 1
-
        case "${FSTYP}" in
        "xfs")
                _xfs_mdrestore "${metadump}" "${SCRATCH_DEV}"
index 14be44068b888b67643ddfa0c1f7527a7aa68037..7eee76c0ee6800d9c23c07ba1ecacebc3814e99e 100644 (file)
@@ -644,6 +644,16 @@ _xfs_mdrestore() {
        shift; shift
        local options="$@"
 
+       # If we're configured for compressed dumps and there isn't already an
+       # uncompressed dump, see if we can use DUMP_COMPRESSOR to decompress
+       # something.
+       if [ ! -e "$metadump" ] && [ -n "$DUMP_COMPRESSOR" ]; then
+               for compr in "$metadump".*; do
+                       [ -e "$compr" ] && $DUMP_COMPRESSOR -d -f -k "$compr" && break
+               done
+       fi
+       test -r "$metadump" || return 1
+
        $XFS_MDRESTORE_PROG $options "${metadump}" "${device}"
 }