Use API instead of raw variables to update block stats.
Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
This commit is contained in:
parent
51c9c516a4
commit
01ce586e6a
@ -453,18 +453,8 @@ void ocf_engine_clean(struct ocf_request *req)
|
|||||||
|
|
||||||
void ocf_engine_update_block_stats(struct ocf_request *req)
|
void ocf_engine_update_block_stats(struct ocf_request *req)
|
||||||
{
|
{
|
||||||
ocf_part_id_t part_id = req->part_id;
|
ocf_core_stats_vol_block_update(req->core, req->part_id, req->rw,
|
||||||
struct ocf_counters_block *blocks;
|
req->byte_length);
|
||||||
|
|
||||||
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();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ocf_engine_update_request_stats(struct ocf_request *req)
|
void ocf_engine_update_request_stats(struct ocf_request *req)
|
||||||
|
@ -480,13 +480,10 @@ static void _ocf_cleaner_core_io_for_dirty_range(struct ocf_request *req,
|
|||||||
int err;
|
int err;
|
||||||
ocf_cache_t cache = req->cache;
|
ocf_cache_t cache = req->cache;
|
||||||
struct ocf_io *io;
|
struct ocf_io *io;
|
||||||
struct ocf_counters_block *core_stats;
|
|
||||||
ocf_core_t core = ocf_cache_get_core(cache, iter->core_id);
|
ocf_core_t core = ocf_cache_get_core(cache, iter->core_id);
|
||||||
ocf_part_id_t part_id = ocf_metadata_get_partition_id(cache,
|
ocf_part_id_t part_id = ocf_metadata_get_partition_id(cache,
|
||||||
iter->coll_idx);
|
iter->coll_idx);
|
||||||
|
|
||||||
core_stats = &core->counters->part_counters[part_id].core_blocks;
|
|
||||||
|
|
||||||
addr = (ocf_line_size(cache) * iter->core_line)
|
addr = (ocf_line_size(cache) * iter->core_line)
|
||||||
+ SECTORS_TO_BYTES(begin);
|
+ SECTORS_TO_BYTES(begin);
|
||||||
offset = (ocf_line_size(cache) * iter->hash)
|
offset = (ocf_line_size(cache) * iter->hash)
|
||||||
@ -505,7 +502,8 @@ static void _ocf_cleaner_core_io_for_dirty_range(struct ocf_request *req,
|
|||||||
|
|
||||||
ocf_io_set_cmpl(io, iter, req, _ocf_cleaner_core_io_cmpl);
|
ocf_io_set_cmpl(io, iter, req, _ocf_cleaner_core_io_cmpl);
|
||||||
|
|
||||||
env_atomic64_add(SECTORS_TO_BYTES(end - begin), &core_stats->write_bytes);
|
ocf_core_stats_core_block_update(core, part_id, OCF_WRITE,
|
||||||
|
SECTORS_TO_BYTES(end - begin));
|
||||||
|
|
||||||
OCF_DEBUG_PARAM(req->cache, "Core write, line = %llu, "
|
OCF_DEBUG_PARAM(req->cache, "Core write, line = %llu, "
|
||||||
"sector = %llu, count = %llu", iter->core_line, begin,
|
"sector = %llu, count = %llu", iter->core_line, begin,
|
||||||
@ -644,7 +642,6 @@ static int _ocf_cleaner_fire_cache(struct ocf_request *req)
|
|||||||
ocf_part_id_t part_id;
|
ocf_part_id_t part_id;
|
||||||
struct ocf_io *io;
|
struct ocf_io *io;
|
||||||
int err;
|
int err;
|
||||||
struct ocf_counters_block *cache_stats;
|
|
||||||
|
|
||||||
/* Protect IO completion race */
|
/* Protect IO completion race */
|
||||||
env_atomic_inc(&req->req_remaining);
|
env_atomic_inc(&req->req_remaining);
|
||||||
@ -668,8 +665,6 @@ static int _ocf_cleaner_fire_cache(struct ocf_request *req)
|
|||||||
|
|
||||||
part_id = ocf_metadata_get_partition_id(cache, iter->coll_idx);
|
part_id = ocf_metadata_get_partition_id(cache, iter->coll_idx);
|
||||||
|
|
||||||
cache_stats = &core->counters->part_counters[part_id].cache_blocks;
|
|
||||||
|
|
||||||
io = ocf_new_cache_io(cache, req->io_queue,
|
io = ocf_new_cache_io(cache, req->io_queue,
|
||||||
addr, ocf_line_size(cache),
|
addr, ocf_line_size(cache),
|
||||||
OCF_READ, part_id, 0);
|
OCF_READ, part_id, 0);
|
||||||
@ -689,7 +684,8 @@ static int _ocf_cleaner_fire_cache(struct ocf_request *req)
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
env_atomic64_add(ocf_line_size(cache), &cache_stats->read_bytes);
|
ocf_core_stats_cache_block_update(core, part_id, OCF_READ,
|
||||||
|
ocf_line_size(cache));
|
||||||
|
|
||||||
ocf_volume_submit_io(io);
|
ocf_volume_submit_io(io);
|
||||||
}
|
}
|
||||||
|
@ -227,7 +227,6 @@ void ocf_submit_cache_reqs(struct ocf_cache *cache,
|
|||||||
struct ocf_request *req, int dir, uint64_t offset,
|
struct ocf_request *req, int dir, uint64_t offset,
|
||||||
uint64_t size, unsigned int reqs, ocf_req_end_t callback)
|
uint64_t size, unsigned int reqs, ocf_req_end_t callback)
|
||||||
{
|
{
|
||||||
struct ocf_counters_block *cache_stats;
|
|
||||||
uint64_t flags = req->ioi.io.flags;
|
uint64_t flags = req->ioi.io.flags;
|
||||||
uint32_t io_class = req->ioi.io.io_class;
|
uint32_t io_class = req->ioi.io.io_class;
|
||||||
uint64_t addr, bytes, total_bytes = 0;
|
uint64_t addr, bytes, total_bytes = 0;
|
||||||
@ -240,8 +239,6 @@ void ocf_submit_cache_reqs(struct ocf_cache *cache,
|
|||||||
ENV_BUG_ON(req->byte_length < offset + size);
|
ENV_BUG_ON(req->byte_length < offset + size);
|
||||||
ENV_BUG_ON(first_cl + reqs > req->core_line_count);
|
ENV_BUG_ON(first_cl + reqs > req->core_line_count);
|
||||||
|
|
||||||
cache_stats = &req->core->counters->part_counters[io_class].cache_blocks;
|
|
||||||
|
|
||||||
if (reqs == 1) {
|
if (reqs == 1) {
|
||||||
addr = ocf_metadata_map_lg2phy(cache,
|
addr = ocf_metadata_map_lg2phy(cache,
|
||||||
req->map[first_cl].coll_idx);
|
req->map[first_cl].coll_idx);
|
||||||
@ -323,27 +320,20 @@ void ocf_submit_cache_reqs(struct ocf_cache *cache,
|
|||||||
ENV_BUG_ON(total_bytes != size);
|
ENV_BUG_ON(total_bytes != size);
|
||||||
|
|
||||||
update_stats:
|
update_stats:
|
||||||
if (dir == OCF_WRITE)
|
ocf_core_stats_cache_block_update(req->core, io_class, dir, total_bytes);
|
||||||
env_atomic64_add(total_bytes, &cache_stats->write_bytes);
|
|
||||||
else if (dir == OCF_READ)
|
|
||||||
env_atomic64_add(total_bytes, &cache_stats->read_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,
|
||||||
ocf_req_end_t callback)
|
ocf_req_end_t callback)
|
||||||
{
|
{
|
||||||
struct ocf_counters_block *core_stats;
|
|
||||||
uint64_t flags = req->ioi.io.flags;
|
uint64_t flags = req->ioi.io.flags;
|
||||||
uint32_t io_class = req->ioi.io.io_class;
|
uint32_t io_class = req->ioi.io.io_class;
|
||||||
int dir = req->rw;
|
int dir = req->rw;
|
||||||
struct ocf_io *io;
|
struct ocf_io *io;
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
core_stats = &req->core->counters->part_counters[io_class].core_blocks;
|
ocf_core_stats_core_block_update(req->core, io_class, dir,
|
||||||
if (dir == OCF_WRITE)
|
req->byte_length);
|
||||||
env_atomic64_add(req->byte_length, &core_stats->write_bytes);
|
|
||||||
else if (dir == OCF_READ)
|
|
||||||
env_atomic64_add(req->byte_length, &core_stats->read_bytes);
|
|
||||||
|
|
||||||
io = ocf_volume_new_io(volume, req->io_queue, req->byte_position,
|
io = ocf_volume_new_io(volume, req->io_queue, req->byte_position,
|
||||||
req->byte_length, dir, io_class, flags);
|
req->byte_length, dir, io_class, flags);
|
||||||
|
Loading…
Reference in New Issue
Block a user