From da67112b17d143c614a6b715f9a9e0e2701a1d83 Mon Sep 17 00:00:00 2001 From: Michal Mielewczyk Date: Fri, 16 Sep 2022 12:10:57 +0200 Subject: [PATCH] load: `init_structures` as a separate step Signed-off-by: Michal Mielewczyk --- src/mngt/ocf_mngt_cache.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/src/mngt/ocf_mngt_cache.c b/src/mngt/ocf_mngt_cache.c index cee7c1b..cc025a9 100644 --- a/src/mngt/ocf_mngt_cache.c +++ b/src/mngt/ocf_mngt_cache.c @@ -677,6 +677,20 @@ static void _ocf_mngt_load_init_cleaning(ocf_pipeline_t pipeline, _ocf_mngt_cleaning_recovery_complete, context); } +static void _ocf_mngt_load_init_structures(ocf_pipeline_t pipeline, + void *priv, ocf_pipeline_arg_t arg) +{ + struct ocf_cache_attach_context *context = priv; + ocf_cache_t cache = context->cache; + + if (context->metadata.shutdown_status == ocf_metadata_clean_shutdown) + OCF_PL_NEXT_RET(pipeline); + + init_attached_data_structures_recovery(cache, true); + + ocf_pipeline_next(context->pipeline); +} + void _ocf_mngt_load_metadata_complete(void *priv, int error) { struct ocf_cache_attach_context *context = priv; @@ -728,8 +742,6 @@ static void _ocf_mngt_load_metadata(ocf_pipeline_t pipeline, } else { ocf_cache_log(cache, log_warn, "ERROR: Cache device did not shut down properly!\n"); - init_attached_data_structures_recovery(cache, true); - ocf_cache_log(cache, log_info, "Initiating recovery sequence...\n"); _ocf_mngt_load_metadata_recovery(pipeline, priv, arg); } @@ -1826,6 +1838,7 @@ struct ocf_pipeline_properties _ocf_mngt_cache_load_pipeline_properties = { OCF_PL_STEP(_ocf_mngt_init_cleaner), OCF_PL_STEP(_ocf_mngt_init_promotion), OCF_PL_STEP(_ocf_mngt_load_add_cores), + OCF_PL_STEP(_ocf_mngt_load_init_structures), OCF_PL_STEP(_ocf_mngt_load_metadata), OCF_PL_STEP(_ocf_mngt_load_rebuild_metadata), OCF_PL_STEP(_ocf_mngt_load_init_cleaning),