From: Niklas Cassel <Niklas.Cassel@wdc.com>
To: Shinichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Cc: "fio@vger.kernel.org" <fio@vger.kernel.org>,
Jens Axboe <axboe@kernel.dk>, Vincent Fu <vincentfu@gmail.com>,
Damien Le Moal <damien.lemoal@opensource.wdc.com>,
Dmitry Fomichev <Dmitry.Fomichev@wdc.com>
Subject: Re: [PATCH v2 5/8] zbd: account valid data bytes only for zone_reset_threshold option
Date: Tue, 7 Feb 2023 14:06:17 +0000 [thread overview]
Message-ID: <Y+Ja2HEYdHIsC230@x1-carbon> (raw)
In-Reply-To: <20230207063739.1661191-6-shinichiro.kawasaki@wdc.com>
On Tue, Feb 07, 2023 at 03:37:36PM +0900, Shin'ichiro Kawasaki wrote:
> The valid data bytes accounting is used only for zone_reset_threshold
> option. Avoid the accounting when the option is not specified.
>
> Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
> ---
> zbd.c | 23 +++++++++++++++++------
> 1 file changed, 17 insertions(+), 6 deletions(-)
>
> diff --git a/zbd.c b/zbd.c
> index 455dad53..6783acf9 100644
> --- a/zbd.c
> +++ b/zbd.c
> @@ -147,6 +147,11 @@ zbd_offset_to_zone(const struct fio_file *f, uint64_t offset)
> return zbd_get_zone(f, zbd_offset_to_zone_idx(f, offset));
> }
>
> +static bool accounting_vdb(struct thread_data *td, const struct fio_file *f)
> +{
> + return td->o.zrt.u.f && td_write(td);
> +}
> +
> /**
> * zbd_get_zoned_model - Get a device zoned model
> * @td: FIO thread data
> @@ -285,9 +290,11 @@ static int zbd_reset_zone(struct thread_data *td, struct fio_file *f,
> break;
> }
>
> - pthread_mutex_lock(&f->zbd_info->mutex);
> - f->zbd_info->wp_valid_data_bytes -= data_in_zone;
> - pthread_mutex_unlock(&f->zbd_info->mutex);
> + if (accounting_vdb(td, f)) {
> + pthread_mutex_lock(&f->zbd_info->mutex);
> + f->zbd_info->wp_valid_data_bytes -= data_in_zone;
> + pthread_mutex_unlock(&f->zbd_info->mutex);
> + }
>
> z->wp = z->start;
>
> @@ -1195,6 +1202,9 @@ static uint64_t zbd_set_vdb(struct thread_data *td, const struct fio_file *f)
> struct fio_zone_info *zb, *ze, *z;
> uint64_t wp_vdb = 0;
>
> + if (!accounting_vdb(td, f))
> + return 0;
> +
> zb = zbd_get_zone(f, f->min_zone);
> ze = zbd_get_zone(f, f->max_zone);
> for (z = zb; z < ze; z++) {
> @@ -1605,10 +1615,11 @@ static void zbd_queue_io(struct thread_data *td, struct io_u *io_u, int q,
> * z->wp > zone_end means that one or more I/O errors
> * have occurred.
> */
> - pthread_mutex_lock(&zbd_info->mutex);
> - if (z->wp <= zone_end)
> + if (accounting_vdb(td, f) && z->wp <= zone_end) {
> + pthread_mutex_lock(&zbd_info->mutex);
> zbd_info->wp_valid_data_bytes += zone_end - z->wp;
> - pthread_mutex_unlock(&zbd_info->mutex);
> + pthread_mutex_unlock(&zbd_info->mutex);
> + }
> z->wp = zone_end;
> break;
> default:
> --
> 2.38.1
>
Reviewed-by: Niklas Cassel <niklas.cassel@wdc.com>
next prev parent reply other threads:[~2023-02-07 14:06 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-02-07 6:37 [PATCH v2 0/8] zbd: fix 'sectors with data' and zone_reset_threshold accounting issues Shin'ichiro Kawasaki
2023-02-07 6:37 ` [PATCH v2 1/8] zbd: refer file->last_start[] instead of sectors with data accounting Shin'ichiro Kawasaki
2023-02-07 14:05 ` Niklas Cassel
2023-02-07 6:37 ` [PATCH v2 2/8] zbd: remove CHECK_SWD feature Shin'ichiro Kawasaki
2023-02-07 14:05 ` Niklas Cassel
2023-02-07 6:37 ` [PATCH v2 3/8] zbd: rename the accounting 'sectors with data' to 'valid data bytes' Shin'ichiro Kawasaki
2023-02-07 14:06 ` Niklas Cassel
2023-02-07 6:37 ` [PATCH v2 4/8] doc: fix unit of zone_reset_threshold and relation to other option Shin'ichiro Kawasaki
2023-02-07 14:06 ` Niklas Cassel
2023-02-07 6:37 ` [PATCH v2 5/8] zbd: account valid data bytes only for zone_reset_threshold option Shin'ichiro Kawasaki
2023-02-07 14:06 ` Niklas Cassel [this message]
2023-02-07 6:37 ` [PATCH v2 6/8] zbd: check write ranges " Shin'ichiro Kawasaki
2023-02-07 14:06 ` Niklas Cassel
2023-02-08 4:59 ` Shinichiro Kawasaki
2023-02-07 6:37 ` [PATCH v2 7/8] zbd: initialize valid data bytes accounting at file set up Shin'ichiro Kawasaki
2023-02-07 14:06 ` Niklas Cassel
2023-02-08 5:03 ` Shinichiro Kawasaki
2023-02-08 8:30 ` Niklas Cassel
2023-02-07 6:37 ` [PATCH v2 8/8] t/zbd: add test cases for zone_reset_threshold option Shin'ichiro Kawasaki
2023-02-07 14:06 ` Niklas Cassel
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=Y+Ja2HEYdHIsC230@x1-carbon \
--to=niklas.cassel@wdc.com \
--cc=Dmitry.Fomichev@wdc.com \
--cc=axboe@kernel.dk \
--cc=damien.lemoal@opensource.wdc.com \
--cc=fio@vger.kernel.org \
--cc=shinichiro.kawasaki@wdc.com \
--cc=vincentfu@gmail.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).