Re: [PATCH 1/4] zbd: move zone finish operation to zbd_convert_to_write_zone()

Damien Le Moal <[email protected]>
Newsgroups org.kernel.vger.fio
Organization Western Digital Research
Message-ID <[email protected]>
On 4/11/25 8:12 PM, Shin'ichiro Kawasaki wrote:
> Currently, when a write target zone has fewer remainder sectors than
> the block size, fio finishes the zone to make the zone inactive (not
> open), so that another zone can be open and used as a write target zone.
> This zone finish operation is implemented in zbd_adjust_block().
> However, this placement is less ideal because zbd_adjust_block() manages
> not just write requests but also read and trim requests.
> 
> Since the zone finish operation is exclusively necessary for write
> requests, implement it into zbd_convert_to_write_zone(). While at it,
> improve the function comment.
> 
> Signed-off-by: Shin'ichiro Kawasaki <[email protected]>

A few nits below. But otherwise, nice cleanup !

Reviewed-by: Damien Le Moal <[email protected]>

> ---
>  zbd.c | 84 ++++++++++++++++++++++++++++++++---------------------------
>  1 file changed, 45 insertions(+), 39 deletions(-)
> 
> diff --git a/zbd.c b/zbd.c
> index ee095b1d..5e0f7f4e 100644
> --- a/zbd.c
> +++ b/zbd.c
> @@ -1396,16 +1396,23 @@ static bool any_io_in_flight(void)
>  	return false;
>  }
>  
> -/*
> +/**
> + * zbd_convert_to_write_zone - Convert the write request to writable zone

Maybe: Convert the target zone of an io_u to a writable zone
?

> + * @td: The fio thread data
> + * @io_u: The I/O unit write request to convert

We do not convert the io_u, but rather, the zones it targets, no ?

> + * @zb: The zone selected at the beginning of the function call. The caller must
> + *      hold zb->mutex.
> + *
>   * Modify the offset of an I/O unit that does not refer to a zone such that
> - * in write target zones array. Add a zone to or remove a zone from the lsit if
> + * in write target zones array. Add a zone to or remove a zone from the list if

Nit: s/list/array

>   * necessary. The write target zone is searched across sequential zones.
>   * This algorithm can only work correctly if all write pointers are
> - * a multiple of the fio block size. The caller must neither hold z->mutex
> - * nor f->zbd_info->mutex. Returns with z->mutex held upon success.
> + * a multiple of the fio block size. The caller must not hold
> + * f->zbd_info->mutex. Returns with z->mutex held upon success.
>   */


-- 
Damien Le Moal
Western Digital Research
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.