perf(quickemu): enable TRIM/discard and detect-zeroes for qcow2 drives
Signed-off-by: Martin Wimpress <martin@wimpress.org>
This commit is contained in:
parent
81b99feccd
commit
76b29c659c
17
quickemu
17
quickemu
|
|
@ -1871,6 +1871,9 @@ function vm_boot() {
|
|||
|
||||
# Add the disks
|
||||
# - https://turlucode.com/qemu-disk-io-performance-comparison-native-or-threads-windows-10-version/
|
||||
# Optimise disk I/O: enable TRIM/discard and zero detection for thin provisioning
|
||||
DRIVE_OPTIMISATIONS="discard=unmap,detect-zeroes=unmap"
|
||||
|
||||
if [[ "${boot}" == *"efi"* ]]; then
|
||||
QCOW2CODE=$(is_firmware_qcow2 "${EFI_CODE}")
|
||||
QCOW2VARS=$(is_firmware_qcow2 "${EFI_VARS}")
|
||||
|
|
@ -1971,13 +1974,13 @@ function vm_boot() {
|
|||
|
||||
# shellcheck disable=SC2054,SC2206
|
||||
args+=(-device ${MAC_DISK_DEV},drive=SystemDisk
|
||||
-drive id=SystemDisk,if=none,format=qcow2,file="${disk_img}" ${STATUS_QUO})
|
||||
-drive id=SystemDisk,if=none,format=qcow2,file="${disk_img}",${DRIVE_OPTIMISATIONS} ${STATUS_QUO})
|
||||
else
|
||||
# Integrated mode: OpenCore is in the main disk's EFI partition
|
||||
# Boot directly from the main disk
|
||||
# shellcheck disable=SC2054,SC2206
|
||||
args+=(-device ${MAC_DISK_DEV},drive=SystemDisk,bootindex=0
|
||||
-drive id=SystemDisk,if=none,format=qcow2,file="${disk_img}" ${STATUS_QUO})
|
||||
-drive id=SystemDisk,if=none,format=qcow2,file="${disk_img}",${DRIVE_OPTIMISATIONS} ${STATUS_QUO})
|
||||
|
||||
if [ -n "${img}" ]; then
|
||||
# shellcheck disable=SC2054
|
||||
|
|
@ -1989,14 +1992,14 @@ function vm_boot() {
|
|||
# shellcheck disable=SC2054,SC2206
|
||||
args+=(-device ahci,id=ahci
|
||||
-device ide-hd,bus=ahci.0,drive=SystemDisk
|
||||
-drive id=SystemDisk,if=none,format=qcow2,file="${disk_img}" ${STATUS_QUO})
|
||||
-drive id=SystemDisk,if=none,format=qcow2,file="${disk_img}",${DRIVE_OPTIMISATIONS} ${STATUS_QUO})
|
||||
|
||||
elif [ "${guest_os}" == "batocera" ] ; then
|
||||
# shellcheck disable=SC2054,SC2206
|
||||
args+=(-device virtio-blk-pci,drive=BootDisk
|
||||
-drive id=BootDisk,if=none,format=raw,file="${img}"
|
||||
-device virtio-blk-pci,drive=SystemDisk
|
||||
-drive id=SystemDisk,if=none,format=qcow2,file="${disk_img}" ${STATUS_QUO})
|
||||
-drive id=SystemDisk,if=none,format=qcow2,file="${disk_img}",${DRIVE_OPTIMISATIONS} ${STATUS_QUO})
|
||||
|
||||
elif [ "${guest_os}" == "reactos" ]; then
|
||||
# https://reactos.org/wiki/QEMU
|
||||
|
|
@ -2006,18 +2009,18 @@ function vm_boot() {
|
|||
elif [ "${guest_os}" == "windows-server" ]; then
|
||||
# shellcheck disable=SC2054,SC2206
|
||||
args+=(-device ide-hd,drive=SystemDisk
|
||||
-drive id=SystemDisk,if=none,format=qcow2,file="${disk_img}" ${STATUS_QUO})
|
||||
-drive id=SystemDisk,if=none,format=qcow2,file="${disk_img}",${DRIVE_OPTIMISATIONS} ${STATUS_QUO})
|
||||
|
||||
else
|
||||
if [ "${ARCH_VM}" == "aarch64" ]; then
|
||||
# ARM64: bootindex=2 ensures disk boots after CD-ROM (bootindex=1) during installation
|
||||
# shellcheck disable=SC2054,SC2206
|
||||
args+=(-device virtio-blk-pci,drive=SystemDisk,bootindex=2
|
||||
-drive id=SystemDisk,if=none,format=${disk_format},file="${disk_img}" ${STATUS_QUO})
|
||||
-drive id=SystemDisk,if=none,format=${disk_format},file="${disk_img}",${DRIVE_OPTIMISATIONS} ${STATUS_QUO})
|
||||
else
|
||||
# shellcheck disable=SC2054,SC2206
|
||||
args+=(-device virtio-blk-pci,drive=SystemDisk
|
||||
-drive id=SystemDisk,if=none,format=${disk_format},file="${disk_img}" ${STATUS_QUO})
|
||||
-drive id=SystemDisk,if=none,format=${disk_format},file="${disk_img}",${DRIVE_OPTIMISATIONS} ${STATUS_QUO})
|
||||
fi
|
||||
fi
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue