From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40545) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZICF1-0002vF-Hj for qemu-devel@nongnu.org; Thu, 23 Jul 2015 04:52:38 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZICF0-0007Xk-J0 for qemu-devel@nongnu.org; Thu, 23 Jul 2015 04:52:35 -0400 From: Fam Zheng Date: Thu, 23 Jul 2015 14:32:14 +0800 Message-Id: <1437633138-29188-8-git-send-email-famz@redhat.com> In-Reply-To: <1437633138-29188-1-git-send-email-famz@redhat.com> References: <1437633138-29188-1-git-send-email-famz@redhat.com> Subject: [Qemu-devel] [RFC PATCH 07/11] aio: Mark ctx->notifier's client type as "context" List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: kwolf@redhat.com, pbonzini@redhat.com, stefanha@redhat.com, qemu-block@nongnu.org It is important to include this for any blocking poll, on the other hand it is also OK to exclude it otherwise. Signed-off-by: Fam Zheng --- aio-posix.c | 3 +++ aio-win32.c | 3 +++ async.c | 4 ++-- include/block/aio.h | 1 + 4 files changed, 9 insertions(+), 2 deletions(-) diff --git a/aio-posix.c b/aio-posix.c index fca905f..4c0328b 100644 --- a/aio-posix.c +++ b/aio-posix.c @@ -247,6 +247,9 @@ bool aio_poll_clients(AioContext *ctx, bool blocking, int client_mask) bool progress; int64_t timeout; + /* Blocking poll must handle waking up. */ + assert(!blocking || (client_mask & AIO_CLIENT_CONTEXT)); + aio_context_acquire(ctx); progress = false; diff --git a/aio-win32.c b/aio-win32.c index c925085..036eeac 100644 --- a/aio-win32.c +++ b/aio-win32.c @@ -303,6 +303,9 @@ bool aio_poll_clients(AioContext *ctx, bool blocking, int client_mask) int count; int timeout; + /* Blocking poll must handle waking up. */ + assert(!blocking || (client_mask & AIO_CLIENT_CONTEXT)); + aio_context_acquire(ctx); progress = false; diff --git a/async.c b/async.c index 43f9425..0bea602 100644 --- a/async.c +++ b/async.c @@ -231,7 +231,7 @@ aio_ctx_finalize(GSource *source) AioContext *ctx = (AioContext *) source; thread_pool_free(ctx->thread_pool); - aio_set_event_notifier(ctx, &ctx->notifier, AIO_CLIENT_UNSPECIFIED, NULL); + aio_set_event_notifier(ctx, &ctx->notifier, AIO_CLIENT_CONTEXT, NULL); event_notifier_cleanup(&ctx->notifier); rfifolock_destroy(&ctx->lock); qemu_mutex_destroy(&ctx->bh_lock); @@ -306,7 +306,7 @@ AioContext *aio_context_new(Error **errp) } g_source_set_can_recurse(&ctx->source, true); aio_set_event_notifier(ctx, &ctx->notifier, - AIO_CLIENT_UNSPECIFIED, + AIO_CLIENT_CONTEXT, (EventNotifierHandler *) event_notifier_dummy_cb); ctx->thread_pool = NULL; diff --git a/include/block/aio.h b/include/block/aio.h index 088f9ce..4b53151 100644 --- a/include/block/aio.h +++ b/include/block/aio.h @@ -275,6 +275,7 @@ bool aio_dispatch(AioContext *ctx); #define AIO_CLIENT_UNSPECIFIED (1 << 0) #define AIO_CLIENT_PROTOCOL (1 << 1) #define AIO_CLIENT_NBD_SERVER (1 << 2) +#define AIO_CLIENT_CONTEXT (1 << 3) #define AIO_CLIENT_MASK_ALL -1 /* Progress in completing AIO work to occur. This can issue new pending -- 2.4.3