[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen-unstable] stubdom: optimize block io completion polling by not polling all the



# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1202980994 0
# Node ID c1003b9e0bb8a32ab61f82026aa4c9284d81ece5
# Parent  b9b6caf06f8c355fcc79a1cd9bfff883167751b8
stubdom: optimize block io completion polling by not polling all the
time; only when some requests have completed.

Signed-off-by: Samuel Thibault <samuel.thibault@xxxxxxxxxxxxx>
---
 extras/mini-os/blkfront.c |    5 +++++
 tools/ioemu/block-vbd.c   |   10 +++++++---
 2 files changed, 12 insertions(+), 3 deletions(-)

diff -r b9b6caf06f8c -r c1003b9e0bb8 extras/mini-os/blkfront.c
--- a/extras/mini-os/blkfront.c Thu Feb 14 09:22:33 2008 +0000
+++ b/extras/mini-os/blkfront.c Thu Feb 14 09:23:14 2008 +0000
@@ -327,6 +327,11 @@ int blkfront_aio_poll(struct blkfront_de
     struct blkif_response *rsp;
 
 moretodo:
+#ifdef HAVE_LIBC
+    files[dev->fd].read = 0;
+    mb(); /* Make sure to let the handler set read to 1 before we start 
looking at the ring */
+#endif
+
     rp = dev->ring.sring->rsp_prod;
     rmb(); /* Ensure we see queued responses up to 'rp'. */
     cons = dev->ring.rsp_cons;
diff -r b9b6caf06f8c -r c1003b9e0bb8 tools/ioemu/block-vbd.c
--- a/tools/ioemu/block-vbd.c   Thu Feb 14 09:22:33 2008 +0000
+++ b/tools/ioemu/block-vbd.c   Thu Feb 14 09:23:14 2008 +0000
@@ -67,6 +67,12 @@ static int vbd_probe(const uint8_t *buf,
     return 100;
 }
 
+static void vbd_io_completed(void *opaque)
+{
+    BDRVVbdState *s = opaque;
+    blkfront_aio_poll(s->dev);
+}
+
 static int vbd_open(BlockDriverState *bs, const char *filename, int flags)
 {
     BDRVVbdState *s = bs->opaque;
@@ -85,6 +91,7 @@ static int vbd_open(BlockDriverState *bs
     }
 
     s->fd = blkfront_open(s->dev);
+    qemu_set_fd_handler(s->fd, vbd_io_completed, NULL, s);
 
     QEMU_LIST_INSERT_HEAD(&vbds, s, list);
 
@@ -102,9 +109,6 @@ void qemu_aio_init(void)
 
 void qemu_aio_poll(void)
 {
-    BDRVVbdState *s;
-    for (s = vbds.lh_first; s; s = s->list.le_next)
-       blkfront_aio_poll(s->dev);
 }
 
 /* Wait for all IO requests to complete.  */

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.