Properly lock hash bucket for status bits operations
Signed-off-by: Adam Rutkowski <adam.j.rutkowski@intel.com>
This commit is contained in:
parent
75baec5aa5
commit
cd9e42f987
@ -164,12 +164,12 @@ static int _ocf_read_generic_do(struct ocf_request *req)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
ocf_hb_req_prot_lock_rd(req);
|
ocf_hb_req_prot_lock_wr(req);
|
||||||
|
|
||||||
/* Set valid status bits map */
|
/* Set valid status bits map */
|
||||||
ocf_set_valid_map_info(req);
|
ocf_set_valid_map_info(req);
|
||||||
|
|
||||||
ocf_hb_req_prot_unlock_rd(req);
|
ocf_hb_req_prot_unlock_wr(req);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ocf_engine_needs_repart(req)) {
|
if (ocf_engine_needs_repart(req)) {
|
||||||
|
@ -27,22 +27,24 @@ static const struct ocf_io_if _io_if_wb_resume = {
|
|||||||
|
|
||||||
static void _ocf_write_wb_update_bits(struct ocf_request *req)
|
static void _ocf_write_wb_update_bits(struct ocf_request *req)
|
||||||
{
|
{
|
||||||
if (ocf_engine_is_miss(req)) {
|
bool miss = ocf_engine_is_miss(req);
|
||||||
ocf_hb_req_prot_lock_rd(req);
|
bool clean_any = !ocf_engine_is_dirty_all(req);
|
||||||
|
|
||||||
|
if (!miss && !clean_any) {
|
||||||
|
ocf_req_set_cleaning_hot(req);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
ocf_hb_req_prot_lock_wr(req);
|
||||||
|
if (miss) {
|
||||||
/* Update valid status bits */
|
/* Update valid status bits */
|
||||||
ocf_set_valid_map_info(req);
|
ocf_set_valid_map_info(req);
|
||||||
|
|
||||||
ocf_hb_req_prot_unlock_rd(req);
|
|
||||||
}
|
}
|
||||||
|
if (clean_any) {
|
||||||
if (!ocf_engine_is_dirty_all(req)) {
|
|
||||||
ocf_hb_req_prot_lock_wr(req);
|
|
||||||
|
|
||||||
/* set dirty bits, and mark if metadata flushing is required */
|
/* set dirty bits, and mark if metadata flushing is required */
|
||||||
ocf_set_dirty_map_info(req);
|
ocf_set_dirty_map_info(req);
|
||||||
|
|
||||||
ocf_hb_req_prot_unlock_wr(req);
|
|
||||||
}
|
}
|
||||||
|
ocf_hb_req_prot_unlock_wr(req);
|
||||||
|
|
||||||
ocf_req_set_cleaning_hot(req);
|
ocf_req_set_cleaning_hot(req);
|
||||||
}
|
}
|
||||||
|
@ -71,6 +71,10 @@ static int ocf_read_wo_cache_do(struct ocf_request *req)
|
|||||||
s = ocf_map_line_start_sector(req, line);
|
s = ocf_map_line_start_sector(req, line);
|
||||||
e = ocf_map_line_end_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
|
/* if cacheline mapping is not sequential, send cache IO to
|
||||||
* previous cacheline(s) */
|
* previous cacheline(s) */
|
||||||
phys_prev = phys_curr;
|
phys_prev = phys_curr;
|
||||||
@ -112,6 +116,10 @@ static int ocf_read_wo_cache_do(struct ocf_request *req)
|
|||||||
== valid);
|
== valid);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ocf_hb_cline_prot_unlock_rd(&cache->metadata.lock,
|
||||||
|
req->lock_idx, entry->core_id,
|
||||||
|
entry->core_line);
|
||||||
|
|
||||||
if (io && !valid) {
|
if (io && !valid) {
|
||||||
/* end of sequential valid region */
|
/* end of sequential valid region */
|
||||||
ocf_read_wo_cache_io(req, io_start,
|
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;
|
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);
|
} while (i <= e);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -97,39 +97,36 @@ static inline void _ocf_write_wt_submit(struct ocf_request *req)
|
|||||||
|
|
||||||
static void _ocf_write_wt_update_bits(struct ocf_request *req)
|
static void _ocf_write_wt_update_bits(struct ocf_request *req)
|
||||||
{
|
{
|
||||||
if (ocf_engine_is_miss(req)) {
|
bool miss = ocf_engine_is_miss(req);
|
||||||
ocf_hb_req_prot_lock_rd(req);
|
bool dirty_any = req->info.dirty_any;
|
||||||
|
bool repart = ocf_engine_needs_repart(req);
|
||||||
|
|
||||||
|
if (!miss && !dirty_any && !repart)
|
||||||
|
return;
|
||||||
|
|
||||||
|
ocf_hb_req_prot_lock_wr(req);
|
||||||
|
|
||||||
|
if (miss) {
|
||||||
/* Update valid status bits */
|
/* Update valid status bits */
|
||||||
ocf_set_valid_map_info(req);
|
ocf_set_valid_map_info(req);
|
||||||
|
|
||||||
ocf_hb_req_prot_unlock_rd(req);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (req->info.dirty_any) {
|
if (dirty_any) {
|
||||||
ocf_hb_req_prot_lock_wr(req);
|
/* Writes goes to both cache and core, need to update
|
||||||
|
* status bits from dirty to clean
|
||||||
/* Writes goes to SDD and HDD, need to update status bits from
|
|
||||||
* dirty to clean
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
ocf_set_clean_map_info(req);
|
ocf_set_clean_map_info(req);
|
||||||
|
|
||||||
ocf_hb_req_prot_unlock_wr(req);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ocf_engine_needs_repart(req)) {
|
if (repart) {
|
||||||
OCF_DEBUG_RQ(req, "Re-Part");
|
OCF_DEBUG_RQ(req, "Re-Part");
|
||||||
|
|
||||||
ocf_hb_req_prot_lock_wr(req);
|
|
||||||
|
|
||||||
/* Probably some cache lines are assigned into wrong
|
/* Probably some cache lines are assigned into wrong
|
||||||
* partition. Need to move it to new one
|
* partition. Need to move it to new one
|
||||||
*/
|
*/
|
||||||
ocf_part_move(req);
|
ocf_part_move(req);
|
||||||
|
}
|
||||||
|
|
||||||
ocf_hb_req_prot_unlock_wr(req);
|
ocf_hb_req_prot_unlock_wr(req);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int _ocf_write_wt_do(struct ocf_request *req)
|
static int _ocf_write_wt_do(struct ocf_request *req)
|
||||||
|
Loading…
Reference in New Issue
Block a user