diff options
author | Paolo Bonzini <pbonzini@redhat.com> | 2011-09-08 14:28:59 +0200 |
---|---|---|
committer | Paolo Bonzini <pbonzini@redhat.com> | 2011-12-22 11:53:57 +0100 |
commit | ae255e523c256cf0708f1c16cb946ff96340a800 (patch) | |
tree | fbc4e2309f43d337ed7ce0c1c7e3582a6008fa5c /nbd.c | |
parent | 8c5135f90e2dcf1d5c3d03106e0ac6e371ccb572 (diff) | |
download | qemu-ae255e523c256cf0708f1c16cb946ff96340a800.zip qemu-ae255e523c256cf0708f1c16cb946ff96340a800.tar.gz qemu-ae255e523c256cf0708f1c16cb946ff96340a800.tar.bz2 |
nbd: switch to asynchronous operation
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'nbd.c')
-rw-r--r-- | nbd.c | 8 |
1 files changed, 8 insertions, 0 deletions
@@ -81,6 +81,14 @@ size_t nbd_wr_sync(int fd, void *buffer, size_t size, bool do_read) { size_t offset = 0; + if (qemu_in_coroutine()) { + if (do_read) { + return qemu_co_recv(fd, buffer, size); + } else { + return qemu_co_send(fd, buffer, size); + } + } + while (offset < size) { ssize_t len; |