All of lore.kernel.org
 help / color / mirror / Atom feed
From: Damien Le Moal <damien.lemoal@opensource.wdc.com>
To: fio@vger.kernel.org, Jens Axboe <axboe@kernel.dk>
Cc: Niklas Cassel <niklas.cassel@wdc.com>,
	Shinichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Subject: [PATCH v2 08/12] zbd: simplify zbd_open_zone()
Date: Tue, 14 Dec 2021 10:24:09 +0900	[thread overview]
Message-ID: <20211214012413.464798-9-damien.lemoal@opensource.wdc.com> (raw)
In-Reply-To: <20211214012413.464798-1-damien.lemoal@opensource.wdc.com>

Similarly to zbd_close_zone(), directly pass a pointer to a zone
information structure to zbd_open_zone() instead of a zone number.

No functional changes.

Signed-off-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Reviewed-by: Niklas Cassel <niklas.cassel@wdc.com>
---
 zbd.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/zbd.c b/zbd.c
index 26387335..b917fa42 100644
--- a/zbd.c
+++ b/zbd.c
@@ -400,11 +400,11 @@ static int zbd_get_max_open_zones(struct thread_data *td, struct fio_file *f,
  * to be exceeded.
  */
 static bool zbd_open_zone(struct thread_data *td, const struct fio_file *f,
-			  uint32_t zone_idx)
+			  struct fio_zone_info *z)
 {
 	const uint64_t min_bs = td->o.min_bs[DDIR_WRITE];
 	struct zoned_block_device_info *zbdi = f->zbd_info;
-	struct fio_zone_info *z = get_zone(f, zone_idx);
+	uint32_t zone_idx = zbd_zone_nr(f, z);
 	bool res = true;
 
 	if (z->cond == ZBD_ZONE_COND_OFFLINE)
@@ -446,7 +446,7 @@ static bool zbd_open_zone(struct thread_data *td, const struct fio_file *f,
 	if (zbdi->num_open_zones >= zbdi->max_open_zones)
 		goto out;
 
-	dprint(FD_ZBD, "%s: opening zone %d\n",
+	dprint(FD_ZBD, "%s: opening zone %u\n",
 	       f->file_name, zone_idx);
 
 	zbdi->open_zones[zbdi->num_open_zones++] = zone_idx;
@@ -1087,7 +1087,7 @@ int zbd_setup_files(struct thread_data *td)
 			if (z->cond != ZBD_ZONE_COND_IMP_OPEN &&
 			    z->cond != ZBD_ZONE_COND_EXP_OPEN)
 				continue;
-			if (zbd_open_zone(td, f, zi))
+			if (zbd_open_zone(td, f, z))
 				continue;
 			/*
 			 * If the number of open zones exceeds specified limits,
@@ -1409,7 +1409,7 @@ retry:
 		zone_lock(td, f, z);
 		if (z->open)
 			continue;
-		if (zbd_open_zone(td, f, zone_idx))
+		if (zbd_open_zone(td, f, z))
 			goto out;
 	}
 
@@ -1478,7 +1478,7 @@ static struct fio_zone_info *zbd_replay_write_order(struct thread_data *td,
 	const struct fio_file *f = io_u->file;
 	const uint64_t min_bs = td->o.min_bs[DDIR_WRITE];
 
-	if (!zbd_open_zone(td, f, zbd_zone_nr(f, z))) {
+	if (!zbd_open_zone(td, f, z)) {
 		zone_unlock(z);
 		z = zbd_convert_to_open_zone(td, io_u);
 		assert(z);
@@ -1947,7 +1947,7 @@ enum io_u_action zbd_adjust_block(struct thread_data *td, struct io_u *io_u)
 			goto eof;
 		}
 
-		if (!zbd_open_zone(td, f, zone_idx_b)) {
+		if (!zbd_open_zone(td, f, zb)) {
 			zone_unlock(zb);
 			zb = zbd_convert_to_open_zone(td, io_u);
 			if (!zb) {
-- 
2.31.1


  parent reply	other threads:[~2021-12-14  1:24 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-14  1:24 [PATCH v2 00/12] Cleanup zbd code Damien Le Moal
2021-12-14  1:24 ` [PATCH v2 01/12] fio: Improve documentation of ignore_zone_limits option Damien Le Moal
2021-12-14  1:24 ` [PATCH v2 02/12] zbd: define local functions as static Damien Le Moal
2021-12-14  1:24 ` [PATCH v2 03/12] zbd: move and cleanup code Damien Le Moal
2021-12-14  1:24 ` [PATCH v2 04/12] zbd: remove is_zone_open() helper Damien Le Moal
2021-12-14  1:24 ` [PATCH v2 05/12] zbd: introduce zbd_zone_align_file_sizes() helper Damien Le Moal
2021-12-14  8:33   ` Niklas Cassel
2021-12-14  1:24 ` [PATCH v2 06/12] zbd: fix code style issues Damien Le Moal
2021-12-14  1:24 ` [PATCH v2 07/12] zbd: simplify zbd_close_zone() Damien Le Moal
2021-12-14  1:24 ` Damien Le Moal [this message]
2021-12-14  1:24 ` [PATCH v2 09/12] zbd: rename zbd_zone_idx() and zbd_zone_nr() Damien Le Moal
2021-12-14  8:33   ` Niklas Cassel
2021-12-14  1:24 ` [PATCH v2 10/12] zbd: rename get_zone() Damien Le Moal
2021-12-14  1:24 ` [PATCH v2 11/12] zbd: introduce zbd_offset_to_zone() helper Damien Le Moal
2021-12-14  8:34   ` Niklas Cassel
2021-12-14  1:24 ` [PATCH v2 12/12] t/zbd: Avoid inappropriate blkzone command call in zone_cap_bs Damien Le Moal
2021-12-14  8:34   ` Niklas Cassel
2021-12-14 13:48 ` [PATCH v2 00/12] Cleanup zbd code 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=20211214012413.464798-9-damien.lemoal@opensource.wdc.com \
    --to=damien.lemoal@opensource.wdc.com \
    --cc=axboe@kernel.dk \
    --cc=fio@vger.kernel.org \
    --cc=niklas.cassel@wdc.com \
    --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 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.