aboutsummaryrefslogtreecommitdiff
path: root/block.c
diff options
context:
space:
mode:
authorAarushi Mehta <mehta.aaru20@gmail.com>2020-01-20 14:18:50 +0000
committerStefan Hajnoczi <stefanha@redhat.com>2020-01-30 20:59:41 +0000
commitf80f267373fd3170584da9d229ac07d4f26b7e16 (patch)
tree8961d4c96aa8970f1c2af50bf4320072d03221d1 /block.c
parentfcb7a4a4e8ae8938e86a669dd9c276ee98aa4203 (diff)
blockdev: adds bdrv_parse_aio to use io_uring
Signed-off-by: Aarushi Mehta <mehta.aaru20@gmail.com> Acked-by: Stefano Garzarella <sgarzare@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> Message-id: 20200120141858.587874-8-stefanha@redhat.com Message-Id: <20200120141858.587874-8-stefanha@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Diffstat (limited to 'block.c')
-rw-r--r--block.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/block.c b/block.c
index ecd09dbbfd..6c2b2bd2e2 100644
--- a/block.c
+++ b/block.c
@@ -846,6 +846,28 @@ static BlockdevDetectZeroesOptions bdrv_parse_detect_zeroes(QemuOpts *opts,
}
/**
+ * 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
*
* Return 0 on success, -1 if the discard mode was invalid.