Merge pull request #727 from mmichal10/seq-cutoff-consts

Seq cutoff consts
This commit is contained in:
Robert Baldyga 2021-03-16 17:11:58 +01:00 committed by GitHub
commit 4a0fba8e79
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 11 additions and 28 deletions

View File

@ -744,8 +744,9 @@ static cli_namespace set_param_namespace = {
int set_param_seq_cutoff_handle_option(char *opt, const char **arg)
{
if (!strcmp(opt, "threshold")) {
if (validate_str_num(arg[0], "sequential cutoff threshold", 1,
4194181) == FAILURE)
if (validate_str_num(arg[0], "sequential cutoff threshold",
OCF_SEQ_CUTOFF_MIN_THRESHOLD,
OCF_SEQ_CUTOFF_MAX_THRESHOLD) == FAILURE)
return FAILURE;
SET_CORE_PARAM(core_param_seq_cutoff_threshold, atoi(arg[0]) * KiB);
@ -764,8 +765,9 @@ int set_param_seq_cutoff_handle_option(char *opt, const char **arg)
return FAILURE;
}
} else if (!strcmp(opt, "promotion-count")) {
if (validate_str_num(arg[0], "sequential cutoff promotion request count", 1,
65535) == FAILURE)
if (validate_str_num(arg[0], "sequential cutoff promotion request count",
OCF_SEQ_CUTOFF_MIN_PROMOTION_COUNT,
OCF_SEQ_CUTOFF_MAX_PROMOTION_COUNT) == FAILURE)
return FAILURE;
SET_CORE_PARAM(core_param_seq_cutoff_promotion_count, atoi(arg[0]));

View File

@ -158,6 +158,10 @@ struct {
OCF_ERR_INVAL_CACHE_DEV,
"Device does not meet requirements."
},
{
OCF_ERR_NO_LOCK,
"Failed to lock cache for management operation."
},
/* CAS kernel error mappings*/
{
@ -253,11 +257,6 @@ struct {
"Waiting for operation interrupted"
},
{
KCAS_ERR_CACHE_STOPPING,
"Cache being stopped"
},
{
KCAS_ERR_CORE_IN_ACTIVE_STATE,
"Core device is in active state"
},

View File

@ -98,13 +98,6 @@ static int _cache_mngt_lock_sync(ocf_cache_t cache)
struct _cache_mngt_async_context *context;
int result;
if (!ocf_cache_is_running(cache)) {
printk(KERN_WARNING "%s is being stopped. "
"Can't perform management operations\n",
ocf_cache_get_name(cache));
return -KCAS_ERR_CACHE_STOPPING;
}
context = kmalloc(sizeof(*context), GFP_KERNEL);
if (!context)
return -ENOMEM;
@ -142,13 +135,6 @@ static int _cache_mngt_read_lock_sync(ocf_cache_t cache)
struct _cache_mngt_async_context *context;
int result;
if (!ocf_cache_is_running(cache)) {
printk(KERN_WARNING "%s is being stopped. "
"Can't perform management operations\n",
ocf_cache_get_name(cache));
return -KCAS_ERR_CACHE_STOPPING;
}
context = kmalloc(sizeof(*context), GFP_KERNEL);
if (!context)
return -ENOMEM;
@ -2432,7 +2418,6 @@ int cache_mngt_exit_instance(const char *cache_name, size_t name_len, int flush)
case -OCF_ERR_CACHE_IN_INCOMPLETE_STATE:
case -OCF_ERR_FLUSHING_INTERRUPTED:
case -KCAS_ERR_WAITING_INTERRUPTED:
case -KCAS_ERR_CACHE_STOPPING:
goto put;
default:
flush_status = status;

View File

@ -526,7 +526,7 @@ struct kcas_get_cache_param {
#define KCAS_IOCTL_PURGE_CORE _IOWR(KCAS_IOCTL_MAGIC, 36, struct kcas_flush_core)
/** Remove inactive core object from an running cache instance */
#define KCAS_IOCTL_REMOVE_INACTIVE _IOR(KCAS_IOCTL_MAGIC, 37, struct kcas_remove_inactive)
#define KCAS_IOCTL_REMOVE_INACTIVE _IOWR(KCAS_IOCTL_MAGIC, 37, struct kcas_remove_inactive)
/**
* Extended kernel CAS error codes
@ -598,9 +598,6 @@ enum kcas_error {
/** Waiting for async operation was interrupted */
KCAS_ERR_WAITING_INTERRUPTED,
/** Cache already being stopped*/
KCAS_ERR_CACHE_STOPPING,
/** Core device is in active state */
KCAS_ERR_CORE_IN_ACTIVE_STATE
};