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 <michal.mielewczyk@intel.com>
This commit is contained in:
Michal Mielewczyk 2019-10-08 08:34:56 -04:00
parent 17ec78d88f
commit db06783d56

View File

@ -250,8 +250,6 @@ void ocf_submit_cache_reqs(struct ocf_cache *cache,
io = ocf_new_cache_io(cache, req->io_queue, io = ocf_new_cache_io(cache, req->io_queue,
addr, bytes, dir, io_class, flags); addr, bytes, dir, io_class, flags);
if (!io) { if (!io) {
ocf_core_stats_cache_block_update(req->core, io_class,
dir, total_bytes);
callback(req, -OCF_ERR_NO_MEM); callback(req, -OCF_ERR_NO_MEM);
return; return;
} }
@ -261,17 +259,14 @@ void ocf_submit_cache_reqs(struct ocf_cache *cache,
err = ocf_io_set_data(io, req->data, offset); err = ocf_io_set_data(io, req->data, offset);
if (err) { if (err) {
ocf_io_put(io); ocf_io_put(io);
ocf_core_stats_cache_block_update(req->core, io_class,
dir, total_bytes);
callback(req, err); callback(req, err);
return; return;
} }
ocf_core_stats_cache_block_update(req->core, io_class, ocf_core_stats_cache_block_update(req->core, io_class,
dir, total_bytes); dir, bytes);
ocf_volume_submit_io(io); ocf_volume_submit_io(io);
total_bytes = bytes;
return; return;
} }
@ -304,8 +299,6 @@ void ocf_submit_cache_reqs(struct ocf_cache *cache,
addr, bytes, dir, io_class, flags); addr, bytes, dir, io_class, flags);
if (!io) { if (!io) {
/* Finish all IOs which left with ERROR */ /* Finish all IOs which left with ERROR */
ocf_core_stats_cache_block_update(req->core, io_class,
dir, total_bytes);
for (; i < reqs; i++) for (; i < reqs; i++)
callback(req, -OCF_ERR_NO_MEM); callback(req, -OCF_ERR_NO_MEM);
return; return;
@ -317,12 +310,12 @@ void ocf_submit_cache_reqs(struct ocf_cache *cache,
if (err) { if (err) {
ocf_io_put(io); ocf_io_put(io);
/* Finish all IOs which left with ERROR */ /* Finish all IOs which left with ERROR */
ocf_core_stats_cache_block_update(req->core, io_class,
dir, total_bytes);
for (; i < reqs; i++) for (; i < reqs; i++)
callback(req, err); callback(req, err);
return; return;
} }
ocf_core_stats_cache_block_update(req->core, io_class,
dir, bytes);
ocf_volume_submit_io(io); ocf_volume_submit_io(io);
total_bytes += bytes; total_bytes += bytes;
} }