qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH 05/21] qcow2: Refcount overflow and qcow2_alloc_


From: Eric Blake
Subject: Re: [Qemu-devel] [PATCH 05/21] qcow2: Refcount overflow and qcow2_alloc_bytes()
Date: Tue, 11 Nov 2014 12:49:18 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.2.0

On 11/11/2014 09:18 AM, Max Reitz wrote:

>> No, I was envisioning that we have a brand new image with one cluster
>> allocated (cluster 1 has refcount 1), then 5 times in a row we do
>> 'savevm' to take an internal snapshot.  If I understand your code
>> correctly, the first two snapshots increase the refcount, so cluster 1
>> has a refcount of 3. Then the next snapshot can't increase the refcount,
>> so it instead copies the contents to cluster 2.
> 
> No, it just errors out.
> 
> qcow2_alloc_bytes() is only used for allocating space for a compressed
> cluster. When taking a snapshot, update_refcount() will be called to
> increase the clusters' refcounts, and that function will simply throw an
> error.

That's okay for now (always better for an initial feature to be
conservative, then expand it later if there is demand).  But I wonder if
we could be made smarter in the future and auto-COW any cluster that
would otherwise exceed max refcount.  Thus, for a refcount_order=0
(width=1) image, a snapshot now doubles the size of the image (as every
single cluster would COW into a new cluster) rather than erroring out.
Food for thought; maybe worth injecting comments into this series
(whether in code or in commit messages, as appropriate) pointing out
that we thought about the future possibility even though we chose not to
allow it for now.


-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

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