From df9a9f272280011b71eaec9aed1a9a3f82e33e5c Mon Sep 17 00:00:00 2001 From: Robert Baldyga Date: Wed, 15 Dec 2021 12:26:09 +0100 Subject: [PATCH] Read superblock sections from cache volume during activate Because of metadata flapping it is much more complicated to capture those sections in flight in standby mode, so we read them directly from the cache volume during the activate. Signed-off-by: Robert Baldyga --- src/concurrency/ocf_pio_concurrency.c | 5 +---- src/metadata/metadata_passive_update.c | 3 --- src/mngt/ocf_mngt_cache.c | 23 ++++++----------------- 3 files changed, 7 insertions(+), 24 deletions(-) diff --git a/src/concurrency/ocf_pio_concurrency.c b/src/concurrency/ocf_pio_concurrency.c index 854572f..c30490e 100644 --- a/src/concurrency/ocf_pio_concurrency.c +++ b/src/concurrency/ocf_pio_concurrency.c @@ -18,7 +18,7 @@ struct pio_ctx { uint64_t first_entry; uint64_t begin; uint64_t end; - } segments[5]; + } segments[2]; }; #define OUT_OF_RANGE -1 @@ -181,9 +181,6 @@ int ocf_pio_concurrency_init(struct ocf_alock **self, ocf_cache_t cache) uint32_t pages_to_alloc = 0; enum ocf_metadata_segment_id update_segments[] = { metadata_segment_sb_config, - metadata_segment_part_config, - metadata_segment_core_config, - metadata_segment_core_uuid, metadata_segment_collision, }; int i; diff --git a/src/metadata/metadata_passive_update.c b/src/metadata/metadata_passive_update.c index 207627a..282a62c 100644 --- a/src/metadata/metadata_passive_update.c +++ b/src/metadata/metadata_passive_update.c @@ -234,9 +234,6 @@ static int passive_io_resume(struct ocf_request *req) ocf_cache_line_t cache_etries = ocf_metadata_collision_table_entries(cache); enum ocf_metadata_segment_id update_segments[] = { metadata_segment_sb_config, - metadata_segment_part_config, - metadata_segment_core_config, - metadata_segment_core_uuid, metadata_segment_collision, }; int i; diff --git a/src/mngt/ocf_mngt_cache.c b/src/mngt/ocf_mngt_cache.c index 0e33906..1584109 100644 --- a/src/mngt/ocf_mngt_cache.c +++ b/src/mngt/ocf_mngt_cache.c @@ -2216,19 +2216,17 @@ static void _ocf_mngt_activate_set_cache_device(ocf_pipeline_t pipeline, ocf_pipeline_next(pipeline); } -static void _ocf_mngt_activate_check_superblock_complete(void *priv, int error) +static void _ocf_mngt_activate_check_superblock(ocf_pipeline_t pipeline, + void *priv, ocf_pipeline_arg_t arg) { struct ocf_cache_attach_context *context = priv; ocf_cache_t cache = context->cache; int result; - if (error) - OCF_PL_FINISH_RET(context->pipeline, error); - result = ocf_metadata_validate_superblock(cache->owner, cache->conf_meta); if (result) - OCF_PL_FINISH_RET(context->pipeline, result); + OCF_PL_FINISH_RET(pipeline, result); if (cache->conf_meta->metadata_layout != cache->metadata.layout) { ocf_cache_log(cache, log_err, "Failed to activate standby instance: " @@ -2244,17 +2242,7 @@ static void _ocf_mngt_activate_check_superblock_complete(void *priv, int error) -OCF_ERR_CACHE_LINE_SIZE_MISMATCH); } - ocf_pipeline_next(context->pipeline); -} - -static void _ocf_mngt_activate_check_superblock(ocf_pipeline_t pipeline, - void *priv, ocf_pipeline_arg_t arg) -{ - struct ocf_cache_attach_context *context = priv; - ocf_cache_t cache = context->cache; - - ocf_metadata_sb_crc_recovery(cache, - _ocf_mngt_activate_check_superblock_complete, context); + ocf_pipeline_next(pipeline); } static void _ocf_mngt_activate_compare_superblock_end( @@ -2378,8 +2366,9 @@ struct ocf_pipeline_properties _ocf_mngt_cache_activate_pipeline_properties = { .steps = { OCF_PL_STEP(_ocf_mngt_copy_uuid_data), OCF_PL_STEP(_ocf_mngt_activate_set_cache_device), - OCF_PL_STEP(_ocf_mngt_activate_check_superblock), OCF_PL_STEP(_ocf_mngt_activate_compare_superblock), + OCF_PL_STEP(_ocf_mngt_load_superblock), + OCF_PL_STEP(_ocf_mngt_activate_check_superblock), OCF_PL_STEP(_ocf_mngt_activate_init_properties), OCF_PL_STEP(_ocf_mngt_test_volume), OCF_PL_STEP(_ocf_mngt_init_promotion),