Re: [PATCH 2/4] zbd: factor out zbd_pick_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:
> To prepare for the following fix, factor out a part of
> zbd_convert_to_write_zone() to the new function zbd_pick_write_zone().
> This function chooses a zone from the current write target zones
> randomly.

Maybe:

This function randomly chooses a zone in the array of write zones.

> 
> Signed-off-by: Shin'ichiro Kawasaki <[email protected]>
> ---
>  zbd.c | 81 ++++++++++++++++++++++++++++++++---------------------------
>  1 file changed, 44 insertions(+), 37 deletions(-)
> 
> diff --git a/zbd.c b/zbd.c
> index 5e0f7f4e..23c18bd3 100644
> --- a/zbd.c
> +++ b/zbd.c
> @@ -1386,6 +1386,43 @@ static uint32_t pick_random_zone_idx(const struct fio_file *f,
>  		f->zbd_info->num_write_zones / f->io_size;
>  }
>  
> +/*
> + * Choose a zone from the current write target zones randomly, which is in the

Randomly choose a zone in the array of write zones and in the range for the file f.

> + * range of the given f. If such a zone is found, set its index in
> + * f->zbd_info->zone_info[], and return true. Otherwise, return false.

I am confused by this description... This function is not setting anything in
f->zbd_info->zone_info[]... Did you perhaps mean:

If such a zone is found, return its index in f->zbd_info->zone_info[] using
@zone_idx and return true. Otherwise, return false.

?

Other than this, the code looks good to me. So with the descriptions fixed,
feel free to add:

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

-- 
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.