Remove redundant fallback-PT counter accesses
The fewer (atomic variable accesses on IO path) the better fare Signed-off-by: Roel Apfelbaum <roel.apfelbaum@huawei.com> Signed-off-by: Michal Mielewczyk <michal.mielewczyk@huawei.com>
This commit is contained in:
parent
6f02a625ad
commit
1d1561649c
@ -139,12 +139,17 @@ static ocf_req_cb ocf_cache_mode_to_engine_cb(
|
|||||||
|
|
||||||
bool ocf_fallback_pt_is_on(ocf_cache_t cache)
|
bool ocf_fallback_pt_is_on(ocf_cache_t cache)
|
||||||
{
|
{
|
||||||
ENV_BUG_ON(env_atomic_read(&cache->fallback_pt_error_counter) < 0);
|
int threshold = cache->fallback_pt_error_threshold;
|
||||||
|
int counter;
|
||||||
|
|
||||||
return (cache->fallback_pt_error_threshold !=
|
if (threshold == OCF_CACHE_FALLBACK_PT_INACTIVE)
|
||||||
OCF_CACHE_FALLBACK_PT_INACTIVE &&
|
return false;
|
||||||
env_atomic_read(&cache->fallback_pt_error_counter) >=
|
|
||||||
cache->fallback_pt_error_threshold);
|
counter = env_atomic_read(&cache->fallback_pt_error_counter);
|
||||||
|
|
||||||
|
ENV_BUG_ON(counter < 0);
|
||||||
|
|
||||||
|
return counter >= threshold;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ocf_resolve_effective_cache_mode(ocf_cache_t cache,
|
void ocf_resolve_effective_cache_mode(ocf_cache_t cache,
|
||||||
|
Loading…
Reference in New Issue
Block a user