[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH] qcow2: Metadata preallocation

From: Kevin Wolf
Subject: Re: [Qemu-devel] [PATCH] qcow2: Metadata preallocation
Date: Mon, 17 Aug 2009 09:11:38 +0200
User-agent: Thunderbird (X11/20090320)

Avi Kivity schrieb:
> 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.

Even with improved concurrent cluster allocation, you might profit from
metadata preallocation by having less fragmented qcow2 images which
avoids splitting up requests. Not sure if this is relevant in practice

>> +    /*
>> +     * 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.

I'm certainly hoping that raw-win32 is doing whatever needs to be done?
The mentioned FSCTL_SET_SPARSE seems to be there at least.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]