FS/XFS testing framework
 help / color / mirror / Atom feed
From: Zorro Lang <zlang@redhat.com>
To: "Darrick J. Wong" <djwong@kernel.org>
Cc: linux-xfs@vger.kernel.org, fstests@vger.kernel.org
Subject: Re: [PATCH 1/4] common/populate: create helpers to handle restoring metadumps
Date: Sat, 17 Dec 2022 14:24:46 +0800	[thread overview]
Message-ID: <20221217062446.4laur23et6xtduka@zlang-mailbox> (raw)
In-Reply-To: <167096071510.1750373.2221240504175764288.stgit@magnolia>

On Tue, Dec 13, 2022 at 11:45:15AM -0800, Darrick J. Wong wrote:
> From: Darrick J. Wong <djwong@kernel.org>
> 
> Refactor _scratch_populate_restore_cached so that the actual commands
> for restoring metadumps are filesystem-specific helpers.
> 
> Signed-off-by: Darrick J. Wong <djwong@kernel.org>
> ---

Looks good to me,
Reviewed-by: Zorro Lang <zlang@redhat.com>

>  common/ext4     |   10 ++++++++++
>  common/fuzzy    |    2 +-
>  common/populate |    4 ++--
>  common/xfs      |    9 +++++++++
>  4 files changed, 22 insertions(+), 3 deletions(-)
> 
> 
> diff --git a/common/ext4 b/common/ext4
> index 4a2eaa157f..dc2e4e59cc 100644
> --- a/common/ext4
> +++ b/common/ext4
> @@ -125,6 +125,16 @@ _ext4_metadump()
>  		$DUMP_COMPRESSOR -f "$dumpfile" &>> "$seqres.full"
>  }
>  
> +_ext4_mdrestore()
> +{
> +	local metadump="$1"
> +	local device="$2"
> +	shift; shift
> +	local options="$@"
> +
> +	$E2IMAGE_PROG $options -r "${metadump}" "${SCRATCH_DEV}"
> +}
> +
>  # this test requires the ext4 kernel support crc feature on scratch device
>  #
>  _require_scratch_ext4_crc()
> diff --git a/common/fuzzy b/common/fuzzy
> index 2d688fd27b..fad79124e5 100644
> --- a/common/fuzzy
> +++ b/common/fuzzy
> @@ -159,7 +159,7 @@ __scratch_xfs_fuzz_mdrestore()
>  	test -e "${POPULATE_METADUMP}" || _fail "Need to set POPULATE_METADUMP"
>  
>  	__scratch_xfs_fuzz_unmount
> -	$XFS_MDRESTORE_PROG "${POPULATE_METADUMP}" "${SCRATCH_DEV}"
> +	_xfs_mdrestore "${POPULATE_METADUMP}" "${SCRATCH_DEV}"
>  }
>  
>  __fuzz_notify() {
> diff --git a/common/populate b/common/populate
> index 6e00499734..f382c40aca 100644
> --- a/common/populate
> +++ b/common/populate
> @@ -861,7 +861,7 @@ _scratch_populate_restore_cached() {
>  
>  	case "${FSTYP}" in
>  	"xfs")
> -		$XFS_MDRESTORE_PROG "${metadump}" "${SCRATCH_DEV}"
> +		_xfs_mdrestore "${metadump}" "${SCRATCH_DEV}"
>  		res=$?
>  		test $res -ne 0 && return $res
>  
> @@ -876,7 +876,7 @@ _scratch_populate_restore_cached() {
>  		return $res
>  		;;
>  	"ext2"|"ext3"|"ext4")
> -		$E2IMAGE_PROG -r "${metadump}" "${SCRATCH_DEV}"
> +		_ext4_mdrestore "${metadump}" "${SCRATCH_DEV}"
>  		ret=$?
>  		test $ret -ne 0 && return $ret
>  
> diff --git a/common/xfs b/common/xfs
> index f466d2c42f..27d6ac84e3 100644
> --- a/common/xfs
> +++ b/common/xfs
> @@ -638,6 +638,15 @@ _xfs_metadump() {
>  	return $res
>  }
>  
> +_xfs_mdrestore() {
> +	local metadump="$1"
> +	local device="$2"
> +	shift; shift
> +	local options="$@"
> +
> +	$XFS_MDRESTORE_PROG $options "${metadump}" "${device}"
> +}
> +
>  # Snapshot the metadata on the scratch device
>  _scratch_xfs_metadump()
>  {
> 


  reply	other threads:[~2022-12-17  6:25 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 [this message]
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   ` [PATCH v1.1 " Darrick J. Wong
2022-12-17  9:50     ` 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=20221217062446.4laur23et6xtduka@zlang-mailbox \
    --to=zlang@redhat.com \
    --cc=djwong@kernel.org \
    --cc=fstests@vger.kernel.org \
    --cc=linux-xfs@vger.kernel.org \
    /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