[PATCH 2/4] qemu: Implement the aio mode io_uring

Han Han hhan at redhat.com
Sat Apr 18 15:57:52 UTC 2020


This aio mode was added since Linux 5.1[1], QEMU 5.0.0[2], which will
deliever faster and more efficient I/O operations for the file,
host_device, host_cdrom backends.

Reference:
[1]: https://lwn.net/Articles/810414/
[2]: https://lists.gnu.org/archive/html/qemu-devel/2020-01/msg07686.html

Signed-off-by: Han Han <hhan at redhat.com>
---
 src/conf/domain_conf.c  | 1 +
 src/conf/domain_conf.h  | 1 +
 src/qemu/qemu_command.c | 8 ++++++++
 3 files changed, 10 insertions(+)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 8700d567..bcaed3ef 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -361,6 +361,7 @@ VIR_ENUM_IMPL(virDomainDiskIo,
               "default",
               "native",
               "threads",
+              "io_uring",
 );
 
 VIR_ENUM_IMPL(virDomainDeviceSGIO,
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index aad3f82d..9f36d3d9 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -421,6 +421,7 @@ typedef enum {
     VIR_DOMAIN_DISK_IO_DEFAULT = 0,
     VIR_DOMAIN_DISK_IO_NATIVE,
     VIR_DOMAIN_DISK_IO_THREADS,
+    VIR_DOMAIN_DISK_IO_URING,
 
     VIR_DOMAIN_DISK_IO_LAST
 } virDomainDiskIo;
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 95402fc4..45dd8307 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -1435,6 +1435,14 @@ qemuCheckDiskConfig(virDomainDiskDefPtr disk,
                            _("detect_zeroes is not supported by this QEMU binary"));
             return -1;
         }
+
+        if (disk->iomode == VIR_DOMAIN_DISK_IO_URING) {
+            if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_AIO_IO_URING)) {
+                virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+                               _("io uring is not supported by this QEMU binary"));
+                return -1;
+            }
+        }
     }
 
     if (disk->serial &&
-- 
2.25.0




More information about the libvir-list mailing list