Change nhit_hash names to avoid collision with kernel
Signed-off-by: Jan Musial <jan.musial@intel.com>
This commit is contained in:
parent
a1d3cf0c4d
commit
ee3fdb0506
@ -1,25 +0,0 @@
|
||||
/*
|
||||
* Copyright(c) 2019 Intel Corporation
|
||||
* SPDX-License-Identifier: BSD-3-Clause-Clear
|
||||
*/
|
||||
|
||||
#ifndef NHIT_HASH_H_
|
||||
#define NHIT_HASH_H_
|
||||
|
||||
#include "ocf/ocf.h"
|
||||
|
||||
typedef struct nhit_hash *nhit_hash_t;
|
||||
|
||||
ocf_error_t hash_init(uint64_t hash_size, nhit_hash_t *ctx);
|
||||
|
||||
void hash_deinit(nhit_hash_t ctx);
|
||||
|
||||
void hash_insert(nhit_hash_t ctx, ocf_core_id_t core_id, uint64_t core_lba);
|
||||
|
||||
bool hash_query(nhit_hash_t ctx, ocf_core_id_t core_id, uint64_t core_lba,
|
||||
int32_t *counter);
|
||||
|
||||
void hash_set_occurences(nhit_hash_t ctx, ocf_core_id_t core_id,
|
||||
uint64_t core_lba, int32_t occurences);
|
||||
|
||||
#endif /* NHIT_HASH_H_ */
|
@ -3,7 +3,7 @@
|
||||
* SPDX-License-Identifier: BSD-3-Clause-Clear
|
||||
*/
|
||||
|
||||
#include "hash.h"
|
||||
#include "nhit_hash.h"
|
||||
#include "../../metadata/metadata.h"
|
||||
#include "../../ocf_priv.h"
|
||||
#include "../../engine/engine_common.h"
|
||||
@ -32,7 +32,7 @@ ocf_error_t nhit_init(ocf_cache_t cache, ocf_promotion_policy_t policy)
|
||||
goto exit;
|
||||
}
|
||||
|
||||
result = hash_init(ocf_metadata_get_cachelines_count(cache) *
|
||||
result = nhit_hash_init(ocf_metadata_get_cachelines_count(cache) *
|
||||
NHIT_MAPPING_RATIO, &ctx->hash_map);
|
||||
if (result)
|
||||
goto dealloc_ctx;
|
||||
@ -57,7 +57,7 @@ void nhit_deinit(ocf_promotion_policy_t policy)
|
||||
{
|
||||
struct nhit_policy_context *ctx = policy->ctx;
|
||||
|
||||
hash_deinit(ctx->hash_map);
|
||||
nhit_hash_deinit(ctx->hash_map);
|
||||
|
||||
env_vfree(ctx);
|
||||
policy->ctx = NULL;
|
||||
@ -137,7 +137,7 @@ ocf_error_t nhit_get_param(ocf_promotion_policy_t policy, uint8_t param_id,
|
||||
static void core_line_purge(struct nhit_policy_context *ctx, ocf_core_id_t core_id,
|
||||
uint64_t core_lba)
|
||||
{
|
||||
hash_set_occurences(ctx->hash_map, core_id, core_lba, 0);
|
||||
nhit_hash_set_occurences(ctx->hash_map, core_id, core_lba, 0);
|
||||
}
|
||||
|
||||
void nhit_req_purge(ocf_promotion_policy_t policy,
|
||||
@ -161,13 +161,13 @@ static bool core_line_should_promote(struct nhit_policy_context *ctx,
|
||||
bool hit;
|
||||
int32_t counter;
|
||||
|
||||
hit = hash_query(ctx->hash_map, core_id, core_lba, &counter);
|
||||
hit = nhit_hash_query(ctx->hash_map, core_id, core_lba, &counter);
|
||||
if (hit) {
|
||||
/* we have a hit, return now */
|
||||
return env_atomic_read(&ctx->insertion_threshold) <= counter;
|
||||
}
|
||||
|
||||
hash_insert(ctx->hash_map, core_id, core_lba);
|
||||
nhit_hash_insert(ctx->hash_map, core_id, core_lba);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
@ -5,7 +5,7 @@
|
||||
|
||||
#include "../../ocf_priv.h"
|
||||
|
||||
#include "hash.h"
|
||||
#include "nhit_hash.h"
|
||||
|
||||
/* Implementation of hashmap-ish structure for tracking core lines in nhit
|
||||
* promotion policy. It consists of two arrays:
|
||||
@ -109,7 +109,7 @@ struct nhit_hash {
|
||||
env_spinlock rb_pointer_lock;
|
||||
};
|
||||
|
||||
ocf_error_t hash_init(uint64_t hash_size, nhit_hash_t *ctx)
|
||||
ocf_error_t nhit_hash_init(uint64_t hash_size, nhit_hash_t *ctx)
|
||||
{
|
||||
int result = 0;
|
||||
struct nhit_hash *new_ctx;
|
||||
@ -181,7 +181,7 @@ exit:
|
||||
return result;
|
||||
}
|
||||
|
||||
void hash_deinit(nhit_hash_t ctx)
|
||||
void nhit_hash_deinit(nhit_hash_t ctx)
|
||||
{
|
||||
ocf_cache_line_t i;
|
||||
|
||||
@ -329,7 +329,7 @@ static inline void write_unlock_hashes(nhit_hash_t ctx, ocf_core_id_t core_id1,
|
||||
env_rwsem_up_write(&ctx->hash_locks[hash2]);
|
||||
}
|
||||
|
||||
void hash_insert(nhit_hash_t ctx, ocf_core_id_t core_id, uint64_t core_lba)
|
||||
void nhit_hash_insert(nhit_hash_t ctx, ocf_core_id_t core_id, uint64_t core_lba)
|
||||
{
|
||||
uint64_t slot_id;
|
||||
struct nhit_list_elem *slot;
|
||||
@ -353,7 +353,7 @@ void hash_insert(nhit_hash_t ctx, ocf_core_id_t core_id, uint64_t core_lba)
|
||||
commit_rb_slot(ctx, slot_id);
|
||||
}
|
||||
|
||||
bool hash_query(nhit_hash_t ctx, ocf_core_id_t core_id, uint64_t core_lba,
|
||||
bool nhit_hash_query(nhit_hash_t ctx, ocf_core_id_t core_id, uint64_t core_lba,
|
||||
int32_t *counter)
|
||||
{
|
||||
ocf_cache_line_t hash = hash_function(core_id, core_lba,
|
||||
@ -377,7 +377,7 @@ bool hash_query(nhit_hash_t ctx, ocf_core_id_t core_id, uint64_t core_lba,
|
||||
return true;
|
||||
}
|
||||
|
||||
void hash_set_occurences(nhit_hash_t ctx, ocf_core_id_t core_id,
|
||||
void nhit_hash_set_occurences(nhit_hash_t ctx, ocf_core_id_t core_id,
|
||||
uint64_t core_lba, int32_t occurences)
|
||||
{
|
||||
ocf_cache_line_t hash = hash_function(core_id, core_lba,
|
24
src/promotion/nhit/nhit_hash.h
Normal file
24
src/promotion/nhit/nhit_hash.h
Normal file
@ -0,0 +1,24 @@
|
||||
/*
|
||||
* Copyright(c) 2019 Intel Corporation
|
||||
* SPDX-License-Identifier: BSD-3-Clause-Clear
|
||||
*/
|
||||
|
||||
#ifndef NHIT_HASH_H_
|
||||
#define NHIT_HASH_H_
|
||||
|
||||
#include "ocf/ocf.h"
|
||||
|
||||
typedef struct nhit_hash *nhit_hash_t;
|
||||
|
||||
ocf_error_t nhit_hash_init(uint64_t hash_size, nhit_hash_t *ctx);
|
||||
|
||||
void nhit_hash_deinit(nhit_hash_t ctx);
|
||||
|
||||
void nhit_hash_insert(nhit_hash_t ctx, ocf_core_id_t core_id, uint64_t core_lba);
|
||||
|
||||
bool nhit_hash_query(nhit_hash_t ctx, ocf_core_id_t core_id, uint64_t core_lba,
|
||||
int32_t *counter);
|
||||
|
||||
void nhit_hash_set_occurences(nhit_hash_t ctx, ocf_core_id_t core_id,
|
||||
uint64_t core_lba, int32_t occurences);
|
||||
#endif /* NHIT_HASH_H_ */
|
Loading…
Reference in New Issue
Block a user