fio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dmitry Fomichev <Dmitry.Fomichev@wdc.com>
To: "fio@vger.kernel.org" <fio@vger.kernel.org>,
	"axboe@kernel.dk" <axboe@kernel.dk>,
	Shinichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Cc: Damien Le Moal <Damien.LeMoal@wdc.com>,
	Niklas Cassel <Niklas.Cassel@wdc.com>
Subject: Re: [PATCH 1/4] zbd: Add min_bytes argument to zbd_find_zone()
Date: Tue, 3 Aug 2021 19:35:44 +0000	[thread overview]
Message-ID: <9ca160b4b2af9ed09ca09ee82f900b8ed0db56c6.camel@wdc.com> (raw)
In-Reply-To: <20210728104752.923770-2-shinichiro.kawasaki@wdc.com>

On Wed, 2021-07-28 at 19:47 +0900, Shin'ichiro Kawasaki wrote:
> The helper function zbd_find_zone() finds a zone with at least
> min_bs[DDIR_READ] bytes readable before the zone write pointer. This
> patch generalizes this function to allow finding a non-empty zone. To
> do
> so, add the min_bytes argument to specify the minimum readable data of
> a
> zone to filter the search. Specifying 1 to min_bytes then become
> equivalent to finding a non-empty zone.
> 
> This change will allow to reuse this function to find a suitable zone
> for trim I/O.
> 
> Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>

With a nit below,
Reviewed-by: Dmitry Fomichev <dmitry.fomichev@wdc.com>

> diff --git a/zbd.c b/zbd.c
> index 04c68dea..f10b3267 100644
> --- a/zbd.c
> +++ b/zbd.c
> @@ -1413,18 +1413,16 @@ static struct fio_zone_info
> *zbd_replay_write_order(struct thread_data *td,
>  }
>  
>  /*
> - * Find another zone for which @io_u fits in the readable data in the
> zone.
> - * Search in zones @zb + 1 .. @zl. For random workload, also search in
> zones
> - * @zb - 1 .. @zf.
> + * Find another zone which has @min_bytes readable data. Search in
> zones
> + * @zb + 1 .. @zl. For random workload, also search in zones @zb - 1
> .. @zf.
>   *
>   * Either returns NULL or returns a zone pointer. When the zone has
> write
>   * pointer, hold the mutex for the zone.
>   */
>  static struct fio_zone_info *
> -zbd_find_zone(struct thread_data *td, struct io_u *io_u,
> +zbd_find_zone(struct thread_data *td, struct io_u *io_u, uint32_t
> min_bytes,
>               struct fio_zone_info *zb, struct fio_zone_info *zl)
>  {
> -       const uint32_t min_bs = td->o.min_bs[io_u->ddir];
>         struct fio_file *f = io_u->file;
>         struct fio_zone_info *z1, *z2;
>         const struct fio_zone_info *const zf = get_zone(f, f-
> >min_zone);
> @@ -1437,7 +1435,7 @@ zbd_find_zone(struct thread_data *td, struct io_u
> *io_u,
>                 if (z1 < zl && z1->cond != ZBD_ZONE_COND_OFFLINE) {
>                         if (z1->has_wp)
>                                 zone_lock(td, f, z1);
> -                       if (z1->start + min_bs <= z1->wp)
> +                       if (z1->start + min_bytes <= z1->wp)
>                                 return z1;
>                         if (z1->has_wp)
>                                 zone_unlock(z1);
> @@ -1448,14 +1446,14 @@ zbd_find_zone(struct thread_data *td, struct
> io_u *io_u,
>                     z2->cond != ZBD_ZONE_COND_OFFLINE) {
>                         if (z2->has_wp)
>                                 zone_lock(td, f, z2);
> -                       if (z2->start + min_bs <= z2->wp)
> +                       if (z2->start + min_bytes <= z2->wp)
>                                 return z2;
>                         if (z2->has_wp)
>                                 zone_unlock(z2);
>                 }
>         }
> -       dprint(FD_ZBD, "%s: adjusting random read offset failed\n",
> -              f->file_name);
> +       dprint(FD_ZBD, "%s: no zone has %d bytes readable data\n",
> +              f->file_name, min_bytes);

This message is more clear than the old version, but you could say
"bytes of readable data" here instead of "bytes readable data". The
same wording change can be done in the patch annotation.

>         return NULL;
>  }
>  
> @@ -1784,7 +1782,7 @@ enum io_u_action zbd_adjust_block(struct
> thread_data *td, struct io_u *io_u)
>                     ((!td_random(td)) && (io_u->offset + min_bs > zb-
> >wp))) {
>                         zone_unlock(zb);
>                         zl = get_zone(f, f->max_zone);
> -                       zb = zbd_find_zone(td, io_u, zb, zl);
> +                       zb = zbd_find_zone(td, io_u, min_bs, zb, zl);
>                         if (!zb) {
>                                 dprint(FD_ZBD,
>                                        "%s: zbd_find_zone(%lld, %llu)
> failed\n",


  reply	other threads:[~2021-08-03 19:35 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-28 10:47 [PATCH 0/4] zbd: Support zone reset by trim Shin'ichiro Kawasaki
2021-07-28 10:47 ` [PATCH 1/4] zbd: Add min_bytes argument to zbd_find_zone() Shin'ichiro Kawasaki
2021-08-03 19:35   ` Dmitry Fomichev [this message]
2021-07-28 10:47 ` [PATCH 2/4] zbd: Support zone reset by trim Shin'ichiro Kawasaki
2021-08-03 19:36   ` Dmitry Fomichev
2021-08-04  6:32     ` Shinichiro Kawasaki
2021-08-04 19:23       ` Dmitry Fomichev
2021-07-28 10:47 ` [PATCH 3/4] engines/libzbc: Enable trim for libzbc I/O engine Shin'ichiro Kawasaki
2021-08-03 19:36   ` Dmitry Fomichev
2021-08-04  6:39     ` Shinichiro Kawasaki
2021-08-04 19:29       ` Dmitry Fomichev
2021-08-05  3:32         ` Shinichiro Kawasaki
2021-07-28 10:47 ` [PATCH 4/4] t/zbd: Add test #58 to test zone reset by trim workload Shin'ichiro Kawasaki
2021-08-03 19:36   ` Dmitry Fomichev
  -- strict thread matches above, loose matches on Subject: below --
2021-07-06  0:59 [PATCH 0/4] zbd: Support zone reset by trim Shin'ichiro Kawasaki
2021-07-06  0:59 ` [PATCH 1/4] zbd: Add min_bytes argument to zbd_find_zone() Shin'ichiro Kawasaki

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=9ca160b4b2af9ed09ca09ee82f900b8ed0db56c6.camel@wdc.com \
    --to=dmitry.fomichev@wdc.com \
    --cc=Damien.LeMoal@wdc.com \
    --cc=Niklas.Cassel@wdc.com \
    --cc=axboe@kernel.dk \
    --cc=fio@vger.kernel.org \
    --cc=shinichiro.kawasaki@wdc.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).