Fix minor bugs in promotion policy

Signed-off-by: Jan Musial <jan.musial@intel.com>
This commit is contained in:
Jan Musial
2019-09-09 12:24:33 +02:00
parent 9c51ca4e97
commit 703a757db1
4 changed files with 10 additions and 6 deletions

View File

@@ -183,7 +183,7 @@ bool nhit_req_should_promote(ocf_promotion_policy_t policy,
ocf_metadata_get_cachelines_count(policy->owner) -
ocf_freelist_num_free(policy->owner->freelist);
if (occupied_cachelines > env_atomic64_read(&ctx->trigger_threshold))
if (occupied_cachelines < env_atomic64_read(&ctx->trigger_threshold))
return true;
for (i = 0, core_line = req->core_line_first;
@@ -196,9 +196,8 @@ bool nhit_req_should_promote(ocf_promotion_policy_t policy,
}
}
/* We don't want to reject even partially
* hit requests - this way we could trigger passthrough and invalidation.
* Let's let it in! */
return result || req->info.hit_no;
/* We don't want to reject even partially hit requests - this way we
* could trigger passthrough and invalidation. Let's let it in! */
return result || ocf_engine_mapped_count(req);
}

View File

@@ -68,6 +68,7 @@ ocf_error_t ocf_promotion_set_policy(ocf_promotion_policy_t policy,
ocf_promotion_policies[prev_policy].deinit(policy);
cache->conf_meta->promotion_policy_type = type;
policy->type = type;
if (ocf_promotion_policies[type].init)
result = ocf_promotion_policies[type].init(cache, policy);