Flush cache volume after writing config metadata segments

After writing metadata configuration to disk we must
send a flush request to make sure configuration sections
are commited to non-volatile storage.

Signed-off-by: Adam Rutkowski <adam.j.rutkowski@intel.com>
This commit is contained in:
Adam Rutkowski 2020-09-28 15:31:30 +02:00
parent 7c29110e47
commit 716edcc637

View File

@ -10,6 +10,7 @@
#include "metadata_status.h" #include "metadata_status.h"
#include "../concurrency/ocf_concurrency.h" #include "../concurrency/ocf_concurrency.h"
#include "../utils/utils_cache_line.h" #include "../utils/utils_cache_line.h"
#include "../utils/utils_io.h"
#include "../utils/utils_pipeline.h" #include "../utils/utils_pipeline.h"
#include "../ocf_def_priv.h" #include "../ocf_def_priv.h"
#include "../ocf_priv.h" #include "../ocf_priv.h"
@ -1580,6 +1581,29 @@ static void ocf_metadata_hash_flush_superblock_finish(ocf_pipeline_t pipeline,
ocf_pipeline_destroy(pipeline); ocf_pipeline_destroy(pipeline);
} }
static void ocf_metadata_hash_flush_disk_end(void *priv, int error)
{
struct ocf_metadata_hash_context *context = priv;
ocf_pipeline_t pipeline = context->pipeline;
if (error) {
OCF_PL_FINISH_RET(pipeline, error);
return;
}
ocf_pipeline_next(pipeline);
}
static void ocf_metadata_hash_flush_disk(ocf_pipeline_t pipeline,
void *priv, ocf_pipeline_arg_t arg)
{
struct ocf_metadata_hash_context *context = priv;
ocf_cache_t cache = context->cache;
ocf_submit_volume_flush(ocf_cache_get_volume(cache),
ocf_metadata_hash_flush_disk_end, context);
}
struct ocf_pipeline_arg ocf_metadata_hash_flush_sb_calculate_crc_args[] = { struct ocf_pipeline_arg ocf_metadata_hash_flush_sb_calculate_crc_args[] = {
OCF_PL_ARG_INT(metadata_segment_part_config), OCF_PL_ARG_INT(metadata_segment_part_config),
OCF_PL_ARG_INT(metadata_segment_core_config), OCF_PL_ARG_INT(metadata_segment_core_config),
@ -1605,6 +1629,7 @@ struct ocf_pipeline_properties ocf_metadata_hash_flush_sb_pipeline_props = {
ocf_metadata_hash_flush_sb_calculate_crc_args), ocf_metadata_hash_flush_sb_calculate_crc_args),
OCF_PL_STEP_FOREACH(ocf_medatata_hash_flush_segment, OCF_PL_STEP_FOREACH(ocf_medatata_hash_flush_segment,
ocf_metadata_hash_flush_sb_flush_segment_args), ocf_metadata_hash_flush_sb_flush_segment_args),
OCF_PL_STEP(ocf_metadata_hash_flush_disk),
OCF_PL_STEP_TERMINATOR(), OCF_PL_STEP_TERMINATOR(),
}, },
}; };