77#
88
99curdir=$( dirname $( readlink -f " ${BASH_SOURCE[0]} " ) )
10- rootdir=$( readlink -f $curdir /../../..)
10+ rootdir=$( readlink -f " $curdir /../../.." )
1111source " $rootdir /test/ocf/common.sh"
1212
13- cache_modes=(" wt" " wb" " wa" " wo" " wi" " pt" )
14-
15- promotion_policies=(" always" " nhit" )
16- promotion_nhit_insertion_threshold_range=(2 1000)
17- promotion_nhit_trigger_threshold_range=(0 100)
18-
19- cleaning_policies=(" alru" " acp" " nop" )
20- cleaning_acp_wake_up_time_range=(0 10000)
21- cleaning_acp_flush_max_buffers_range=(1 10000)
22- cleaning_alru_wake_up_time_range=(0 3600)
23- cleaning_alru_flush_max_buffers_range=(1 10000)
24- cleaning_alru_staleness_time_range=(1 3600)
25- cleaning_alru_activity_threshold_range=(0 1000000)
26- cleaning_alru_max_dirty_ratio_range=(0 100)
27-
28- seqcutoff_policies=(" always" " full" " never" )
29- seqcutoff_policy_default=" full"
30- seqcutoff_threshold_range=(1 4194181)
31- seqcutoff_threshold_default=1
32- seqcutoff_promotion_count_range=(1 65535)
33- seqcutoff_promotion_count_default=8
34- seqcutoff_promote_on_threshold_range=(0 1)
35- seqcutoff_promote_on_threshold_default=false
13+ start_caches_with_cache_line_size () {
14+ if [ $# -ne 1 ]; then
15+ echo >&2 " invalid number of arguments"
16+ exit 1
17+ fi
18+
19+ local cache_line_size=$1
20+
21+ for i in {1..3}; do
22+ $rpc_py bdev_ocf_start_cache Ocf_cache$i Cache_dev$i --cache-line-size $cache_line_size --no-load
23+ done
24+ $rpc_py bdev_ocf_get_bdevs | jq -e ' .'
25+ }
3626
3727set_cache_mode () {
3828 if [ $# -ne 1 ]; then
@@ -183,6 +173,18 @@ set_seqcutoff_params_all() {
183173 $rpc_py bdev_ocf_get_bdevs | jq -e ' .'
184174}
185175
176+ __check_cache_line_size () {
177+ if [ $# -ne 1 ]; then
178+ echo >&2 " invalid number of arguments"
179+ exit 1
180+ fi
181+
182+ local cache_line_size=$1
183+
184+ $rpc_py bdev_ocf_get_bdevs | jq -e --argjson cache_line_size $cache_line_size \
185+ ' .caches[].cache_line_size == $cache_line_size * 1024'
186+ }
187+
186188__check_cache_mode () {
187189 if [ $# -ne 1 ]; then
188190 echo >&2 " invalid number of arguments"
@@ -355,33 +357,36 @@ __check_seqcutoff_params_all() {
355357 (.promote_on_threshold == $promote_on_threshold)'
356358}
357359
358- # cache modes:
360+ # cache line sizes and cache modes:
359361
360- for add_cores in false true ; do
361- for create_caches in false true ; do
362- for stop_caches in false true ; do
363- start_spdk
364- start_caches
365- if [ $create_caches = true ]; then
366- create_caches
367- __check_caches_attached
368- if [ $add_cores = true ]; then
369- create_cores
370- add_cores
371- __check_cores_attached
362+ for cache_line_size in " ${cache_line_sizes[@]} " ; do
363+ for add_cores in false true ; do
364+ for create_caches in false true ; do
365+ for stop_caches in false true ; do
366+ start_spdk
367+ start_caches_with_cache_line_size $cache_line_size
368+ if [ $create_caches == true ]; then
369+ create_caches
370+ __check_caches_attached
371+ if [ $add_cores == true ]; then
372+ create_cores
373+ add_cores
374+ __check_cores_attached
375+ fi
376+ else
377+ __check_caches_detached
372378 fi
373- else
374- __check_caches_detached
375- fi
376- for cache_mode in " ${cache_modes[@]} " ; do
377- set_cache_mode $cache_mode
378- __check_cache_mode $cache_mode
379+ __check_cache_line_size $cache_line_size
380+ for cache_mode in " ${cache_modes[@]} " ; do
381+ set_cache_mode $cache_mode
382+ __check_cache_mode $cache_mode
383+ done
384+ if [ $stop_caches == true ]; then
385+ stop_caches
386+ __check_caches_empty
387+ fi
388+ stop_spdk
379389 done
380- if [ $stop_caches = true ]; then
381- stop_caches
382- __check_caches_empty
383- fi
384- stop_spdk
385390 done
386391 done
387392done
@@ -395,21 +400,21 @@ for promotion_policy in "${promotion_policies[@]}"; do
395400 create_caches
396401 start_caches
397402 __check_caches_attached
398- if [ $add_cores = true ]; then
403+ if [ $add_cores == true ]; then
399404 create_cores
400405 add_cores
401406 __check_cores_attached
402407 fi
403- if [ $promotion_policy = always ]; then
408+ if [ $promotion_policy == always ]; then
404409 set_promotion_always_params $promotion_policy
405410 __check_promotion_always_params $promotion_policy
406- elif [ $promotion_policy = nhit ]; then
411+ elif [ $promotion_policy == nhit ]; then
407412 insertion_threshold=$( random_number ${promotion_nhit_insertion_threshold_range[0]} ${promotion_nhit_insertion_threshold_range[1]} )
408413 trigger_threshold=$( random_number ${promotion_nhit_trigger_threshold_range[0]} ${promotion_nhit_trigger_threshold_range[1]} )
409414 set_promotion_nhit_params $promotion_policy $insertion_threshold $trigger_threshold
410415 __check_promotion_nhit_params $promotion_policy $insertion_threshold $trigger_threshold
411416 fi
412- if [ $stop_caches = true ]; then
417+ if [ $stop_caches == true ]; then
413418 stop_caches
414419 __check_caches_empty
415420 fi
@@ -427,29 +432,29 @@ for cleaning_policy in "${cleaning_policies[@]}"; do
427432 create_caches
428433 start_caches
429434 __check_caches_attached
430- if [ $add_cores = true ]; then
435+ if [ $add_cores == true ]; then
431436 create_cores
432437 add_cores
433438 __check_cores_attached
434439 fi
435- if [ $cleaning_policy = alru ]; then
440+ if [ $cleaning_policy == alru ]; then
436441 wake_up_time=$( random_number ${cleaning_alru_wake_up_time_range[0]} ${cleaning_alru_wake_up_time_range[1]} )
437442 flush_max_buffers=$( random_number ${cleaning_alru_flush_max_buffers_range[0]} ${cleaning_alru_flush_max_buffers_range[1]} )
438443 staleness_time=$( random_number ${cleaning_alru_staleness_time_range[0]} ${cleaning_alru_staleness_time_range[1]} )
439444 activity_threshold=$( random_number ${cleaning_alru_activity_threshold_range[0]} ${cleaning_alru_activity_threshold_range[1]} )
440445 max_dirty_ratio=$( random_number ${cleaning_alru_max_dirty_ratio_range[0]} ${cleaning_alru_max_dirty_ratio_range[1]} )
441446 set_cleaning_alru_params $cleaning_policy $wake_up_time $flush_max_buffers $staleness_time $activity_threshold $max_dirty_ratio
442447 __check_cleaning_alru_params $cleaning_policy $wake_up_time $flush_max_buffers $staleness_time $activity_threshold $max_dirty_ratio
443- elif [ $cleaning_policy = acp ]; then
448+ elif [ $cleaning_policy == acp ]; then
444449 wake_up_time=$( random_number ${cleaning_acp_wake_up_time_range[0]} ${cleaning_acp_wake_up_time_range[1]} )
445450 flush_max_buffers=$( random_number ${cleaning_acp_flush_max_buffers_range[0]} ${cleaning_acp_flush_max_buffers_range[1]} )
446451 set_cleaning_acp_params $cleaning_policy $wake_up_time $flush_max_buffers
447452 __check_cleaning_acp_params $cleaning_policy $wake_up_time $flush_max_buffers
448- elif [ $cleaning_policy = nop ]; then
453+ elif [ $cleaning_policy == nop ]; then
449454 set_cleaning_nop_params $cleaning_policy
450455 __check_cleaning_nop_params $cleaning_policy
451456 fi
452- if [ $stop_caches = true ]; then
457+ if [ $stop_caches == true ]; then
453458 stop_caches
454459 __check_caches_empty
455460 fi
@@ -473,14 +478,14 @@ for device in core cache; do
473478 threshold=$( random_number ${seqcutoff_threshold_range[0]} ${seqcutoff_threshold_range[1]} )
474479 promotion_count=$( random_number ${seqcutoff_promotion_count_range[0]} ${seqcutoff_promotion_count_range[1]} )
475480 promote_on_threshold=$( random_number ${seqcutoff_promote_on_threshold_range[0]} ${seqcutoff_promote_on_threshold_range[1]} )
476- if [ $device = core ]; then
481+ if [ $device == core ]; then
477482 set_seqcutoff_params $seqcutoff_policy $threshold $promotion_count $promote_on_threshold
478483 __check_seqcutoff_params $seqcutoff_policy $threshold $promotion_count $promote_on_threshold
479- elif [ $device = cache ]; then
484+ elif [ $device == cache ]; then
480485 set_seqcutoff_params_all $seqcutoff_policy $threshold $promotion_count $promote_on_threshold
481486 __check_seqcutoff_params_all $seqcutoff_policy $threshold $promotion_count $promote_on_threshold
482487 fi
483- if [ $stop_caches = true ]; then
488+ if [ $stop_caches == true ]; then
484489 stop_caches
485490 __check_caches_empty
486491 fi
0 commit comments