[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 01/19] Specification for qcow2 version 3
From: |
Kevin Wolf |
Subject: |
Re: [Qemu-devel] [PATCH 01/19] Specification for qcow2 version 3 |
Date: |
Fri, 13 Apr 2012 10:20:09 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:11.0) Gecko/20120329 Thunderbird/11.0.1 |
Am 12.04.2012 23:14, schrieb Anthony Liguori:
> On 04/12/2012 10:01 AM, Kevin Wolf wrote:
>> This updates the qcow2 specification to cover version 3. It contains the
>> following changes:
>>
>> - Added compatible/incompatible/auto-clear feature bits plus an optional
>> feature name table to allow useful error messages even if an older
>> version doesn't know some feature at all.
>>
>> - Configurable refcount width. If you don't want to use internal
>> snapshots, make refcounts one bit and save cache space and I/O.
>>
>> - Zero cluster flags. This allows discard even with a backing file that
>> doesn't contain zeros. It is also useful for copy-on-read/image
>> streaming, as you'll want to keep sparseness without accessing the
>> remote image for an unallocated cluster all the time.
>>
>> - Fixed internal snapshot metadata to use 64 bit VM state size. You
>> can't save a snapshot of a VM with>= 4 GB RAM today.
>>
>> - Extended internal snapshot metadata to contain the disk size, so that
>> resizing images that have snapshots can be allowed in the future.
>>
>> Signed-off-by: Kevin Wolf<address@hidden>
>> ---
>> docs/specs/qcow2.txt | 121
>> ++++++++++++++++++++++++++++++++++++++++---------
>> 1 files changed, 98 insertions(+), 23 deletions(-)
>>
>> diff --git a/docs/specs/qcow2.txt b/docs/specs/qcow2.txt
>> index b6adcad..00c5696 100644
>> --- a/docs/specs/qcow2.txt
>> +++ b/docs/specs/qcow2.txt
>> @@ -18,7 +18,7 @@ The first cluster of a qcow2 image contains the file
>> header:
>> QCOW magic string ("QFI\xfb")
>>
>> 4 - 7: version
>> - Version number (only valid value is 2)
>> + Version number (valid values are 2 and 3)
>
> Which version will `qemu-img create -f qcow2 foo.img 10G' use?
>
> It looks like it depends on the compat_level option? Why not just do `-f
> qcow3?
Yes, if you want a non-default version, you use qemu-img create -o
compat=0.10/1.1. Otherwise you just get whatever is the default for the
specific qemu version that you're using. My plan was to leave the
default at version 2 for 1.1 and switch to version 3 at 1.2 when it has
matured a bit more.
The change is really not much different from adding an incompatible
feature flag, and you wouldn't change the format name for that, but just
add a switch.
In the code, the only difference is the version number that is written
to the header in bdrv_create, which is exactly what image creation
options are for. And in the user interface, I think users will be glad
that they won't have to change their scripts, update their libvirt etc.
>>
>> 8 - 15: backing_file_offset
>> Offset into the image file at which the backing file
>> name
>> @@ -67,12 +67,45 @@ The first cluster of a qcow2 image contains the file
>> header:
>> Offset into the image file at which the snapshot table
>> starts. Must be aligned to a cluster boundary.
>>
>> +If the version is 3 or higher, the header has the following additional
>> fields.
>> +For version 2, the values are assumed to be zero, unless specified otherwise
>> +in the description of a field.
>> +
>> + 72 - 79: incompatible_features
>> + Bitmask of incompatible features. An implementation must
>> + fail to open an image if an unknown bit is set.
>> +
>> + Bits 0-63: Reserved (set to 0)
>> +
>> + 80 - 87: compatible_features
>> + Bitmask of compatible features. An implementation can
>> + safely ignore any unknown bits that are set.
>> +
>> + Bits 0-63: Reserved (set to 0)
>> +
>> + 88 - 95: autoclear_features
>> + Bitmask of auto-clear features. An implementation may
>> only
>> + write to an image with unknown auto-clear features if it
>> + clears the respective bits from this field first.
>> +
>> + Bits 0-63: Reserved (set to 0)
>> +
>> + 96 - 99: refcount_bits
>> + Size of a reference count block entry in bits. For
>> version 2
>> + images, the size is always assumed to be 16 bits. The
>> size
>> + must be a power of two.
>
> It may be nicer this an order since that way, any value would be valid. So
> v2
> would be assumed to be refcount_order=4.
"any" is rather theoretical as large values don't make any sense.
Especially anything that becomes larger than the cluster size. I guess I
should add an upper boundary of 64 bits/order 6.
But yeah, I'll consider to change it.
Kevin
- [Qemu-devel] [PATCH 00/19] qcow2: Add basic version 3 support, Kevin Wolf, 2012/04/12
- [Qemu-devel] [PATCH 05/19] qcow2: Fail write_compressed when overwriting data, Kevin Wolf, 2012/04/12
- [Qemu-devel] [PATCH 04/19] qcow2: Ignore reserved bits in count_contiguous_clusters(), Kevin Wolf, 2012/04/12
- [Qemu-devel] [PATCH 03/19] qcow2: Ignore reserved bits in get_cluster_offset, Kevin Wolf, 2012/04/12
- [Qemu-devel] [PATCH 02/19] qcow2: Save disk size in snapshot header, Kevin Wolf, 2012/04/12
- [Qemu-devel] [PATCH 09/19] qcow2: Ignore reserved bits in refcount table entries, Kevin Wolf, 2012/04/12
- [Qemu-devel] [PATCH 07/19] qcow2: Refactor qcow2_free_any_clusters, Kevin Wolf, 2012/04/12
- [Qemu-devel] [PATCH 10/19] qcow2: Ignore reserved bits in check_refcounts, Kevin Wolf, 2012/04/12