Track max number of cores for atomic volume

Signed-off-by: Michal Mielewczyk <michal.mielewczyk@huawei.com>
This commit is contained in:
Michal Mielewczyk 2023-10-23 08:53:03 +02:00 committed by Rafal Stefanowski
parent 2a97de8792
commit 41224c61c0
3 changed files with 30 additions and 2 deletions

View File

@ -1661,6 +1661,29 @@ static void _ocf_mngt_load_superblock(ocf_pipeline_t pipeline,
} }
} }
static void _ocf_mngt_attach_update_cores_atomic(ocf_pipeline_t pipeline,
void *priv, ocf_pipeline_arg_t arg)
{
struct ocf_cache_attach_context *context = priv;
ocf_cache_t cache = context->cache;
ocf_core_t core;
ocf_core_id_t core_id;
ocf_seq_no_t core_sequence_no = 0;
cache->conf_meta->curr_core_seq_no = 0;
if (!ocf_volume_is_atomic(ocf_cache_get_volume(cache)))
OCF_PL_NEXT_RET(pipeline);
for_each_core_metadata(cache, core, core_id) {
core_sequence_no = ocf_mngt_get_core_seq_no(cache);
if (core_sequence_no == OCF_SEQ_NO_INVALID)
OCF_PL_FINISH_RET(pipeline, -OCF_ERR_TOO_MANY_CORES);
core->conf_meta->seq_no = core_sequence_no;
}
}
static void _ocf_mngt_init_cleaner(ocf_pipeline_t pipeline, static void _ocf_mngt_init_cleaner(ocf_pipeline_t pipeline,
void *priv, ocf_pipeline_arg_t arg) void *priv, ocf_pipeline_arg_t arg)
{ {
@ -1927,6 +1950,7 @@ struct ocf_pipeline_properties _ocf_mngt_cache_attach_pipeline_properties = {
OCF_PL_STEP(_ocf_mngt_attach_check_ram), OCF_PL_STEP(_ocf_mngt_attach_check_ram),
OCF_PL_STEP(_ocf_mngt_attach_prepare_metadata), OCF_PL_STEP(_ocf_mngt_attach_prepare_metadata),
OCF_PL_STEP(_ocf_mngt_test_volume), OCF_PL_STEP(_ocf_mngt_test_volume),
OCF_PL_STEP(_ocf_mngt_attach_update_cores_atomic),
OCF_PL_STEP(_ocf_mngt_init_cleaner), OCF_PL_STEP(_ocf_mngt_init_cleaner),
OCF_PL_STEP(_ocf_mngt_init_promotion), OCF_PL_STEP(_ocf_mngt_init_promotion),
OCF_PL_STEP(_ocf_mngt_attach_init_metadata), OCF_PL_STEP(_ocf_mngt_attach_init_metadata),

View File

@ -1,5 +1,6 @@
/* /*
* Copyright(c) 2012-2022 Intel Corporation * Copyright(c) 2012-2022 Intel Corporation
* Copyright(c) 2024 Huawei Technologies
* SPDX-License-Identifier: BSD-3-Clause * SPDX-License-Identifier: BSD-3-Clause
*/ */
@ -14,7 +15,7 @@
#include "../ocf_def_priv.h" #include "../ocf_def_priv.h"
#include "../cleaning/cleaning_ops.h" #include "../cleaning/cleaning_ops.h"
static ocf_seq_no_t _ocf_mngt_get_core_seq_no(ocf_cache_t cache) ocf_seq_no_t ocf_mngt_get_core_seq_no(ocf_cache_t cache)
{ {
if (cache->conf_meta->curr_core_seq_no == OCF_SEQ_NO_MAX) if (cache->conf_meta->curr_core_seq_no == OCF_SEQ_NO_MAX)
return OCF_SEQ_NO_INVALID; return OCF_SEQ_NO_INVALID;
@ -482,7 +483,7 @@ static void ocf_mngt_cache_add_core_insert(ocf_pipeline_t pipeline,
/* Add core sequence number for atomic metadata matching */ /* Add core sequence number for atomic metadata matching */
if (ocf_volume_is_atomic(&cache->device->volume)) { if (ocf_volume_is_atomic(&cache->device->volume)) {
core_sequence_no = _ocf_mngt_get_core_seq_no(cache); core_sequence_no = ocf_mngt_get_core_seq_no(cache);
if (core_sequence_no == OCF_SEQ_NO_INVALID) if (core_sequence_no == OCF_SEQ_NO_INVALID)
OCF_PL_FINISH_RET(pipeline, -OCF_ERR_TOO_MANY_CORES); OCF_PL_FINISH_RET(pipeline, -OCF_ERR_TOO_MANY_CORES);
} }

View File

@ -1,5 +1,6 @@
/* /*
* Copyright(c) 2012-2021 Intel Corporation * Copyright(c) 2012-2021 Intel Corporation
* Copyright(c) 2024 Huawei Technologies
* SPDX-License-Identifier: BSD-3-Clause * SPDX-License-Identifier: BSD-3-Clause
*/ */
@ -12,4 +13,6 @@ int ocf_mngt_core_init_front_volume(ocf_core_t core);
void ocf_mngt_core_clear_uuid_metadata(ocf_core_t core); void ocf_mngt_core_clear_uuid_metadata(ocf_core_t core);
ocf_seq_no_t ocf_mngt_get_core_seq_no(ocf_cache_t cache);
#endif /* __OCF_MNGT_CORE_PRIV_H__ */ #endif /* __OCF_MNGT_CORE_PRIV_H__ */