Properly lock hash bucket for status bits operations

Signed-off-by: Adam Rutkowski <adam.j.rutkowski@intel.com>
This commit is contained in:
Adam Rutkowski
2021-02-15 19:42:42 -06:00
parent 75baec5aa5
commit cd9e42f987
4 changed files with 43 additions and 30 deletions

View File

@@ -71,6 +71,10 @@ static int ocf_read_wo_cache_do(struct ocf_request *req)
s = ocf_map_line_start_sector(req, line);
e = ocf_map_line_end_sector(req, line);
ocf_hb_cline_prot_lock_rd(&cache->metadata.lock,
req->lock_idx, entry->core_id,
entry->core_line);
/* if cacheline mapping is not sequential, send cache IO to
* previous cacheline(s) */
phys_prev = phys_curr;
@@ -112,6 +116,10 @@ static int ocf_read_wo_cache_do(struct ocf_request *req)
== valid);
}
ocf_hb_cline_prot_unlock_rd(&cache->metadata.lock,
req->lock_idx, entry->core_id,
entry->core_line);
if (io && !valid) {
/* end of sequential valid region */
ocf_read_wo_cache_io(req, io_start,
@@ -126,6 +134,12 @@ static int ocf_read_wo_cache_do(struct ocf_request *req)
}
offset += increment;
if (i <= e) {
ocf_hb_cline_prot_lock_rd(&cache->metadata.lock,
req->lock_idx, entry->core_id,
entry->core_line);
}
} while (i <= e);
}