All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] stubdom: optimize block io completion polling
@ 2008-02-13 13:59 Samuel Thibault
  2008-02-13 15:57 ` Samuel Thibault
  0 siblings, 1 reply; 2+ messages in thread
From: Samuel Thibault @ 2008-02-13 13:59 UTC (permalink / raw)
  To: xen-devel

stubdom: optimize block io completion polling
by not polling all the time but just when some requests have completed.

Signed-off-by: Samuel Thibault <samuel.thibault@eu.citrix.com>

diff -r c9122280dd86 extras/mini-os/blkfront.c
--- a/extras/mini-os/blkfront.c	Wed Feb 13 12:13:42 2008 +0000
+++ b/extras/mini-os/blkfront.c	Wed Feb 13 13:56:48 2008 +0000
@@ -370,6 +370,10 @@ moretodo:
     RING_FINAL_CHECK_FOR_RESPONSES(&dev->ring, more);
     if (more) goto moretodo;
 
+#ifdef HAVE_LIBC
+    if (!nr_consumed)
+        files[dev->fd].read = 0;
+#endif
     return nr_consumed;
 }
 
diff -r c9122280dd86 tools/ioemu/block-vbd.c
--- a/tools/ioemu/block-vbd.c	Wed Feb 13 12:13:42 2008 +0000
+++ b/tools/ioemu/block-vbd.c	Wed Feb 13 13:56:48 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.  */

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

end of thread, other threads:[~2008-02-13 15:57 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-02-13 13:59 [PATCH] stubdom: optimize block io completion polling Samuel Thibault
2008-02-13 15:57 ` Samuel Thibault

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.