Optimize cacheline locking in ocf_engine_prepare_clines
Hash bucket read/write lock is sufficient to safely attempt cacheline trylock/lock. This change removes cacheline lock global RW semaprhore and moves cacheline trylock/lock under hash bucket read/write lock respectively. Signed-off-by: Adam Rutkowski <adam.j.rutkowski@intel.com>
This commit is contained in:
@@ -154,12 +154,18 @@ int ocf_write_wi(struct ocf_request *req)
|
||||
|
||||
if (ocf_engine_mapped_count(req)) {
|
||||
/* Some cache line are mapped, lock request for WRITE access */
|
||||
lock = ocf_req_async_lock_wr(req, _ocf_write_wi_on_resume);
|
||||
lock = ocf_req_trylock_wr(req);
|
||||
} else {
|
||||
lock = OCF_LOCK_ACQUIRED;
|
||||
}
|
||||
|
||||
ocf_req_hash_unlock_rd(req); /*- END Metadata READ access----------------*/
|
||||
if (lock != OCF_LOCK_ACQUIRED) {
|
||||
ocf_req_hash_lock_upgrade(req);
|
||||
lock = ocf_req_async_lock_wr(req, _ocf_write_wi_on_resume);
|
||||
ocf_req_hash_unlock_wr(req);
|
||||
} else {
|
||||
ocf_req_hash_unlock_rd(req);
|
||||
}
|
||||
|
||||
if (lock >= 0) {
|
||||
if (lock == OCF_LOCK_ACQUIRED) {
|
||||
|
Reference in New Issue
Block a user