aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAarushi Mehta <mehta.aaru20@gmail.com>2020-01-20 14:18:56 +0000
committerStefan Hajnoczi <stefanha@redhat.com>2020-01-30 21:01:38 +0000
commit7680274da1357c559373c2e14e13f3a5bf4fa100 (patch)
treec4684b58b2ea2f6b2dad6b91db2e4e986aa2d2c3
parentcdd267749a3ab787e8b03f1971d1c7c147c8a47c (diff)
downloadqemu-7680274da1357c559373c2e14e13f3a5bf4fa100.zip
qemu-7680274da1357c559373c2e14e13f3a5bf4fa100.tar.gz
qemu-7680274da1357c559373c2e14e13f3a5bf4fa100.tar.bz2
qemu-nbd: adds option for aio engines
Signed-off-by: Aarushi Mehta <mehta.aaru20@gmail.com> Acked-by: Eric Blake <eblake@redhat.com> Acked-by: Stefano Garzarella <sgarzare@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> Message-id: 20200120141858.587874-14-stefanha@redhat.com Message-Id: <20200120141858.587874-14-stefanha@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
-rw-r--r--docs/interop/qemu-nbd.rst4
-rw-r--r--qemu-nbd.c12
2 files changed, 6 insertions, 10 deletions
diff --git a/docs/interop/qemu-nbd.rst b/docs/interop/qemu-nbd.rst
index 873bb9e..df7b6b9 100644
--- a/docs/interop/qemu-nbd.rst
+++ b/docs/interop/qemu-nbd.rst
@@ -108,8 +108,8 @@ driver options if ``--image-opts`` is specified.
.. option:: --aio=AIO
- Set the asynchronous I/O mode between ``threads`` (the default)
- and ``native`` (Linux only).
+ Set the asynchronous I/O mode between ``threads`` (the default),
+ ``native`` (Linux only), and ``io_uring`` (Linux 5.1+).
.. option:: --discard=DISCARD
diff --git a/qemu-nbd.c b/qemu-nbd.c
index 108a51f..db29a0d 100644
--- a/qemu-nbd.c
+++ b/qemu-nbd.c
@@ -135,7 +135,7 @@ static void usage(const char *name)
" '[ID_OR_NAME]'\n"
" -n, --nocache disable host cache\n"
" --cache=MODE set cache mode (none, writeback, ...)\n"
-" --aio=MODE set AIO mode (native or threads)\n"
+" --aio=MODE set AIO mode (native, io_uring or threads)\n"
" --discard=MODE set discard mode (ignore, unmap)\n"
" --detect-zeroes=MODE set detect-zeroes mode (off, on, unmap)\n"
" --image-opts treat FILE as a full set of image options\n"
@@ -726,13 +726,9 @@ int main(int argc, char **argv)
exit(EXIT_FAILURE);
}
seen_aio = true;
- if (!strcmp(optarg, "native")) {
- flags |= BDRV_O_NATIVE_AIO;
- } else if (!strcmp(optarg, "threads")) {
- /* this is the default */
- } else {
- error_report("invalid aio mode `%s'", optarg);
- exit(EXIT_FAILURE);
+ if (bdrv_parse_aio(optarg, &flags) < 0) {
+ error_report("Invalid aio mode '%s'", optarg);
+ exit(EXIT_FAILURE);
}
break;
case QEMU_NBD_OPT_DISCARD: