qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH v6 03/14] qcow2: Optimize bdrv_make_empty()


From: Eric Blake
Subject: Re: [Qemu-devel] [PATCH v6 03/14] qcow2: Optimize bdrv_make_empty()
Date: Tue, 29 Apr 2014 16:45:17 -0600
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.4.0

On 04/29/2014 04:24 PM, Eric Blake wrote:
> On 04/29/2014 09:07 AM, Max Reitz wrote:
>> bdrv_make_empty() is currently only called if the current image
>> represents an external snapshot that has been committed to its base
>> image; it is therefore unlikely to have internal snapshots. In this
>> case, bdrv_make_empty() can be greatly sped up by creating an empty L1
>> table and dropping all data clusters at once by recreating the refcount
>> structure accordingly instead of normally discarding all clusters.
>>

>> +            /* Only 0 and 1 are possible as refcounts here */
>> +            refblock[i] = cpu_to_be16(!cluster_offset ||
>> +                                      (cluster_offset >= blob_start &&
>> +                                       cluster_offset <  blob_end));
> 
> Caller passed in refblocks, but you are correct that each refblock entry
> is 2 bytes long.
> 
> The image header and all clusters within the blob will have a refcount
> of 1, all other clusters will have a refcount of 2.  Of course, at this

Pardon my review typo; obviously, all other clusters will have a
refcount of 0 (they are not in use by any snapshots, since the image
already has no snapshots; and they are not in use by our blob or the
overall image header).

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