From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MceNJ-0001jM-8C for qemu-devel@nongnu.org; Sun, 16 Aug 2009 07:58:13 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MceNE-0001j3-NE for qemu-devel@nongnu.org; Sun, 16 Aug 2009 07:58:12 -0400 Received: from [199.232.76.173] (port=36530 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MceNE-0001j0-GG for qemu-devel@nongnu.org; Sun, 16 Aug 2009 07:58:08 -0400 Received: from mx2.redhat.com ([66.187.237.31]:57402) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MceND-0004l9-V8 for qemu-devel@nongnu.org; Sun, 16 Aug 2009 07:58:08 -0400 Received: from int-mx2.corp.redhat.com (int-mx2.corp.redhat.com [172.16.27.26]) by mx2.redhat.com (8.13.8/8.13.8) with ESMTP id n7GBw6Ji000585 for ; Sun, 16 Aug 2009 07:58:06 -0400 Message-ID: <4A87F44B.5080308@redhat.com> Date: Sun, 16 Aug 2009 14:58:03 +0300 From: Avi Kivity MIME-Version: 1.0 Subject: Re: [Qemu-devel] [PATCH] qcow2: Metadata preallocation References: <1250262015-996-1-git-send-email-kwolf@redhat.com> In-Reply-To: <1250262015-996-1-git-send-email-kwolf@redhat.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Kevin Wolf Cc: qemu-devel@nongnu.org On 08/14/2009 06:00 PM, Kevin Wolf wrote: > This introduces a qemu-img create option for qcow2 which allows the metadata to > be preallocated, i.e. clusters are reserved in the refcount table and L1/L2 > tables, but no data is written to them. Metadata is quite small, so this > happens in almost no time. > > Especially with qcow2 on virtio this helps to gain a bit of performance during > the initial writes. However, as soon as create a snapshot, we're back to the > normal slow speed, obviously. So this isn't the real fix, but kind of a cheat > while we're still having trouble with qcow2 on virtio. > > Note that the option is disabled by default and needs to be specified > explicitly using qemu-img create -f qcow2 -o preallocation=metadata. > > Can't say I'm thrilled with this. I'd prefer coalescing metadata updates on parallel writes. I don't object to this though. > + /* > + * It is expected that the image file is large enough to actually contain > + * all of the allocated clusters (otherwise we get failing reads after > + * EOF). So just write some zeros to the last sector. > + */ > + if (cluster_offset != 0) { > + uint8_t buf[512]; > + memset(buf, 0, 512); > + bdrv_write(s->hd, (cluster_offset>> 9) + num - 1, buf, 1); > + } > + > Older versions of Windows don't support sparse files, and newer ones need a flag. It's a good idea to set this flag when opening on Windows. -- error compiling committee.c: too many arguments to function