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,
|
OCF_ERR_TOO_MANY_CORES,
|
||||||
"Too many core devices in cache"
|
"Too many core devices in cache"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
OCF_ERR_CORE_EXIST,
|
||||||
|
"Core id already used"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
OCF_ERR_CORE_NOT_AVAIL,
|
OCF_ERR_CORE_NOT_AVAIL,
|
||||||
"Core device not available"
|
"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 kcas_insert_core *cmd_info)
|
||||||
{
|
{
|
||||||
struct block_device *bdev;
|
struct block_device *bdev;
|
||||||
static char core_name[OCF_CORE_NAME_SIZE];
|
char core_name[OCF_CORE_NAME_SIZE] = {};
|
||||||
struct cache_priv *cache_priv;
|
|
||||||
ocf_cache_t cache;
|
ocf_cache_t cache;
|
||||||
uint16_t core_id;
|
uint16_t core_id;
|
||||||
int result;
|
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) {
|
if (cmd_info->core_id == OCF_CORE_MAX) {
|
||||||
result = mngt_get_cache_by_id(cas_ctx, cmd_info->cache_id,
|
result = mngt_get_cache_by_id(cas_ctx, cmd_info->cache_id,
|
||||||
&cache);
|
&cache);
|
||||||
if (result)
|
if (result && result != -OCF_ERR_CACHE_NOT_EXIST) {
|
||||||
return result;
|
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);
|
core_id = find_free_core_id(cache_priv->core_id_bitmap);
|
||||||
ocf_mngt_cache_put(cache);
|
if (core_id == OCF_CORE_MAX)
|
||||||
|
return -OCF_ERR_INVAL;
|
||||||
|
|
||||||
core_id = find_free_core_id(cache_priv->core_id_bitmap);
|
cmd_info->core_id = core_id;
|
||||||
if (core_id == OCF_CORE_MAX)
|
}
|
||||||
return -OCF_ERR_INVAL;
|
|
||||||
|
|
||||||
cmd_info->core_id = core_id;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
snprintf(core_name, sizeof(core_name), "core%d", cmd_info->core_id);
|
snprintf(core_name, sizeof(core_name), "core%d", cmd_info->core_id);
|
||||||
|
Loading…
Reference in New Issue
Block a user