Use cleaning ops wrapper functions

Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
This commit is contained in:
Michal Mielewczyk
2021-07-19 15:52:04 +02:00
parent 00aa56dd28
commit 26194fc536
11 changed files with 34 additions and 144 deletions

View File

@@ -13,7 +13,7 @@
#include "../mngt/ocf_mngt_common.h"
#include "../metadata/metadata.h"
#include "../ocf_queue_priv.h"
#include "cleaning_ops.c"
#include "cleaning_ops.h"
int ocf_start_cleaner(ocf_cache_t cache)
{
@@ -82,7 +82,6 @@ static void ocf_cleaner_run_complete(ocf_cleaner_t cleaner, uint32_t interval)
void ocf_cleaner_run(ocf_cleaner_t cleaner, ocf_queue_t queue)
{
ocf_cache_t cache;
ocf_cleaning_t clean_type;
OCF_CHECK_NULL(cleaner);
OCF_CHECK_NULL(queue);
@@ -110,13 +109,8 @@ void ocf_cleaner_run(ocf_cleaner_t cleaner, ocf_queue_t queue)
return;
}
clean_type = cache->conf_meta->cleaning_policy_type;
ENV_BUG_ON(clean_type >= ocf_cleaning_max);
ocf_queue_get(queue);
cleaner->io_queue = queue;
cleaning_policy_ops[clean_type].perform_cleaning(cache,
ocf_cleaner_run_complete);
ocf_cleaning_perform_cleaning(cache, ocf_cleaner_run_complete);
}

View File

@@ -38,27 +38,6 @@ struct cleaning_policy_meta {
} meta;
};
struct cleaning_policy_ops {
void (*setup)(ocf_cache_t cache);
int (*initialize)(ocf_cache_t cache, int init_metadata);
void (*deinitialize)(ocf_cache_t cache);
int (*add_core)(ocf_cache_t cache, ocf_core_id_t core_id);
void (*remove_core)(ocf_cache_t cache, ocf_core_id_t core_id);
void (*init_cache_block)(ocf_cache_t cache, uint32_t cache_line);
void (*purge_cache_block)(ocf_cache_t cache, uint32_t cache_line);
int (*purge_range)(ocf_cache_t cache, int core_id,
uint64_t start_byte, uint64_t end_byte);
void (*set_hot_cache_line)(ocf_cache_t cache, uint32_t cache_line);
int (*set_cleaning_param)(ocf_cache_t cache, uint32_t param_id,
uint32_t param_value);
int (*get_cleaning_param)(ocf_cache_t cache, uint32_t param_id,
uint32_t *param_value);
void (*perform_cleaning)(ocf_cache_t cache, ocf_cleaner_end_t cmpl);
const char *name;
};
extern struct cleaning_policy_ops cleaning_policy_ops[ocf_cleaning_max];
struct ocf_cleaner {
void *cleaning_policy_context;
ocf_queue_t io_queue;