$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
_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
_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
_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
# 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=""
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=""
_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
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