From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52051) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZKJCP-0002H5-7F for qemu-devel@nongnu.org; Wed, 29 Jul 2015 00:42:38 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZKJCO-00051f-8R for qemu-devel@nongnu.org; Wed, 29 Jul 2015 00:42:37 -0400 From: Fam Zheng Date: Wed, 29 Jul 2015 12:42:07 +0800 Message-Id: <1438144934-23619-5-git-send-email-famz@redhat.com> In-Reply-To: <1438144934-23619-1-git-send-email-famz@redhat.com> References: <1438144934-23619-1-git-send-email-famz@redhat.com> Subject: [Qemu-devel] [PATCH v2 04/11] nbd: Mark fd handlers client type as "nbd server" 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 So we could distinguish it from "protocol" to avoid handling in nested aio polls. Signed-off-by: Fam Zheng --- include/block/aio.h | 1 + nbd.c | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/include/block/aio.h b/include/block/aio.h index d02ddfa..8b15105 100644 --- a/include/block/aio.h +++ b/include/block/aio.h @@ -274,6 +274,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_MASK_ALL -1 /* Progress in completing AIO work to occur. This can issue new pending diff --git a/nbd.c b/nbd.c index 64ed91b..7b38334 100644 --- a/nbd.c +++ b/nbd.c @@ -1437,7 +1437,7 @@ static void nbd_set_handlers(NBDClient *client) { if (client->exp && client->exp->ctx) { aio_set_fd_handler(client->exp->ctx, client->sock, - AIO_CLIENT_UNSPECIFIED, + AIO_CLIENT_NBD_SERVER, client->can_read ? nbd_read : NULL, client->send_coroutine ? nbd_restart_write : NULL, client); @@ -1448,7 +1448,7 @@ static void nbd_unset_handlers(NBDClient *client) { if (client->exp && client->exp->ctx) { aio_set_fd_handler(client->exp->ctx, client->sock, - AIO_CLIENT_UNSPECIFIED, NULL, NULL, NULL); + AIO_CLIENT_NBD_SERVER, NULL, NULL, NULL); } } -- 2.4.3