From 9dc1381b77e822aa4d51ec79a5fcffd7c156486b Mon Sep 17 00:00:00 2001 From: Adam Rutkowski Date: Wed, 12 Jun 2019 18:30:17 -0400 Subject: [PATCH] Refactor ocf_submit_cache_reqs map indexing Refactoring ocf_submit_cache_reqs to make it clear that req->map is accessed at index derived from offset argument, not necesarily starting at 0. Signed-off-by: Adam Rutkowski --- src/utils/utils_io.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/utils/utils_io.c b/src/utils/utils_io.c index 719fd22..ff405c8 100644 --- a/src/utils/utils_io.c +++ b/src/utils/utils_io.c @@ -236,12 +236,11 @@ void ocf_submit_cache_reqs(struct ocf_cache *cache, struct ocf_io *io; int err; uint32_t i; - uint32_t entry = ocf_bytes_2_lines(cache, req->byte_position + offset) - - ocf_bytes_2_lines(cache, req->byte_position); - struct ocf_map_info *map_info = &req->map[entry]; + uint32_t first_cl = ocf_bytes_2_lines(cache, req->byte_position + + offset) - ocf_bytes_2_lines(cache, req->byte_position); ENV_BUG_ON(req->byte_length < offset + size); - ENV_BUG_ON(entry + reqs > req->core_line_count); + ENV_BUG_ON(first_cl + reqs > req->core_line_count); cache_stats = &req->core->counters->cache_blocks; @@ -253,7 +252,7 @@ void ocf_submit_cache_reqs(struct ocf_cache *cache, } addr = ocf_metadata_map_lg2phy(cache, - map_info[0].coll_idx); + req->map[first_cl].coll_idx); addr *= ocf_line_size(cache); addr += cache->device->metadata_offset; addr += ((req->byte_position + offset) % ocf_line_size(cache)); @@ -288,7 +287,7 @@ void ocf_submit_cache_reqs(struct ocf_cache *cache, } addr = ocf_metadata_map_lg2phy(cache, - map_info[i].coll_idx); + req->map[first_cl + i].coll_idx); addr *= ocf_line_size(cache); addr += cache->device->metadata_offset; bytes = ocf_line_size(cache);