zbd: avoid assertions during sequential read I/O
authorDmitry Fomichev <dmitry.fomichev@wdc.com>
Tue, 6 Feb 2024 10:57:51 +0000 (19:57 +0900)
committerVincent Fu <vincent.fu@samsung.com>
Wed, 7 Feb 2024 13:43:13 +0000 (08:43 -0500)
commit3f96645f7a0b26f018fc7386c4f9116526d24e0a
treefbd73005c058e4581e8986aeb8cf6fa4149590de
parent625b155dcd3d56595ced60806e091126446c1e08
zbd: avoid assertions during sequential read I/O

The following assert has been observed to be triggered
if the I/O offset + I/O size exceeds the device capacity in a
sequential read workload -

“zbd.c:110: zone_lock: Assertion `f->min_zone <= nz && nz < f->max_zone' failed.”

The code in zbd_zone_align_file_sizes() rounds down the I/O size to
avoid these situations, but it is bypassed if
td->o.td_ddir == TD_DDIR_READ.

Avoid this issue by modifying zbd_zone_align_file_sizes() to round down
the I/O size for read I/Os and leave the I/O offset untouched.

Fixes: bfbdd35b3e8f ("Add support for zoned block devices")
Signed-off-by: Dmitry Fomichev <dmitry.fomichev@wdc.com>
Reviewed-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Tested-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Link: https://lore.kernel.org/r/20240206105755.214891-2-dmitry.fomichev@wdc.com
Signed-off-by: Vincent Fu <vincent.fu@samsung.com>
zbd.c