Patch detached cache API

Signed-off-by: Michal Mielewczyk <michal.mielewczyk@huawei.com>
This commit is contained in:
Michal Mielewczyk 2023-10-04 14:27:05 +02:00 committed by Rafal Stefanowski
parent 06a2125ba9
commit 3f41a35f30
2 changed files with 7 additions and 1 deletions

View File

@ -3064,6 +3064,11 @@ void ocf_mngt_cache_attach(ocf_cache_t cache,
if (!cache->mngt_queue)
OCF_CMPL_RET(cache, priv, -OCF_ERR_INVAL);
if (ocf_cache_is_device_attached(cache)) {
ocf_cache_log(cache, log_err, "Cache is already attached!\n");
OCF_CMPL_RET(cache, priv, -OCF_ERR_INVAL);
}
result = _ocf_mngt_cache_validate_attach_cfg(cfg);
if (result)
OCF_CMPL_RET(cache, priv, result);

View File

@ -482,7 +482,8 @@ static void ocf_mngt_cache_add_core_insert(ocf_pipeline_t pipeline,
cfg->seq_cutoff_promote_on_threshold);
/* Add core sequence number for atomic metadata matching */
if (ocf_volume_is_atomic(&cache->device->volume)) {
if (ocf_cache_is_device_attached(cache) &&
ocf_volume_is_atomic(&cache->device->volume)) {
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);