Merge pull request #165 from robertbaldyga/ctx-get-put
Give ocf_ctx get/put semantics
This commit is contained in:
@@ -1216,6 +1216,8 @@ static int _ocf_mngt_cache_start(ocf_ctx_t ctx, ocf_cache_t *cache,
|
||||
if (result)
|
||||
goto _cache_mng_init_instance_ERROR;
|
||||
|
||||
ocf_ctx_get(ctx);
|
||||
|
||||
if (params.locked) {
|
||||
/* Increment reference counter to match cache_lock /
|
||||
cache_unlock convention. User is expected to call
|
||||
|
@@ -119,11 +119,15 @@ void cache_mng_core_remove_from_cache(struct ocf_cache *cache, int core_id)
|
||||
|
||||
void ocf_mngt_cache_put(ocf_cache_t cache)
|
||||
{
|
||||
ocf_ctx_t ctx;
|
||||
|
||||
OCF_CHECK_NULL(cache);
|
||||
|
||||
if (ocf_refcnt_dec(&cache->refcnt.cache) == 0) {
|
||||
ctx = cache->owner;
|
||||
ocf_metadata_deinit(cache);
|
||||
env_vfree(cache);
|
||||
ocf_ctx_put(ctx);
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user