Purge cache command

Purge invalidates all cache lines. 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-08 11:12:31 -04:00
parent f7d854bf70
commit d24288a9b1
7 changed files with 129 additions and 1 deletions

View File

@@ -1419,6 +1419,7 @@ enum {
script_cmd_add_core,
script_cmd_remove_core,
script_cmd_purge_cache,
script_cmd_max_id,
@@ -1477,6 +1478,14 @@ static cli_option script_params_options[] = {
| (1 << script_opt_core_id),
.flags = CLI_COMMAND_HIDDEN,
},
[script_cmd_purge_cache] = {
.short_name = 0,
.long_name = "purge-cache",
.args_count = 0,
.arg = NULL,
.priv = (1 << script_opt_cache_id),
.flags = CLI_COMMAND_HIDDEN,
},
[script_opt_cache_device] = {
.short_name = 0,
.long_name = "cache-device",
@@ -1491,7 +1500,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_cache),
.flags = (CLI_OPTION_RANGE_INT | CLI_OPTION_HIDDEN),
.min_value = OCF_CACHE_ID_MIN,
.max_value = OCF_CACHE_ID_MAX,
@@ -1658,6 +1668,8 @@ int script_handle() {
command_args_values.detach,
command_args_values.no_flush
);
case script_cmd_purge_cache:
return purge_cache(command_args_values.cache_id);
}
return FAILURE;