diff --git a/src/engine/engine_bf.c b/src/engine/engine_bf.c index 1ba963fc..34d54d4f 100644 --- a/src/engine/engine_bf.c +++ b/src/engine/engine_bf.c @@ -107,7 +107,7 @@ static int _ocf_backfill_do(struct ocf_request *req) addr += req->addr % line_size; ocf_core_stats_cache_block_update(req->core, req->part_id, - OCF_WRITE, req->bytes); + OCF_WRITE, req->bytes, req->io.pf_id); ocf_req_forward_cache_io(req, OCF_WRITE, addr, req->bytes, req->offset); return 0; @@ -158,7 +158,7 @@ static int _ocf_backfill_do(struct ocf_request *req) bytes = OCF_MIN(bytes, req->bytes - total_bytes); ocf_core_stats_cache_block_update(req->core, req->part_id, - OCF_WRITE, bytes); + OCF_WRITE, bytes, req->io.pf_id); ocf_req_forward_cache_io(req, OCF_WRITE, addr, bytes, req->offset + total_bytes); diff --git a/src/engine/engine_io.c b/src/engine/engine_io.c index dbdabfd9..faaa6af1 100644 --- a/src/engine/engine_io.c +++ b/src/engine/engine_io.c @@ -28,7 +28,7 @@ void ocf_engine_forward_cache_io(struct ocf_request *req, int dir, addr += (offset + seek) % ocf_line_size(cache); ocf_core_stats_cache_block_update(req->core, req->part_id, - dir, req->bytes); + dir, req->bytes, req->io.pf_id); ocf_req_forward_cache_io(req, dir, addr, size, req->offset + offset); @@ -49,7 +49,7 @@ void ocf_engine_forward_cache_io_req(struct ocf_request *req, int dir, addr += req->addr % ocf_line_size(cache); ocf_core_stats_cache_block_update(req->core, req->part_id, - dir, req->bytes); + dir, req->bytes, req->io.pf_id); ocf_req_forward_cache_io(req, dir, addr, req->bytes, req->offset); @@ -98,7 +98,7 @@ void ocf_engine_forward_cache_io_req(struct ocf_request *req, int dir, ENV_BUG_ON(bytes == 0); ocf_core_stats_cache_block_update(req->core, req->part_id, - dir, bytes); + dir, bytes, req->io.pf_id); ocf_req_forward_cache_io(req, dir, addr, bytes, req->offset + total_bytes); diff --git a/src/ocf_stats.c b/src/ocf_stats.c index aa4c19e0..2f2ce222 100644 --- a/src/ocf_stats.c +++ b/src/ocf_stats.c @@ -92,10 +92,17 @@ void ocf_core_stats_vol_block_update(ocf_core_t core, ocf_part_id_t part_id, } void ocf_core_stats_cache_block_update(ocf_core_t core, ocf_part_id_t part_id, - int dir, uint64_t bytes) + int dir, uint64_t bytes, ocf_pf_id_t pf_id) { - struct ocf_counters_block *counters = - &core->counters->part_counters[part_id].cache_blocks; + struct ocf_counters_block *counters; + + if (OCF_PF_ID_VALID(pf_id)) { + counters = &core->counters-> + part_counters[part_id].prefetch_blocks[pf_id]; + } else { + counters = &core->counters-> + part_counters[part_id].cache_blocks; + } _ocf_stats_block_update(counters, dir, bytes); } @@ -103,15 +110,17 @@ void ocf_core_stats_cache_block_update(ocf_core_t core, ocf_part_id_t part_id, void ocf_core_stats_core_block_update(ocf_core_t core, ocf_part_id_t part_id, int dir, uint64_t bytes, ocf_pf_id_t pf_id) { - struct ocf_counters_block *counters = - &core->counters->part_counters[part_id].core_blocks; + struct ocf_counters_block *counters; - _ocf_stats_block_update(counters, dir, bytes); if (OCF_PF_ID_VALID(pf_id)) { counters = &core->counters-> part_counters[part_id].prefetch_blocks[pf_id]; - _ocf_stats_block_update(counters, dir, bytes); + } else { + counters = &core->counters-> + part_counters[part_id].core_blocks; } + + _ocf_stats_block_update(counters, dir, bytes); } void ocf_core_stats_pt_block_update(ocf_core_t core, ocf_part_id_t part_id, diff --git a/src/ocf_stats_priv.h b/src/ocf_stats_priv.h index 0fb7ba78..735eee89 100644 --- a/src/ocf_stats_priv.h +++ b/src/ocf_stats_priv.h @@ -215,7 +215,7 @@ struct ocf_counters_core { void ocf_core_stats_core_block_update(ocf_core_t core, ocf_part_id_t part_id, int dir, uint64_t bytes, ocf_pf_id_t pf_id); void ocf_core_stats_cache_block_update(ocf_core_t core, ocf_part_id_t part_id, - int dir, uint64_t bytes); + int dir, uint64_t bytes, ocf_pf_id_t pf_id); void ocf_core_stats_vol_block_update(ocf_core_t core, ocf_part_id_t part_id, int dir, uint64_t bytes); void ocf_core_stats_pt_block_update(ocf_core_t core, ocf_part_id_t part_id, diff --git a/src/prefetch/ocf_prefetch.c b/src/prefetch/ocf_prefetch.c index 93a048a5..cb0901dd 100644 --- a/src/prefetch/ocf_prefetch.c +++ b/src/prefetch/ocf_prefetch.c @@ -68,7 +68,7 @@ static bool ocf_pf_next_sub_range_miss(struct ocf_request *req, return true; } -void ocf_prefetch_range(struct ocf_request *req, ocf_pf_id_t pf_id, +static void ocf_prefetch_range(struct ocf_request *req, ocf_pf_id_t pf_id, struct ocf_pf_range *range) { struct ocf_request *prefetch_req = NULL; diff --git a/src/prefetch/ocf_prefetch_readahead.c b/src/prefetch/ocf_prefetch_readahead.c index 0076587e..969326ce 100644 --- a/src/prefetch/ocf_prefetch_readahead.c +++ b/src/prefetch/ocf_prefetch_readahead.c @@ -21,6 +21,6 @@ void ocf_pf_readahead_get_range(struct ocf_request *req, struct ocf_pf_range *range) { range->core_line_first = req->core_line_first + req->core_line_count; - range->core_line_count = OCF_MIN(req->core_line_count, + range->core_line_count = OCF_MAX(req->core_line_count, ocf_bytes_2_lines(req->cache, OCF_PF_READAHEAD_MIN)); } diff --git a/src/utils/utils_cleaner.c b/src/utils/utils_cleaner.c index 451ee2a6..379fcc3f 100644 --- a/src/utils/utils_cleaner.c +++ b/src/utils/utils_cleaner.c @@ -580,7 +580,7 @@ static int _ocf_cleaner_fire_cache(struct ocf_request *req) part_id = ocf_metadata_get_partition_id(cache, iter->coll_idx); ocf_core_stats_cache_block_update(req->core, part_id, OCF_READ, - ocf_line_size(cache)); + ocf_line_size(cache), ocf_pf_none); req->addr = iter->core_line * ocf_line_size(cache);