]> rtime.felk.cvut.cz Git - lisovros/qemu_apohw.git/commitdiff
aio: make aio_poll(ctx, true) block with no fds
authorStefan Hajnoczi <stefanha@redhat.com>
Tue, 26 Nov 2013 15:18:01 +0000 (16:18 +0100)
committerStefan Hajnoczi <stefanha@redhat.com>
Fri, 6 Dec 2013 15:53:51 +0000 (16:53 +0100)
This patch drops a special case where aio_poll(ctx, true) returns false
instead of blocking if no file descriptors are waiting on I/O.  Now it
is possible to block in aio_poll() to wait for aio_notify().

This change eliminates busy waiting.  bdrv_drain_all() used to rely on
busy waiting to completed throttled I/O requests but this is no longer
required so we can simplify aio_poll().

Note that aio_poll() still returns false when aio_notify() was used.  In
other words, stopping a blocking aio_poll() wait is not considered
making progress.

Adjust test-aio /aio/bh/callback-delete/one which assumed aio_poll(ctx,
true) would immediately return false instead of blocking.

Reviewed-by: Alex Bligh <alex@alex.org.uk>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
aio-posix.c
aio-win32.c
tests/test-aio.c

index bd06f33c7824184d56ccd7e6149cc1fa1e56448d..f921d4f538337c30e58abd7f1b3565c79c155ff4 100644 (file)
@@ -217,11 +217,6 @@ bool aio_poll(AioContext *ctx, bool blocking)
 
     ctx->walking_handlers--;
 
-    /* early return if we only have the aio_notify() fd */
-    if (ctx->pollfds->len == 1) {
-        return progress;
-    }
-
     /* wait until next event */
     ret = qemu_poll_ns((GPollFD *)ctx->pollfds->data,
                          ctx->pollfds->len,
index f9cfbb75aca8ad9af7b50fc0338065f286dc81f8..23f4e5ba19755bd9c743d6eaa3e2200bebfa4bec 100644 (file)
@@ -161,11 +161,6 @@ bool aio_poll(AioContext *ctx, bool blocking)
 
     ctx->walking_handlers--;
 
-    /* early return if we only have the aio_notify() fd */
-    if (count == 1) {
-        return progress;
-    }
-
     /* wait until next event */
     while (count > 0) {
         int ret;
index c4fe0fc3b7b749af3ccc4e6c2c616f3cf1323034..592721ed3f6d05299b8ad067d71f85196a5413eb 100644 (file)
@@ -195,7 +195,6 @@ static void test_bh_delete_from_cb(void)
     g_assert(data1.bh == NULL);
 
     g_assert(!aio_poll(ctx, false));
-    g_assert(!aio_poll(ctx, true));
 }
 
 static void test_bh_delete_from_cb_many(void)