30.03.2021 19:39, Max Reitz wrote:
==
OK, I think now that you didn't mean qcow2_alloc_clusters(). So, we are saying about only
functions returning an offset to cluster with "guest data", not to any kind of
host cluster. Than what you propose looks like this to me:
- take my v5
- rename qcow2_inflight_writes_dec() to put_cluster_offset()
- call qcow2_inflight_writes_inc() from the three functions you mention
Yes, I think so. Or you take the CoRwLock in those three functions, depending
on which implementation we want.
CoRwLock brings one inconvenient feature: to pass ownership on the reference to
coroutine (for example to task coroutine in qcow2_co_pwritev) we have to unlock
the lock in original coroutine and lock in another, as CoRwLock doesn't support
transferring to other coroutine. So we'll do put_cluster_offset() in
qcow2_co_pwritev() and do get_cluster_offset() in qcow2_co_pwritev_task(). (and
we must be sure that the second lock taken before releasing the first one). So
in this case it probably better to keep direct CoRwLock interface, not
shadowing it by get/put.
--
Best regards,
Vladimir