Re: [PATCH 2/4] zbd: factor out zbd_pick_write_zone()
Shinichiro Kawasaki <[email protected]>
| Newsgroups | org.kernel.vger.fio |
|---|---|
| Message-ID | <qbpvaep67bq4dgc3oxuqsqbqodws3s3ejj6njnp47hppqe5fdr@upstgrkyywyu> |
On Apr 14, 2025 / 09:35, Damien Le Moal wrote: > 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. > > ? Yes, that is what I meant. Will reflect to v2.