All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dmitry Fomichev <Dmitry.Fomichev@wdc.com>
To: Alexey Dobriyan <adobriyan@gmail.com>,
	"axboe@kernel.dk" <axboe@kernel.dk>
Cc: "fio@vger.kernel.org" <fio@vger.kernel.org>,
	Damien Le Moal <Damien.LeMoal@wdc.com>
Subject: RE: [PATCH] zbd: use ->min_zone, ->max_zone in more places
Date: Thu, 13 Aug 2020 22:00:22 +0000	[thread overview]
Message-ID: <MN2PR04MB5951C0F65D56BD17B1FBDA0AE1430@MN2PR04MB5951.namprd04.prod.outlook.com> (raw)
In-Reply-To: <20200813163632.GB26072@localhost.localdomain>


> -----Original Message-----
> From: fio-owner@vger.kernel.org <fio-owner@vger.kernel.org> On Behalf
> Of Alexey Dobriyan
> Sent: Thursday, August 13, 2020 12:37 PM
> To: axboe@kernel.dk
> Cc: fio@vger.kernel.org; Damien Le Moal <Damien.LeMoal@wdc.com>
> Subject: [PATCH] zbd: use ->min_zone, ->max_zone in more places
> 
> Check that ->min_zone is less than ->max_zone.
> This assert found one bug here.
> 
> Use it in more places, now that it was added.
> 
> Signed-off-by: Alexey Dobriyan (SK hynix) <adobriyan@gmail.com>
> ---

Works fine for me. Nice cleanup!

Reviewed-by: Dmitry Fomichev <dmitry.fomichev@wdc.com>

> 
>  zbd.c |   11 +++++------
>  1 file changed, 5 insertions(+), 6 deletions(-)
> 
> --- a/zbd.c
> +++ b/zbd.c
> @@ -319,6 +319,7 @@ static bool zbd_verify_sizes(void)
> 
>  			f->min_zone = zbd_zone_idx(f, f->file_offset);
>  			f->max_zone = zbd_zone_idx(f, f->file_offset + f-
> >io_size);
> +			assert(f->min_zone < f->max_zone);
>  		}
>  	}
> 
> @@ -839,9 +840,8 @@ static uint64_t zbd_process_swd(const struct fio_file
> *f, enum swd_action a)
>  	struct fio_zone_info *zb, *ze, *z;
>  	uint64_t swd = 0;
> 
> -	zb = &f->zbd_info->zone_info[zbd_zone_idx(f, f->file_offset)];
> -	ze = &f->zbd_info->zone_info[zbd_zone_idx(f, f->file_offset +
> -						  f->io_size)];
> +	zb = &f->zbd_info->zone_info[f->min_zone];
> +	ze = &f->zbd_info->zone_info[f->max_zone];
>  	for (z = zb; z < ze; z++) {
>  		pthread_mutex_lock(&z->mutex);
>  		swd += z->wp - z->start;
> @@ -1175,7 +1175,7 @@ zbd_find_zone(struct thread_data *td, struct io_u
> *io_u,
>  	struct fio_file *f = io_u->file;
>  	struct fio_zone_info *z1, *z2;
>  	const struct fio_zone_info *const zf =
> -		&f->zbd_info->zone_info[zbd_zone_idx(f, f->file_offset)];
> +		&f->zbd_info->zone_info[f->min_zone];
> 
>  	/*
>  	 * Skip to the next non-empty zone in case of sequential I/O and to
> @@ -1482,8 +1482,7 @@ enum io_u_action zbd_adjust_block(struct
> thread_data *td, struct io_u *io_u)
>  		if (range < min_bs ||
>  		    ((!td_random(td)) && (io_u->offset + min_bs > zb->wp))) {
>  			pthread_mutex_unlock(&zb->mutex);
> -			zl = &f->zbd_info->zone_info[zbd_zone_idx(f,
> -						f->file_offset + f->io_size)];
> +			zl = &f->zbd_info->zone_info[f->max_zone];
>  			zb = zbd_find_zone(td, io_u, zb, zl);
>  			if (!zb) {
>  				dprint(FD_ZBD,

  reply	other threads:[~2020-08-13 22:00 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-13 16:36 [PATCH] zbd: use ->min_zone, ->max_zone in more places Alexey Dobriyan
2020-08-13 22:00 ` Dmitry Fomichev [this message]
2020-08-13 22:06 ` Jens Axboe

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=MN2PR04MB5951C0F65D56BD17B1FBDA0AE1430@MN2PR04MB5951.namprd04.prod.outlook.com \
    --to=dmitry.fomichev@wdc.com \
    --cc=Damien.LeMoal@wdc.com \
    --cc=adobriyan@gmail.com \
    --cc=axboe@kernel.dk \
    --cc=fio@vger.kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.