From 49110174f8835ec3d5ca7fc076ee1f51c18564fe Mon Sep 17 00:00:00 2001 From: Paolo Bonzini Date: Fri, 20 Feb 2015 17:26:51 +0100 Subject: AioContext: acquire/release AioContext during aio_poll This is the first step in pushing down acquire/release, and will let rfifolock drop the contention callback feature. Signed-off-by: Paolo Bonzini Reviewed-by: Stefan Hajnoczi Message-id: 1424449612-18215-3-git-send-email-pbonzini@redhat.com Signed-off-by: Stefan Hajnoczi Signed-off-by: Kevin Wolf --- aio-posix.c | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'aio-posix.c') diff --git a/aio-posix.c b/aio-posix.c index 296cd9b..4abec38 100644 --- a/aio-posix.c +++ b/aio-posix.c @@ -238,6 +238,7 @@ bool aio_poll(AioContext *ctx, bool blocking) bool progress; int64_t timeout; + aio_context_acquire(ctx); was_dispatching = ctx->dispatching; progress = false; @@ -267,7 +268,13 @@ bool aio_poll(AioContext *ctx, bool blocking) timeout = blocking ? aio_compute_timeout(ctx) : 0; /* wait until next event */ + if (timeout) { + aio_context_release(ctx); + } ret = qemu_poll_ns((GPollFD *)pollfds, npfd, timeout); + if (timeout) { + aio_context_acquire(ctx); + } /* if we have any readable fds, dispatch event */ if (ret > 0) { @@ -286,5 +293,7 @@ bool aio_poll(AioContext *ctx, bool blocking) } aio_set_dispatching(ctx, was_dispatching); + aio_context_release(ctx); + return progress; } -- cgit v1.1