All of lore.kernel.org
 help / color / mirror / Atom feed
From: Kevin Wolf <kwolf@redhat.com>
To: Avi Kivity <avi@redhat.com>
Cc: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH] qcow2: Metadata preallocation
Date: Mon, 17 Aug 2009 09:11:38 +0200	[thread overview]
Message-ID: <4A8902AA.2050200@redhat.com> (raw)
In-Reply-To: <4A87F44B.5080308@redhat.com>

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
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.

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.

Kevin

  parent reply	other threads:[~2009-08-17  7:12 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-08-14 15:00 [Qemu-devel] [PATCH] qcow2: Metadata preallocation Kevin Wolf
2009-08-16 11:58 ` Avi Kivity
2009-08-16 12:12   ` Filip Navara
2009-08-16 16:48     ` Jamie Lokier
2009-08-16 20:28       ` Jamie Lokier
2009-08-17  7:16       ` Kevin Wolf
2009-08-17  7:11   ` Kevin Wolf [this message]
2009-08-17  7:45     ` Avi Kivity
2009-08-17  7:58       ` Kevin Wolf

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4A8902AA.2050200@redhat.com \
    --to=kwolf@redhat.com \
    --cc=avi@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.