Adding synchronization primitives destroyers

Environment should provide calls for destroying primitives (i.e. env_mutex_destroy()) and OCF should call these functions in its cleanup paths.

Signed-off-by: Firas Medini <mdnfiras@yahoo.com>
This commit is contained in:
Firas Medini
2019-08-13 05:13:11 -07:00
parent 34c8d135c2
commit 1f979f630b
16 changed files with 58 additions and 189 deletions

View File

@@ -134,6 +134,7 @@ ocf_cache_line_concurrency_init:
*/
void ocf_cache_line_concurrency_deinit(struct ocf_cache *cache)
{
int i;
struct ocf_cache_line_concurrency *concurrency;
if (!cache->device->concurrency.cache_line)
@@ -143,6 +144,11 @@ void ocf_cache_line_concurrency_deinit(struct ocf_cache *cache)
concurrency = cache->device->concurrency.cache_line;
env_rwlock_destroy(&concurrency->lock);
for (i = 0; i < _WAITERS_LIST_ENTRIES; i++)
env_spinlock_destroy(&concurrency->waiters_lsts[i].lock);
if (concurrency->access)
OCF_REALLOC_DEINIT(&concurrency->access,
&concurrency->access_limit);

View File

@@ -12,6 +12,13 @@ void ocf_metadata_concurrency_init(struct ocf_cache *cache)
env_rwsem_init(&cache->metadata.lock.collision);
}
void ocf_metadata_concurrency_deinit(struct ocf_cache *cache)
{
env_spinlock_destroy(&cache->metadata.lock.eviction);
env_rwlock_destroy(&cache->metadata.lock.status);
env_rwsem_destroy(&cache->metadata.lock.collision);
}
int ocf_metadata_concurrency_attached_init(struct ocf_cache *cache)
{
return 0;

View File

@@ -12,6 +12,8 @@
void ocf_metadata_concurrency_init(struct ocf_cache *cache);
void ocf_metadata_concurrency_deinit(struct ocf_cache *cache);
int ocf_metadata_concurrency_attached_init(struct ocf_cache *cache);
static inline void ocf_metadata_eviction_lock(struct ocf_cache *cache)