t/zbd: fix minimum write size to sequential write required zones
authorShin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Mon, 6 Mar 2023 05:58:40 +0000 (14:58 +0900)
committerVincent Fu <vincent.fu@samsung.com>
Tue, 7 Mar 2023 17:45:41 +0000 (12:45 -0500)
commit557cfc51068921766e8cd6b242feb4c929cb45ea
treecbc151fb16f4d1c7bce5a8a8af4854c1dd2a8060
parent79201772c8091386077bf3bdc31f53211a0e020d
t/zbd: fix minimum write size to sequential write required zones

ZBC and ZAC require that writes to sequential write required zones shall
be aligned to physical block size. However, the t/zbd/test-zbd-support
script uses logical block size as the minimum write size. When SMR
drives have the physical block size larger than the logical block size,
writes with the logical block size causes unaligned write command error.

To fix it, use correct value as the minimum write size. As for zoned
block devices, introduce a helper function min_seq_write_size(), which
checks sysfs attributes and returns the correct size. Refer the
attribute zone_write_granularity when it is available, which provides the
minimum write size regardless of the device type. If the attribute is
not available, refer the attribute physical_block_size for SMR devices,
and the logical_block_size attribute for other devices. As for SG node
device, refer physical block size that zbc_info command reports.

Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Signed-off-by: Vincent Fu <vincent.fu@samsung.com>
t/zbd/functions
t/zbd/test-zbd-support