Merge pull request #253 from mmichal10/stats-refactor
Stats builder for ioclasses
This commit is contained in:
@@ -61,7 +61,7 @@ static void _ocf_backfill_complete(struct ocf_request *req, int error)
|
||||
req->data = NULL;
|
||||
|
||||
if (req->error) {
|
||||
env_atomic_inc(&req->core->counters->cache_errors.write);
|
||||
ocf_core_stats_cache_error_update(req->core, OCF_WRITE);
|
||||
ocf_engine_invalidate(req);
|
||||
} else {
|
||||
ocf_req_unlock(req);
|
||||
|
@@ -446,42 +446,14 @@ void ocf_engine_clean(struct ocf_request *req)
|
||||
|
||||
void ocf_engine_update_block_stats(struct ocf_request *req)
|
||||
{
|
||||
ocf_part_id_t part_id = req->part_id;
|
||||
struct ocf_counters_block *blocks;
|
||||
|
||||
blocks = &req->core->counters->
|
||||
part_counters[part_id].blocks;
|
||||
|
||||
if (req->rw == OCF_READ)
|
||||
env_atomic64_add(req->byte_length, &blocks->read_bytes);
|
||||
else if (req->rw == OCF_WRITE)
|
||||
env_atomic64_add(req->byte_length, &blocks->write_bytes);
|
||||
else
|
||||
ENV_BUG();
|
||||
ocf_core_stats_vol_block_update(req->core, req->part_id, req->rw,
|
||||
req->byte_length);
|
||||
}
|
||||
|
||||
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)
|
||||
|
@@ -16,17 +16,13 @@
|
||||
|
||||
static void _ocf_d2c_completion(struct ocf_request *req, int error)
|
||||
{
|
||||
ocf_core_t core = req->core;
|
||||
req->error = error;
|
||||
|
||||
OCF_DEBUG_RQ(req, "Completion");
|
||||
|
||||
if (req->error) {
|
||||
req->info.core_error = 1;
|
||||
if (req->rw == OCF_READ)
|
||||
env_atomic_inc(&core->counters->core_errors.read);
|
||||
else
|
||||
env_atomic_inc(&core->counters->core_errors.write);
|
||||
ocf_core_stats_core_error_update(req->core, req->rw);
|
||||
}
|
||||
|
||||
/* Complete request */
|
||||
@@ -51,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);
|
||||
|
@@ -43,7 +43,7 @@ static void _ocf_read_fast_complete(struct ocf_request *req, int error)
|
||||
if (req->error) {
|
||||
OCF_DEBUG_RQ(req, "ERROR");
|
||||
|
||||
env_atomic_inc(&req->core->counters->cache_errors.read);
|
||||
ocf_core_stats_cache_error_update(req->core, OCF_READ);
|
||||
ocf_engine_push_req_front_pt(req);
|
||||
} else {
|
||||
ocf_req_unlock(req);
|
||||
@@ -91,7 +91,7 @@ static int _ocf_read_fast_do(struct ocf_request *req)
|
||||
ocf_engine_io_count(req), _ocf_read_fast_complete);
|
||||
|
||||
|
||||
/* Updata statistics */
|
||||
/* Update statistics */
|
||||
ocf_engine_update_request_stats(req);
|
||||
ocf_engine_update_block_stats(req);
|
||||
|
||||
|
@@ -20,7 +20,7 @@ static void _ocf_invalidate_req(struct ocf_request *req, int error)
|
||||
{
|
||||
if (error) {
|
||||
req->error = error;
|
||||
env_atomic_inc(&req->core->counters->cache_errors.write);
|
||||
ocf_core_stats_cache_error_update(req->core, OCF_WRITE);
|
||||
}
|
||||
|
||||
if (env_atomic_dec_return(&req->req_remaining))
|
||||
|
@@ -28,7 +28,7 @@ static void _ocf_read_pt_complete(struct ocf_request *req, int error)
|
||||
|
||||
if (req->error) {
|
||||
req->info.core_error = 1;
|
||||
env_atomic_inc(&req->core->counters->core_errors.read);
|
||||
ocf_core_stats_core_error_update(req->core, OCF_READ);
|
||||
}
|
||||
|
||||
/* Complete request */
|
||||
@@ -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);
|
||||
|
@@ -38,7 +38,7 @@ static void _ocf_read_generic_hit_complete(struct ocf_request *req, int error)
|
||||
OCF_DEBUG_RQ(req, "HIT completion");
|
||||
|
||||
if (req->error) {
|
||||
env_atomic_inc(&req->core->counters->cache_errors.read);
|
||||
ocf_core_stats_cache_error_update(req->core, OCF_READ);
|
||||
ocf_engine_push_req_front_pt(req);
|
||||
} else {
|
||||
|
||||
@@ -77,7 +77,7 @@ static void _ocf_read_generic_miss_complete(struct ocf_request *req, int error)
|
||||
req->complete(req, req->error);
|
||||
|
||||
req->info.core_error = 1;
|
||||
env_atomic_inc(&req->core->counters->core_errors.read);
|
||||
ocf_core_stats_core_error_update(req->core, OCF_READ);
|
||||
|
||||
ctx_data_free(cache->owner, req->cp_data);
|
||||
req->cp_data = NULL;
|
||||
|
@@ -24,7 +24,7 @@ static void _ocf_read_wa_complete(struct ocf_request *req, int error)
|
||||
|
||||
if (req->error) {
|
||||
req->info.core_error = 1;
|
||||
env_atomic_inc(&req->core->counters->core_errors.write);
|
||||
ocf_core_stats_core_error_update(req->core, OCF_WRITE);
|
||||
}
|
||||
|
||||
/* Complete request */
|
||||
@@ -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 */
|
||||
|
@@ -89,7 +89,7 @@ static const struct ocf_io_if _io_if_wb_flush_metadata = {
|
||||
static void _ocf_write_wb_complete(struct ocf_request *req, int error)
|
||||
{
|
||||
if (error) {
|
||||
env_atomic_inc(&req->core->counters->cache_errors.write);
|
||||
ocf_core_stats_cache_error_update(req->core, OCF_WRITE);
|
||||
req->error |= error;
|
||||
}
|
||||
|
||||
@@ -150,13 +150,13 @@ int ocf_write_wb_do(struct ocf_request *req)
|
||||
/* Get OCF request - increase reference counter */
|
||||
ocf_req_get(req);
|
||||
|
||||
/* Updata status bits */
|
||||
/* Update status bits */
|
||||
_ocf_write_wb_update_bits(req);
|
||||
|
||||
/* Submit IO */
|
||||
_ocf_write_wb_submit(req);
|
||||
|
||||
/* Updata statistics */
|
||||
/* Update statistics */
|
||||
ocf_engine_update_request_stats(req);
|
||||
ocf_engine_update_block_stats(req);
|
||||
|
||||
|
@@ -26,7 +26,7 @@ static const struct ocf_io_if _io_if_wi_flush_metadata = {
|
||||
static void _ocf_write_wi_io_flush_metadata(struct ocf_request *req, int error)
|
||||
{
|
||||
if (error) {
|
||||
env_atomic_inc(&req->core->counters->cache_errors.write);
|
||||
ocf_core_stats_cache_error_update(req->core, OCF_WRITE);
|
||||
req->error |= error;
|
||||
}
|
||||
|
||||
@@ -77,7 +77,7 @@ static void _ocf_write_wi_core_complete(struct ocf_request *req, int error)
|
||||
if (error) {
|
||||
req->error = error;
|
||||
req->info.core_error = 1;
|
||||
env_atomic_inc(&req->core->counters->core_errors.write);
|
||||
ocf_core_stats_core_error_update(req->core, OCF_WRITE);
|
||||
}
|
||||
|
||||
if (env_atomic_dec_return(&req->req_remaining))
|
||||
@@ -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);
|
||||
|
@@ -21,7 +21,7 @@
|
||||
static void ocf_read_wo_cache_complete(struct ocf_request *req, int error)
|
||||
{
|
||||
if (error) {
|
||||
env_atomic_inc(&req->core->counters->cache_errors.read);
|
||||
ocf_core_stats_cache_error_update(req->core, OCF_READ);
|
||||
req->error |= error;
|
||||
}
|
||||
|
||||
@@ -148,7 +148,7 @@ static void _ocf_read_wo_core_complete(struct ocf_request *req, int error)
|
||||
if (error) {
|
||||
req->error |= error;
|
||||
req->info.core_error = 1;
|
||||
env_atomic_inc(&req->core->counters->core_errors.read);
|
||||
ocf_core_stats_core_error_update(req->core, OCF_READ);
|
||||
}
|
||||
|
||||
/* if all mapped cachelines are clean, the data we've read from core
|
||||
|
@@ -48,7 +48,7 @@ static void _ocf_write_wt_cache_complete(struct ocf_request *req, int error)
|
||||
{
|
||||
if (error) {
|
||||
req->error = req->error ?: error;
|
||||
env_atomic_inc(&req->core->counters->cache_errors.write);
|
||||
ocf_core_stats_cache_error_update(req->core, OCF_WRITE);
|
||||
|
||||
if (req->error)
|
||||
inc_fallback_pt_error_counter(req->cache);
|
||||
@@ -62,7 +62,7 @@ static void _ocf_write_wt_core_complete(struct ocf_request *req, int error)
|
||||
if (error) {
|
||||
req->error = error;
|
||||
req->info.core_error = 1;
|
||||
env_atomic_inc(&req->core->counters->core_errors.write);
|
||||
ocf_core_stats_core_error_update(req->core, OCF_WRITE);
|
||||
}
|
||||
|
||||
_ocf_write_wt_req_complete(req);
|
||||
|
@@ -50,7 +50,7 @@ static const struct ocf_io_if _io_if_zero_purge = {
|
||||
static void _ocf_zero_io_flush_metadata(struct ocf_request *req, int error)
|
||||
{
|
||||
if (error) {
|
||||
env_atomic_inc(&req->core->counters->cache_errors.write);
|
||||
ocf_core_stats_cache_error_update(req->core, OCF_WRITE);
|
||||
req->error = error;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user