From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41003) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WHeRn-0007x1-Ec for qemu-devel@nongnu.org; Sun, 23 Feb 2014 14:10:48 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WHeRh-0005wB-Rq for qemu-devel@nongnu.org; Sun, 23 Feb 2014 14:10:43 -0500 Received: from mx.ipv6.kamp.de ([2a02:248:0:51::16]:46333 helo=mx01.kamp.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WHeRh-0005ux-Gg for qemu-devel@nongnu.org; Sun, 23 Feb 2014 14:10:37 -0500 Message-ID: <530A479E.4070900@kamp.de> Date: Sun, 23 Feb 2014 20:10:22 +0100 From: Peter Lieven MIME-Version: 1.0 References: <1393074022-32388-1-git-send-email-pl@kamp.de> <20140222164512.GC16767@T430.redhat.com> In-Reply-To: <20140222164512.GC16767@T430.redhat.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [RFC PATCH] block: optimize zero writes with bdrv_write_zeroes List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Fam Zheng Cc: kwolf@redhat.com, pbonzini@redhat.com, qemu-devel@nongnu.org, stefanha@redhat.com Am 22.02.2014 17:45, schrieb Fam Zheng: > On Sat, 02/22 14:00, Peter Lieven wrote: >> this patch tries to optimize zero write requests >> by automatically using bdrv_write_zeroes if it is >> supported by the format. >> >> i know that there is a lot of potential for discussion, but i would >> like to know what the others think. >> >> this should significantly speed up file system initialization and >> should speed zero write test used to test backend storage performance. >> >> the difference can simply be tested by e.g. >> >> dd if=/dev/zero of=/dev/vdX bs=1M >> >> Signed-off-by: Peter Lieven >> --- > With this patch, is is still possible to actually do zero fill? Prefill is > usually writing zeroes too, but according to the semantic, bdrv_write_zeroes > may just set L2 entry flag without allocating clusters, which won't satisfy > that. Can you specify which operation you exactly mean? I don't think that there is a problem, but maybe it would be better to add a check for bs->file != NULL so the optimization takes only place for the format not for the protocol. I meanwhile ran a short test which shows that there is potential for significant improvement. I created a 60GB qcow2 container and formatted it with ext4. To immediately show the difference I disabled lazy inode table and lazy journal init (writing zero takes place immediately then). Timing without the patch: time mkfs.ext4 -E lazy_itable_init=0,lazy_journal_init=0 /dev/vda real 1m5.649s user 0m0.416s sys 0m3.148s Timing with the patch: time mkfs.ext4 -E lazy_itable_init=0,lazy_journal_init=0 /dev/vdX real 0m1.228s user 0m0.116s sys 0m0.732s Container Size after Format without the patch: 1150615552 Byte (1097.3MB) Container Size after Format with the patch: 24645632 Byte (23.5MB) Peter > > Thanks, > Fam