Add OCL wrappers for promotion policy management

This commit is contained in:
Jan Musial 2019-09-10 16:26:07 +02:00
parent b9de71126b
commit 0810df2a0e
3 changed files with 92 additions and 1 deletions

View File

@ -348,6 +348,73 @@ int cache_mngt_get_cleaning_param(ocf_cache_t cache, ocf_cleaning_t type,
return result; return result;
} }
int cache_mngt_set_promotion_policy(ocf_cache_t cache, uint32_t type)
{
int result;
result = _cache_mngt_lock_sync(cache);
if (result) {
return result;
}
result = ocf_mngt_cache_promotion_set_policy(cache, type);
if (result)
goto out;
result = _cache_mngt_save_sync(cache);
out:
ocf_mngt_cache_unlock(cache);
return result;
}
int cache_mngt_get_promotion_policy(ocf_cache_t cache, uint32_t *type)
{
int result;
result = _cache_mngt_read_lock_sync(cache);
if (result) {
return result;
}
*type = ocf_mngt_cache_promotion_get_policy(cache);
ocf_mngt_cache_read_unlock(cache);
return result;
}
int cache_mngt_set_promotion_param(ocf_cache_t cache, uint32_t param_id,
uint32_t param_value)
{
int result;
result = _cache_mngt_lock_sync(cache);
if (result) {
return result;
}
result = ocf_mngt_cache_promotion_set_param(cache, param_id, param_value);
ocf_mngt_cache_unlock(cache);
return result;
}
int cache_mngt_get_promotion_param(ocf_cache_t cache, uint32_t param_id,
uint32_t *param_value)
{
int result;
result = _cache_mngt_read_lock_sync(cache);
if (result) {
return result;
}
result = ocf_mngt_cache_promotion_get_param(cache, param_id, param_value);
ocf_mngt_cache_read_unlock(cache);
return result;
}
struct get_paths_ctx { struct get_paths_ctx {
char *core_path_name_tab; char *core_path_name_tab;
int max_count; int max_count;
@ -1064,6 +1131,7 @@ int cache_mngt_prepare_cache_cfg(struct ocf_mngt_cache_config *cfg,
cfg->cache_mode = cmd->caching_mode; cfg->cache_mode = cmd->caching_mode;
cfg->cache_line_size = cmd->line_size; cfg->cache_line_size = cmd->line_size;
cfg->eviction_policy = cmd->eviction_policy; cfg->eviction_policy = cmd->eviction_policy;
cfg->promotion_policy = ocf_promotion_default;
cfg->cache_line_size = cmd->line_size; cfg->cache_line_size = cmd->line_size;
cfg->pt_unaligned_io = !unaligned_io; cfg->pt_unaligned_io = !unaligned_io;
cfg->use_submit_io_fast = !use_io_scheduler; cfg->use_submit_io_fast = !use_io_scheduler;
@ -2109,6 +2177,19 @@ int cache_mngt_get_cache_params(struct kcas_get_cache_param *info)
ocf_cleaning_acp, ocf_acp_flush_max_buffers, ocf_cleaning_acp, ocf_acp_flush_max_buffers,
&info->param_value); &info->param_value);
break; break;
case cache_param_promotion_policy_type:
result = cache_mngt_get_promotion_policy(cache, &info->param_value);
break;
case cache_param_promotion_nhit_insertion_threshold:
result = cache_mngt_get_promotion_param(cache,
ocf_nhit_insertion_threshold,
&info->param_value);
break;
case cache_param_promotion_nhit_trigger_threshold:
result = cache_mngt_get_promotion_param(cache,
ocf_nhit_trigger_threshold,
&info->param_value);
break;
default: default:
result = -EINVAL; result = -EINVAL;
} }

View File

@ -20,6 +20,16 @@ int cache_mngt_set_cleaning_param(ocf_cache_t cache, ocf_cleaning_t type,
int cache_mngt_get_cleaning_param(ocf_cache_t cache, ocf_cleaning_t type, int cache_mngt_get_cleaning_param(ocf_cache_t cache, ocf_cleaning_t type,
uint32_t param_id, uint32_t *param_value); uint32_t param_id, uint32_t *param_value);
int cache_mngt_set_promotion_policy(ocf_cache_t cache, uint32_t type);
int cache_mngt_get_promotion_policy(ocf_cache_t cache, uint32_t *type);
int cache_mngt_set_promotion_param(ocf_cache_t cache, uint32_t param_id,
uint32_t param_value);
int cache_mngt_get_promotion_param(ocf_cache_t cache, uint32_t param_id,
uint32_t *param_value);
int cache_mngt_add_core_to_cache(const char *cache_name, int cache_mngt_add_core_to_cache(const char *cache_name,
struct ocf_mngt_core_config *cfg, struct ocf_mngt_core_config *cfg,
struct kcas_insert_core *cmd_info); struct kcas_insert_core *cmd_info);

2
ocf

@ -1 +1 @@
Subproject commit f86287ef06190b080f9529c9f2514e56da8b726b Subproject commit af48ee56e3d86c5de4a0ce7def35a1fedf35edf4