qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] qemu and qemu-xen: support empty write barriers in xen_disk
@ 2010-11-24 13:08 Stefano Stabellini
  2010-11-24 14:23 ` Gerd Hoffmann
  2010-11-24 16:58 ` Christoph Hellwig
  0 siblings, 2 replies; 15+ messages in thread
From: Stefano Stabellini @ 2010-11-24 13:08 UTC (permalink / raw)
  To: xen-devel; +Cc: qemu-devel

Hi all,
this patch can be applied to both qemu-xen and qemu and adds support
for empty write barriers to xen_disk.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>

diff --git a/hw/xen_disk.c b/hw/xen_disk.c
index 38b5fbf..94af001 100644
--- a/hw/xen_disk.c
+++ b/hw/xen_disk.c
@@ -182,6 +182,10 @@ static int ioreq_parse(struct ioreq *ioreq)
 	ioreq->prot = PROT_WRITE; /* to memory */
 	break;
     case BLKIF_OP_WRITE_BARRIER:
+        if (!ioreq->req.nr_segments) {
+            ioreq->presync = 1;
+            return 0;
+        }
 	if (!syncwrite)
 	    ioreq->presync = ioreq->postsync = 1;
 	/* fall through */
@@ -306,7 +310,7 @@ static int ioreq_runio_qemu_sync(struct ioreq *ioreq)
     int i, rc, len = 0;
     off_t pos;
 
-    if (ioreq_map(ioreq) == -1)
+    if (ioreq->req.nr_segments && ioreq_map(ioreq) == -1)
 	goto err;
     if (ioreq->presync)
 	bdrv_flush(blkdev->bs);
@@ -330,6 +334,8 @@ static int ioreq_runio_qemu_sync(struct ioreq *ioreq)
 	break;
     case BLKIF_OP_WRITE:
     case BLKIF_OP_WRITE_BARRIER:
+        if (!ioreq->req.nr_segments)
+            break;
 	pos = ioreq->start;
 	for (i = 0; i < ioreq->v.niov; i++) {
 	    rc = bdrv_write(blkdev->bs, pos / BLOCK_SIZE,
@@ -387,7 +393,7 @@ static int ioreq_runio_qemu_aio(struct ioreq *ioreq)
 {
     struct XenBlkDev *blkdev = ioreq->blkdev;
 
-    if (ioreq_map(ioreq) == -1)
+    if (ioreq->req.nr_segments && ioreq_map(ioreq) == -1)
 	goto err;
 
     ioreq->aio_inflight++;
@@ -404,6 +410,8 @@ static int ioreq_runio_qemu_aio(struct ioreq *ioreq)
     case BLKIF_OP_WRITE:
     case BLKIF_OP_WRITE_BARRIER:
         ioreq->aio_inflight++;
+        if (!ioreq->req.nr_segments)
+            break;
         bdrv_aio_writev(blkdev->bs, ioreq->start / BLOCK_SIZE,
                         &ioreq->v, ioreq->v.size / BLOCK_SIZE,
                         qemu_aio_complete, ioreq);

^ permalink raw reply related	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2010-12-14 18:43 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-11-24 13:08 [Qemu-devel] [PATCH] qemu and qemu-xen: support empty write barriers in xen_disk Stefano Stabellini
2010-11-24 14:23 ` Gerd Hoffmann
2010-11-24 16:29   ` Kevin Wolf
2010-11-24 16:46     ` Stefano Stabellini
2010-12-14 18:43   ` [Xen-devel] " Ian Jackson
2010-11-24 16:58 ` Christoph Hellwig
2010-11-24 18:18   ` [Xen-devel] " Jeremy Fitzhardinge
2010-11-24 18:44     ` Christoph Hellwig
2010-11-24 19:55       ` Stefano Stabellini
2010-11-26 11:03       ` Kevin Wolf
2010-11-26 13:29         ` Christoph Hellwig
2010-11-26 15:25         ` Stefano Stabellini
     [not found]     ` <m2n.s.1PLKM9-000VR4@chiark.greenend.org.uk>
2010-11-25 19:30       ` Ian Jackson
2010-11-25 19:46         ` Jeremy Fitzhardinge
2010-11-25 23:30           ` Christoph Hellwig

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).