common/populate: use metadump v2 format by default for fs metadata snapshots
authorDarrick J. Wong <djwong@kernel.org>
Thu, 20 Feb 2025 21:47:06 +0000 (13:47 -0800)
committerZorro Lang <zlang@kernel.org>
Thu, 6 Mar 2025 13:25:55 +0000 (21:25 +0800)
When we're snapshotting filesystem metadata after creating a populated
filesystem, force the creation of metadump v2 files by default to
exercise the new format, since xfs_metadump continues to use the v1
format unless told otherwise.

Signed-off-by: "Darrick J. Wong" <djwong@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Zorro Lang <zlang@kernel.org>
common/populate

index 32dc5275e2debdce6af58c6f9f05036f77bb1d6c..9fc1ee32bd490d95e8549e5faf42ae95018495c6 100644 (file)
@@ -55,7 +55,12 @@ __populate_fail() {
        case "$FSTYP" in
        xfs)
                _scratch_unmount
-               _scratch_xfs_metadump "$metadump" -a -o
+
+               mdargs=('-a' '-o')
+               test "$(_xfs_metadump_max_version)" -gt 1 && \
+                       mdargs+=('-v' '2')
+
+               _scratch_xfs_metadump "$metadump" "${mdargs[@]}"
                ;;
        ext4)
                _scratch_unmount
@@ -1056,8 +1061,12 @@ _scratch_populate_save_metadump()
                [ "$USE_EXTERNAL" = yes -a ! -z "$SCRATCH_LOGDEV" ] && \
                        logdev=$SCRATCH_LOGDEV
 
+               mdargs=('-a' '-o')
+               test "$(_xfs_metadump_max_version)" -gt 1 && \
+                       mdargs+=('-v' '2')
+
                _xfs_metadump "$metadump_file" "$SCRATCH_DEV" "$logdev" \
-                               compress -a -o
+                               compress "${mdargs[@]}"
                res=$?
                ;;
        "ext2"|"ext3"|"ext4")