aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp>2013-03-12 16:05:42 +0900
committerStefan Hajnoczi <stefanha@redhat.com>2013-03-15 16:07:50 +0100
commit0d6db300cd95339cec6b8ab2ef46bd7cdb040959 (patch)
tree0f76c2bd24d6573b42d3308c15312202e9151d89
parent381b487d54ba18c73df9db8452028a330058c505 (diff)
sheepdog: use non-blocking fd in coroutine context
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 <morita.kazutaka@lab.ntt.co.jp> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
-rw-r--r--block/sheepdog.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/block/sheepdog.c b/block/sheepdog.c
index c711c28613..27abef2129 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;
}