[pve-devel] [PATCH] enable write zeroes optimisations
Alexandre Derumier
aderumier at odiso.com
Mon Oct 13 09:45:30 CEST 2014
This enable write zeroes optimisation inside guest.
(I have tested them with qcow2,raw (ext4|xfs) , zfs|iscsi and nfs too.
No impact if the block driver don't support it yet (like rbd)
https://lists.nongnu.org/archive/html/qemu-devel/2014-04/msg00009.html
> a) mkfs.ext4 -E lazy_itable_init=0,lazy_journal_init=0 /dev/vdX
>
> QCOW2 [off] [on] [unmap]
> -----
> runtime: 14secs 1.1secs 1.1secs
> filesize: 937M 18M 18M
>
> iSCSI [off] [on] [unmap]
> ----
> runtime: 9.3s 0.9s 0.9s
>
> b) dd if=/dev/zero of=/dev/vdX bs=1M oflag=direct
>
> QCOW2 [off] [on] [unmap]
> -----
> runtime: 246secs 18secs 18secs
> filesize: 51G 192K 192K
> throughput: 203M/s 2.3G/s 2.3G/s
>
> iSCSI* [off] [on] [unmap]
> ----
> runtime: 8mins 45secs 33secs
> throughput: 106M/s 1.2G/s 1.6G/s
> allocated: 100% 100% 0%
Signed-off-by: Alexandre Derumier <aderumier at odiso.com>
---
PVE/QemuServer.pm | 3 +++
1 file changed, 3 insertions(+)
diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm
index 8abeb92..98264d1 100644
--- a/PVE/QemuServer.pm
+++ b/PVE/QemuServer.pm
@@ -1199,6 +1199,9 @@ sub print_drive_full {
$opts .= ",cache=none" if !$drive->{cache} && !drive_is_cdrom($drive);
+ my $detectzeroes = $drive->{discard} ? "unmap" : "on";
+ $opts .= ",detect-zeroes=$detectzeroes" if !drive_is_cdrom($drive);
+
my $pathinfo = $path ? "file=$path," : '';
return "${pathinfo}if=none,id=drive-$drive->{interface}$drive->{index}$opts";
--
1.7.10.4
More information about the pve-devel
mailing list