Enforce the 'writeback' cache setting for an EFI disk with RBD driver
to work around issue #3229. See also commit 6aaad230 ("fix #3329: turn
on cache=writeback for efidisks on rbd").

Signed-off-by: Fiona Ebner <f.eb...@proxmox.com>
---
 src/PVE/QemuServer/Blockdev.pm | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/src/PVE/QemuServer/Blockdev.pm b/src/PVE/QemuServer/Blockdev.pm
index f799a950..f096f9d1 100644
--- a/src/PVE/QemuServer/Blockdev.pm
+++ b/src/PVE/QemuServer/Blockdev.pm
@@ -128,7 +128,14 @@ sub generate_file_blockdev {
         $scfg = PVE::Storage::storage_config($storecfg, $storeid);
     }
 
-    $blockdev->{cache} = generate_blockdev_drive_cache($drive, $scfg);
+    # SPI flash does lots of read-modify-write OPs, without writeback this 
gets really slow #3329
+    # It also needs the rbd_cache_policy set to 'writeback' on the RBD side, 
which is done by the
+    # storage layer.
+    if ($blockdev->{driver} eq 'rbd' && $drive->{interface} eq 'efidisk') {
+        $blockdev->{cache} = { direct => JSON::false, 'no-flush' => 
JSON::false };
+    } else {
+        $blockdev->{cache} = generate_blockdev_drive_cache($drive, $scfg);
+    }
 
     my $driver = $blockdev->{driver};
     # only certain drivers have the aio setting
-- 
2.47.2



_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel

Reply via email to