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