Merge pull request #227 from mmichal10/mark-core-added-false

Don't try to remove invalid cores

If valid cache metadata was read, but environment has changed (i.e. number of cache lines has changed) ocf (in error handling path) was trying to close cores which were not opened. It happened due to cores were marked in cache metadata as added, but any cache inserting operation didn't take place.

In this patch 'added' flag in cache metadata was replaced with more meaningful 'valid' - it is set if given core is stored in cache metadata. Moreover, new 'added' flag was added to core run-time metadata and it is set if given core is added to cache.
This commit is contained in:
Michal Rakowski
2019-08-07 13:37:59 +02:00
committed by GitHub
6 changed files with 37 additions and 23 deletions

View File

@@ -640,7 +640,7 @@ static void ocf_metadata_query_cores_end(struct query_cores_context *context,
ocf_metadata_hash_query_cores_data_read(ctx,
&context->data.core_config,
&core_config, sizeof(core_config));
if (core_config.added) {
if (core_config.valid) {
env_bit_set(i, valid_core_bitmap);
++core_count;
}
@@ -1313,7 +1313,7 @@ static void ocf_medatata_hash_load_superblock_post(ocf_pipeline_t pipeline,
ctrl = (struct ocf_metadata_hash_ctrl *)cache->metadata.iface_priv;
sb_config = METADATA_MEM_POOL(ctrl, metadata_segment_sb_config);
for_each_core(cache, core, core_id) {
for_each_core_metadata(cache, core, core_id) {
muuid = ocf_metadata_get_core_uuid(cache, core_id);
uuid.data = muuid->data;
uuid.size = muuid->size;
@@ -1473,7 +1473,7 @@ static void ocf_medatata_hash_flush_superblock_prepare(ocf_pipeline_t pipeline,
ocf_core_id_t core_id;
/* Synchronize core objects types */
for_each_core(cache, core, core_id) {
for_each_core_metadata(cache, core, core_id) {
core->conf_meta->type = ocf_ctx_get_volume_type_id(
cache->owner, core->volume.type);
}