On 04.11.19 13:35, Max Reitz wrote:
> On 26.10.19 23:25, Alberto Garcia wrote:
>> This function returns the type of an individual subcluster. If an
>> image does not have subclusters then this returns the exact same value
>> as qcow2_get_cluster_type().
>>
>> The information in standard and extended L2 entries is encoded in a
>> slightly different way, but all existing QCow2ClusterType values are
>> also valid for subclusters and have the same meanings (although they
>> typically only apply to the requested subcluster).
>>
>> There are two important exceptions to this:
>>
>>   a) QCOW2_CLUSTER_COMPRESSED means that the whole cluster is
>>      compressed. We do not support compression at the subcluster
>>      level.
>>
>>   b) QCOW2_CLUSTER_UNALLOCATED means that the cluster is unallocated,
>>      that is, the offset field of the L2 entry does not point to a
>>      host cluster. All subclusters are obviously unallocated too but
>>      any of them could be of type QCOW2_CLUSTER_ZERO_PLAIN.
>>
>> In addition to that, extended L2 entries allow one new scenario where
>> the cluster is normally allocated but an individual subcluster is not.
>> This is very different from (b) and because of that this patch adds a
>> new value called QCOW2_CLUSTER_UNALLOCATED_SUBCLUSTER.
>>
>> As a last thing, this patch adds QCOW2_CLUSTER_INVALID to detect the
>> cases where an L2 entry has a value that violates the spec. The caller
>> is responsible for handling these situations.
>>
>> To prevent compatibility problems with images that have invalid values
>> but are currently being read by QEMU without causing side effects,
>> QCOW2_CLUSTER_INVALID is only returned for images with extended L2
>> entries.
>>
>> Signed-off-by: Alberto Garcia <be...@igalia.com>
>> ---
>>  block/qcow2.h | 62 +++++++++++++++++++++++++++++++++++++++++++++++++++
>>  1 file changed, 62 insertions(+)
> 
> [...]
> 
>> +        case QCOW2_CLUSTER_ZERO_PLAIN:
>> +        case QCOW2_CLUSTER_ZERO_ALLOC:
>> +            return QCOW2_CLUSTER_INVALID;
> 
> The spec doesn’t say anything about this, though.

It does, I just forgot. O:-)

Max

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to