Merge pull request #1329 from robertbaldyga/seq-cutoff-threshold-issue
Fix seq cutoff min threshold calculation
This commit is contained in:
commit
88dff6ead3
@ -23,6 +23,8 @@
|
||||
#include <cas_ioctl_codes.h>
|
||||
#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;
|
||||
|
||||
|
@ -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:
|
||||
|
Loading…
Reference in New Issue
Block a user