Re: [PATCH blktests 1/2] common/rc: Check both max_active_zones and max_open_zones
From: Johannes Thumshirn <hidden>
Date: 2020-12-03 09:51:26
From: Johannes Thumshirn <hidden>
Date: 2020-12-03 09:51:26
On 03/12/2020 09:22, Shin'ichiro Kawasaki wrote:
-_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
Otherwise looks good,
Reviewed-by: Johannes Thumshirn <redacted>