From: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
To: Jan Beulich <JBeulich@suse.com>
Cc: Jeremy Fitzhardinge <jeremy@goop.org>,
hch@infradead.org, Jan Kara <jack@suse.cz>,
linux-kernel@vger.kernel.org
Subject: Re: Help with implementing some form of barriers in 3.0 kernels.
Date: Wed, 14 Sep 2011 10:32:47 -0400 [thread overview]
Message-ID: <20110914143247.GA17206@phenom.oracle.com> (raw)
In-Reply-To: <4E708C240200007800055FDF@nat28.tlf.novell.com>
> > + if (drain) {
> > + struct request_queue *q = bdev_get_queue(preq.bdev);
> > + unsigned long flags;
> > +
> > + /* Emulate the original behavior of write barriers */
> > + spin_lock_irqsave(q->queue_lock, flags);
> > + elv_drain_elevator(q);
> > + __blk_run_queue(q);
> > + spin_unlock_irqrestore(q->queue_lock, flags);
> > + }
I also had to add:
diff --git a/drivers/block/xen-blkback/blkback.c b/drivers/block/xen-blkback/blkback.c
index eaf49d1..20fddbc 100644
--- a/drivers/block/xen-blkback/blkback.c
+++ b/drivers/block/xen-blkback/blkback.c
@@ -679,6 +679,10 @@ static int dispatch_rw_block_io(struct xen_blkif *blkif,
struct request_queue *q = bdev_get_queue(preq.bdev);
unsigned long flags;
+ if (!q->elevator) {
+ __end_block_io_op(pending_req, -EOPNOTSUPP);
+ return -EOPNOTSUPP;
+ }
/* Emulate the original behavior of write barriers */
spin_lock_irqsave(q->queue_lock, flags);
elv_drain_elevator(q);
diff --git a/drivers/block/xen-blkback/common.h b/drivers/block/xen-blkback/common.h
index 52d8893..722714a 100644
--- a/drivers/block/xen-blkback/common.h
+++ b/drivers/block/xen-blkback/common.h
@@ -157,6 +157,7 @@ struct xen_vbd {
/* Cached size parameter. */
sector_t size;
bool flush_support;
+ bool barrier_support;
};
struct backend_info;
diff --git a/drivers/block/xen-blkback/xenbus.c b/drivers/block/xen-blkback/xenbus.c
index da1e27a..7189ecd 100644
--- a/drivers/block/xen-blkback/xenbus.c
+++ b/drivers/block/xen-blkback/xenbus.c
@@ -384,6 +384,9 @@ static int xen_vbd_create(struct xen_blkif *blkif, blkif_vdev_t handle,
if (q && q->flush_flags)
vbd->flush_support = true;
+ if (q && q->elevator && q->elevator->ops)
+ vbd->barrier_support = true;
+
DPRINTK("Successful creation of handle=%04x (dom=%u)\n",
handle, blkif->domid);
return 0;
@@ -728,7 +731,7 @@ again:
if (err)
goto abort;
- err = xen_blkbk_barrier(xbt, be, be->blkif->vbd.flush_support);
+ err = xen_blkbk_barrier(xbt, be, be->blkif->vbd.barrier_support);
err = xen_blkbk_discard(xbt, be);
Otherwise it would crash.. Thought I am not sure why the elevator is not
set (the guest is on a LVM LV).
next prev parent reply other threads:[~2011-09-14 14:33 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-09-07 17:48 Help with implementing some form of barriers in 3.0 kernels Konrad Rzeszutek Wilk
2011-09-07 18:17 ` Vivek Goyal
2011-09-07 18:27 ` Konrad Rzeszutek Wilk
2011-09-07 18:36 ` Vivek Goyal
2011-09-07 20:16 ` Christoph Hellwig
2011-09-07 21:31 ` Vivek Goyal
2011-09-08 8:22 ` Christoph Hellwig
2011-09-08 8:02 ` Jan Beulich
2011-09-08 8:08 ` Christoph Hellwig
2011-09-13 10:44 ` Jan Beulich
2011-09-14 8:59 ` Konrad Rzeszutek Wilk
2011-09-14 9:12 ` Jan Beulich
2011-09-14 9:30 ` Konrad Rzeszutek Wilk
2011-09-14 10:15 ` Jan Beulich
2011-09-14 14:32 ` Konrad Rzeszutek Wilk [this message]
2011-09-14 15:01 ` [PATCH]: xen/blkback: Add support for old BARRIER requests - 'feature-barrier', was "Help with implementing some form of barriers in 3.0 kernels." Konrad Rzeszutek Wilk
2011-09-14 16:13 ` Jan Beulich
2011-09-15 12:51 ` Konrad Rzeszutek Wilk
2011-09-15 13:00 ` Jan Beulich
2011-09-15 14:21 ` Konrad Rzeszutek Wilk
2011-09-15 15:13 ` Jan Kara
2011-09-15 15:15 ` Christoph Hellwig
2011-09-16 9:24 ` Konrad Rzeszutek Wilk
2011-09-15 13:24 ` Jan Kara
2011-09-14 15:34 ` Help with implementing some form of barriers in 3.0 kernels 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=20110914143247.GA17206@phenom.oracle.com \
--to=konrad.wilk@oracle.com \
--cc=JBeulich@suse.com \
--cc=hch@infradead.org \
--cc=jack@suse.cz \
--cc=jeremy@goop.org \
--cc=linux-kernel@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