From d3fa923044321b2ccc12bbdedd582d2c49d958aa Mon Sep 17 00:00:00 2001 From: Stefan Hajnoczi Date: Tue, 26 Nov 2013 16:18:01 +0100 Subject: aio: make aio_poll(ctx, true) block with no fds 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 Signed-off-by: Stefan Hajnoczi --- aio-win32.c | 5 ----- 1 file changed, 5 deletions(-) (limited to 'aio-win32.c') diff --git a/aio-win32.c b/aio-win32.c index f9cfbb75ac..23f4e5ba19 100644 --- a/aio-win32.c +++ b/aio-win32.c @@ -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; -- cgit 1.4.1