From: Aarushi Mehta <mehta.aaru20@gmail.com>
To: qemu-devel@nongnu.org
Cc: Fam Zheng <fam@euphon.net>, Kevin Wolf <kwolf@redhat.com>,
qemu-block@nongnu.org, Sergio Lopez <slp@redhat.com>,
Markus Armbruster <armbru@redhat.com>,
Maxim Levitsky <mlevitsk@redhat.com>,
saket.sinha89@gmail.com, Max Reitz <mreitz@redhat.com>,
Stefan Hajnoczi <stefanha@redhat.com>,
Paolo Bonzini <pbonzini@redhat.com>,
Stefan Hajnoczi <stefan@redhat.com>,
Julia Suvorova <jusual@mail.ru>,
Aarushi Mehta <mehta.aaru20@gmail.com>
Subject: [Qemu-devel] [PATCH v7 07/15] blockdev: adds bdrv_parse_aio to use io_uring
Date: Mon, 29 Jul 2019 20:46:43 +0530 [thread overview]
Message-ID: <20190729151651.21306-8-mehta.aaru20@gmail.com> (raw)
In-Reply-To: <20190729151651.21306-1-mehta.aaru20@gmail.com>
Signed-off-by: Aarushi Mehta <mehta.aaru20@gmail.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
---
block.c | 22 ++++++++++++++++++++++
blockdev.c | 12 ++++--------
include/block/block.h | 1 +
3 files changed, 27 insertions(+), 8 deletions(-)
diff --git a/block.c b/block.c
index cbd8da5f3b..401831e28d 100644
--- a/block.c
+++ b/block.c
@@ -844,6 +844,28 @@ static BlockdevDetectZeroesOptions bdrv_parse_detect_zeroes(QemuOpts *opts,
return detect_zeroes;
}
+/**
+ * Set open flags for aio engine
+ *
+ * Return 0 on success, -1 if the engine specified is invalid
+ */
+int bdrv_parse_aio(const char *mode, int *flags)
+{
+ if (!strcmp(mode, "threads")) {
+ /* do nothing, default */
+ } else if (!strcmp(mode, "native")) {
+ *flags |= BDRV_O_NATIVE_AIO;
+#ifdef CONFIG_LINUX_IO_URING
+ } else if (!strcmp(mode, "io_uring")) {
+ *flags |= BDRV_O_IO_URING;
+#endif
+ } else {
+ return -1;
+ }
+
+ return 0;
+}
+
/**
* Set open flags for a given discard mode
*
diff --git a/blockdev.c b/blockdev.c
index 4d141e9a1f..a41623ae9a 100644
--- a/blockdev.c
+++ b/blockdev.c
@@ -383,13 +383,9 @@ static void extract_common_blockdev_options(QemuOpts *opts, int *bdrv_flags,
}
if ((aio = qemu_opt_get(opts, "aio")) != NULL) {
- if (!strcmp(aio, "native")) {
- *bdrv_flags |= BDRV_O_NATIVE_AIO;
- } else if (!strcmp(aio, "threads")) {
- /* this is the default */
- } else {
- error_setg(errp, "invalid aio option");
- return;
+ if (bdrv_parse_aio(aio, bdrv_flags) < 0) {
+ error_setg(errp, "invalid aio option");
+ return;
}
}
}
@@ -4574,7 +4570,7 @@ QemuOptsList qemu_common_drive_opts = {
},{
.name = "aio",
.type = QEMU_OPT_STRING,
- .help = "host AIO implementation (threads, native)",
+ .help = "host AIO implementation (threads, native, io_uring)",
},{
.name = BDRV_OPT_CACHE_WB,
.type = QEMU_OPT_BOOL,
diff --git a/include/block/block.h b/include/block/block.h
index e29baa172c..ec6b9ea4c8 100644
--- a/include/block/block.h
+++ b/include/block/block.h
@@ -297,6 +297,7 @@ void bdrv_append(BlockDriverState *bs_new, BlockDriverState *bs_top,
void bdrv_replace_node(BlockDriverState *from, BlockDriverState *to,
Error **errp);
+int bdrv_parse_aio(const char *mode, int *flags);
int bdrv_parse_cache_mode(const char *mode, int *flags, bool *writethrough);
int bdrv_parse_discard_flags(const char *mode, int *flags);
BdrvChild *bdrv_open_child(const char *filename,
--
2.21.0
next prev parent reply other threads:[~2019-07-29 15:29 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-07-29 15:16 [Qemu-devel] [PATCH v7 00/15] Add support for io_uring Aarushi Mehta
2019-07-29 15:16 ` [Qemu-devel] [PATCH v7 01/15] configure: permit use of io_uring Aarushi Mehta
2019-07-29 15:16 ` [Qemu-devel] [PATCH v7 02/15] qapi/block-core: add option for io_uring Aarushi Mehta
2019-07-29 15:16 ` [Qemu-devel] [PATCH v7 03/15] block/block: add BDRV flag " Aarushi Mehta
2019-07-29 15:16 ` [Qemu-devel] [PATCH v7 04/15] block/io_uring: implements interfaces " Aarushi Mehta
2019-07-30 7:28 ` Stefan Hajnoczi
2019-07-29 15:16 ` [Qemu-devel] [PATCH v7 05/15] stubs: add stubs for io_uring interface Aarushi Mehta
2019-07-29 15:16 ` [Qemu-devel] [PATCH v7 06/15] util/async: add aio interfaces for io_uring Aarushi Mehta
2019-07-29 15:16 ` Aarushi Mehta [this message]
2019-07-29 15:16 ` [Qemu-devel] [PATCH v7 08/15] block/file-posix.c: extend to use io_uring Aarushi Mehta
2019-07-29 15:16 ` [Qemu-devel] [PATCH v7 09/15] block: add trace events for io_uring Aarushi Mehta
2019-07-29 15:16 ` [Qemu-devel] [PATCH v7 10/15] block/io_uring: adds userspace completion polling Aarushi Mehta
2019-07-29 15:16 ` [Qemu-devel] [PATCH v7 11/15] qemu-io: adds option to use aio engine Aarushi Mehta
2019-07-30 7:34 ` [Qemu-devel] [Qemu-block] " Stefan Hajnoczi
2019-07-29 15:16 ` [Qemu-devel] [PATCH v7 12/15] qemu-img: adds option to use aio engine for benchmarking Aarushi Mehta
2019-07-30 7:37 ` [Qemu-devel] [Qemu-block] " Stefan Hajnoczi
2019-07-29 15:16 ` [Qemu-devel] [PATCH v7 13/15] qemu-nbd: adds option for aio engines Aarushi Mehta
2019-07-30 7:38 ` Stefan Hajnoczi
2019-07-30 13:01 ` Eric Blake
2019-07-29 15:16 ` [Qemu-devel] [PATCH v7 14/15] tests/qemu-iotests: enable testing with aio options Aarushi Mehta
2019-07-30 7:41 ` [Qemu-devel] [Qemu-block] " Stefan Hajnoczi
2019-07-29 15:16 ` [Qemu-devel] [PATCH v7 15/15] tests/qemu-iotests: use AIOMODE with various tests Aarushi Mehta
2019-07-30 7:43 ` [Qemu-devel] [Qemu-block] " Stefan Hajnoczi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190729151651.21306-8-mehta.aaru20@gmail.com \
--to=mehta.aaru20@gmail.com \
--cc=armbru@redhat.com \
--cc=fam@euphon.net \
--cc=jusual@mail.ru \
--cc=kwolf@redhat.com \
--cc=mlevitsk@redhat.com \
--cc=mreitz@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=saket.sinha89@gmail.com \
--cc=slp@redhat.com \
--cc=stefan@redhat.com \
--cc=stefanha@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).