From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:43069) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UGWLe-0008RB-E4 for qemu-devel@nongnu.org; Fri, 15 Mar 2013 11:15:14 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UGWLT-0004Cd-24 for qemu-devel@nongnu.org; Fri, 15 Mar 2013 11:15:10 -0400 Received: from mx1.redhat.com ([209.132.183.28]:27487) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UGWLS-0004C4-RJ for qemu-devel@nongnu.org; Fri, 15 Mar 2013 11:14:59 -0400 From: Stefan Hajnoczi Date: Fri, 15 Mar 2013 16:14:13 +0100 Message-Id: <1363360465-5247-17-git-send-email-stefanha@redhat.com> In-Reply-To: <1363360465-5247-1-git-send-email-stefanha@redhat.com> References: <1363360465-5247-1-git-send-email-stefanha@redhat.com> Subject: [Qemu-devel] [PATCH 16/28] sheepdog: use non-blocking fd in coroutine context List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Anthony Liguori From: MORITA Kazutaka Using a blocking socket in the coroutine context reduces the chance of switching to other work. This patch makes the sheepdog driver use a non-blocking fd always. Signed-off-by: MORITA Kazutaka Signed-off-by: Stefan Hajnoczi --- block/sheepdog.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/block/sheepdog.c b/block/sheepdog.c index c711c28..27abef2 100644 --- a/block/sheepdog.c +++ b/block/sheepdog.c @@ -468,6 +468,8 @@ static int connect_to_sdog(BDRVSheepdogState *s) if (err != NULL) { qerror_report_err(err); error_free(err); + } else { + socket_set_nonblock(fd); } return fd; @@ -523,7 +525,6 @@ static coroutine_fn void do_co_req(void *opaque) co = qemu_coroutine_self(); qemu_aio_set_fd_handler(sockfd, NULL, restart_co_req, NULL, co); - socket_set_block(sockfd); ret = send_co_req(sockfd, hdr, data, wlen); if (ret < 0) { goto out; @@ -553,7 +554,6 @@ static coroutine_fn void do_co_req(void *opaque) ret = 0; out: qemu_aio_set_fd_handler(sockfd, NULL, NULL, NULL, NULL); - socket_set_nonblock(sockfd); srco->ret = ret; srco->finished = true; @@ -776,8 +776,6 @@ static int get_sheep_fd(BDRVSheepdogState *s) return fd; } - socket_set_nonblock(fd); - qemu_aio_set_fd_handler(fd, co_read_response, NULL, aio_flush_request, s); return fd; } -- 1.8.1.4