Re: [PATCH v2 1/8] zbd: fix zone selection of random writes

Damien Le Moal
2026-02-27T04:48:31Z

On 2/16/26 16:59, Shin'ichiro Kawasaki wrote:
> In zonemode=zbd, random write workloads targeting zoned block devices
> with max write zones limits such as max_open_zones can not do write
> operations to randomly chosen offset because of the zoned block device
> constraint of writing at write pointers. To adjust the offsets to valid
> positions, fio calls the function zbd_convert_to_write_zone(). This
> function checks the current write target zones as the next offset
> candidates but may fail depending on the conditions of those zones.
> In such cases, the function waits for zone condition changes before
> retrying.
>
> However, the retry logic begins with the zone where the previous attempt
> ended, and selects the zones that were previously write target.
> Consequently, the same zones are repeatedly chosen for writing,
> resulting in writes concentrating on certain zones despite the workload
> specifying random write.
>
> To ensure proper zone selection for random writes, modify
> zbd_convert_to_write_zone() to retry the zone selection based on the
> original offset provided to the function. The local variable 'zb' keeps
> the reference to the zone corresponding to the original offset. Use 'zb'
> at the retry attempt start.
>
> Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>

Looks good to me.

Reviewed-by: Damien Le Moal <dlemoal@kernel.org>

--
Damien Le Moal
Western Digital Research