diff --git a/src/concurrency/ocf_cache_line_concurrency.c b/src/concurrency/ocf_cache_line_concurrency.c index 5323aae..62745fb 100644 --- a/src/concurrency/ocf_cache_line_concurrency.c +++ b/src/concurrency/ocf_cache_line_concurrency.c @@ -69,14 +69,12 @@ struct ocf_cache_line_concurrency { #define ALLOCATOR_NAME_MAX (sizeof(ALLOCATOR_NAME_FMT) + OCF_CACHE_NAME_SIZE) int ocf_cache_line_concurrency_init(struct ocf_cache_line_concurrency **self, - ocf_cache_t cache) + unsigned num_clines, ocf_cache_t cache) { uint32_t i; int error = 0; struct ocf_cache_line_concurrency *c; char name[ALLOCATOR_NAME_MAX]; - ocf_cache_line_t line_entries = ocf_metadata_collision_table_entries( - cache); OCF_DEBUG_TRACE(cache); @@ -87,7 +85,7 @@ int ocf_cache_line_concurrency_init(struct ocf_cache_line_concurrency **self, } c->cache = cache; - c->num_clines = line_entries; + c->num_clines = num_clines; error = env_mutex_init(&c->lock); if (error) { @@ -96,7 +94,7 @@ int ocf_cache_line_concurrency_init(struct ocf_cache_line_concurrency **self, } OCF_REALLOC_INIT(&c->access, &c->access_limit); - OCF_REALLOC_CP(&c->access, sizeof(c->access[0]), line_entries, + OCF_REALLOC_CP(&c->access, sizeof(c->access[0]), num_clines, &c->access_limit); if (!c->access) { diff --git a/src/concurrency/ocf_cache_line_concurrency.h b/src/concurrency/ocf_cache_line_concurrency.h index 65ed263..29895fe 100644 --- a/src/concurrency/ocf_cache_line_concurrency.h +++ b/src/concurrency/ocf_cache_line_concurrency.h @@ -20,12 +20,13 @@ struct ocf_cache_line_concurrency; * @brief Initialize OCF cache concurrency module * * @param self - cacheline concurrency private data + * @param num_clines - cachelines count * @param cache - OCF cache instance * @return 0 - Initialization successful, otherwise ERROR */ int ocf_cache_line_concurrency_init(struct ocf_cache_line_concurrency **self, - struct ocf_cache *cache); + unsigned num_clines, struct ocf_cache *cache); /** * @biref De-Initialize OCF cache concurrency module diff --git a/src/concurrency/ocf_concurrency.c b/src/concurrency/ocf_concurrency.c index 7a45951..f469f7c 100644 --- a/src/concurrency/ocf_concurrency.c +++ b/src/concurrency/ocf_concurrency.c @@ -4,6 +4,7 @@ */ #include "ocf_concurrency.h" +#include "../metadata/metadata.h" int ocf_concurrency_init(struct ocf_cache *cache) { @@ -11,6 +12,7 @@ int ocf_concurrency_init(struct ocf_cache *cache) result = ocf_cache_line_concurrency_init( &cache->device->concurrency.cache_line, + ocf_metadata_collision_table_entries(cache), cache); if (result) @@ -23,6 +25,5 @@ void ocf_concurrency_deinit(struct ocf_cache *cache) { ocf_cache_line_concurrency_deinit( &cache->device->concurrency.cache_line); - }