[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 16/28] sheepdog: use non-blocking fd in coroutine co
From: |
Stefan Hajnoczi |
Subject: |
[Qemu-devel] [PATCH 16/28] sheepdog: use non-blocking fd in coroutine context |
Date: |
Fri, 15 Mar 2013 16:14:13 +0100 |
From: MORITA Kazutaka <address@hidden>
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 <address@hidden>
Signed-off-by: Stefan Hajnoczi <address@hidden>
---
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
- [Qemu-devel] [PATCH 01/28] block: Add options QDict to .bdrv_open(), (continued)
- [Qemu-devel] [PATCH 01/28] block: Add options QDict to .bdrv_open(), Stefan Hajnoczi, 2013/03/15
- [Qemu-devel] [PATCH 10/28] qcow2: flush refcount cache correctly in qcow2_write_snapshots(), Stefan Hajnoczi, 2013/03/15
- [Qemu-devel] [PATCH 11/28] qcow2: set L2 cache dependency in qcow2_alloc_bytes(), Stefan Hajnoczi, 2013/03/15
- [Qemu-devel] [PATCH 09/28] qcow2: flush refcount cache correctly in alloc_refcount_block(), Stefan Hajnoczi, 2013/03/15
- [Qemu-devel] [PATCH 07/28] block: Support driver specific options in drive_init(), Stefan Hajnoczi, 2013/03/15
- [Qemu-devel] [PATCH 14/28] qcow2: drop unnecessary flush in qcow2_update_snapshot_refcount(), Stefan Hajnoczi, 2013/03/15
- [Qemu-devel] [PATCH 06/28] blockdev: Keep a copy of DriveInfo.serial, Stefan Hajnoczi, 2013/03/15
- [Qemu-devel] [PATCH 12/28] qcow2: flush in qcow2_update_snapshot_refcount(), Stefan Hajnoczi, 2013/03/15
- [Qemu-devel] [PATCH 13/28] qcow2: drop flush in update_cluster_refcount(), Stefan Hajnoczi, 2013/03/15
- [Qemu-devel] [PATCH 15/28] qcow2: make is_allocated return true for zero clusters, Stefan Hajnoczi, 2013/03/15
- [Qemu-devel] [PATCH 16/28] sheepdog: use non-blocking fd in coroutine context,
Stefan Hajnoczi <=
- [Qemu-devel] [PATCH 17/28] sheepdog: set io_flush handler in do_co_req, Stefan Hajnoczi, 2013/03/15
- [Qemu-devel] [PATCH 19/28] threadpool: move globals into struct ThreadPool, Stefan Hajnoczi, 2013/03/15
- [Qemu-devel] [PATCH 20/28] threadpool: add thread_pool_new() and thread_pool_free(), Stefan Hajnoczi, 2013/03/15
- [Qemu-devel] [PATCH 22/28] block: add bdrv_get_aio_context(), Stefan Hajnoczi, 2013/03/15
- [Qemu-devel] [PATCH 18/28] main-loop: add qemu_get_aio_context(), Stefan Hajnoczi, 2013/03/15
- [Qemu-devel] [PATCH 21/28] aio: add a ThreadPool instance to AioContext, Stefan Hajnoczi, 2013/03/15
- [Qemu-devel] [PATCH 24/28] coroutine: use AioContext for CoQueue BH, Stefan Hajnoczi, 2013/03/15
- [Qemu-devel] [PATCH 25/28] dataplane: fix hang introduced by AioContext transition, Stefan Hajnoczi, 2013/03/15
- [Qemu-devel] [PATCH 26/28] qemu-iotests: add tests for rebasing zero clusters, Stefan Hajnoczi, 2013/03/15
- [Qemu-devel] [PATCH 28/28] blockdev: Fix up copyright and permission notice, Stefan Hajnoczi, 2013/03/15