Patchwork [RFC,02/13] dataplane/virtio-blk: check exit conditions before aio_poll()

login
register
mail settings
Submitter Stefan Hajnoczi
Date April 11, 2013, 3:44 p.m.
Message ID <1365695085-27970-3-git-send-email-stefanha@redhat.com>
Download mbox | patch
Permalink /patch/235866/
State New
Headers show

Comments

Stefan Hajnoczi - April 11, 2013, 3:44 p.m.
Check exit conditions before entering blocking aio_poll().  This is
mainly for consistency since it's unlikely that we are stopping in the
first event loop iteration.

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
---
 hw/block/dataplane/virtio-blk.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Patch

diff --git a/hw/block/dataplane/virtio-blk.c b/hw/block/dataplane/virtio-blk.c
index 5baef23..982896c 100644
--- a/hw/block/dataplane/virtio-blk.c
+++ b/hw/block/dataplane/virtio-blk.c
@@ -378,9 +378,9 @@  static void *data_plane_thread(void *opaque)
 {
     VirtIOBlockDataPlane *s = opaque;
 
-    do {
+    while (!s->stopping || s->num_reqs > 0) {
         aio_poll(s->ctx, true);
-    } while (!s->stopping || s->num_reqs > 0);
+    }
     return NULL;
 }