Move core initialization code from metadata to mngt
Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
This commit is contained in:
parent
24728330fc
commit
a2db4d14e8
@ -132,30 +132,10 @@ static void ocf_metadata_load_superblock_post(ocf_pipeline_t pipeline,
|
|||||||
struct ocf_metadata_ctrl *ctrl;
|
struct ocf_metadata_ctrl *ctrl;
|
||||||
struct ocf_superblock_config *sb_config;
|
struct ocf_superblock_config *sb_config;
|
||||||
ocf_cache_t cache = context->cache;
|
ocf_cache_t cache = context->cache;
|
||||||
struct ocf_metadata_uuid *muuid;
|
|
||||||
struct ocf_volume_uuid uuid;
|
|
||||||
ocf_volume_type_t volume_type;
|
|
||||||
ocf_core_t core;
|
|
||||||
ocf_core_id_t core_id;
|
|
||||||
|
|
||||||
ctrl = (struct ocf_metadata_ctrl *)cache->metadata.priv;
|
ctrl = (struct ocf_metadata_ctrl *)cache->metadata.priv;
|
||||||
sb_config = METADATA_MEM_POOL(ctrl, metadata_segment_sb_config);
|
sb_config = METADATA_MEM_POOL(ctrl, metadata_segment_sb_config);
|
||||||
|
|
||||||
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;
|
|
||||||
|
|
||||||
volume_type = ocf_ctx_get_volume_type(cache->owner,
|
|
||||||
core->conf_meta->type);
|
|
||||||
|
|
||||||
/* Initialize core volume */
|
|
||||||
ocf_volume_init(&core->volume, volume_type, &uuid, false);
|
|
||||||
core->has_volume = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Restore all dynamics items */
|
|
||||||
|
|
||||||
if (sb_config->core_count > OCF_CORE_MAX) {
|
if (sb_config->core_count > OCF_CORE_MAX) {
|
||||||
ocf_cache_log(cache, log_err,
|
ocf_cache_log(cache, log_err,
|
||||||
"Loading cache state ERROR, invalid cores count\n");
|
"Loading cache state ERROR, invalid cores count\n");
|
||||||
|
@ -362,10 +362,22 @@ static void _ocf_mngt_load_add_cores(ocf_pipeline_t pipeline,
|
|||||||
|
|
||||||
/* Check in metadata which cores were saved in cache metadata */
|
/* Check in metadata which cores were saved in cache metadata */
|
||||||
for_each_core_metadata(cache, core, core_id) {
|
for_each_core_metadata(cache, core, core_id) {
|
||||||
|
struct ocf_metadata_uuid *muuid;
|
||||||
|
struct ocf_volume_uuid uuid;
|
||||||
|
ocf_volume_type_t volume_type;
|
||||||
ocf_volume_t tvolume = NULL;
|
ocf_volume_t tvolume = NULL;
|
||||||
|
|
||||||
if (!core->volume.type)
|
muuid = ocf_metadata_get_core_uuid(cache, core_id);
|
||||||
|
uuid.data = muuid->data;
|
||||||
|
uuid.size = muuid->size;
|
||||||
|
|
||||||
|
volume_type = ocf_ctx_get_volume_type(cache->owner,
|
||||||
|
core->conf_meta->type);
|
||||||
|
|
||||||
|
ret = ocf_volume_init(&core->volume, volume_type, &uuid, false);
|
||||||
|
if (ret)
|
||||||
goto err;
|
goto err;
|
||||||
|
core->has_volume = true;
|
||||||
|
|
||||||
tvolume = ocf_mngt_core_pool_lookup(ocf_cache_get_ctx(cache),
|
tvolume = ocf_mngt_core_pool_lookup(ocf_cache_get_ctx(cache),
|
||||||
&core->volume.uuid, core->volume.type);
|
&core->volume.uuid, core->volume.type);
|
||||||
|
Loading…
Reference in New Issue
Block a user