From 69c53a63667f914ebf7e7a85c83351d90a7e2bc8 Mon Sep 17 00:00:00 2001 From: Dmitry Fomichev Date: Tue, 6 Feb 2024 19:57:53 +0900 Subject: [PATCH] zbd: use a helper to calculate zone index 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 Reviewed-by: Shin'ichiro Kawasaki Tested-by: Shin'ichiro Kawasaki Link: https://lore.kernel.org/r/20240206105755.214891-4-dmitry.fomichev@wdc.com Signed-off-by: Vincent Fu --- 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.25.1