Initialize metadata structures in pipelines
Initializing metadata in an asynchronous manner will allow to use parallelization utilities in the future commits Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
This commit is contained in:
@@ -831,22 +831,33 @@ static inline void _ocf_init_collision_entry(struct ocf_cache *cache,
|
||||
/*
|
||||
* Initialize collision table
|
||||
*/
|
||||
void ocf_metadata_init_collision(struct ocf_cache *cache)
|
||||
void ocf_metadata_init_collision(ocf_pipeline_t pipeline, void *priv,
|
||||
ocf_pipeline_arg_t arg)
|
||||
{
|
||||
struct ocf_init_metadata_context *context = priv;
|
||||
ocf_cache_t cache = context->cache;
|
||||
unsigned int i;
|
||||
unsigned int step = 0;
|
||||
|
||||
if (context->skip_collision)
|
||||
OCF_PL_NEXT_RET(pipeline);
|
||||
|
||||
for (i = 0; i < cache->device->collision_table_entries; i++) {
|
||||
_ocf_init_collision_entry(cache, i);
|
||||
OCF_COND_RESCHED_DEFAULT(step);
|
||||
}
|
||||
|
||||
ocf_pipeline_next(context->pipeline);
|
||||
}
|
||||
|
||||
/*
|
||||
* Initialize hash table
|
||||
*/
|
||||
void ocf_metadata_init_hash_table(struct ocf_cache *cache)
|
||||
void ocf_metadata_init_hash_table(ocf_pipeline_t pipeline, void *priv,
|
||||
ocf_pipeline_arg_t arg)
|
||||
{
|
||||
struct ocf_init_metadata_context *context = priv;
|
||||
ocf_cache_t cache = context->cache;
|
||||
unsigned int i;
|
||||
unsigned int hash_table_entries = cache->device->hash_table_entries;
|
||||
ocf_cache_line_t invalid_idx = cache->device->collision_table_entries;
|
||||
@@ -860,6 +871,7 @@ void ocf_metadata_init_hash_table(struct ocf_cache *cache)
|
||||
ocf_metadata_set_hash(cache, i, invalid_idx);
|
||||
}
|
||||
|
||||
ocf_pipeline_next(context->pipeline);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@@ -25,6 +25,16 @@
|
||||
#define CLEAN 2
|
||||
#define DIRTY 3
|
||||
|
||||
typedef void (*ocf_mngt_init_metadata_end_t)(void *priv, int error);
|
||||
|
||||
struct ocf_init_metadata_context {
|
||||
ocf_mngt_init_metadata_end_t cmpl;
|
||||
ocf_pipeline_t pipeline;
|
||||
ocf_cache_t cache;
|
||||
uint8_t skip_collision;
|
||||
void *priv;
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Initialize metadata
|
||||
*
|
||||
@@ -60,14 +70,16 @@ void ocf_metadata_init_freelist_partition(struct ocf_cache *cache);
|
||||
*
|
||||
* @param cache - Cache instance
|
||||
*/
|
||||
void ocf_metadata_init_hash_table(struct ocf_cache *cache);
|
||||
void ocf_metadata_init_hash_table(ocf_pipeline_t pipeline, void *priv,
|
||||
ocf_pipeline_arg_t arg);
|
||||
|
||||
/**
|
||||
* @brief Initialize collision table
|
||||
*
|
||||
* @param cache - Cache instance
|
||||
*/
|
||||
void ocf_metadata_init_collision(struct ocf_cache *cache);
|
||||
void ocf_metadata_init_collision(ocf_pipeline_t pipeline, void *priv,
|
||||
ocf_pipeline_arg_t arg);
|
||||
|
||||
/**
|
||||
* @brief De-Initialize metadata
|
||||
|
Reference in New Issue
Block a user