diff --git a/casadm/cas_main.c b/casadm/cas_main.c index 9482463..7bab2be 100644 --- a/casadm/cas_main.c +++ b/casadm/cas_main.c @@ -854,7 +854,7 @@ int set_param_promotion_nhit_handle_option(char *opt, const char **arg) strtoul(arg[0], NULL, 10)); } else if (!strcmp(opt, "trigger")) { if (validate_str_num(arg[0], "trigger", - OCF_NHIT_MIN_TRIGGER, OCF_NHIT_MAX_THRESHOLD)) { + OCF_NHIT_MIN_TRIGGER, OCF_NHIT_MAX_TRIGGER)) { return FAILURE; } diff --git a/modules/cas_cache/layer_cache_management.c b/modules/cas_cache/layer_cache_management.c index d1b3d73..2b8b695 100644 --- a/modules/cas_cache/layer_cache_management.c +++ b/modules/cas_cache/layer_cache_management.c @@ -378,8 +378,8 @@ int cache_mngt_get_promotion_policy(ocf_cache_t cache, uint32_t *type) return result; } -int cache_mngt_set_promotion_param(ocf_cache_t cache, uint32_t param_id, - uint32_t param_value) +int cache_mngt_set_promotion_param(ocf_cache_t cache, ocf_promotion_t type, + uint32_t param_id, uint32_t param_value) { int result; @@ -388,14 +388,15 @@ int cache_mngt_set_promotion_param(ocf_cache_t cache, uint32_t param_id, return result; } - result = ocf_mngt_cache_promotion_set_param(cache, param_id, param_value); + result = ocf_mngt_cache_promotion_set_param(cache, type, 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 cache_mngt_get_promotion_param(ocf_cache_t cache, ocf_promotion_t type, + uint32_t param_id, uint32_t *param_value) { int result; @@ -404,7 +405,8 @@ int cache_mngt_get_promotion_param(ocf_cache_t cache, uint32_t param_id, return result; } - result = ocf_mngt_cache_promotion_get_param(cache, param_id, param_value); + result = ocf_mngt_cache_promotion_get_param(cache, type, param_id, + param_value); ocf_mngt_cache_read_unlock(cache); return result; @@ -2199,11 +2201,11 @@ int cache_mngt_set_cache_params(struct kcas_set_cache_param *info) result = cache_mngt_set_promotion_policy(cache, info->param_value); break; case cache_param_promotion_nhit_insertion_threshold: - result = cache_mngt_set_promotion_param(cache, + result = cache_mngt_set_promotion_param(cache, ocf_promotion_nhit, ocf_nhit_insertion_threshold, info->param_value); break; case cache_param_promotion_nhit_trigger_threshold: - result = cache_mngt_set_promotion_param(cache, + result = cache_mngt_set_promotion_param(cache, ocf_promotion_nhit, ocf_nhit_trigger_threshold, info->param_value); break; default: @@ -2264,14 +2266,12 @@ int cache_mngt_get_cache_params(struct kcas_get_cache_param *info) 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); + result = cache_mngt_get_promotion_param(cache, ocf_promotion_nhit, + 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); + result = cache_mngt_get_promotion_param(cache, ocf_promotion_nhit, + ocf_nhit_trigger_threshold, &info->param_value); break; default: result = -EINVAL; diff --git a/modules/cas_cache/layer_cache_management.h b/modules/cas_cache/layer_cache_management.h index 7bc465c..5857a39 100644 --- a/modules/cas_cache/layer_cache_management.h +++ b/modules/cas_cache/layer_cache_management.h @@ -24,11 +24,11 @@ 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_set_promotion_param(ocf_cache_t cache, ocf_promotion_t type, + 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_get_promotion_param(ocf_cache_t cache, ocf_promotion_t type, + uint32_t param_id, uint32_t *param_value); int cache_mngt_add_core_to_cache(const char *cache_name, size_t name_len, struct ocf_mngt_core_config *cfg, diff --git a/modules/cas_cache/layer_upgrade.c b/modules/cas_cache/layer_upgrade.c index d2a7a70..46ecee9 100644 --- a/modules/cas_cache/layer_upgrade.c +++ b/modules/cas_cache/layer_upgrade.c @@ -332,10 +332,10 @@ static int _cas_upgrade_dump_cache_conf_promotion(ocf_cache_t cache, if (promotion_type == ocf_promotion_nhit) { result |= cache_mngt_get_promotion_param(cache, - ocf_nhit_insertion_threshold, + ocf_promotion_nhit, ocf_nhit_insertion_threshold, &nhit_insertion_threshold); result |= cache_mngt_get_promotion_param(cache, - ocf_nhit_trigger_threshold, + ocf_promotion_nhit, ocf_nhit_trigger_threshold, &nhit_trigger_threshold); } @@ -1199,16 +1199,16 @@ static int _cas_upgrade_restore_conf_promotion(struct cas_properties *cache_prop goto out; } - result = cache_mngt_set_promotion_param(cache, ocf_nhit_insertion_threshold, - nhit_insertion_threshold); + result = cache_mngt_set_promotion_param(cache, ocf_promotion_nhit, + ocf_nhit_insertion_threshold, nhit_insertion_threshold); if (result) { printk(KERN_ERR OCF_PREFIX_SHORT "Couldn't set NHIT insertion " "threshold parameter \n"); goto out; } - result = cache_mngt_set_promotion_param(cache, ocf_nhit_trigger_threshold, - nhit_trigger_threshold); + result = cache_mngt_set_promotion_param(cache, ocf_promotion_nhit, + ocf_nhit_trigger_threshold, nhit_trigger_threshold); if (result) { printk(KERN_ERR OCF_PREFIX_SHORT "Couldn't set NHIT trigger " "threshold parameter \n"); diff --git a/ocf b/ocf index 79a2d86..5113542 160000 --- a/ocf +++ b/ocf @@ -1 +1 @@ -Subproject commit 79a2d866ae5079f97390995e2fb8e092a03136f8 +Subproject commit 5113542c7f70b77b6047257a5bd17d74bd6a6691