Use API instead of raw variables to update req stats.

Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
This commit is contained in:
Michal Mielewczyk 2019-09-05 08:51:51 -04:00
parent b4c384eb2d
commit 51c9c516a4
5 changed files with 10 additions and 33 deletions

View File

@ -469,26 +469,8 @@ void ocf_engine_update_block_stats(struct ocf_request *req)
void ocf_engine_update_request_stats(struct ocf_request *req)
{
ocf_part_id_t part_id = req->part_id;
struct ocf_counters_req *reqs;
switch (req->rw) {
case OCF_READ:
reqs = &req->core->counters->part_counters[part_id].read_reqs;
break;
case OCF_WRITE:
reqs = &req->core->counters->part_counters[part_id].write_reqs;
break;
default:
ENV_BUG();
}
env_atomic64_inc(&reqs->total);
if (req->info.hit_no == 0)
env_atomic64_inc(&reqs->full_miss);
else if (req->info.hit_no < req->core_line_count)
env_atomic64_inc(&reqs->partial_miss);
ocf_core_stats_request_update(req->core, req->part_id, req->rw,
req->info.hit_no, req->core_line_count);
}
void ocf_engine_push_req_back(struct ocf_request *req, bool allow_sync)

View File

@ -47,13 +47,8 @@ int ocf_io_d2c(struct ocf_request *req)
ocf_engine_update_block_stats(req);
if (req->rw == OCF_READ) {
env_atomic64_inc(&core->counters->
part_counters[req->part_id].read_reqs.pass_through);
} else {
env_atomic64_inc(&core->counters->
part_counters[req->part_id].write_reqs.pass_through);
}
ocf_core_stats_request_pt_update(req->core, req->part_id, req->rw,
req->info.hit_no, req->core_line_count);
/* Put OCF request - decrease reference counter */
ocf_req_put(req);

View File

@ -87,8 +87,8 @@ int ocf_read_pt_do(struct ocf_request *req)
/* Update statistics */
ocf_engine_update_block_stats(req);
env_atomic64_inc(&req->core->counters->
part_counters[req->part_id].read_reqs.pass_through);
ocf_core_stats_request_pt_update(req->core, req->part_id, req->rw,
req->info.hit_no, req->core_line_count);
/* Put OCF request - decrease reference counter */
ocf_req_put(req);

View File

@ -76,8 +76,8 @@ int ocf_write_wa(struct ocf_request *req)
/* Update statistics */
ocf_engine_update_block_stats(req);
env_atomic64_inc(&req->core->counters->
part_counters[req->part_id].write_reqs.pass_through);
ocf_core_stats_request_pt_update(req->core, req->part_id, req->rw,
req->info.hit_no, req->core_line_count);
}
/* Put OCF request - decrease reference counter */

View File

@ -112,8 +112,8 @@ static int _ocf_write_wi_do(struct ocf_request *req)
/* Update statistics */
ocf_engine_update_block_stats(req);
env_atomic64_inc(&req->core->counters->
part_counters[req->part_id].write_reqs.pass_through);
ocf_core_stats_request_pt_update(req->core, req->part_id, req->rw,
req->info.hit_no, req->core_line_count);
/* Put OCF request - decrease reference counter */
ocf_req_put(req);