OCF update (removed configurable eviction policy)

Signed-off-by: Adam Rutkowski <adam.j.rutkowski@intel.com>
This commit is contained in:
Adam Rutkowski 2021-06-21 16:47:00 +02:00 committed by Kozlowski Mateusz
parent 647124895f
commit 7aa883dbd3
10 changed files with 12 additions and 51 deletions

View File

@ -256,11 +256,6 @@ struct name_to_val_mapping {
int value;
};
static struct name_to_val_mapping eviction_policy_names[] = {
{ .short_name = "lru", .value = ocf_eviction_lru },
{ NULL }
};
static struct name_to_val_mapping cache_mode_names[] = {
{ .short_name = "wt", .long_name = "Write-Through", .value = ocf_cache_mode_wt },
{ .short_name = "wb", .long_name = "Write-Back", .value = ocf_cache_mode_wb },
@ -417,19 +412,6 @@ static const char* val_to_short_name(int value, const struct name_to_val_mapping
return other_name;
}
/* Returns non-negative policy index or
* negative number in case of error.
*/
inline int validate_str_ev_policy(const char *s)
{
return validate_str_val_mapping(s, eviction_policy_names, -1);
}
inline const char *eviction_policy_to_name(uint8_t policy)
{
return val_to_short_name(policy, eviction_policy_names, "Unknown");
}
inline const char *cache_mode_to_name(uint8_t cache_mode)
{
return val_to_short_name(cache_mode, cache_mode_names, "Unknown");
@ -850,7 +832,6 @@ struct cache_device *get_cache_device(const struct kcas_cache_info *info, bool b
cache->mode = info->info.cache_mode;
cache->dirty = info->info.dirty;
cache->flushed = info->info.flushed;
cache->eviction_policy = info->info.eviction_policy;
cache->cleaning_policy = info->info.cleaning_policy;
cache->promotion_policy = info->info.promotion_policy;
cache->size = info->info.cache_line_size;
@ -1017,7 +998,6 @@ static void check_cache_scheduler(const char *cache_device, const char *elv_name
int start_cache(uint16_t cache_id, unsigned int cache_init,
const char *cache_device, ocf_cache_mode_t cache_mode,
ocf_eviction_t eviction_policy_type,
ocf_cache_line_size_t line_size, int force)
{
int fd = 0;
@ -1069,7 +1049,6 @@ int start_cache(uint16_t cache_id, unsigned int cache_init,
return FAILURE;
}
cmd.caching_mode = cache_mode;
cmd.eviction_policy = eviction_policy_type;
cmd.line_size = line_size;
cmd.force = (uint8_t)force;
@ -2175,7 +2154,7 @@ int partition_list(unsigned int cache_id, unsigned int output_format)
}
fputc('\n', intermediate_file[1]);
for (i = 0; i < OCF_IO_CLASS_MAX; i++, io_class.ext_err_code = 0) {
for (i = 0; i < OCF_USER_IO_CLASS_MAX; i++, io_class.ext_err_code = 0) {
io_class.cache_id = cache_id;
io_class.class_id = i;

View File

@ -91,7 +91,6 @@ enum metadata_mode_t {
#define STATS_FILTER_COUNTERS (STATS_FILTER_REQ | STATS_FILTER_BLK | STATS_FILTER_ERR)
const char *eviction_policy_to_name(uint8_t policy);
const char *cleaning_policy_to_name(uint8_t policy);
const char *promotion_policy_to_name(uint8_t policy);
const char *cache_mode_to_name(uint8_t cache_mode);
@ -122,7 +121,6 @@ void metadata_memory_footprint(uint64_t size, float *footprint, const char **uni
int start_cache(uint16_t cache_id, unsigned int cache_init,
const char *cache_device, ocf_cache_mode_t cache_mode,
ocf_eviction_t eviction_policy_type,
ocf_cache_line_size_t line_size, int force);
int stop_cache(uint16_t cache_id, int flush);
@ -264,7 +262,6 @@ int validate_str_unum(const char *source_str, const char *msg, unsigned int min,
int validate_path(const char *path, int exist);
int validate_str_cache_mode(const char *s);
int validate_str_ev_policy(const char *s);
int validate_str_cln_policy(const char *s);
int validate_str_promotion_policy(const char *s);
int validate_str_meta_variant(const char *s);

View File

@ -44,7 +44,6 @@ struct command_args{
int stats_filters;
int output_format;
int io_class_id;
int eviction_policy_type;
int line_size;
int cache_state_flush;
int flush_data;
@ -139,11 +138,6 @@ int command_handle_option(char *opt, const char **arg)
if (command_args_values.cleaning_policy_type < 0)
return FAILURE;
} else if (!strcmp(opt, "eviction-policy")) {
command_args_values.eviction_policy_type = validate_str_ev_policy((const char*)arg[0]);
if (command_args_values.eviction_policy_type < 0)
return FAILURE;
} else if (!strcmp(opt, "try-add")) {
command_args_values.try_add = true;
} else if (!strcmp(opt, "update-path")) {
@ -336,7 +330,6 @@ int handle_start()
command_args_values.state,
command_args_values.cache_device,
command_args_values.cache_mode,
command_args_values.eviction_policy_type,
command_args_values.line_size,
command_args_values.force);

View File

@ -498,7 +498,7 @@ int cache_stats_ioclasses(int ctrl_fd, const struct kcas_cache_info *cache_info,
return SUCCESS;
}
for (part_iter_id = 0; part_iter_id < OCF_IO_CLASS_MAX; part_iter_id++) {
for (part_iter_id = 0; part_iter_id < OCF_USER_IO_CLASS_MAX; part_iter_id++) {
info.cache_id = cache_id;
info.class_id = part_iter_id;
stats.cache_id = cache_id;
@ -567,8 +567,6 @@ int cache_stats_conf(int ctrl_fd, const struct kcas_cache_info *cache_info,
print_kv_pair(outfile, "Write Policy", "%s",
cache_mode_to_name(cache_info->info.cache_mode));
print_kv_pair(outfile, "Eviction Policy", "%s",
eviction_policy_to_name(cache_info->info.eviction_policy));
print_kv_pair(outfile, "Cleaning Policy", "%s",
cleaning_policy_to_name(cache_info->info.cleaning_policy));
print_kv_pair(outfile, "Promotion Policy", "%s",

View File

@ -1121,7 +1121,7 @@ int cas_cls_init(ocf_cache_t cache)
/* Update rules for all I/O classes except 0 - this is default for all
* unclassified I/O */
for (i = 1; i < OCF_IO_CLASS_MAX; i++) {
for (i = 1; i < OCF_USER_IO_CLASS_MAX; i++) {
result = _cas_cls_rule_init(cache, i);
if (result)
break;

View File

@ -1584,16 +1584,16 @@ int cache_mngt_set_partitions(const char *cache_name, size_t name_len,
{
ocf_cache_t cache;
struct ocf_mngt_io_classes_config *io_class_cfg;
struct cas_cls_rule *cls_rule[OCF_IO_CLASS_MAX];
struct cas_cls_rule *cls_rule[OCF_USER_IO_CLASS_MAX];
ocf_part_id_t class_id;
int result;
io_class_cfg = kzalloc(sizeof(struct ocf_mngt_io_class_config) *
OCF_IO_CLASS_MAX, GFP_KERNEL);
OCF_USER_IO_CLASS_MAX, GFP_KERNEL);
if (!io_class_cfg)
return -OCF_ERR_NO_MEM;
for (class_id = 0; class_id < OCF_IO_CLASS_MAX; class_id++) {
for (class_id = 0; class_id < OCF_USER_IO_CLASS_MAX; class_id++) {
io_class_cfg->config[class_id].class_id = class_id;
if (!cfg->info[class_id].name[0]) {
@ -1610,7 +1610,7 @@ int cache_mngt_set_partitions(const char *cache_name, size_t name_len,
if (result)
goto out_get;
for (class_id = 0; class_id < OCF_IO_CLASS_MAX; class_id++) {
for (class_id = 0; class_id < OCF_USER_IO_CLASS_MAX; class_id++) {
result = cas_cls_rule_create(cache, class_id,
cfg->info[class_id].name,
&cls_rule[class_id]);
@ -1632,7 +1632,7 @@ int cache_mngt_set_partitions(const char *cache_name, size_t name_len,
if (result)
goto out_configure;
for (class_id = 0; class_id < OCF_IO_CLASS_MAX; class_id++)
for (class_id = 0; class_id < OCF_USER_IO_CLASS_MAX; class_id++)
cas_cls_rule_apply(cache, class_id, cls_rule[class_id]);
out_configure:
@ -1712,7 +1712,6 @@ int cache_mngt_prepare_cache_cfg(struct ocf_mngt_cache_config *cfg,
strncpy(cfg->name, cache_name, OCF_CACHE_NAME_SIZE - 1);
cfg->cache_mode = cmd->caching_mode;
cfg->cache_line_size = cmd->line_size;
cfg->eviction_policy = cmd->eviction_policy;
cfg->promotion_policy = ocf_promotion_default;
cfg->cache_line_size = cmd->line_size;
cfg->pt_unaligned_io = !unaligned_io;

View File

@ -63,11 +63,6 @@ struct kcas_start_cache {
*/
ocf_cache_mode_t caching_mode;
/**
* eviction policy to be used for newely configured cache instance.
*/
ocf_eviction_t eviction_policy;
uint8_t flush_data; /**< should data be flushed? */
/**
@ -269,7 +264,7 @@ struct kcas_io_classes {
};
#define KCAS_IO_CLASSES_SIZE (sizeof(struct kcas_io_classes) \
+ OCF_IO_CLASS_MAX * sizeof(struct ocf_io_class_info))
+ OCF_USER_IO_CLASS_MAX * sizeof(struct ocf_io_class_info))
/**
* structure in which result of KCAS_IOCTL_LIST_CACHE is supplied from kernel module.

2
ocf

@ -1 +1 @@
Subproject commit 73c3e97f43b482ed8162d18314054a0b5d4b5d69
Subproject commit 847f5f1174e7997a3f32220cc8f0c233e0bab4ad

View File

@ -42,7 +42,7 @@ TARGET_DEVICE_OPTION="$CACHE_DEVICE" PARTITION_SIZE_OPTION="2000M" PARTITION_IDS
# Create 1 primary partition on CORE_DEVICE, 4000M
TARGET_DEVICE_OPTION="$CORE_DEVICE" PARTITION_SIZE_OPTION="4000M" PARTITION_IDS_OPTION="1" make_primary_partitions
METADATA_SECTIONS_NAMES=("Super block config" "Super block runtime" "Reserved" "Cleaning" "Eviction" "Collision" "List info" "Hash" "Core config" "Core runtime" "Core UUID")
METADATA_SECTIONS_NAMES=("Super block config" "Super block runtime" "Reserved" "Cleaning" "LRU list" "Collision" "List info" "Hash" "Core config" "Core runtime" "Core UUID")
for SECTION in "${METADATA_SECTIONS_NAMES[@]}"
do

View File

@ -30,7 +30,7 @@ TARGET_DEVICE_OPTION="$CACHE_DEVICE" PARTITION_SIZE_OPTION="2000M" PARTITION_IDS
# Create 1 primary partition on CORE_DEVICE, 4000M
TARGET_DEVICE_OPTION="$CORE_DEVICE" PARTITION_SIZE_OPTION="4000M" PARTITION_IDS_OPTION="1" make_primary_partitions
METADATA_SECTIONS_NAMES=("Super block config" "Super block runtime" "Reserved" "Cleaning" "Eviction" "Collision" "List info" "Hash" "Core config" "Core runtime" "Core UUID")
METADATA_SECTIONS_NAMES=("Super block config" "Super block runtime" "Reserved" "Cleaning" "LRU list" "Collision" "List info" "Hash" "Core config" "Core runtime" "Core UUID")
for SECTION in "${METADATA_SECTIONS_NAMES[@]}"
do