Re: [PATCH blktests 1/2] common/rc: Check both max_active_zones and max_open_zones
From: Shinichiro Kawasaki <hidden>
Date: 2020-12-04 01:46:38
From: Shinichiro Kawasaki <hidden>
Date: 2020-12-04 01:46:38
On Dec 03, 2020 / 09:50, Johannes Thumshirn wrote:
On 03/12/2020 09:22, Shin'ichiro Kawasaki wrote:quoted
-_test_dev_max_active_zones() { +# Return max open zones or max active zones of the test target device. +# If the device has both, return smaller value. +_test_dev_max_open_active_zones() { + local -i ret=0 + local -i maz=0 + + if [[ -r "${TEST_DEV_SYSFS}/queue/max_open_zones" ]]; then + ret=$(_test_dev_queue_get max_open_zones) + fi + if [[ -r "${TEST_DEV_SYSFS}/queue/max_active_zones" ]]; then - _test_dev_queue_get max_active_zones - else - echo 0 + maz=$(_test_dev_queue_get max_active_zones) fi + + if ((!ret)) || ((maz && maz < ret)); then + ret="${maz}" + fi + + echo "${ret}" }Maybe change $ret to $moz and then if ((!moz)) || ((maz && maz < moz)); then echo ${maz} else echo ${moz} fi
Thanks. I agree that your code is easier to understand. Will reflect this comment and send out v2.
Otherwise looks good, Reviewed-by: Johannes Thumshirn <redacted>
-- Best Regards, Shin'ichiro Kawasaki