summaryrefslogtreecommitdiff
path: root/nbd/common.c
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2017-02-13 14:52:24 +0100
committerStefan Hajnoczi <stefanha@redhat.com>2017-02-21 11:14:08 +0000
commitff82911cd3f69f028f2537825c9720ff78bc3f19 (patch)
tree68ea48537278208b0246e42061fcf2ac9b22cf1d /nbd/common.c
parentc4c497d27f0be8552ae244e76ba2bce66bd2443e (diff)
downloadqemu-ff82911cd3f69f028f2537825c9720ff78bc3f19.tar.gz
nbd: convert to use qio_channel_yield
In the client, read the reply headers from a coroutine, switching the read side between the "read header" coroutine and the I/O coroutine that reads the body of the reply. In the server, if the server can read more requests it will create a new "read request" coroutine as soon as a request has been read. Otherwise, the new coroutine is created in nbd_request_put. Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Reviewed-by: Fam Zheng <famz@redhat.com> Reviewed-by: Daniel P. Berrange <berrange@redhat.com> Message-id: 20170213135235.12274-8-pbonzini@redhat.com Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Diffstat (limited to 'nbd/common.c')
-rw-r--r--nbd/common.c9
1 files changed, 1 insertions, 8 deletions
diff --git a/nbd/common.c b/nbd/common.c
index a5f39ea58e..dccbb8e9de 100644
--- a/nbd/common.c
+++ b/nbd/common.c
@@ -43,14 +43,7 @@ ssize_t nbd_wr_syncv(QIOChannel *ioc,
}
if (len == QIO_CHANNEL_ERR_BLOCK) {
if (qemu_in_coroutine()) {
- /* XXX figure out if we can create a variant on
- * qio_channel_yield() that works with AIO contexts
- * and consider using that in this branch */
- qemu_coroutine_yield();
- } else if (done) {
- /* XXX this is needed by nbd_reply_ready. */
- qio_channel_wait(ioc,
- do_read ? G_IO_IN : G_IO_OUT);
+ qio_channel_yield(ioc, do_read ? G_IO_IN : G_IO_OUT);
} else {
return -EAGAIN;
}