From 429302adfcd987ef6e3b79597adc509fc5514249 Mon Sep 17 00:00:00 2001 From: Jan Musial Date: Wed, 18 Sep 2019 13:02:25 +0200 Subject: [PATCH] Remove unneccessary cache_puts Signed-off-by: Jan Musial --- modules/cas_cache/layer_cache_management.c | 26 ++++++++++------------ 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/modules/cas_cache/layer_cache_management.c b/modules/cas_cache/layer_cache_management.c index 770d0d2..c8085b0 100644 --- a/modules/cas_cache/layer_cache_management.c +++ b/modules/cas_cache/layer_cache_management.c @@ -271,10 +271,8 @@ int cache_mngt_set_cleaning_policy(ocf_cache_t cache, uint32_t type) int result; result = _cache_mngt_lock_sync(cache); - if (result) { - ocf_mngt_cache_put(cache); + if (result) return result; - } result = ocf_mngt_cache_cleaning_set_policy(cache, type); if (result) @@ -293,10 +291,8 @@ int cache_mngt_get_cleaning_policy(ocf_cache_t cache, uint32_t *type) int result; result = _cache_mngt_read_lock_sync(cache); - if (result) { - ocf_mngt_cache_put(cache); + if (result) return result; - } result = ocf_mngt_cache_cleaning_get_policy(cache, &tmp_type); @@ -313,10 +309,8 @@ int cache_mngt_set_cleaning_param(ocf_cache_t cache, ocf_cleaning_t type, int result; result = _cache_mngt_lock_sync(cache); - if (result) { - ocf_mngt_cache_put(cache); + if (result) return result; - } result = ocf_mngt_cache_cleaning_set_param(cache, type, param_id, param_value); @@ -336,10 +330,8 @@ int cache_mngt_get_cleaning_param(ocf_cache_t cache, ocf_cleaning_t type, int result; result = _cache_mngt_read_lock_sync(cache); - if (result) { - ocf_mngt_cache_put(cache); + if (result) return result; - } result = ocf_mngt_cache_cleaning_get_param(cache, type, param_id, param_value); @@ -1507,12 +1499,15 @@ int cache_mngt_get_seq_cutoff_threshold(ocf_core_t core, uint32_t *thresh) int result; result = _cache_mngt_read_lock_sync(cache); - if (result) + if (result) { + ocf_mngt_cache_put(cache); return result; + } result = ocf_mngt_core_get_seq_cutoff_threshold(core, thresh); ocf_mngt_cache_read_unlock(cache); + ocf_mngt_cache_put(cache); return result; } @@ -1531,12 +1526,15 @@ int cache_mngt_get_seq_cutoff_policy(ocf_core_t core, int result; result = _cache_mngt_read_lock_sync(cache); - if (result) + if (result) { + ocf_mngt_cache_put(cache); return result; + } result = ocf_mngt_core_get_seq_cutoff_policy(core, policy); ocf_mngt_cache_read_unlock(cache); + ocf_mngt_cache_put(cache); return result; }