t/zbd: Fix write target zones counting in test case #31
authorShin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Fri, 4 Jun 2021 11:32:52 +0000 (20:32 +0900)
committerJens Axboe <axboe@kernel.dk>
Tue, 8 Jun 2021 21:15:58 +0000 (15:15 -0600)
commit40d0b84220f7c0ff9c3874656db7f0f8cb6a85e6
tree7dbd5a89ec1a434ea7afe48328725cd5e110e6ed
parent351fe91089c3babb06ae421a1abce3632f42b672
t/zbd: Fix write target zones counting in test case #31

The test case #31 in t/zbd/test-zbd-support writes 128KB data to
sequential write required zones as the preparation for the following
random read test. The data write leaves the target zones in open status.
The test case refers the variable 'nz', which has max_open_zones value,
to decide how many zones to write the data. However, the end condition
of the write target zone loop has a bug. The disk end offset is used as
the loop end condition, which does not match the last target zone when
number of sequential write required zones divided by nz has remainder.
This results in write to more zones than nz=max_open_zones limit and the
test case failure. To fix the bug and to simplify the script, avoid the
loop and utilize zonemode strided to achieve the same data write
pattern. Also specify size and io_size using nz to reliably count the
write target zones.

Even with the fix above, still the number of open zones may exceed
max_open_zones since other test cases executed before the test case 31
may leave open zones on the test target device. To avoid this failure,
reset all zones before the data write.

The failures were observed with libzbc I/O engine after the commit
e8267436fd7a ("engines/libzbc: add support for the get_max_open_zones io
op"), which changed the max_open_zones value fio refers.

Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Reviewed-by: Damien Le Moal <damien.lemoal@wdc.com>
Reviewed-by: Niklas Cassel <niklas.cassel@wdc.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
t/zbd/test-zbd-support