Merge pull request #126 from mmichal10/fix-try-add
Don't generate core name when adding core to corepool.
This commit is contained in:
commit
cdab8cacd5
@ -61,6 +61,10 @@ struct {
|
||||
OCF_ERR_TOO_MANY_CORES,
|
||||
"Too many core devices in cache"
|
||||
},
|
||||
{
|
||||
OCF_ERR_CORE_EXIST,
|
||||
"Core id already used"
|
||||
},
|
||||
{
|
||||
OCF_ERR_CORE_NOT_AVAIL,
|
||||
"Core device not available"
|
||||
|
@ -534,8 +534,7 @@ int cache_mngt_prepare_core_cfg(struct ocf_mngt_core_config *cfg,
|
||||
struct kcas_insert_core *cmd_info)
|
||||
{
|
||||
struct block_device *bdev;
|
||||
static char core_name[OCF_CORE_NAME_SIZE];
|
||||
struct cache_priv *cache_priv;
|
||||
char core_name[OCF_CORE_NAME_SIZE] = {};
|
||||
ocf_cache_t cache;
|
||||
uint16_t core_id;
|
||||
int result;
|
||||
@ -546,17 +545,19 @@ int cache_mngt_prepare_core_cfg(struct ocf_mngt_core_config *cfg,
|
||||
if (cmd_info->core_id == OCF_CORE_MAX) {
|
||||
result = mngt_get_cache_by_id(cas_ctx, cmd_info->cache_id,
|
||||
&cache);
|
||||
if (result)
|
||||
if (result && result != -OCF_ERR_CACHE_NOT_EXIST) {
|
||||
return result;
|
||||
} else if (!result) {
|
||||
struct cache_priv *cache_priv;
|
||||
cache_priv = ocf_cache_get_priv(cache);
|
||||
ocf_mngt_cache_put(cache);
|
||||
|
||||
cache_priv = ocf_cache_get_priv(cache);
|
||||
ocf_mngt_cache_put(cache);
|
||||
core_id = find_free_core_id(cache_priv->core_id_bitmap);
|
||||
if (core_id == OCF_CORE_MAX)
|
||||
return -OCF_ERR_INVAL;
|
||||
|
||||
core_id = find_free_core_id(cache_priv->core_id_bitmap);
|
||||
if (core_id == OCF_CORE_MAX)
|
||||
return -OCF_ERR_INVAL;
|
||||
|
||||
cmd_info->core_id = core_id;
|
||||
cmd_info->core_id = core_id;
|
||||
}
|
||||
}
|
||||
|
||||
snprintf(core_name, sizeof(core_name), "core%d", cmd_info->core_id);
|
||||
|
Loading…
Reference in New Issue
Block a user