|
From: | Vladimir Sementsov-Ogievskiy |
Subject: | Re: [PATCH v4 for-6.0? 0/3] qcow2: fix parallel rewrite and discard (rw-lock) |
Date: | Wed, 31 Mar 2021 09:23:47 +0300 |
User-agent: | Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.9.0 |
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 mentionYes, 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
[Prev in Thread] | Current Thread | [Next in Thread] |