tests: Update sequential cutoff tests

Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
This commit is contained in:
Robert Baldyga 2021-02-15 20:46:15 +01:00
parent 3ee253cc4e
commit 9352c881ab
3 changed files with 7 additions and 3 deletions

View File

@ -1021,7 +1021,7 @@ int ocf_mngt_core_get_seq_cutoff_policy(ocf_core_t core,
* use function ocf_mngt_cache_save(). * use function ocf_mngt_cache_save().
* *
* @param[in] core Core handle * @param[in] core Core handle
* @param[in] thresh promotion request count * @param[in] count promotion request count
* *
* @retval 0 Sequential cutoff promotion requets count has been set successfully * @retval 0 Sequential cutoff promotion requets count has been set successfully
* @retval Non-zero Error occured and request count hasn't been updated * @retval Non-zero Error occured and request count hasn't been updated

View File

@ -45,6 +45,7 @@ class CoreConfig(Structure):
("_volume_type", c_uint8), ("_volume_type", c_uint8),
("_try_add", c_bool), ("_try_add", c_bool),
("_seq_cutoff_threshold", c_uint32), ("_seq_cutoff_threshold", c_uint32),
("_seq_cutoff_promotion_count", c_uint32),
("_user_metadata", UserMetadata), ("_user_metadata", UserMetadata),
] ]
@ -52,6 +53,7 @@ class CoreConfig(Structure):
class Core: class Core:
DEFAULT_ID = 4096 DEFAULT_ID = 4096
DEFAULT_SEQ_CUTOFF_THRESHOLD = 1024 * 1024 DEFAULT_SEQ_CUTOFF_THRESHOLD = 1024 * 1024
DEFAULT_SEQ_CUTOFF_PROMOTION_COUNT = 8
def __init__( def __init__(
self, self,
@ -59,6 +61,7 @@ class Core:
try_add: bool, try_add: bool,
name: str = "core", name: str = "core",
seq_cutoff_threshold: int = DEFAULT_SEQ_CUTOFF_THRESHOLD, seq_cutoff_threshold: int = DEFAULT_SEQ_CUTOFF_THRESHOLD,
seq_cutoff_promotion_count: int = DEFAULT_SEQ_CUTOFF_PROMOTION_COUNT,
): ):
self.cache = None self.cache = None
self.device = device self.device = device
@ -76,6 +79,7 @@ class Core:
_volume_type=self.device.type_id, _volume_type=self.device.type_id,
_try_add=try_add, _try_add=try_add,
_seq_cutoff_threshold=seq_cutoff_threshold, _seq_cutoff_threshold=seq_cutoff_threshold,
_seq_cutoff_promotion_count=seq_cutoff_promotion_count,
_user_metadata=UserMetadata(_data=None, _size=0), _user_metadata=UserMetadata(_data=None, _size=0),
) )

View File

@ -71,7 +71,7 @@ def test_seq_cutoff_max_streams(pyocf_ctx):
handled by cache. It should no longer be tracked by OCF, because of request in step 3. which handled by cache. It should no longer be tracked by OCF, because of request in step 3. which
overflowed the OCF handling structure) overflowed the OCF handling structure)
""" """
MAX_STREAMS = 256 MAX_STREAMS = 128
TEST_STREAMS = MAX_STREAMS + 1 # Number of streams used by test - one more than OCF can track TEST_STREAMS = MAX_STREAMS + 1 # Number of streams used by test - one more than OCF can track
core_size = Size.from_MiB(200) core_size = Size.from_MiB(200)
threshold = Size.from_KiB(4) threshold = Size.from_KiB(4)
@ -91,7 +91,7 @@ def test_seq_cutoff_max_streams(pyocf_ctx):
streams.remove(non_active_stream) streams.remove(non_active_stream)
cache = Cache.start_on_device(Volume(Size.from_MiB(200)), cache_mode=CacheMode.WT) cache = Cache.start_on_device(Volume(Size.from_MiB(200)), cache_mode=CacheMode.WT)
core = Core.using_device(Volume(core_size)) core = Core.using_device(Volume(core_size), seq_cutoff_promotion_count=1)
cache.add_core(core) cache.add_core(core)