Synchronization of collision table
Adding synchronization around metadata collision segment pages. This part of metadata is modified when cacheline is mapped/unmapped and when dirty status changes. Synchronization on page level is required on top of cacheline and hash bucket locks to assure metadata flush always reads consistent state when copying entire collision table memory page. Signed-off-by: Adam Rutkowski <adam.j.rutkowski@intel.com>
This commit is contained in:
@@ -113,9 +113,9 @@ ocf_cache_line_t ocf_metadata_get_cachelines_count(ocf_cache_t cache)
|
||||
void ocf_metadata_flush_all(ocf_cache_t cache,
|
||||
ocf_metadata_end_t cmpl, void *priv)
|
||||
{
|
||||
ocf_metadata_start_exclusive_access(&cache->metadata.lock);
|
||||
ocf_metadata_start_shared_access(&cache->metadata.lock);
|
||||
cache->metadata.iface.flush_all(cache, cmpl, priv);
|
||||
ocf_metadata_end_exclusive_access(&cache->metadata.lock);
|
||||
ocf_metadata_end_shared_access(&cache->metadata.lock);
|
||||
}
|
||||
|
||||
void ocf_metadata_load_all(ocf_cache_t cache,
|
||||
|
@@ -2568,7 +2568,7 @@ void ocf_metadata_hash_end_collision_shared_access(struct ocf_cache *cache,
|
||||
&ctrl->raw_desc[metadata_segment_collision];
|
||||
uint32_t page = ocf_metadata_raw_page(raw, line);
|
||||
|
||||
ocf_collision_start_shared_access(&cache->metadata.lock, page);
|
||||
ocf_collision_end_shared_access(&cache->metadata.lock, page);
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
|
@@ -226,9 +226,9 @@ static int ocf_restart_meta_io(struct ocf_request *req)
|
||||
int ret;
|
||||
|
||||
/* Fill with the latest metadata. */
|
||||
/* TODO: synchronize with concurrent metadata io and hash bucket locks
|
||||
*/
|
||||
ocf_metadata_start_shared_access(&cache->metadata.lock);
|
||||
metadata_io_req_fill(meta_io_req);
|
||||
ocf_metadata_end_shared_access(&cache->metadata.lock);
|
||||
|
||||
io = ocf_new_cache_io(cache, req->io_queue,
|
||||
PAGES_TO_BYTES(meta_io_req->page),
|
||||
|
@@ -107,6 +107,8 @@ void ocf_metadata_sparse_cache_line(struct ocf_cache *cache,
|
||||
static void _ocf_metadata_sparse_cache_line(struct ocf_cache *cache,
|
||||
uint32_t cache_line)
|
||||
{
|
||||
ocf_metadata_start_collision_shared_access(cache, cache_line);
|
||||
|
||||
set_cache_line_invalid_no_flush(cache, 0, ocf_line_end_sector(cache),
|
||||
cache_line);
|
||||
|
||||
@@ -114,6 +116,8 @@ static void _ocf_metadata_sparse_cache_line(struct ocf_cache *cache,
|
||||
* This is especially for removing inactive core
|
||||
*/
|
||||
metadata_clear_dirty(cache, cache_line);
|
||||
|
||||
ocf_metadata_end_collision_shared_access(cache, cache_line);
|
||||
}
|
||||
|
||||
/* caller must hold metadata lock
|
||||
|
Reference in New Issue
Block a user