[pve-devel] [PATCH] use aio=native only with O_DIRECT (cache=none|directsync)

Alexandre Derumier aderumier at odiso.com
Thu Apr 2 08:11:25 CEST 2015


Currently qemu auto fallback to aio=threads if cache=none|directsync
It's better to handle that correctly

see:
https://bugzilla.redhat.com/show_bug.cgi?id=1086704

http://wiki.qemu.org/ChangeLog/2.3
Future incompatible changes:
Block device parameter aio=native has no effect without cache.direct=on. It will be made an error.

Signed-off-by: Alexandre Derumier <aderumier at odiso.com>
---
 PVE/QemuServer.pm |   11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm
index 50e896b..b5f308a 100644
--- a/PVE/QemuServer.pm
+++ b/PVE/QemuServer.pm
@@ -1230,8 +1230,15 @@ sub print_drive_full {
 	$opts .= ",$o=" . int($v*1024*1024) if $v;
     }
 
-    # use linux-aio by default (qemu default is threads)
-    $opts .= ",aio=native" if !$drive->{aio};
+    # aio native works only with O_DIRECT
+    if (!$drive->{aio}) {
+	if(!$drive->{cache} || $drive->{cache} eq 'none' || $drive->{cache} eq 'directsync') {
+	    $opts .= ",aio=native";
+	} else {
+	    $opts .= ",aio=threads";
+	}
+    }
+
 
     my $path;
     my $volid = $drive->{file};
-- 
1.7.10.4



More information about the pve-devel mailing list