Merge pull request #255 from imjfckm/pp-tests

Add promotion policies functional tests
This commit is contained in:
Michał Mielewczyk
2019-09-16 09:34:16 +02:00
committed by GitHub
10 changed files with 410 additions and 23 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);