Merge pull request #808 from mmichal10/vol_and_req_fixes
Volume improvements
This commit is contained in:
commit
3ebf6e64c1
@ -34,6 +34,12 @@ struct ocf_mngt_core_config {
|
|||||||
*/
|
*/
|
||||||
uint8_t volume_type;
|
uint8_t volume_type;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Optional opaque volume parameters, passed down to core volume
|
||||||
|
* open callback
|
||||||
|
*/
|
||||||
|
void *volume_params;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Add core to pool if cache isn't present or add core to
|
* @brief Add core to pool if cache isn't present or add core to
|
||||||
* earlier loaded cache
|
* earlier loaded cache
|
||||||
|
@ -107,9 +107,6 @@ struct ocf_cache_attach_context {
|
|||||||
bool device_alloc : 1;
|
bool device_alloc : 1;
|
||||||
/*!< data structure allocated */
|
/*!< data structure allocated */
|
||||||
|
|
||||||
bool volume_stored : 1;
|
|
||||||
/*!< underlying device volume is stored in contex */
|
|
||||||
|
|
||||||
bool volume_inited : 1;
|
bool volume_inited : 1;
|
||||||
/*!< underlying device volume is initialized */
|
/*!< underlying device volume is initialized */
|
||||||
|
|
||||||
@ -895,8 +892,14 @@ static void _ocf_mngt_attach_cache_device(ocf_pipeline_t pipeline,
|
|||||||
|
|
||||||
context->flags.device_alloc = true;
|
context->flags.device_alloc = true;
|
||||||
|
|
||||||
ocf_volume_move(&cache->device->volume, device_cfg->volume);
|
ret = ocf_volume_init(&cache->device->volume, device_cfg->volume->type,
|
||||||
|
NULL, false);
|
||||||
|
if (ret)
|
||||||
|
OCF_PL_FINISH_RET(pipeline, -OCF_ERR_NO_MEM);
|
||||||
|
|
||||||
context->flags.volume_inited = true;
|
context->flags.volume_inited = true;
|
||||||
|
|
||||||
|
ocf_volume_move(&cache->device->volume, device_cfg->volume);
|
||||||
cache->device->volume.cache = cache;
|
cache->device->volume.cache = cache;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -1911,8 +1914,6 @@ static void _ocf_mngt_attach_handle_error(
|
|||||||
|
|
||||||
if (context->flags.volume_inited)
|
if (context->flags.volume_inited)
|
||||||
ocf_volume_deinit(&cache->device->volume);
|
ocf_volume_deinit(&cache->device->volume);
|
||||||
else
|
|
||||||
ocf_volume_deinit(context->cfg.device.volume);
|
|
||||||
|
|
||||||
if (context->flags.front_volume_opened)
|
if (context->flags.front_volume_opened)
|
||||||
ocf_volume_close(&cache->device->front_volume);
|
ocf_volume_close(&cache->device->front_volume);
|
||||||
@ -2460,9 +2461,15 @@ static void _ocf_mngt_activate_set_cache_device(ocf_pipeline_t pipeline,
|
|||||||
ocf_cache_t cache = context->cache;
|
ocf_cache_t cache = context->cache;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
|
ret = ocf_volume_init(&cache->device->volume, device_cfg->volume->type,
|
||||||
|
NULL, false);
|
||||||
|
if (ret)
|
||||||
|
OCF_PL_FINISH_RET(pipeline, -OCF_ERR_NO_MEM);
|
||||||
|
|
||||||
|
context->flags.volume_inited = true;
|
||||||
|
|
||||||
ocf_volume_move(&cache->device->volume, device_cfg->volume);
|
ocf_volume_move(&cache->device->volume, device_cfg->volume);
|
||||||
cache->device->volume.cache = cache;
|
cache->device->volume.cache = cache;
|
||||||
context->flags.volume_inited = true;
|
|
||||||
|
|
||||||
ret = ocf_volume_open(&cache->device->volume,
|
ret = ocf_volume_open(&cache->device->volume,
|
||||||
device_cfg->volume_params);
|
device_cfg->volume_params);
|
||||||
@ -2581,11 +2588,6 @@ static void _ocf_mngt_activate_handle_error(
|
|||||||
|
|
||||||
if (context->flags.volume_inited)
|
if (context->flags.volume_inited)
|
||||||
ocf_volume_deinit(&cache->device->volume);
|
ocf_volume_deinit(&cache->device->volume);
|
||||||
else
|
|
||||||
ocf_volume_deinit(context->cfg.device.volume);
|
|
||||||
|
|
||||||
if (context->flags.volume_stored)
|
|
||||||
ocf_volume_move(&cache->device->volume, &context->cache_volume);
|
|
||||||
|
|
||||||
if (context->flags.metadata_frozen)
|
if (context->flags.metadata_frozen)
|
||||||
ocf_refcnt_unfreeze(&cache->refcnt.metadata);
|
ocf_refcnt_unfreeze(&cache->refcnt.metadata);
|
||||||
@ -2613,12 +2615,6 @@ static void _ocf_mngt_cache_activate_finish(ocf_pipeline_t pipeline,
|
|||||||
ocf_pipeline_destroy(cache->stop_pipeline);
|
ocf_pipeline_destroy(cache->stop_pipeline);
|
||||||
cache->stop_pipeline = stop_pipeline;
|
cache->stop_pipeline = stop_pipeline;
|
||||||
|
|
||||||
if (context->flags.volume_stored) {
|
|
||||||
if (context->cache_volume.opened)
|
|
||||||
ocf_volume_close(&context->cache_volume);
|
|
||||||
ocf_volume_deinit(&context->cache_volume);
|
|
||||||
}
|
|
||||||
|
|
||||||
out:
|
out:
|
||||||
context->cmpl(context->cache, context->priv1, context->priv2, error);
|
context->cmpl(context->cache, context->priv1, context->priv2, error);
|
||||||
|
|
||||||
|
@ -414,7 +414,7 @@ static void ocf_mngt_cache_add_core_insert(ocf_pipeline_t pipeline,
|
|||||||
OCF_PL_FINISH_RET(pipeline, result);
|
OCF_PL_FINISH_RET(pipeline, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
result = ocf_volume_open(volume, NULL);
|
result = ocf_volume_open(volume, cfg->volume_params);
|
||||||
if (result)
|
if (result)
|
||||||
OCF_PL_FINISH_RET(pipeline, result);
|
OCF_PL_FINISH_RET(pipeline, result);
|
||||||
|
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
#
|
#
|
||||||
# Copyright(c) 2019-2022 Intel Corporation
|
# Copyright(c) 2019-2022 Intel Corporation
|
||||||
|
# Copyright(c) 2024 Huawei Technologies
|
||||||
# SPDX-License-Identifier: BSD-3-Clause
|
# SPDX-License-Identifier: BSD-3-Clause
|
||||||
#
|
#
|
||||||
|
|
||||||
@ -44,6 +45,7 @@ class CoreConfig(Structure):
|
|||||||
("_name", c_char * MAX_CORE_NAME_SIZE),
|
("_name", c_char * MAX_CORE_NAME_SIZE),
|
||||||
("_uuid", Uuid),
|
("_uuid", Uuid),
|
||||||
("_volume_type", c_uint8),
|
("_volume_type", c_uint8),
|
||||||
|
("_volume_params", c_void_p),
|
||||||
("_try_add", c_bool),
|
("_try_add", c_bool),
|
||||||
("_seq_cutoff_threshold", c_uint32),
|
("_seq_cutoff_threshold", c_uint32),
|
||||||
("_seq_cutoff_promotion_count", c_uint32),
|
("_seq_cutoff_promotion_count", c_uint32),
|
||||||
|
Loading…
Reference in New Issue
Block a user