Purge core command

Purge invalidates all cache lines which belongs to given core. It is very
usefull feature for tests.

Calling purge is possbile with casadm `--script` swtich.

Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
This commit is contained in:
Michal Mielewczyk
2020-05-11 04:49:03 -04:00
parent d24288a9b1
commit 3b62e40a2e
7 changed files with 149 additions and 2 deletions

View File

@@ -1420,6 +1420,7 @@ enum {
script_cmd_add_core,
script_cmd_remove_core,
script_cmd_purge_cache,
script_cmd_purge_core,
script_cmd_max_id,
@@ -1486,6 +1487,15 @@ static cli_option script_params_options[] = {
.priv = (1 << script_opt_cache_id),
.flags = CLI_COMMAND_HIDDEN,
},
[script_cmd_purge_core] = {
.short_name = 0,
.long_name = "purge-core",
.args_count = 0,
.arg = NULL,
.priv = (1 << script_opt_cache_id)
| (1 << script_opt_core_id),
.flags = CLI_COMMAND_HIDDEN,
},
[script_opt_cache_device] = {
.short_name = 0,
.long_name = "cache-device",
@@ -1501,7 +1511,8 @@ static cli_option script_params_options[] = {
.arg = "ID",
.priv = (1 << script_cmd_remove_core)
| (1 << script_cmd_add_core)
| (1 << script_cmd_purge_cache),
| (1 << script_cmd_purge_cache)
| (1 << script_cmd_purge_core),
.flags = (CLI_OPTION_RANGE_INT | CLI_OPTION_HIDDEN),
.min_value = OCF_CACHE_ID_MIN,
.max_value = OCF_CACHE_ID_MAX,
@@ -1512,7 +1523,8 @@ static cli_option script_params_options[] = {
.args_count = 1,
.arg = "ID",
.priv = (1 << script_cmd_remove_core)
| (1 << script_cmd_add_core),
| (1 << script_cmd_add_core)
| (1 << script_cmd_purge_core),
.flags = (CLI_OPTION_RANGE_INT | CLI_OPTION_HIDDEN),
.min_value = OCF_CORE_ID_MIN,
.max_value = OCF_CORE_ID_MAX,
@@ -1670,6 +1682,11 @@ int script_handle() {
);
case script_cmd_purge_cache:
return purge_cache(command_args_values.cache_id);
case script_cmd_purge_core:
return purge_core(
command_args_values.cache_id,
command_args_values.core_id
);
}
return FAILURE;