All of lore.kernel.org
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@infradead.org>
To: "Darrick J. Wong" <djwong@kernel.org>
Cc: guaneryu@gmail.com, zlang@redhat.com, linux-xfs@vger.kernel.org,
	fstests@vger.kernel.org, guan@eryu.me
Subject: Re: [PATCH 1/2] common: refactor fail_make_request boilerplate
Date: Thu, 28 Jul 2022 12:01:05 -0700	[thread overview]
Message-ID: <YuLc8eIfTXTIT/Ca@infradead.org> (raw)
In-Reply-To: <165886494011.1585218.15776043472701680079.stgit@magnolia>

On Tue, Jul 26, 2022 at 12:49:00PM -0700, Darrick J. Wong wrote:
> From: Darrick J. Wong <djwong@kernel.org>
> 
> Refactor the control functions from generic/019 into a common helper to
> be used by all three tests that use fail_make_requests.

There is btrfs/271 as well with similar boilerplate as well, which
is why I've been looking into refactoring it before.

> +_start_fail_scratch_dev()
> +{
> +    local SYSFS_BDEV=`_sysfs_dev $SCRATCH_DEV`
> +    echo "Force SCRATCH_DEV device failure"
> +    echo " echo 1 > $SYSFS_BDEV/make-it-fail" >> $seqres.full
> +    echo 1 > $SYSFS_BDEV/make-it-fail
> +}

.. and for that use cases we need to pass an explicit device here, and
not just default to $SCRATCH_DEV.  

>  enable_io_failure()
>  {
> +	_allow_fail_make_request 100 1000 > /dev/null
> +	_start_fail_scratch_dev > /dev/null
>  }
>  
>  disable_io_failure()
>  {
> +	_stop_fail_scratch_dev > /dev/null
> +	_disallow_fail_make_request > /dev/null
>  }

Let's just drop these wrappers.

Otherwise this looks really nice.

  reply	other threads:[~2022-07-28 19:01 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-26 19:48 [PATCHSET 0/2] fstests: enhance fail_make_request Darrick J. Wong
2022-07-26 19:49 ` [PATCH 1/2] common: refactor fail_make_request boilerplate Darrick J. Wong
2022-07-28 19:01   ` Christoph Hellwig [this message]
2022-07-26 19:49 ` [PATCH 2/2] fail_make_request: teach helpers about external devices Darrick J. Wong
2022-07-28 19:02   ` Christoph Hellwig
2022-08-01 21:13     ` Darrick J. Wong
  -- strict thread matches above, loose matches on Subject: below --
2022-08-03  4:22 [PATCHSET v2 0/2] fstests: enhance fail_make_request Darrick J. Wong
2022-08-03  4:22 ` [PATCH 1/2] common: refactor fail_make_request boilerplate Darrick J. Wong
2022-08-11 12:36   ` 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=YuLc8eIfTXTIT/Ca@infradead.org \
    --to=hch@infradead.org \
    --cc=djwong@kernel.org \
    --cc=fstests@vger.kernel.org \
    --cc=guan@eryu.me \
    --cc=guaneryu@gmail.com \
    --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 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.