Merge pull request #743 from arutk/270622
volume init/deinit enhancements
This commit is contained in:
commit
8b83f0f164
@ -440,23 +440,6 @@ void ocf_metadata_load_superblock_recovery(ocf_cache_t cache,
|
|||||||
ocf_pipeline_next(pipeline);
|
ocf_pipeline_next(pipeline);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void ocf_metadata_flush_superblock_prepare(ocf_pipeline_t pipeline,
|
|
||||||
void *priv, ocf_pipeline_arg_t arg)
|
|
||||||
{
|
|
||||||
struct ocf_metadata_context *context = priv;
|
|
||||||
ocf_cache_t cache = context->cache;
|
|
||||||
ocf_core_t core;
|
|
||||||
ocf_core_id_t core_id;
|
|
||||||
|
|
||||||
/* Synchronize core objects types */
|
|
||||||
for_each_core_metadata(cache, core, core_id) {
|
|
||||||
core->conf_meta->type = ocf_ctx_get_volume_type_id(
|
|
||||||
cache->owner, core->volume.type);
|
|
||||||
}
|
|
||||||
|
|
||||||
ocf_pipeline_next(pipeline);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void ocf_metadata_flush_superblock_flap(ocf_pipeline_t pipeline,
|
static void ocf_metadata_flush_superblock_flap(ocf_pipeline_t pipeline,
|
||||||
void *priv, ocf_pipeline_arg_t arg)
|
void *priv, ocf_pipeline_arg_t arg)
|
||||||
{
|
{
|
||||||
@ -544,7 +527,6 @@ struct ocf_pipeline_properties ocf_metadata_flush_sb_pipeline_props = {
|
|||||||
.priv_size = sizeof(struct ocf_metadata_context),
|
.priv_size = sizeof(struct ocf_metadata_context),
|
||||||
.finish = ocf_metadata_flush_superblock_finish,
|
.finish = ocf_metadata_flush_superblock_finish,
|
||||||
.steps = {
|
.steps = {
|
||||||
OCF_PL_STEP(ocf_metadata_flush_superblock_prepare),
|
|
||||||
OCF_PL_STEP_FOREACH(ocf_metadata_calculate_crc,
|
OCF_PL_STEP_FOREACH(ocf_metadata_calculate_crc,
|
||||||
ocf_metadata_flush_sb_args),
|
ocf_metadata_flush_sb_args),
|
||||||
OCF_PL_STEP_FOREACH(ocf_metadata_flush_segment,
|
OCF_PL_STEP_FOREACH(ocf_metadata_flush_segment,
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright(c) 2012-2021 Intel Corporation
|
* Copyright(c) 2012-2022 Intel Corporation
|
||||||
* SPDX-License-Identifier: BSD-3-Clause
|
* SPDX-License-Identifier: BSD-3-Clause
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -426,6 +426,7 @@ static void ocf_mngt_cache_add_core_insert(ocf_pipeline_t pipeline,
|
|||||||
}
|
}
|
||||||
|
|
||||||
core->conf_meta->length = length;
|
core->conf_meta->length = length;
|
||||||
|
core->conf_meta->type = cfg->volume_type;
|
||||||
|
|
||||||
if (ocf_cache_is_device_attached(cache)) {
|
if (ocf_cache_is_device_attached(cache)) {
|
||||||
result = ocf_cleaning_add_core(cache, core_id);
|
result = ocf_cleaning_add_core(cache, core_id);
|
||||||
|
@ -152,11 +152,6 @@ static void ocf_composite_volume_on_deinit(ocf_volume_t cvolume)
|
|||||||
struct ocf_composite_volume *composite = ocf_volume_get_priv(cvolume);
|
struct ocf_composite_volume *composite = ocf_volume_get_priv(cvolume);
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
/* priv can be NULL if this volume had been moved from. In this case
|
|
||||||
* it's the owner responsibility to deinit member volumes. */
|
|
||||||
if (!composite)
|
|
||||||
return;
|
|
||||||
|
|
||||||
for (i = 0; i < composite->members_cnt; i++)
|
for (i = 0; i < composite->members_cnt; i++)
|
||||||
ocf_volume_deinit(&composite->member[i].volume);
|
ocf_volume_deinit(&composite->member[i].volume);
|
||||||
}
|
}
|
||||||
|
@ -93,6 +93,9 @@ int ocf_volume_init(ocf_volume_t volume, ocf_volume_type_t type,
|
|||||||
if (!volume || !type)
|
if (!volume || !type)
|
||||||
return -OCF_ERR_INVAL;
|
return -OCF_ERR_INVAL;
|
||||||
|
|
||||||
|
if (uuid && uuid->size > OCF_VOLUME_UUID_MAX_SIZE)
|
||||||
|
return -OCF_ERR_INVAL;
|
||||||
|
|
||||||
priv_size = type->properties->volume_priv_size;
|
priv_size = type->properties->volume_priv_size;
|
||||||
volume->priv = env_zalloc(priv_size, ENV_MEM_NORMAL);
|
volume->priv = env_zalloc(priv_size, ENV_MEM_NORMAL);
|
||||||
if (!volume->priv)
|
if (!volume->priv)
|
||||||
@ -161,6 +164,7 @@ void ocf_volume_deinit(ocf_volume_t volume)
|
|||||||
|
|
||||||
env_free(volume->priv);
|
env_free(volume->priv);
|
||||||
volume->priv = NULL;
|
volume->priv = NULL;
|
||||||
|
volume->type = NULL;
|
||||||
|
|
||||||
if (volume->uuid_copy && volume->uuid.data) {
|
if (volume->uuid_copy && volume->uuid.data) {
|
||||||
env_vfree(volume->uuid.data);
|
env_vfree(volume->uuid.data);
|
||||||
@ -191,6 +195,7 @@ void ocf_volume_move(ocf_volume_t volume, ocf_volume_t from)
|
|||||||
from->opened = false;
|
from->opened = false;
|
||||||
from->priv = NULL;
|
from->priv = NULL;
|
||||||
from->uuid.data = NULL;
|
from->uuid.data = NULL;
|
||||||
|
from->type = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
int ocf_volume_create(ocf_volume_t *volume, ocf_volume_type_t type,
|
int ocf_volume_create(ocf_volume_t *volume, ocf_volume_type_t type,
|
||||||
|
Loading…
Reference in New Issue
Block a user