[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
signature.asc
Description: OpenPGP digital signature
- [Qemu-devel] [PATCH v6 00/14] qemu-img: Implement commit like QMP, Max Reitz, 2014/04/29
- [Qemu-devel] [PATCH v6 01/14] qcow2: Allow "full" discard, Max Reitz, 2014/04/29
- [Qemu-devel] [PATCH v6 02/14] qcow2: Implement bdrv_make_empty(), Max Reitz, 2014/04/29
- [Qemu-devel] [PATCH v6 03/14] qcow2: Optimize bdrv_make_empty(), Max Reitz, 2014/04/29
- [Qemu-devel] [PATCH v6 04/14] blockjob: Introduce block_job_complete_sync(), Max Reitz, 2014/04/29
- [Qemu-devel] [PATCH v6 05/14] blockjob: Add "ready" field, Max Reitz, 2014/04/29
- [Qemu-devel] [PATCH v6 06/14] block/mirror: Improve progress report, Max Reitz, 2014/04/29
- [Qemu-devel] [PATCH v6 07/14] qemu-img: Implement commit like QMP, Max Reitz, 2014/04/29
- [Qemu-devel] [PATCH v6 08/14] qemu-img: Empty image after commit, Max Reitz, 2014/04/29
- [Qemu-devel] [PATCH v6 09/14] qemu-img: Enable progress output for commit, Max Reitz, 2014/04/29