All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mike Snitzer <snitzer@redhat.com>
To: Mikulas Patocka <mpatocka@redhat.com>
Cc: dm-devel@redhat.com
Subject: Re: [PATCH 7/8] dm: improve noclone_endio() to support multipath target
Date: Wed, 20 Feb 2019 10:14:21 -0500	[thread overview]
Message-ID: <20190220151421.GA24047@redhat.com> (raw)
In-Reply-To: <alpine.LRH.2.02.1902201007010.25108@file01.intranet.prod.int.rdu2.redhat.com>

On Wed, Feb 20 2019 at 10:08am -0500,
Mikulas Patocka <mpatocka@redhat.com> wrote:

> 
> 
> On Tue, 19 Feb 2019, Mike Snitzer wrote:
> 
> > noclone_endio() must call the target's ->endio method if it exists.
> > Also must handle the various DM_ENDIO_* returns that are possible.
> > 
> > Factor out dm_bio_pushback_needed() for both dec_pending() and
> > noclone_endio() to use when handling BLK_STS_DM_REQUEUE.
> > 
> > Lastly, there is no need to conditionally set md->immutable_target in
> > __bind().  If the device only uses a single immutable target then it
> > should always be reflected in md->immutable_target.  This is important
> > because noclone_endio() benefits from this to get access to the
> > multipath dm_target without needing to add another member to the
> > 'dm_noclone' structure.
> > 
> > Signed-off-by: Mike Snitzer <snitzer@redhat.com>
> > ---
> >  drivers/md/dm.c | 77 ++++++++++++++++++++++++++++++++++++++++-----------------
> >  1 file changed, 55 insertions(+), 22 deletions(-)
> > 
> > diff --git a/drivers/md/dm.c b/drivers/md/dm.c
> > index 8ff0ced278d7..2299f946c175 100644
> > --- a/drivers/md/dm.c
> > +++ b/drivers/md/dm.c
> > @@ -897,6 +897,28 @@ static int __noflush_suspending(struct mapped_device *md)
> >  	return test_bit(DMF_NOFLUSH_SUSPENDING, &md->flags);
> >  }
> >  
> > +static bool dm_bio_pushback_needed(struct mapped_device *md,
> > +				   struct bio *bio, blk_status_t *error)
> > +{
> > +	unsigned long flags;
> > +
> > +	/*
> > +	 * Target requested pushing back the I/O.
> > +	 */
> > +	if (__noflush_suspending(md)) {
> > +		spin_lock_irqsave(&md->deferred_lock, flags);
> > +		// FIXME: using bio_list_add_head() creates LIFO
> > +		bio_list_add_head(&md->deferred, bio);
> > +		spin_unlock_irqrestore(&md->deferred_lock, flags);
> > +		return true;
> > +	} else {
> > +		/* noflush suspend was interrupted. */
> > +		*error = BLK_STS_IOERR;
> > +	}
> > +
> > +	return false;
> > +}
> > +
> >  /*
> >   * Decrements the number of outstanding ios that a bio has been
> >   * cloned into, completing the original io if necc.
> > @@ -917,19 +939,8 @@ static void dec_pending(struct dm_io *io, blk_status_t error)
> >  	}
> >  
> >  	if (atomic_dec_and_test(&io->io_count)) {
> > -		if (io->status == BLK_STS_DM_REQUEUE) {
> > -			/*
> > -			 * Target requested pushing back the I/O.
> > -			 */
> > -			spin_lock_irqsave(&md->deferred_lock, flags);
> > -			if (__noflush_suspending(md))
> > -				/* NOTE early return due to BLK_STS_DM_REQUEUE below */
> > -				bio_list_add_head(&md->deferred, io->orig_bio);
> > -			else
> > -				/* noflush suspend was interrupted. */
> > -				io->status = BLK_STS_IOERR;
> > -			spin_unlock_irqrestore(&md->deferred_lock, flags);
> > -		}
> > +		if (unlikely(io->status == BLK_STS_DM_REQUEUE))
> > +			(void) dm_bio_pushback_needed(md, bio, &io->status);
> 
> This triggers compiler warning because the variable bio is uninitialized 
> here.

Right, I fixed it up in latest git, please see latest 'dm-5.1' branch:
https://git.kernel.org/pub/scm/linux/kernel/git/device-mapper/linux-dm.git/log/?h=dm-5.1

  reply	other threads:[~2019-02-20 15:14 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-19 22:17 [PATCH 0/8] dm: changes staged in linux-next for 5.1 so far Mike Snitzer
2019-02-19 22:17 ` [PATCH 1/8] dm: update dm_process_bio() to split bio if in ->make_request_fn() Mike Snitzer
2019-02-19 22:17 ` [PATCH 2/8] dm: eliminate 'split_discard_bios' flag from DM target interface Mike Snitzer
2019-02-19 22:17 ` [PATCH 3/8] dm: refactor start_io_acct and end_io_acct Mike Snitzer
2019-02-19 22:17 ` [PATCH 4/8] dm: implement noclone optimization for bio-based Mike Snitzer
2019-02-19 22:17 ` [PATCH 5/8] dm: improve noclone bio support Mike Snitzer
2019-02-19 22:17 ` [PATCH 6/8] dm: add the ability to attach per-bio-data to dm_noclone bio Mike Snitzer
2019-02-19 22:17 ` [PATCH 7/8] dm: improve noclone_endio() to support multipath target Mike Snitzer
2019-02-20 15:08   ` Mikulas Patocka
2019-02-20 15:14     ` Mike Snitzer [this message]
2019-02-19 22:17 ` [PATCH 8/8] dm mpath: add support for dm_noclone and its per-bio-data Mike Snitzer

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=20190220151421.GA24047@redhat.com \
    --to=snitzer@redhat.com \
    --cc=dm-devel@redhat.com \
    --cc=mpatocka@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.