All of lore.kernel.org
 help / color / mirror / Atom feed
From: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
To: Jan Beulich <JBeulich@suse.com>
Cc: hch@infradead.org, xen-devel@lists.xensource.com,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/3] xen/blkback: Support 'feature-barrier' aka old-style BARRIER requests.
Date: Mon, 17 Oct 2011 12:52:47 -0400	[thread overview]
Message-ID: <20111017165247.GB19724@phenom.dumpdata.com> (raw)
In-Reply-To: <4E9C3B39020000780005BA5D@nat28.tlf.novell.com>

On Mon, Oct 17, 2011 at 01:27:05PM +0100, Jan Beulich wrote:
> >>> On 10.10.11 at 17:28, Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> wrote:
> > We emulate the barrier requests by draining the outstanding bio's
> > and then sending the WRITE_FLUSH command. To drain the I/Os
> > we use the refcnt that is used during disconnect to wait for all
> > the I/Os before disconnecting from the frontend. We latch on its
> > value and if it reaches either the threshold for disconnect or when
> > there are no more outstanding I/Os, then we have drained all I/Os.
> > 
> > Suggested-by: Christopher Hellwig <hch@infradead.org>
> > Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
> > ---
> >  drivers/block/xen-blkback/blkback.c |   37 +++++++++++++++++++++++++++++++++-
> >  drivers/block/xen-blkback/common.h  |    5 ++++
> >  drivers/block/xen-blkback/xenbus.c  |   18 +++++++++++++++++
> >  3 files changed, 58 insertions(+), 2 deletions(-)
> > 
> > diff --git a/drivers/block/xen-blkback/blkback.c 
> > b/drivers/block/xen-blkback/blkback.c
> > index e0dab61..184b133 100644
> > --- a/drivers/block/xen-blkback/blkback.c
> > +++ b/drivers/block/xen-blkback/blkback.c
> > @@ -452,6 +452,23 @@ static void xen_blk_discard(struct xen_blkif *blkif, 
> > struct blkif_request *req)
> >  	make_response(blkif, req->id, req->operation, status);
> >  }
> >  
> > +static void xen_blk_drain_io(struct xen_blkif *blkif)
> > +{
> > +	atomic_set(&blkif->drain, 1);
> > +	do {
> > +		wait_for_completion_interruptible_timeout(
> > +				&blkif->drain_complete, HZ);
> > +
> > +		if (!atomic_read(&blkif->drain))
> > +			break;
> > +		/* The initial value is one, and one refcnt taken at the
> > +		 * start of the xen_blkif_schedule thread. */
> > +		if (atomic_read(&blkif->refcnt) <= 2)
> > +			break;
> 
> Shouldn't this test be done the very first thing in the loop? It looks
> racy the way it's placed now, and it would incur a 1 sec stall if this
> was the only request currently being processed (as no completion
> of ane earlier request could signal completion).

Sure does. An earlier version of this (not posted), had this check right
before going in the loop as all of the requests might have been already
processed.

I accidently dropped that logic as I moved this whole code into a function.


  reply	other threads:[~2011-10-17 16:53 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-10 15:28 [PATCH] Xen block fixes, secure discard, and barrier support for 3.2 (v1) Konrad Rzeszutek Wilk
2011-10-10 15:28 ` [PATCH 1/3] xen/blkback: Support 'feature-barrier' aka old-style BARRIER requests Konrad Rzeszutek Wilk
2011-10-17 11:36   ` Jan Beulich
2011-10-17 11:36     ` Jan Beulich
2011-10-17 16:50     ` Konrad Rzeszutek Wilk
2011-10-17 12:27   ` Jan Beulich
2011-10-17 12:27     ` Jan Beulich
2011-10-17 16:52     ` Konrad Rzeszutek Wilk [this message]
2011-10-10 15:28 ` [PATCH 2/3] xen/blkback: Fix the inhibition to map pages when discarding sector ranges Konrad Rzeszutek Wilk
2011-10-10 15:28   ` Konrad Rzeszutek Wilk
2011-10-11  7:25   ` Jan Beulich
2011-10-11  7:25     ` Jan Beulich
     [not found]   ` <4E940B99020000780005AA12@victor.provo.novell.com>
2011-10-11  7:33     ` Li Dongyang
2011-10-11 18:39       ` [Xen-devel] " Konrad Rzeszutek Wilk
2011-10-11 20:50         ` Konrad Rzeszutek Wilk
2011-10-12 10:18           ` Jan Beulich
2011-10-12 10:18             ` Jan Beulich
2011-10-12 10:30           ` Ian Campbell
2011-10-10 15:28 ` [PATCH 3/3] xen/blk[front|back]: Enhance discard support with secure erasing support Konrad Rzeszutek Wilk
2011-10-10 16:13   ` [Xen-devel] " Ian Campbell
2011-10-10 16:42     ` Konrad Rzeszutek Wilk
2011-10-10 17:53       ` Konrad Rzeszutek Wilk
2011-10-10 19:19         ` Ian Campbell
2011-10-10 19:20       ` Ian Campbell
2011-10-10 19:57         ` Konrad Rzeszutek Wilk
2011-10-11  7:36           ` Jan Beulich
2011-10-11  7:36             ` Jan Beulich
2011-10-11  8:09             ` [Xen-devel] " Ian Campbell
2011-10-11 15:51             ` Konrad Rzeszutek Wilk
2011-10-11 20:57               ` Konrad Rzeszutek Wilk
2011-10-12 10:54                 ` Ian Campbell
2011-10-12 15:45                   ` Konrad Rzeszutek Wilk
2011-10-12 16:14                     ` Ian Campbell
2011-10-12 17:21                       ` Konrad Rzeszutek Wilk
2011-10-17 13:23                 ` Jan Beulich
2011-10-17 13:23                   ` Jan Beulich
2011-10-21  0:06                   ` [Xen-devel] " Konrad Rzeszutek Wilk
     [not found]                 ` <4E9C4855020000780005BA73@victor.provo.novell.com>
2011-10-20  3:17                   ` Li Dongyang
2011-10-20  3:46                     ` Konrad Rzeszutek Wilk

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=20111017165247.GB19724@phenom.dumpdata.com \
    --to=konrad.wilk@oracle.com \
    --cc=JBeulich@suse.com \
    --cc=hch@infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=xen-devel@lists.xensource.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.