On Mon 04 Nov 2019 04:10:58 PM CET, Max Reitz wrote:
>>> qcow2_cache_entry_mark_dirty(s->l2_table_cache, l2_slice);
>>> if (cluster_type == QCOW2_CLUSTER_COMPRESSED || unmap) {
>>> - set_l2_entry(s, l2_slice, l2_index + i, QCOW_OFLAG_ZERO);
>>> qcow2_free_any_clusters(bs, old_offset, 1,
>>> QCOW2_DISCARD_REQUEST);
>>
>> It feels wrong to me to free the cluster before updating the L2
>> entry.
>
> (Although it’s pre-existing, as set_l2_entry() is just an in-cache
> operation anyway :-/)
Yes, I think that if you want to do it afterwards you need to add
another loop after the qcow2_cache_put() call.
Berto