qcow2: Replace QCOW2_CLUSTER_* with QCOW2_SUBCLUSTER_*

In order to support extended L2 entries some functions of the qcow2
driver need to start dealing with subclusters instead of clusters.

qcow2_get_host_offset() is modified to return the subcluster type
instead of the cluster type, and all callers are updated to replace
all values of QCow2ClusterType with their QCow2SubclusterType
equivalents.

This patch only changes the data types, there are no semantic changes.

Signed-off-by: Alberto Garcia <berto@igalia.com>
Reviewed-by: Max Reitz <mreitz@redhat.com>
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Message-Id: <f6c29737c295f32cbee74c903c30b01820363b34.1594396418.git.berto@igalia.com>
Signed-off-by: Max Reitz <mreitz@redhat.com>
This commit is contained in:
Alberto Garcia 2020-07-10 18:13:00 +02:00 committed by Max Reitz
parent ca4a0bb81b
commit 10dabdc596
3 changed files with 42 additions and 40 deletions

View file

@ -564,15 +564,15 @@ static int coroutine_fn do_perform_cow_write(BlockDriverState *bs,
* offset that we are interested in.
*
* On exit, *bytes is the number of bytes starting at offset that have the same
* cluster type and (if applicable) are stored contiguously in the image file.
* The cluster type is stored in *cluster_type.
* Compressed clusters are always returned one by one.
* subcluster type and (if applicable) are stored contiguously in the image
* file. The subcluster type is stored in *subcluster_type.
* Compressed clusters are always processed one by one.
*
* Returns 0 on success, -errno in error cases.
*/
int qcow2_get_host_offset(BlockDriverState *bs, uint64_t offset,
unsigned int *bytes, uint64_t *host_offset,
QCow2ClusterType *cluster_type)
QCow2SubclusterType *subcluster_type)
{
BDRVQcow2State *s = bs->opaque;
unsigned int l2_index;
@ -714,7 +714,7 @@ out:
assert(bytes_available - offset_in_cluster <= UINT_MAX);
*bytes = bytes_available - offset_in_cluster;
*cluster_type = type;
*subcluster_type = qcow2_cluster_to_subcluster_type(type);
return 0;