Merge pull request #139 from mmichal10/fix-pp

Adapt to new OCF PP param set/get API.
This commit is contained in:
Katarzyna Łapińska 2019-10-01 13:14:49 +02:00 committed by GitHub
commit 3d4d7c96bf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 26 additions and 26 deletions

View File

@ -854,7 +854,7 @@ int set_param_promotion_nhit_handle_option(char *opt, const char **arg)
strtoul(arg[0], NULL, 10)); strtoul(arg[0], NULL, 10));
} else if (!strcmp(opt, "trigger")) { } else if (!strcmp(opt, "trigger")) {
if (validate_str_num(arg[0], "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; return FAILURE;
} }

View File

@ -378,8 +378,8 @@ int cache_mngt_get_promotion_policy(ocf_cache_t cache, uint32_t *type)
return result; return result;
} }
int cache_mngt_set_promotion_param(ocf_cache_t cache, uint32_t param_id, int cache_mngt_set_promotion_param(ocf_cache_t cache, ocf_promotion_t type,
uint32_t param_value) uint32_t param_id, uint32_t param_value)
{ {
int result; int result;
@ -388,14 +388,15 @@ int cache_mngt_set_promotion_param(ocf_cache_t cache, uint32_t param_id,
return result; 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); ocf_mngt_cache_unlock(cache);
return result; return result;
} }
int cache_mngt_get_promotion_param(ocf_cache_t cache, uint32_t param_id, int cache_mngt_get_promotion_param(ocf_cache_t cache, ocf_promotion_t type,
uint32_t *param_value) uint32_t param_id, uint32_t *param_value)
{ {
int result; int result;
@ -404,7 +405,8 @@ int cache_mngt_get_promotion_param(ocf_cache_t cache, uint32_t param_id,
return result; 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); ocf_mngt_cache_read_unlock(cache);
return result; 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); result = cache_mngt_set_promotion_policy(cache, info->param_value);
break; break;
case cache_param_promotion_nhit_insertion_threshold: 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); ocf_nhit_insertion_threshold, info->param_value);
break; break;
case cache_param_promotion_nhit_trigger_threshold: 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); ocf_nhit_trigger_threshold, info->param_value);
break; break;
default: 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); result = cache_mngt_get_promotion_policy(cache, &info->param_value);
break; break;
case cache_param_promotion_nhit_insertion_threshold: case cache_param_promotion_nhit_insertion_threshold:
result = cache_mngt_get_promotion_param(cache, result = cache_mngt_get_promotion_param(cache, ocf_promotion_nhit,
ocf_nhit_insertion_threshold, ocf_nhit_insertion_threshold, &info->param_value);
&info->param_value);
break; break;
case cache_param_promotion_nhit_trigger_threshold: case cache_param_promotion_nhit_trigger_threshold:
result = cache_mngt_get_promotion_param(cache, result = cache_mngt_get_promotion_param(cache, ocf_promotion_nhit,
ocf_nhit_trigger_threshold, ocf_nhit_trigger_threshold, &info->param_value);
&info->param_value);
break; break;
default: default:
result = -EINVAL; result = -EINVAL;

View File

@ -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_get_promotion_policy(ocf_cache_t cache, uint32_t *type);
int cache_mngt_set_promotion_param(ocf_cache_t cache, uint32_t param_id, int cache_mngt_set_promotion_param(ocf_cache_t cache, ocf_promotion_t type,
uint32_t param_value); uint32_t param_id, uint32_t param_value);
int cache_mngt_get_promotion_param(ocf_cache_t cache, uint32_t param_id, int cache_mngt_get_promotion_param(ocf_cache_t cache, ocf_promotion_t type,
uint32_t *param_value); uint32_t param_id, uint32_t *param_value);
int cache_mngt_add_core_to_cache(const char *cache_name, size_t name_len, int cache_mngt_add_core_to_cache(const char *cache_name, size_t name_len,
struct ocf_mngt_core_config *cfg, struct ocf_mngt_core_config *cfg,

View File

@ -332,10 +332,10 @@ static int _cas_upgrade_dump_cache_conf_promotion(ocf_cache_t cache,
if (promotion_type == ocf_promotion_nhit) { if (promotion_type == ocf_promotion_nhit) {
result |= cache_mngt_get_promotion_param(cache, result |= cache_mngt_get_promotion_param(cache,
ocf_nhit_insertion_threshold, ocf_promotion_nhit, ocf_nhit_insertion_threshold,
&nhit_insertion_threshold); &nhit_insertion_threshold);
result |= cache_mngt_get_promotion_param(cache, result |= cache_mngt_get_promotion_param(cache,
ocf_nhit_trigger_threshold, ocf_promotion_nhit, ocf_nhit_trigger_threshold,
&nhit_trigger_threshold); &nhit_trigger_threshold);
} }
@ -1199,16 +1199,16 @@ static int _cas_upgrade_restore_conf_promotion(struct cas_properties *cache_prop
goto out; goto out;
} }
result = cache_mngt_set_promotion_param(cache, ocf_nhit_insertion_threshold, result = cache_mngt_set_promotion_param(cache, ocf_promotion_nhit,
nhit_insertion_threshold); ocf_nhit_insertion_threshold, nhit_insertion_threshold);
if (result) { if (result) {
printk(KERN_ERR OCF_PREFIX_SHORT "Couldn't set NHIT insertion " printk(KERN_ERR OCF_PREFIX_SHORT "Couldn't set NHIT insertion "
"threshold parameter \n"); "threshold parameter \n");
goto out; goto out;
} }
result = cache_mngt_set_promotion_param(cache, ocf_nhit_trigger_threshold, result = cache_mngt_set_promotion_param(cache, ocf_promotion_nhit,
nhit_trigger_threshold); ocf_nhit_trigger_threshold, nhit_trigger_threshold);
if (result) { if (result) {
printk(KERN_ERR OCF_PREFIX_SHORT "Couldn't set NHIT trigger " printk(KERN_ERR OCF_PREFIX_SHORT "Couldn't set NHIT trigger "
"threshold parameter \n"); "threshold parameter \n");

2
ocf

@ -1 +1 @@
Subproject commit 79a2d866ae5079f97390995e2fb8e092a03136f8 Subproject commit 5113542c7f70b77b6047257a5bd17d74bd6a6691