Merge pull request #263 from imjfckm/pp-get-param-fix

Add missing stuff from get_param in PP
This commit is contained in:
Jan Musiał 2019-09-17 15:22:51 +02:00 committed by GitHub
commit f1d8a18a30
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 3 deletions

View File

@ -121,7 +121,12 @@ ocf_error_t nhit_get_param(ocf_promotion_policy_t policy, uint8_t param_id,
case ocf_nhit_insertion_threshold:
*param_value = env_atomic_read(&ctx->insertion_threshold);
break;
case ocf_nhit_trigger_threshold:
*param_value = OCF_DIV_ROUND_UP(
env_atomic64_read(&ctx->trigger_threshold) * 100,
ocf_metadata_get_cachelines_count(policy->owner)
);
break;
default:
ocf_cache_log(policy->owner, log_err, "Invalid nhit "
"promotion policy parameter (%u)!\n",

View File

@ -18,6 +18,7 @@ struct promotion_policy_ops ocf_promotion_policies[ocf_promotion_max] = {
.init = nhit_init,
.deinit = nhit_deinit,
.set_param = nhit_set_param,
.get_param = nhit_get_param,
.req_purge = nhit_req_purge,
.req_should_promote = nhit_req_should_promote,
},
@ -89,7 +90,7 @@ ocf_error_t ocf_promotion_set_param(ocf_promotion_policy_t policy,
uint8_t param_id, uint64_t param_value)
{
ocf_promotion_t type = policy->type;
ocf_error_t result = 0;
ocf_error_t result = -OCF_ERR_INVAL;
ENV_BUG_ON(type >= ocf_promotion_max);
@ -105,7 +106,7 @@ ocf_error_t ocf_promotion_get_param(ocf_promotion_policy_t policy,
uint8_t param_id, uint64_t *param_value)
{
ocf_promotion_t type = policy->type;
ocf_error_t result = 0;
ocf_error_t result = -OCF_ERR_INVAL;
ENV_BUG_ON(type >= ocf_promotion_max);