Validate activate parameters
Signed-off-by: Jan Musial <jan.musial@intel.com>
This commit is contained in:
parent
b9c84e331c
commit
010f30eeaf
@ -2732,20 +2732,22 @@ void ocf_mngt_cache_activate(ocf_cache_t cache,
|
|||||||
OCF_CHECK_NULL(cache);
|
OCF_CHECK_NULL(cache);
|
||||||
OCF_CHECK_NULL(cfg);
|
OCF_CHECK_NULL(cfg);
|
||||||
|
|
||||||
if (!cache->mngt_queue)
|
|
||||||
OCF_CMPL_RET(cache, priv, -OCF_ERR_INVAL);
|
|
||||||
|
|
||||||
/* Activate is not allowed in volatile metadata mode */
|
|
||||||
if (cache->metadata.is_volatile)
|
|
||||||
OCF_CMPL_RET(cache, priv, -OCF_ERR_INVAL);
|
|
||||||
|
|
||||||
/* Activate is not allowed with 'force' flag on */
|
|
||||||
if (cfg->force) {
|
if (cfg->force) {
|
||||||
ocf_cache_log(cache, log_err, "Using 'force' flag is forbidden "
|
ocf_cache_log(cache, log_err, "Using 'force' flag is forbidden "
|
||||||
"for activate operation.");
|
"for activate operation.");
|
||||||
OCF_CMPL_RET(cache, priv, -OCF_ERR_INVAL);
|
OCF_CMPL_RET(cache, priv, -OCF_ERR_INVAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (cfg->cache_line_size != ocf_cache_line_size_none &&
|
||||||
|
cfg->cache_line_size != cache->metadata.line_size) {
|
||||||
|
ocf_cache_log(cache, log_err, "Specifying cache line size is "
|
||||||
|
"forbidden for activate operation.");
|
||||||
|
OCF_CMPL_RET(cache, priv, -OCF_ERR_INVAL);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!cache->mngt_queue)
|
||||||
|
OCF_CMPL_RET(cache, priv, -OCF_ERR_INVAL);
|
||||||
|
|
||||||
result = _ocf_mngt_cache_validate_device_cfg(cfg);
|
result = _ocf_mngt_cache_validate_device_cfg(cfg);
|
||||||
if (result)
|
if (result)
|
||||||
OCF_CMPL_RET(cache, priv, result);
|
OCF_CMPL_RET(cache, priv, result);
|
||||||
|
Loading…
Reference in New Issue
Block a user