@@ -731,8 +731,11 @@ static struct cas_param cas_cache_params[] = {
731731 [cache_param_cleaning_alru_activity_threshold ] = {
732732 .name = "Activity threshold [ms]" ,
733733 },
734- [cache_param_cleaning_alru_max_dirty_ratio ] = {
735- .name = "Maximum dirty ratio [percent]" ,
734+ [cache_param_cleaning_alru_dirty_ratio_threshold ] = {
735+ .name = "Dirty ratio trigger threshold [%]" ,
736+ },
737+ [cache_param_cleaning_alru_dirty_ratio_inertia ] = {
738+ .name = "Dirty ratio trigger inertia [%]" ,
736739 },
737740
738741 /* Cleaning policy ACP params */
@@ -778,8 +781,10 @@ static struct cas_param cas_cache_params[] = {
778781 " <%d-%d> (default: %d)"
779782#define CLEANING_ALRU_ACTIVITY_THRESHOLD_DESC "Cache idle time before flushing thread can start <%d-%d>[ms]" \
780783 " (default: %d ms)"
781- #define CLEANING_ALRU_MAX_DIRTY_RATIO_DESC "Maximum dirty ratio of the cache device" \
782- " <%d-%d> (default: %d)"
784+ #define CLEANING_ALRU_DIRTY_RATIO_THRESHOLD_DESC "Dirty ratio of the cache device at which cleaning will be triggered" \
785+ " <%d-%d>[%] (default: %d%)"
786+ #define CLEANING_ALRU_DIRTY_RATIO_INERTIA_DESC "Inertia for dirty ratio triggered cleaning - the trigger will be disabled" \
787+ " after dirty ratio falls to (trigger - inertia)% <%d-%d>[%] (default: %d%)"
783788
784789#define CLEANING_ACP_WAKE_UP_DESC "Time between ACP cleaning thread iterations <%d-%d>[ms] (default: %d ms)"
785790#define CLEANING_ACP_MAX_BUFFERS_DESC "Number of cache lines flushed in single ACP cleaning thread iteration" \
@@ -840,10 +845,14 @@ static cli_namespace set_param_namespace = {
840845 CLI_OPTION_RANGE_INT | CLI_OPTION_DEFAULT_INT ,
841846 OCF_ALRU_MIN_ACTIVITY_THRESHOLD , OCF_ALRU_MAX_ACTIVITY_THRESHOLD ,
842847 OCF_ALRU_DEFAULT_ACTIVITY_THRESHOLD },
843- {'d' , "max- dirty-ratio" , CLEANING_ALRU_MAX_DIRTY_RATIO_DESC , 1 , "NUMBER" ,
848+ {'d' , "dirty-ratio-threshold " , CLEANING_ALRU_DIRTY_RATIO_THRESHOLD_DESC , 1 , "NUMBER" ,
844849 CLI_OPTION_RANGE_INT | CLI_OPTION_DEFAULT_INT ,
845- OCF_ALRU_MIN_MAX_DIRTY_RATIO , OCF_ALRU_MAX_MAX_DIRTY_RATIO ,
846- OCF_ALRU_DEFAULT_MAX_DIRTY_RATIO },
850+ OCF_ALRU_MIN_DIRTY_RATIO_THRESHOLD , OCF_ALRU_MAX_DIRTY_RATIO_THRESHOLD ,
851+ OCF_ALRU_DEFAULT_DIRTY_RATIO_THRESHOLD },
852+ {0 , "dirty-ratio-inertia" , CLEANING_ALRU_DIRTY_RATIO_INERTIA_DESC , 1 , "NUMBER" ,
853+ CLI_OPTION_RANGE_INT | CLI_OPTION_DEFAULT_INT ,
854+ OCF_ALRU_MIN_DIRTY_RATIO_INERTIA , OCF_ALRU_MAX_DIRTY_RATIO_INERTIA ,
855+ OCF_ALRU_DEFAULT_DIRTY_RATIO_INERTIA },
847856 CACHE_PARAMS_NS_END ()
848857
849858 CACHE_PARAMS_NS_BEGIN ("cleaning-acp" , "Cleaning policy ACP parameters" )
@@ -955,13 +964,21 @@ int set_param_cleaning_alru_handle_option(char *opt, const char **arg)
955964
956965 SET_CACHE_PARAM (cache_param_cleaning_alru_activity_threshold ,
957966 strtoul (arg [0 ], NULL , 10 ));
958- } else if (!strcmp (opt , "max-dirty-ratio" )) {
959- if (validate_str_num (arg [0 ], "max dirty ratio" ,
960- OCF_ALRU_MIN_MAX_DIRTY_RATIO , OCF_ALRU_MAX_MAX_DIRTY_RATIO )) {
967+ } else if (!strcmp (opt , "dirty-ratio-threshold" )) {
968+ if (validate_str_num (arg [0 ], "dirty ratio trigger threshold" ,
969+ OCF_ALRU_MIN_DIRTY_RATIO_THRESHOLD , OCF_ALRU_MAX_DIRTY_RATIO_THRESHOLD )) {
970+ return FAILURE ;
971+ }
972+
973+ SET_CACHE_PARAM (cache_param_cleaning_alru_dirty_ratio_threshold ,
974+ strtoul (arg [0 ], NULL , 10 ));
975+ } else if (!strcmp (opt , "dirty-ratio-inertia" )) {
976+ if (validate_str_num (arg [0 ], "dirty ratio trigger inertia" ,
977+ OCF_ALRU_MIN_DIRTY_RATIO_INERTIA , OCF_ALRU_MAX_DIRTY_RATIO_INERTIA )) {
961978 return FAILURE ;
962979 }
963980
964- SET_CACHE_PARAM (cache_param_cleaning_alru_max_dirty_ratio ,
981+ SET_CACHE_PARAM (cache_param_cleaning_alru_dirty_ratio_inertia ,
965982 strtoul (arg [0 ], NULL , 10 ));
966983 } else {
967984 return FAILURE ;
@@ -1143,7 +1160,8 @@ int get_param_namespace_handle_option(char *namespace, char *opt, const char **a
11431160 SELECT_CACHE_PARAM (cache_param_cleaning_alru_stale_buffer_time );
11441161 SELECT_CACHE_PARAM (cache_param_cleaning_alru_flush_max_buffers );
11451162 SELECT_CACHE_PARAM (cache_param_cleaning_alru_activity_threshold );
1146- SELECT_CACHE_PARAM (cache_param_cleaning_alru_max_dirty_ratio );
1163+ SELECT_CACHE_PARAM (cache_param_cleaning_alru_dirty_ratio_threshold );
1164+ SELECT_CACHE_PARAM (cache_param_cleaning_alru_dirty_ratio_inertia );
11471165 return cache_param_handle_option_generic (opt , arg ,
11481166 get_param_handle_option );
11491167 } else if (!strcmp (namespace , "cleaning-acp" )) {
0 commit comments