File xemu_uring-by-default.patch of Package xemu
diff --git a/block.c b/block.c
index e97ce0b1c8..1d43c3363c 100644
--- a/block.c
+++ b/block.c
@@ -1085,13 +1085,22 @@ static BlockdevDetectZeroesOptions bdrv_parse_detect_zeroes(QemuOpts *opts,
*/
int bdrv_parse_aio(const char *mode, int *flags)
{
+#ifdef CONFIG_LINUX_IO_URING
+ *flags |= BDRV_O_IO_URING;
+#endif
+
if (!strcmp(mode, "threads")) {
- /* do nothing, default */
+#ifdef CONFIG_LINUX_IO_URING
+ *flags &= ~BDRV_O_IO_URING;
+#endif
} else if (!strcmp(mode, "native")) {
+#ifdef CONFIG_LINUX_IO_URING
+ *flags &= ~BDRV_O_IO_URING;
+#endif
*flags |= BDRV_O_NATIVE_AIO;
#ifdef CONFIG_LINUX_IO_URING
} else if (!strcmp(mode, "io_uring")) {
- *flags |= BDRV_O_IO_URING;
+ /* do nothing, default */
#endif
} else {
return -1;
diff --git a/qemu-io.c b/qemu-io.c
index 57f07501df..ce3d5b43b4 100644
--- a/qemu-io.c
+++ b/qemu-io.c
@@ -166,6 +166,10 @@ static QemuOptsList empty_opts = {
static int open_f(BlockBackend *blk, int argc, char **argv)
{
int flags = BDRV_O_UNMAP;
+#ifdef CONFIG_LINUX_IO_URING
+ /* always start with trying to enable uring aio */
+ flags |= BDRV_O_IO_URING;
+#endif
int readonly = 0;
bool writethrough = true;
int c;
@@ -190,6 +194,10 @@ static int open_f(BlockBackend *blk, int argc, char **argv)
readonly = 1;
break;
case 'k':
+#ifdef CONFIG_LINUX_IO_URING
+ /* make sure one is disabled before the other */
+ flags &= ~BDRV_O_IO_URING;
+#endif
flags |= BDRV_O_NATIVE_AIO;
break;
case 't':