@@ -302,7 +302,11 @@ __scratch_xfs_fuzz_mdrestore()
[ "$USE_EXTERNAL" = yes -a ! -z "$SCRATCH_LOGDEV" ] && \
logdev=$SCRATCH_LOGDEV
- _xfs_mdrestore "${POPULATE_METADUMP}" "${SCRATCH_DEV}" "${logdev}" || \
+ local rtdev=none
+ [ "$USE_EXTERNAL" = yes -a ! -z "$SCRATCH_RTDEV" ] && \
+ rtdev=$SCRATCH_RTDEV
+
+ _xfs_mdrestore "${POPULATE_METADUMP}" "${SCRATCH_DEV}" "${logdev}" "${rtdev}" || \
_fail "${POPULATE_METADUMP}: Could not find metadump to restore?"
}
@@ -908,7 +908,11 @@ _scratch_populate_restore_cached() {
case "${FSTYP}" in
"xfs")
- _xfs_mdrestore "${metadump}" "${SCRATCH_DEV}" "${logdev}"
+ local rtdev=none
+ [ "$USE_EXTERNAL" = yes -a ! -z "$SCRATCH_RTDEV" ] && \
+ rtdev=$SCRATCH_RTDEV
+
+ _xfs_mdrestore "${metadump}" "${SCRATCH_DEV}" "${logdev}" "${rtdev}"
return $?
;;
"ext2"|"ext3"|"ext4")
@@ -930,8 +934,12 @@ _scratch_populate_save_metadump()
[ "$USE_EXTERNAL" = yes -a ! -z "$SCRATCH_LOGDEV" ] && \
logdev=$SCRATCH_LOGDEV
+ local rtdev=none
+ [ "$USE_EXTERNAL" = yes -a ! -z "$SCRATCH_RTDEV" ] && \
+ rtdev=$SCRATCH_RTDEV
+
_xfs_metadump "$metadump_file" "$SCRATCH_DEV" "$logdev" \
- compress
+ "$rtdev" compress
res=$?
;;
"ext2"|"ext3"|"ext4")
@@ -679,15 +679,20 @@ _xfs_metadump() {
local metadump="$1"
local device="$2"
local logdev="$3"
- local compressopt="$4"
- shift; shift; shift; shift
+ local rtdev="$4"
+ local compressopt="$5"
+ shift; shift; shift; shift; shift
local options="$@"
test -z "$options" && options="-a -o"
local metadump_has_dash_x
+ local metadump_has_dash_R
# Does metadump support capturing from external devices?
$XFS_METADUMP_PROG --help 2>&1 | grep -q -- '-[a-zA-Z]*[wW]x' && \
metadump_has_dash_x=1
+ # Does metadump support capturing realtime devices?
+ $XFS_METADUMP_PROG --help 2>&1 | grep -q -- '-R rtdev' && \
+ metadump_has_dash_R=1
if [ "$logdev" != "none" ]; then
options="$options -l $logdev"
@@ -699,6 +704,17 @@ _xfs_metadump() {
fi
fi
+ # Capture the realtime device, if possible
+ if [ "$rtdev" != "none" ] && [ -n "$metadump_has_dash_R" ]; then
+ options="$options -R $rtdev"
+
+ # Tell metadump to capture the rt device
+ if [ -n "$metadump_has_dash_x" ]; then
+ options="$options -x"
+ unset metadump_has_dash_x
+ fi
+ fi
+
$XFS_METADUMP_PROG $options "$device" "$metadump"
res=$?
[ "$compressopt" = "compress" ] && [ -n "$DUMP_COMPRESSOR" ] &&
@@ -710,7 +726,8 @@ _xfs_mdrestore() {
local metadump="$1"
local device="$2"
local logdev="$3"
- shift; shift; shift
+ local rtdev="$4"
+ shift; shift; shift; shift
local options="$@"
# If we're configured for compressed dumps and there isn't already an
@@ -730,6 +747,11 @@ _xfs_mdrestore() {
logdev="none"
fi
+ # Does mdrestore support restoring to realtime devices?
+ if [ "$rtdev" != "none" ] && $XFS_MDRESTORE_PROG --help 2>&1 | grep -q -- '-R rtdev'; then
+ options="$options -R $rtdev"
+ fi
+
$XFS_MDRESTORE_PROG $options "${metadump}" "${device}"
res=$?
test $res -ne 0 && return $res
@@ -750,12 +772,16 @@ _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 "$@"
+ local rtdev=none
+ [ "$USE_EXTERNAL" = yes -a ! -z "$SCRATCH_RTDEV" ] && \
+ rtdev=$SCRATCH_RTDEV
+
+ _xfs_metadump "$metadump" "$SCRATCH_DEV" "$logdev" "$rtdev" nocompress "$@"
}
# Restore snapshotted metadata on the scratch device
@@ -768,7 +794,11 @@ _scratch_xfs_mdrestore()
[ "$USE_EXTERNAL" = yes -a ! -z "$SCRATCH_LOGDEV" ] && \
logdev=$SCRATCH_LOGDEV
- _xfs_mdrestore "$metadump" "$SCRATCH_DEV" "$logdev" "$@"
+ local rtdev=none
+ [ "$USE_EXTERNAL" = yes -a ! -z "$SCRATCH_RTDEV" ] && \
+ rtdev=$SCRATCH_RTDEV
+
+ _xfs_mdrestore "$metadump" "$SCRATCH_DEV" "$logdev" "$rtdev" "$@"
}
# run xfs_check and friends on a FS.
@@ -895,7 +925,7 @@ _check_xfs_filesystem()
if [ "$ok" -ne 1 ] && [ "$DUMP_CORRUPT_FS" = "1" ]; then
local flatdev="$(basename "$device")"
_xfs_metadump "$seqres.$flatdev.check.md" "$device" "$logdev" \
- compress >> $seqres.full
+ "$rtdev" compress >> $seqres.full
fi
# Optionally test the index rebuilding behavior.
@@ -928,7 +958,7 @@ _check_xfs_filesystem()
if [ "$rebuild_ok" -ne 1 ] && [ "$DUMP_CORRUPT_FS" = "1" ]; then
local flatdev="$(basename "$device")"
_xfs_metadump "$seqres.$flatdev.rebuild.md" "$device" \
- "$logdev" compress >> $seqres.full
+ "$logdev" "$rtdev" compress >> $seqres.full
fi
fi
@@ -1009,7 +1039,7 @@ _check_xfs_filesystem()
if [ "$orebuild_ok" -ne 1 ] && [ "$DUMP_CORRUPT_FS" = "1" ]; then
local flatdev="$(basename "$device")"
_xfs_metadump "$seqres.$flatdev.orebuild.md" "$device" \
- "$logdev" compress >> $seqres.full
+ "$logdev" "$rtdev" compress >> $seqres.full
fi
fi