On Thu 02 Jul 2020 04:28:57 PM CEST, Max Reitz wrote:
>> +    /* For full clusters use zero_in_l2_slice() instead */
>> +    assert(nb_subclusters > 0 && nb_subclusters < 
>> s->subclusters_per_cluster);
>> +    assert(sc + nb_subclusters <= s->subclusters_per_cluster);
>
> Maybe we should also assert that @offset is aligned to the subcluster
> size.

It doesn't hurt but the only caller already guarantees that already ...

>> @@ -4367,12 +4367,13 @@ static int coroutine_fn 
>> qcow2_co_truncate(BlockDriverState *bs, int64_t offset,
>>          uint64_t zero_start = QEMU_ALIGN_UP(old_length, s->cluster_size);
>
> Can we instead align this to just subclusters?

I think so, good catch.

Berto

Reply via email to