Remove eviction policy abstraction

Signed-off-by: Adam Rutkowski <adam.j.rutkowski@intel.com>
This commit is contained in:
Adam Rutkowski
2021-06-15 20:39:09 +02:00
parent 31737ee0e7
commit 88e04a4204
33 changed files with 52 additions and 320 deletions

View File

@@ -103,9 +103,11 @@ void set_cache_line_clean(struct ocf_cache *cache, uint8_t start_bit,
ocf_cache_line_t line = req->map[map_idx].coll_idx;
ocf_part_id_t part_id = ocf_metadata_get_partition_id(cache, line);
struct ocf_part *part = &cache->user_parts[part_id].part;
uint8_t evp_type = cache->conf_meta->eviction_policy_type;
bool line_is_clean;
ENV_BUG_ON(part_id > OCF_USER_IO_CLASS_MAX);
part = &cache->user_parts[part_id].part;
if (metadata_clear_dirty_sec_changed(cache, line, start_bit, end_bit,
&line_is_clean)) {
ocf_metadata_flush_mark(cache, req, map_idx, CLEAN, start_bit,
@@ -130,12 +132,7 @@ void set_cache_line_clean(struct ocf_cache *cache, uint8_t start_bit,
*/
env_atomic_dec(&req->core->runtime_meta->
part_counters[part_id].dirty_clines);
if (likely(evict_policy_ops[evp_type].clean_cline)) {
evict_policy_ops[evp_type].clean_cline(cache,
part, line);
}
evp_lru_clean_cline(cache, part, line);
ocf_purge_cleaning_policy(cache, line);
}
}
@@ -147,10 +144,12 @@ void set_cache_line_dirty(struct ocf_cache *cache, uint8_t start_bit,
{
ocf_cache_line_t line = req->map[map_idx].coll_idx;
ocf_part_id_t part_id = ocf_metadata_get_partition_id(cache, line);
struct ocf_part *part = &cache->user_parts[part_id].part;
uint8_t evp_type = cache->conf_meta->eviction_policy_type;
struct ocf_part *part;
bool line_was_dirty;
ENV_BUG_ON(part_id > OCF_USER_IO_CLASS_MAX);
part = &cache->user_parts[part_id].part;
if (metadata_set_dirty_sec_changed(cache, line, start_bit, end_bit,
&line_was_dirty)) {
ocf_metadata_flush_mark(cache, req, map_idx, DIRTY, start_bit,
@@ -175,11 +174,7 @@ void set_cache_line_dirty(struct ocf_cache *cache, uint8_t start_bit,
*/
env_atomic_inc(&req->core->runtime_meta->
part_counters[part_id].dirty_clines);
if (likely(evict_policy_ops[evp_type].dirty_cline)) {
evict_policy_ops[evp_type].dirty_cline(cache,
part, line);
}
evp_lru_dirty_cline(cache, part, line);
}
}

View File

@@ -9,7 +9,6 @@
#include "../metadata/metadata.h"
#include "../concurrency/ocf_cache_line_concurrency.h"
#include "../eviction/eviction.h"
#include "../eviction/ops.h"
#include "../engine/cache_engine.h"
#include "../ocf_request.h"
#include "../ocf_def_priv.h"
@@ -180,7 +179,7 @@ static inline void ocf_purge_cleaning_policy(struct ocf_cache *cache,
static inline void ocf_purge_eviction_policy(struct ocf_cache *cache,
ocf_cache_line_t line)
{
ocf_eviction_purge_cache_line(cache, line);
evp_lru_rm_cline(cache, line);
}
/**

View File

@@ -8,7 +8,7 @@
#include "../ocf_request.h"
#include "../metadata/metadata.h"
#include "../engine/cache_engine.h"
#include "../eviction/ops.h"
#include "../eviction/lru.h"
#include "utils_user_part.h"
static struct ocf_lst_entry *ocf_user_part_lst_getter_valid(