diff --git a/casadm/cas_main.c b/casadm/cas_main.c index 99d3773..b1410a5 100644 --- a/casadm/cas_main.c +++ b/casadm/cas_main.c @@ -23,6 +23,8 @@ #include #include "statistics_view.h" +#define DIV_ROUND_UP(n, d) (((n) + (d) - 1) / (d)) + #define HELP_HEADER OCF_PREFIX_LONG #define WRONG_DEVICE_ERROR "Specified caching device '%s' is not supported.\n" @@ -826,7 +828,7 @@ 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", - OCF_SEQ_CUTOFF_MIN_THRESHOLD / KiB, + DIV_ROUND_UP(OCF_SEQ_CUTOFF_MIN_THRESHOLD, KiB), OCF_SEQ_CUTOFF_MAX_THRESHOLD / KiB) == FAILURE) return FAILURE; diff --git a/test/functional/tests/cli/test_seq_cutoff_settings.py b/test/functional/tests/cli/test_seq_cutoff_settings.py index 92d9f6b..f751673 100644 --- a/test/functional/tests/cli/test_seq_cutoff_settings.py +++ b/test/functional/tests/cli/test_seq_cutoff_settings.py @@ -1,5 +1,5 @@ # -# Copyright(c) 2019-2021 Intel Corporation +# Copyright(c) 2019-2022 Intel Corporation # SPDX-License-Identifier: BSD-3-Clause # @@ -175,7 +175,7 @@ def test_seq_cutoff_set_invalid_threshold(threshold): f"{_threshold}"): command = set_param_cutoff_cmd( cache_id=str(cache.cache_id), core_id=str(cores[0].core_id), - threshold=str(int(_threshold.get_value()))) + threshold=str(int(_threshold.get_value(Unit.KiloByte)))) output = TestRun.executor.run_expect_fail(command) if "Invalid sequential cutoff threshold, must be in the range 1-4194181"\ not in output.stderr: @@ -185,7 +185,7 @@ def test_seq_cutoff_set_invalid_threshold(threshold): f"to value passed as a float"): command = set_param_cutoff_cmd( cache_id=str(cache.cache_id), core_id=str(cores[0].core_id), - threshold=str(_threshold.get_value())) + threshold=str(_threshold.get_value(Unit.KiloByte))) output = TestRun.executor.run_expect_fail(command) if "Invalid sequential cutoff threshold, must be a correct unsigned decimal integer"\ not in output.stderr: