Split global metadata lock
Divide single global lock instance into 4 to reduce contention in multiple read-locks scenario. Signed-off-by: Adam Rutkowski <adam.j.rutkowski@intel.com>
This commit is contained in:
@@ -215,9 +215,11 @@ static int metadata_io_restart_req(struct ocf_request *req)
|
||||
|
||||
/* Fill with the latest metadata. */
|
||||
if (m_req->req.rw == OCF_WRITE) {
|
||||
ocf_metadata_start_shared_access(&cache->metadata.lock);
|
||||
ocf_metadata_start_shared_access(&cache->metadata.lock,
|
||||
m_req->page % OCF_NUM_GLOBAL_META_LOCKS);
|
||||
metadata_io_req_fill(m_req);
|
||||
ocf_metadata_end_shared_access(&cache->metadata.lock);
|
||||
ocf_metadata_end_shared_access(&cache->metadata.lock,
|
||||
m_req->page % OCF_NUM_GLOBAL_META_LOCKS);
|
||||
}
|
||||
|
||||
io = ocf_new_cache_io(cache, req->io_queue,
|
||||
|
@@ -43,9 +43,13 @@ struct ocf_cache_line_settings {
|
||||
uint64_t sector_end;
|
||||
};
|
||||
|
||||
|
||||
#define OCF_METADATA_GLOBAL_LOCK_IDX_BITS 2
|
||||
#define OCF_NUM_GLOBAL_META_LOCKS (1 << (OCF_METADATA_GLOBAL_LOCK_IDX_BITS))
|
||||
|
||||
struct ocf_metadata_lock
|
||||
{
|
||||
env_rwsem global; /*!< global metadata lock (GML) */
|
||||
env_rwsem global[OCF_NUM_GLOBAL_META_LOCKS]; /*!< global metadata lock (GML) */
|
||||
env_rwlock status; /*!< Fast lock for status bits */
|
||||
env_spinlock eviction[OCF_NUM_EVICTION_LISTS]; /*!< Fast lock for eviction policy */
|
||||
env_rwsem *hash; /*!< Hash bucket locks */
|
||||
|
Reference in New Issue
Block a user