All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Darrick J. Wong" <djwong@kernel.org>
To: djwong@kernel.org, zlang@redhat.com
Cc: Christoph Hellwig <hch@lst.de>, Zorro Lang <zlang@kernel.org>,
	linux-xfs@vger.kernel.org, fstests@vger.kernel.org, guan@eryu.me
Subject: [PATCH 02/10] common/xfs: simplify maximum metadump format detection
Date: Tue, 06 Feb 2024 18:18:45 -0800	[thread overview]
Message-ID: <170727232530.3726171.13484518243714744011.stgit@frogsfrogsfrogs> (raw)
In-Reply-To: <170727231361.3726171.14834727104549554832.stgit@frogsfrogsfrogs>

From: Darrick J. Wong <djwong@kernel.org>

xfs_metadump (aka the wrapper around xfs_db -c metadump) advertises the
-v switch to turn on v2 format in its help screen.  There's no need to
fire up xfs_db on the scratch device which will load the AGs and take
much longer.

While we're at it, reduce the amount of boilerplate in the test files by
changing the function to emit the max version supported.

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/xfs    |   10 +++++++---
 tests/xfs/129 |    3 +--
 tests/xfs/234 |    3 +--
 tests/xfs/253 |    3 +--
 tests/xfs/291 |    3 +--
 tests/xfs/432 |    3 +--
 tests/xfs/503 |    3 +--
 tests/xfs/605 |    3 +--
 8 files changed, 14 insertions(+), 17 deletions(-)


diff --git a/common/xfs b/common/xfs
index 11cfd79562..248ccefda3 100644
--- a/common/xfs
+++ b/common/xfs
@@ -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
diff --git a/tests/xfs/129 b/tests/xfs/129
index 8a817b416c..cdac2349df 100755
--- a/tests/xfs/129
+++ b/tests/xfs/129
@@ -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
 
diff --git a/tests/xfs/234 b/tests/xfs/234
index c9bdb674ab..f4f8af6d3a 100755
--- a/tests/xfs/234
+++ b/tests/xfs/234
@@ -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
 
diff --git a/tests/xfs/253 b/tests/xfs/253
index 8e18ddb83a..3b567999d8 100755
--- a/tests/xfs/253
+++ b/tests/xfs/253
@@ -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
 
diff --git a/tests/xfs/291 b/tests/xfs/291
index 33193eb78e..1433140821 100755
--- a/tests/xfs/291
+++ b/tests/xfs/291
@@ -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=""
diff --git a/tests/xfs/432 b/tests/xfs/432
index a215d3ce2e..7e402aa88f 100755
--- a/tests/xfs/432
+++ b/tests/xfs/432
@@ -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=""
diff --git a/tests/xfs/503 b/tests/xfs/503
index a1479eb613..8643c3d483 100755
--- a/tests/xfs/503
+++ b/tests/xfs/503
@@ -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
diff --git a/tests/xfs/605 b/tests/xfs/605
index 5cbf5d2550..f2cd7aba98 100755
--- a/tests/xfs/605
+++ b/tests/xfs/605
@@ -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


  parent reply	other threads:[~2024-02-07  2:18 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-07  2:18 [PATCHSET] fstests: random fixes for v2024.01.14 Darrick J. Wong
2024-02-07  2:18 ` [PATCH 01/10] generic/256: constrain runtime with TIME_FACTOR Darrick J. Wong
2024-02-07  2:18 ` Darrick J. Wong [this message]
2024-02-07  2:18 ` [PATCH 03/10] common/populate: always metadump full metadata blocks Darrick J. Wong
2024-02-07  2:18 ` [PATCH 04/10] xfs/336: fix omitted -a and -o in metadump call Darrick J. Wong
2024-02-07  2:19 ` [PATCH 05/10] common: refactor metadump v1 and v2 tests, version 2 Darrick J. Wong
2024-02-07  9:15   ` Zorro Lang
2024-02-07  2:19 ` [PATCH 06/10] xfs/{129,234,253,605}: disable metadump v1 testing with external devices Darrick J. Wong
2024-02-07  2:19 ` [PATCH 07/10] xfs/503: test metadump obfuscation, not progressbars Darrick J. Wong
2024-02-07  2:19 ` [PATCH 08/10] xfs/503: split copy and metadump into two tests Darrick J. Wong
2024-02-07  2:19 ` [PATCH 09/10] common/xfs: only pass -l in _xfs_mdrestore for v2 metadumps Darrick J. Wong
2024-02-07  2:19 ` [PATCH 10/10] xfs/122: fix for xfs_attr_shortform removal in 6.8 Darrick J. Wong
  -- strict thread matches above, loose matches on Subject: below --
2024-01-25 19:04 [PATCHSET] fstests: random fixes for v2024.01.14 Darrick J. Wong
2024-01-25 19:04 ` [PATCH 02/10] common/xfs: simplify maximum metadump format detection Darrick J. Wong
2024-01-26 13:31   ` Christoph Hellwig

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=170727232530.3726171.13484518243714744011.stgit@frogsfrogsfrogs \
    --to=djwong@kernel.org \
    --cc=fstests@vger.kernel.org \
    --cc=guan@eryu.me \
    --cc=hch@lst.de \
    --cc=linux-xfs@vger.kernel.org \
    --cc=zlang@kernel.org \
    --cc=zlang@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.