Refactor _scratch_populate_restore_cached so that the actual commands
for restoring metadumps are filesystem-specific helpers.
Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Zorro Lang <zlang@redhat.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
$DUMP_COMPRESSOR -f "$dumpfile" &>> "$seqres.full"
}
+_ext4_mdrestore()
+{
+ local metadump="$1"
+ local device="$2"
+ shift; shift
+ local options="$@"
+
+ $E2IMAGE_PROG $options -r "${metadump}" "${SCRATCH_DEV}"
+}
+
# this test requires the ext4 kernel support crc feature on scratch device
#
_require_scratch_ext4_crc()
test -e "${POPULATE_METADUMP}" || _fail "Need to set POPULATE_METADUMP"
__scratch_xfs_fuzz_unmount
- $XFS_MDRESTORE_PROG "${POPULATE_METADUMP}" "${SCRATCH_DEV}"
+ _xfs_mdrestore "${POPULATE_METADUMP}" "${SCRATCH_DEV}"
}
__fuzz_notify() {
case "${FSTYP}" in
"xfs")
- $XFS_MDRESTORE_PROG "${metadump}" "${SCRATCH_DEV}"
+ _xfs_mdrestore "${metadump}" "${SCRATCH_DEV}"
res=$?
test $res -ne 0 && return $res
return $res
;;
"ext2"|"ext3"|"ext4")
- $E2IMAGE_PROG -r "${metadump}" "${SCRATCH_DEV}"
+ _ext4_mdrestore "${metadump}" "${SCRATCH_DEV}"
ret=$?
test $ret -ne 0 && return $ret
return $res
}
+_xfs_mdrestore() {
+ local metadump="$1"
+ local device="$2"
+ shift; shift
+ local options="$@"
+
+ $XFS_MDRESTORE_PROG $options "${metadump}" "${device}"
+}
+
# Snapshot the metadata on the scratch device
_scratch_xfs_metadump()
{