After loading cache mark used core ids.

Since OCF doesn't use core and cache ids anymore adapter has to track occupied
ids on its own. After loading cache, ids of all loaded cores should be marked as
occupied, otherwise adding new core without explicit specifying core id will
fail.

Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
This commit is contained in:
Michal Mielewczyk 2019-09-10 10:06:38 -04:00
parent 225ed2833f
commit 76acefd831

View File

@ -592,10 +592,19 @@ static void _cache_mngt_log_core_device_path(ocf_core_t core)
ocf_core_get_name(core), ocf_cache_get_name(cache)); ocf_core_get_name(core), ocf_cache_get_name(cache));
} }
static int _cache_mngt_log_core_device_path_visitor(ocf_core_t core, void *cntx) static int _cache_mngt_core_device_loaded_visitor(ocf_core_t core, void *cntx)
{ {
struct cache_priv *cache_priv;
uint16_t core_id = OCF_CORE_ID_INVALID;
ocf_cache_t cache = ocf_core_get_cache(core);
cache_priv = ocf_cache_get_priv(cache);
_cache_mngt_log_core_device_path(core); _cache_mngt_log_core_device_path(core);
core_id_from_name(&core_id, ocf_core_get_name(core));
mark_core_id_used(cache_priv->core_id_bitmap, core_id);
return 0; return 0;
} }
@ -1339,7 +1348,7 @@ static int _cache_mngt_load(struct ocf_mngt_cache_config *cfg,
if (result) if (result)
goto err_core_obj; goto err_core_obj;
ocf_core_visit(tmp_cache, _cache_mngt_log_core_device_path_visitor, ocf_core_visit(tmp_cache, _cache_mngt_core_device_loaded_visitor,
NULL, false); NULL, false);
*cache = tmp_cache; *cache = tmp_cache;