public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
From: "Darrick J. Wong" <djwong@kernel.org>
To: zlang@redhat.com
Cc: linux-xfs@vger.kernel.org, fstests@vger.kernel.org, guan@eryu.me
Subject: [PATCH v1.1 3/4] common/populate: move decompression code to _{xfs,ext4}_mdrestore
Date: Sat, 17 Dec 2022 00:18:34 -0800	[thread overview]
Message-ID: <Y517WiHeORSpumeK@magnolia> (raw)
In-Reply-To: <167096072838.1750373.11954125201906427521.stgit@magnolia>

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

Move the metadump decompression code to the per-filesystem mdrestore
commands so that everyone can take advantage of them.  This enables the
XFS and ext4 _mdrestore helpers to handle metadata dumps compressed with
their respective _metadump helpers.

In turn, this means that the xfs fuzz tests can now handle the
compressed metadumps created by the _scratch_populate_cached helper.
This is key to unbreaking fuzz testing for xfs.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
---
v1.1: remove unnecessary parameter
---
 common/ext4     |   10 ++++++++++
 common/populate |   11 -----------
 common/xfs      |   10 ++++++++++
 3 files changed, 20 insertions(+), 11 deletions(-)

diff --git a/common/ext4 b/common/ext4
index dc2e4e59cc..8fd6dbc682 100644
--- a/common/ext4
+++ b/common/ext4
@@ -132,6 +132,16 @@ _ext4_mdrestore()
 	shift; shift
 	local options="$@"
 
+	# If we're configured for compressed dumps and there isn't already an
+	# uncompressed dump, see if we can use DUMP_COMPRESSOR to decompress
+	# something.
+	if [ ! -e "$metadump" ] && [ -n "$DUMP_COMPRESSOR" ]; then
+		for compr in "$metadump".*; do
+			[ -e "$compr" ] && $DUMP_COMPRESSOR -d -f -k "$compr" && break
+		done
+	fi
+	test -r "$metadump" || return 1
+
 	$E2IMAGE_PROG $options -r "${metadump}" "${SCRATCH_DEV}"
 }
 
diff --git a/common/populate b/common/populate
index f382c40aca..0a8a6390d4 100644
--- a/common/populate
+++ b/common/populate
@@ -848,17 +848,6 @@ _scratch_populate_cache_tag() {
 _scratch_populate_restore_cached() {
 	local metadump="$1"
 
-	# If we're configured for compressed dumps and there isn't already an
-	# uncompressed dump, see if we can use DUMP_COMPRESSOR to decompress
-	# something.
-	if [ -n "$DUMP_COMPRESSOR" ]; then
-		for compr in "$metadump".*; do
-			[ -e "$compr" ] && $DUMP_COMPRESSOR -d -f -k "$compr" && break
-		done
-	fi
-
-	test -r "$metadump" || return 1
-
 	case "${FSTYP}" in
 	"xfs")
 		_xfs_mdrestore "${metadump}" "${SCRATCH_DEV}"
diff --git a/common/xfs b/common/xfs
index 216dab3bcd..60848a5b8a 100644
--- a/common/xfs
+++ b/common/xfs
@@ -644,6 +644,16 @@ _xfs_mdrestore() {
 	shift; shift
 	local options="$@"
 
+	# If we're configured for compressed dumps and there isn't already an
+	# uncompressed dump, see if we can use DUMP_COMPRESSOR to decompress
+	# something.
+	if [ ! -e "$metadump" ] && [ -n "$DUMP_COMPRESSOR" ]; then
+		for compr in "$metadump".*; do
+			[ -e "$compr" ] && $DUMP_COMPRESSOR -d -f -k "$compr" && break
+		done
+	fi
+	test -r "$metadump" || return 1
+
 	$XFS_MDRESTORE_PROG $options "${metadump}" "${device}"
 }
 

  parent reply	other threads:[~2022-12-17  8:18 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-13 19:45 [PATCHSET 0/4] fstests: fix broken fuzzing xfs_mdrestore calls Darrick J. Wong
2022-12-13 19:45 ` [PATCH 1/4] common/populate: create helpers to handle restoring metadumps Darrick J. Wong
2022-12-17  6:24   ` Zorro Lang
2022-12-13 19:45 ` [PATCH 2/4] common/xfs: create a helper for restoring metadumps to the scratch devs Darrick J. Wong
2022-12-17  6:32   ` Zorro Lang
2022-12-13 19:45 ` [PATCH 3/4] common/populate: move decompression code to _{xfs,ext4}_mdrestore Darrick J. Wong
2022-12-17  6:50   ` Zorro Lang
2022-12-17  8:11     ` Darrick J. Wong
2022-12-17  8:18   ` Darrick J. Wong [this message]
2022-12-17  9:50     ` [PATCH v1.1 " Zorro Lang
2022-12-13 19:45 ` [PATCH 4/4] fuzzy: don't fail on compressed metadumps Darrick J. Wong
2022-12-17  7:03   ` Zorro Lang
2022-12-17 10:33     ` Zorro Lang
2022-12-17 20:06       ` Darrick J. Wong

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=Y517WiHeORSpumeK@magnolia \
    --to=djwong@kernel.org \
    --cc=fstests@vger.kernel.org \
    --cc=guan@eryu.me \
    --cc=linux-xfs@vger.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox