From f80f267373fd3170584da9d229ac07d4f26b7e16 Mon Sep 17 00:00:00 2001 From: Aarushi Mehta Date: Mon, 20 Jan 2020 14:18:50 +0000 Subject: blockdev: adds bdrv_parse_aio to use io_uring Signed-off-by: Aarushi Mehta Acked-by: Stefano Garzarella Signed-off-by: Stefan Hajnoczi Message-id: 20200120141858.587874-8-stefanha@redhat.com Message-Id: <20200120141858.587874-8-stefanha@redhat.com> Signed-off-by: Stefan Hajnoczi --- block.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'block.c') diff --git a/block.c b/block.c index ecd09dbbfd..6c2b2bd2e2 100644 --- a/block.c +++ b/block.c @@ -845,6 +845,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 * -- cgit v1.2.3