From: Daan De Meyer Date: Wed, 23 Oct 2024 09:50:15 +0000 (+0200) Subject: Set qemu drive caching options for qemu drives as well X-Git-Tag: v25~211 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=885f5cc8350ca139f28d72bd31b30fa871014042;p=thirdparty%2Fmkosi.git Set qemu drive caching options for qemu drives as well We already set these for the scratch device, let's make sure we set them for any drives we allocate as well. We also make sure the drive size is aligned to the page size so qemu can use O_DIRECT. --- diff --git a/mkosi/qemu.py b/mkosi/qemu.py index d2534d06f..511f41062 100644 --- a/mkosi/qemu.py +++ b/mkosi/qemu.py @@ -752,7 +752,7 @@ def finalize_drive(config: Config, drive: QemuDrive) -> Iterator[Path]: prefix=f"mkosi-drive-{drive.id}", ) as file: make_nocow(config, Path(file.name)) - file.truncate(drive.size) + file.truncate(round_up(drive.size, resource.getpagesize())) yield Path(file.name) @@ -1348,7 +1348,7 @@ def run_qemu(args: Args, config: Config) -> None: file = stack.enter_context(finalize_drive(config, drives[0])) for drive in drives: - arg = f"if=none,id={drive.id},file={file},format=raw,file.locking=off" + arg = f"if=none,id={drive.id},file={file},format=raw,file.locking=off,cache.writeback=on,cache.direct=on,cache.no-flush=yes,aio=io_uring" # noqa: E501 if drive.options: arg += f",{drive.options}"