return -EINVAL;
}
- if (bitmaps_ext.bitmap_directory_offset & (s->cluster_size - 1)) {
+ if (offset_into_cluster(s, bitmaps_ext.bitmap_directory_offset)) {
error_setg(errp, "bitmaps_ext: "
"invalid bitmap directory offset");
return -EINVAL;
{
BDRVQcow2State *s = bs->opaque;
uint64_t cluster_offset;
- int index_in_cluster, ret;
unsigned int bytes;
- int status = 0;
+ int ret, status = 0;
qemu_co_mutex_lock(&s->lock);
if ((ret == QCOW2_CLUSTER_NORMAL || ret == QCOW2_CLUSTER_ZERO_ALLOC) &&
!s->crypto) {
- index_in_cluster = offset & (s->cluster_size - 1);
- *map = cluster_offset | index_in_cluster;
+ *map = cluster_offset | offset_into_cluster(s, offset);
*file = s->data_file->bs;
status |= BDRV_BLOCK_OFFSET_VALID;
}