Calculate CRC for runtime metadata sections only on clean load
During recovery procedure there is no guarantee that checksums of runtime sections were flushed correctly before dirty shutdown. Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
This commit is contained in:
parent
0e1efb5b04
commit
d946124a01
@ -1273,8 +1273,8 @@ static void ocf_medatata_hash_check_crc_sb_config(ocf_pipeline_t pipeline,
|
||||
ocf_pipeline_next(pipeline);
|
||||
}
|
||||
|
||||
static void ocf_medatata_hash_check_crc(ocf_pipeline_t pipeline,
|
||||
void *priv, ocf_pipeline_arg_t arg)
|
||||
static void ocf_medatata_hash_check_crc_skip(ocf_pipeline_t pipeline,
|
||||
void *priv, ocf_pipeline_arg_t arg, bool skip_on_dirty_shutdown)
|
||||
{
|
||||
struct ocf_metadata_hash_context *context = priv;
|
||||
int segment = ocf_pipeline_arg_get_int(arg);
|
||||
@ -1286,6 +1286,9 @@ static void ocf_medatata_hash_check_crc(ocf_pipeline_t pipeline,
|
||||
ctrl = (struct ocf_metadata_hash_ctrl *)cache->metadata.iface_priv;
|
||||
sb_config = METADATA_MEM_POOL(ctrl, metadata_segment_sb_config);
|
||||
|
||||
if (!sb_config->clean_shutdown && skip_on_dirty_shutdown)
|
||||
OCF_PL_NEXT_RET(pipeline);
|
||||
|
||||
crc = ocf_metadata_raw_checksum(cache, &(ctrl->raw_desc[segment]));
|
||||
|
||||
if (crc != sb_config->checksum[segment]) {
|
||||
@ -1299,6 +1302,18 @@ static void ocf_medatata_hash_check_crc(ocf_pipeline_t pipeline,
|
||||
ocf_pipeline_next(pipeline);
|
||||
}
|
||||
|
||||
static void ocf_medatata_hash_check_crc(ocf_pipeline_t pipeline,
|
||||
void *priv, ocf_pipeline_arg_t arg)
|
||||
{
|
||||
ocf_medatata_hash_check_crc_skip(pipeline, priv, arg, false);
|
||||
}
|
||||
|
||||
static void ocf_medatata_hash_check_crc_if_clean(ocf_pipeline_t pipeline,
|
||||
void *priv, ocf_pipeline_arg_t arg)
|
||||
{
|
||||
ocf_medatata_hash_check_crc_skip(pipeline, priv, arg, true);
|
||||
}
|
||||
|
||||
static void ocf_medatata_hash_load_superblock_post(ocf_pipeline_t pipeline,
|
||||
void *priv, ocf_pipeline_arg_t arg)
|
||||
{
|
||||
@ -1409,14 +1424,18 @@ struct ocf_pipeline_arg ocf_metadata_hash_load_sb_load_segment_args[] = {
|
||||
};
|
||||
|
||||
struct ocf_pipeline_arg ocf_metadata_hash_load_sb_check_crc_args[] = {
|
||||
OCF_PL_ARG_INT(metadata_segment_sb_runtime),
|
||||
OCF_PL_ARG_INT(metadata_segment_part_config),
|
||||
OCF_PL_ARG_INT(metadata_segment_part_runtime),
|
||||
OCF_PL_ARG_INT(metadata_segment_core_config),
|
||||
OCF_PL_ARG_INT(metadata_segment_core_uuid),
|
||||
OCF_PL_ARG_TERMINATOR(),
|
||||
};
|
||||
|
||||
struct ocf_pipeline_arg ocf_metadata_hash_load_sb_check_crc_args_clean[] = {
|
||||
OCF_PL_ARG_INT(metadata_segment_sb_runtime),
|
||||
OCF_PL_ARG_INT(metadata_segment_part_runtime),
|
||||
OCF_PL_ARG_TERMINATOR(),
|
||||
};
|
||||
|
||||
struct ocf_pipeline_properties ocf_metadata_hash_load_sb_pipeline_props = {
|
||||
.priv_size = sizeof(struct ocf_metadata_hash_context),
|
||||
.finish = ocf_metadata_hash_load_superblock_finish,
|
||||
@ -1428,6 +1447,8 @@ struct ocf_pipeline_properties ocf_metadata_hash_load_sb_pipeline_props = {
|
||||
OCF_PL_STEP(ocf_medatata_hash_check_crc_sb_config),
|
||||
OCF_PL_STEP_FOREACH(ocf_medatata_hash_check_crc,
|
||||
ocf_metadata_hash_load_sb_check_crc_args),
|
||||
OCF_PL_STEP_FOREACH(ocf_medatata_hash_check_crc_if_clean,
|
||||
ocf_metadata_hash_load_sb_check_crc_args_clean),
|
||||
OCF_PL_STEP(ocf_medatata_hash_load_superblock_post),
|
||||
OCF_PL_STEP_TERMINATOR(),
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user