@@ -713,10 +713,14 @@ _xfs_mdrestore() {
$XFS_MDRESTORE_PROG $options "${metadump}" "${device}"
}
-_scratch_metadump_v2_supported()
+# What is the maximum metadump file format supported by xfs_metadump?
+_xfs_metadump_max_version()
{
- $XFS_DB_PROG -c "help metadump" $SCRATCH_DEV | \
- grep -q "Metadump version to be used"
+ if $XFS_METADUMP_PROG --help 2>&1 | grep -q -- '-v version'; then
+ echo 2
+ else
+ echo 1
+ fi
}
# Snapshot the metadata on the scratch device
@@ -106,8 +106,7 @@ verify_metadump_v2()
_scratch_mkfs >/dev/null 2>&1
-max_md_version=1
-_scratch_metadump_v2_supported && max_md_version=2
+max_md_version=$(_xfs_metadump_max_version)
_scratch_mount
@@ -106,8 +106,7 @@ verify_metadump_v2()
_scratch_mkfs >/dev/null 2>&1
-max_md_version=1
-_scratch_metadump_v2_supported && max_md_version=2
+max_md_version=$(_xfs_metadump_max_version)
_scratch_mount
@@ -233,8 +233,7 @@ cd $here
_scratch_unmount
-max_md_version=1
-_scratch_metadump_v2_supported && max_md_version=2
+max_md_version=$(_xfs_metadump_max_version)
verify_metadump_v1 $max_md_version
@@ -92,8 +92,7 @@ _scratch_xfs_check >> $seqres.full 2>&1 || _fail "xfs_check failed"
# Yes they can! Now...
# Can xfs_metadump cope with this monster?
-max_md_version=1
-_scratch_metadump_v2_supported && max_md_version=2
+max_md_version=$(_xfs_metadump_max_version)
for md_version in $(seq 1 $max_md_version); do
version=""
@@ -87,8 +87,7 @@ echo "qualifying extent: $extlen blocks" >> $seqres.full
test -n "$extlen" || _notrun "could not create dir extent > 1000 blocks"
echo "Try to metadump, restore and check restored metadump image"
-max_md_version=1
-_scratch_metadump_v2_supported && max_md_version=2
+max_md_version=$(_xfs_metadump_max_version)
for md_version in $(seq 1 $max_md_version); do
version=""
@@ -54,8 +54,7 @@ check_restored_metadump_image()
_destroy_loop_device $loop_dev
}
-max_md_version=1
-_scratch_metadump_v2_supported && max_md_version=2
+max_md_version=$(_xfs_metadump_max_version)
echo "metadump and mdrestore"
for md_version in $(seq 1 $max_md_version); do
@@ -44,8 +44,7 @@ testfile=${SCRATCH_MNT}/testfile
echo "Format filesystem on scratch device"
_scratch_mkfs >> $seqres.full 2>&1
-max_md_version=1
-_scratch_metadump_v2_supported && max_md_version=2
+max_md_version=$(_xfs_metadump_max_version)
external_log=0
if [[ $USE_EXTERNAL = yes && -n "$SCRATCH_LOGDEV" ]]; then