]> git.proxmox.com Git - qemu-server.git/commitdiff
drive commandline: factor out checks if io_uring is allowed by default
authorFiona Ebner <f.ebner@proxmox.com>
Fri, 10 Feb 2023 14:19:10 +0000 (15:19 +0100)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Tue, 14 Feb 2023 09:09:04 +0000 (10:09 +0100)
while getting rid of the double negation.

In preparation to re-use the check for live disk cloning.

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
PVE/QemuServer.pm

index 6130fe82913992be80f04eda3f3abaa014db95e0..10d29a069e6319e77d2e4e2cdc4b7c1abcd77725 100644 (file)
@@ -1598,6 +1598,23 @@ sub get_initiator_name {
     return $initiator;
 }
 
+my sub storage_allows_io_uring_default {
+    my ($scfg, $cache_direct) = @_;
+
+    # io_uring with cache mode writeback or writethrough on krbd will hang...
+    return if $scfg && $scfg->{type} eq 'rbd' && $scfg->{krbd} && !$cache_direct;
+
+    # io_uring with cache mode writeback or writethrough on LVM will hang, without cache only
+    # sometimes, just plain disable...
+    return if $scfg && $scfg->{type} eq 'lvm';
+
+    # io_uring causes problems when used with CIFS since kernel 5.15
+    # Some discussion: https://www.spinics.net/lists/linux-cifs/msg26734.html
+    return if $scfg && $scfg->{type} eq 'cifs';
+
+    return 1;
+}
+
 sub print_drive_commandline_full {
     my ($storecfg, $vmid, $drive, $pbs_name, $io_uring) = @_;
 
@@ -1680,19 +1697,8 @@ sub print_drive_commandline_full {
        $cache_direct = 1;
     }
 
-    # io_uring with cache mode writeback or writethrough on krbd will hang...
-    my $rbd_no_io_uring = $scfg && $scfg->{type} eq 'rbd' && $scfg->{krbd} && !$cache_direct;
-
-    # io_uring with cache mode writeback or writethrough on LVM will hang, without cache only
-    # sometimes, just plain disable...
-    my $lvm_no_io_uring = $scfg && $scfg->{type} eq 'lvm';
-
-    # io_uring causes problems when used with CIFS since kernel 5.15
-    # Some discussion: https://www.spinics.net/lists/linux-cifs/msg26734.html
-    my $cifs_no_io_uring = $scfg && $scfg->{type} eq 'cifs';
-
     if (!$drive->{aio}) {
-       if ($io_uring && !$rbd_no_io_uring && !$lvm_no_io_uring && !$cifs_no_io_uring) {
+       if ($io_uring && storage_allows_io_uring_default($scfg, $cache_direct)) {
            # io_uring supports all cache modes
            $opts .= ",aio=io_uring";
        } else {