Merge pull request #281 from robertbaldyga/create-volume-ram-check
Create new volume instead of using non-allocated one
This commit is contained in:
commit
43bd843bc8
@ -1068,7 +1068,7 @@ uint64_t _ocf_mngt_calculate_ram_needed(ocf_cache_t cache,
|
|||||||
int ocf_mngt_get_ram_needed(ocf_cache_t cache,
|
int ocf_mngt_get_ram_needed(ocf_cache_t cache,
|
||||||
struct ocf_mngt_cache_device_config *cfg, uint64_t *ram_needed)
|
struct ocf_mngt_cache_device_config *cfg, uint64_t *ram_needed)
|
||||||
{
|
{
|
||||||
struct ocf_volume *volume = &cache->device->volume;
|
ocf_volume_t volume;
|
||||||
ocf_volume_type_t type;
|
ocf_volume_type_t type;
|
||||||
int result;
|
int result;
|
||||||
|
|
||||||
@ -1080,21 +1080,21 @@ int ocf_mngt_get_ram_needed(ocf_cache_t cache,
|
|||||||
if (!type)
|
if (!type)
|
||||||
return -OCF_ERR_INVAL_VOLUME_TYPE;
|
return -OCF_ERR_INVAL_VOLUME_TYPE;
|
||||||
|
|
||||||
result = ocf_volume_init(volume, type,
|
result = ocf_volume_create(&volume, type,
|
||||||
&cfg->uuid, false);
|
&cfg->uuid);
|
||||||
if (result)
|
if (result)
|
||||||
return result;
|
return result;
|
||||||
|
|
||||||
result = ocf_volume_open(volume, cfg->volume_params);
|
result = ocf_volume_open(volume, cfg->volume_params);
|
||||||
if (result) {
|
if (result) {
|
||||||
ocf_volume_deinit(volume);
|
ocf_volume_destroy(volume);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
*ram_needed = _ocf_mngt_calculate_ram_needed(cache, volume);
|
*ram_needed = _ocf_mngt_calculate_ram_needed(cache, volume);
|
||||||
|
|
||||||
ocf_volume_close(volume);
|
ocf_volume_close(volume);
|
||||||
ocf_volume_deinit(volume);
|
ocf_volume_destroy(volume);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user