Update stats before calling completion callback
Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
This commit is contained in:
parent
74954667a2
commit
f51f7f7e1e
@ -250,8 +250,10 @@ 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);
|
||||||
goto update_stats;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
ocf_io_set_cmpl(io, req, callback, ocf_submit_volume_req_cmpl);
|
ocf_io_set_cmpl(io, req, callback, ocf_submit_volume_req_cmpl);
|
||||||
@ -259,14 +261,18 @@ 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);
|
||||||
goto update_stats;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ocf_core_stats_cache_block_update(req->core, io_class,
|
||||||
|
dir, total_bytes);
|
||||||
|
|
||||||
ocf_volume_submit_io(io);
|
ocf_volume_submit_io(io);
|
||||||
total_bytes = bytes;
|
total_bytes = bytes;
|
||||||
|
return;
|
||||||
goto update_stats;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Issue requests to cache. */
|
/* Issue requests to cache. */
|
||||||
@ -298,9 +304,11 @@ 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);
|
||||||
goto update_stats;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
ocf_io_set_cmpl(io, req, callback, ocf_submit_volume_req_cmpl);
|
ocf_io_set_cmpl(io, req, callback, ocf_submit_volume_req_cmpl);
|
||||||
@ -309,18 +317,17 @@ 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);
|
||||||
goto update_stats;
|
return;
|
||||||
}
|
}
|
||||||
ocf_volume_submit_io(io);
|
ocf_volume_submit_io(io);
|
||||||
total_bytes += bytes;
|
total_bytes += bytes;
|
||||||
}
|
}
|
||||||
|
|
||||||
ENV_BUG_ON(total_bytes != size);
|
ENV_BUG_ON(total_bytes != size);
|
||||||
|
|
||||||
update_stats:
|
|
||||||
ocf_core_stats_cache_block_update(req->core, io_class, dir, total_bytes);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ocf_submit_volume_req(ocf_volume_t volume, struct ocf_request *req,
|
void ocf_submit_volume_req(ocf_volume_t volume, struct ocf_request *req,
|
||||||
|
Loading…
Reference in New Issue
Block a user