Cleanup map_info struct

1. Rename hash_key -> hash
2. Better comments for hash and coll_idx

Signed-off-by: Adam Rutkowski <adam.j.rutkowski@intel.com>
This commit is contained in:
Adam Rutkowski 2019-07-19 12:58:07 -04:00
parent 0c8bc4cec5
commit 7184f7787c
3 changed files with 15 additions and 13 deletions

View File

@ -37,19 +37,19 @@ void ocf_engine_lookup_map_entry(struct ocf_cache *cache,
uint64_t core_line)
{
ocf_cache_line_t line;
ocf_cache_line_t hash_key;
ocf_cache_line_t hash;
hash_key = ocf_metadata_hash_func(cache, core_line, core_id);
hash = ocf_metadata_hash_func(cache, core_line, core_id);
/* Initially assume that we have cache miss.
* Hash points to proper bucket.
*/
entry->hash_key = hash_key;
entry->hash = hash;
entry->status = LOOKUP_MISS;
entry->coll_idx = cache->device->collision_table_entries;
entry->core_line = core_line;
line = ocf_metadata_get_hash(cache, hash_key);
line = ocf_metadata_get_hash(cache, hash);
while (line != cache->device->collision_table_entries) {
ocf_core_id_t curr_core_id;
@ -340,7 +340,7 @@ void ocf_engine_map(struct ocf_request *req)
if (entry->status != LOOKUP_HIT) {
ocf_engine_map_cache_line(req, entry->core_line,
entry->hash_key, &entry->coll_idx);
entry->hash, &entry->coll_idx);
if (req->info.eviction_error) {
/*

View File

@ -49,9 +49,11 @@ struct ocf_req_info {
};
struct ocf_map_info {
/* If HIT -> pointer to hash_key and coll_idx */
unsigned int hash_key;
unsigned int coll_idx;
ocf_cache_line_t hash;
/*!< target LBA & core id hash */
ocf_cache_line_t coll_idx;
/*!< Index in collision table (in case of hit) */
uint64_t core_line;

View File

@ -493,7 +493,7 @@ static void _ocf_cleaner_core_io_for_dirty_range(struct ocf_request *req,
addr = (ocf_line_size(cache) * iter->core_line)
+ SECTORS_TO_BYTES(begin);
offset = (ocf_line_size(cache) * iter->hash_key)
offset = (ocf_line_size(cache) * iter->hash)
+ SECTORS_TO_BYTES(begin);
ocf_io_configure(io, addr, SECTORS_TO_BYTES(end - begin), OCF_WRITE,
@ -676,7 +676,7 @@ static int _ocf_cleaner_fire_cache(struct ocf_request *req)
addr *= ocf_line_size(cache);
addr += cache->device->metadata_offset;
offset = ocf_line_size(cache) * iter->hash_key;
offset = ocf_line_size(cache) * iter->hash;
part_id = ocf_metadata_get_partition_id(cache, iter->coll_idx);
@ -776,7 +776,7 @@ static int _ocf_cleaner_do_fire(struct ocf_request *req, uint32_t i_out,
req->map[i_out].core_id = OCF_CORE_MAX;
req->map[i_out].core_line = ULLONG_MAX;
req->map[i_out].status = LOOKUP_MISS;
req->map[i_out].hash_key = i_out;
req->map[i_out].hash = i_out;
}
if (do_sort) {
@ -784,7 +784,7 @@ static int _ocf_cleaner_do_fire(struct ocf_request *req, uint32_t i_out,
env_sort(req->map, req->core_line_count, sizeof(req->map[0]),
_ocf_cleaner_cmp_private, NULL);
for (i = 0; i < req->core_line_count; i++)
req->map[i].hash_key = i;
req->map[i].hash = i;
}
/* issue actual request */
@ -919,7 +919,7 @@ void ocf_cleaner_fire(struct ocf_cache *cache,
req->map[i_out].core_line = core_sector;
req->map[i_out].coll_idx = cache_line;
req->map[i_out].status = LOOKUP_HIT;
req->map[i_out].hash_key = i_out;
req->map[i_out].hash = i_out;
i_out++;
if (max == i_out) {