All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dmitry Fomichev <dmitry.fomichev@wdc.com>
To: Jens Axboe <axboe@kernel.dk>, Vincent Fu <vincent.fu@samsung.com>,
	fio@vger.kernel.org
Cc: Damien Le Moal <damien.lemoal@wdc.com>,
	Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>,
	Niklas Cassel <niklas.cassel@wdc.com>,
	Dmitry Fomichev <dmitry.fomichev@wdc.com>
Subject: [PATCH v2 3/5] zbd: use a helper to calculate zone index
Date: Tue,  6 Feb 2024 19:57:53 +0900	[thread overview]
Message-ID: <20240206105755.214891-4-dmitry.fomichev@wdc.com> (raw)
In-Reply-To: <20240206105755.214891-1-dmitry.fomichev@wdc.com>

zone_lock() function contains the debug code to verify that the zone
being locked belongs to the job's working zone range. Clean up this
code by using a previously defined helper for calculating the zone
index to check.

Signed-off-by: Dmitry Fomichev <dmitry.fomichev@wdc.com>
---
 zbd.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/zbd.c b/zbd.c
index 7577472e..37417660 100644
--- a/zbd.c
+++ b/zbd.c
@@ -104,8 +104,7 @@ static void zone_lock(struct thread_data *td, const struct fio_file *f,
 		      struct fio_zone_info *z)
 {
 #ifndef NDEBUG
-	struct zoned_block_device_info *zbd = f->zbd_info;
-	uint32_t const nz = z - zbd->zone_info;
+	unsigned int const nz = zbd_zone_idx(f, z);
 	/* A thread should never lock zones outside its working area. */
 	assert(f->min_zone <= nz && nz < f->max_zone);
 	assert(z->has_wp);
-- 
2.37.3


  parent reply	other threads:[~2024-02-06 10:59 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-06 10:57 [PATCH v2 0/5] zbd, t/zbd: miscellaneous fixes Dmitry Fomichev
2024-02-06 10:57 ` [PATCH v2 1/5] zbd: avoid assertions during sequential read I/O Dmitry Fomichev
2024-02-06 10:57 ` [PATCH v2 2/5] oslib: log BLKREPORTZONE error code Dmitry Fomichev
2024-02-06 10:57 ` Dmitry Fomichev [this message]
2024-02-06 10:57 ` [PATCH v2 4/5] t/zbd: check device for unrestricted read support Dmitry Fomichev
2024-02-06 10:57 ` [PATCH v2 5/5] t/zbd: add -s option to test-zbd-support script Dmitry Fomichev
2024-02-07  3:05 ` [PATCH v2 0/5] zbd, t/zbd: miscellaneous fixes Shinichiro Kawasaki
2024-02-07 13:44   ` Vincent Fu

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=20240206105755.214891-4-dmitry.fomichev@wdc.com \
    --to=dmitry.fomichev@wdc.com \
    --cc=axboe@kernel.dk \
    --cc=damien.lemoal@wdc.com \
    --cc=fio@vger.kernel.org \
    --cc=niklas.cassel@wdc.com \
    --cc=shinichiro.kawasaki@wdc.com \
    --cc=vincent.fu@samsung.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.