From db06783d56e50f322a823115d59ca8773725a052 Mon Sep 17 00:00:00 2001 From: Michal Mielewczyk Date: Tue, 8 Oct 2019 08:34:56 -0400 Subject: [PATCH] Fix cache stats updating. When single request to cache was issued, stats updating function was called with 0 bytes as value to update. In case of many request issued to cache, stats were updated only in case of error. Signed-off-by: Michal Mielewczyk --- src/utils/utils_io.c | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/src/utils/utils_io.c b/src/utils/utils_io.c index 7dbd37e..7e4b7ac 100644 --- a/src/utils/utils_io.c +++ b/src/utils/utils_io.c @@ -250,8 +250,6 @@ void ocf_submit_cache_reqs(struct ocf_cache *cache, io = ocf_new_cache_io(cache, req->io_queue, addr, bytes, dir, io_class, flags); if (!io) { - ocf_core_stats_cache_block_update(req->core, io_class, - dir, total_bytes); callback(req, -OCF_ERR_NO_MEM); return; } @@ -261,17 +259,14 @@ void ocf_submit_cache_reqs(struct ocf_cache *cache, err = ocf_io_set_data(io, req->data, offset); if (err) { ocf_io_put(io); - ocf_core_stats_cache_block_update(req->core, io_class, - dir, total_bytes); callback(req, err); return; } ocf_core_stats_cache_block_update(req->core, io_class, - dir, total_bytes); + dir, bytes); ocf_volume_submit_io(io); - total_bytes = bytes; return; } @@ -304,8 +299,6 @@ void ocf_submit_cache_reqs(struct ocf_cache *cache, addr, bytes, dir, io_class, flags); if (!io) { /* Finish all IOs which left with ERROR */ - ocf_core_stats_cache_block_update(req->core, io_class, - dir, total_bytes); for (; i < reqs; i++) callback(req, -OCF_ERR_NO_MEM); return; @@ -317,12 +310,12 @@ void ocf_submit_cache_reqs(struct ocf_cache *cache, if (err) { ocf_io_put(io); /* Finish all IOs which left with ERROR */ - ocf_core_stats_cache_block_update(req->core, io_class, - dir, total_bytes); for (; i < reqs; i++) callback(req, err); return; } + ocf_core_stats_cache_block_update(req->core, io_class, + dir, bytes); ocf_volume_submit_io(io); total_bytes += bytes; }