summaryrefslogtreecommitdiff
path: root/zbd.c
diff options
context:
space:
mode:
authorAnkit Kumar <ankit.kumar@samsung.com>2021-08-04 16:53:08 +0530
committerJens Axboe <axboe@kernel.dk>2021-08-04 07:26:01 -0600
commitcb765e413e4d124355c3eec47f7ac8cd314a6951 (patch)
treeddc085819ef0bb564791adee600126c865583328 /zbd.c
parent3b78a9726ee9129aaed12222f4d11436e88a8282 (diff)
downloadfio-cb765e413e4d124355c3eec47f7ac8cd314a6951.tar.gz
fio-cb765e413e4d124355c3eec47f7ac8cd314a6951.tar.bz2
zbd: Improve random zone index generation logic
Existing random zone index generation logic is dependent on the file size. For smaller I/O sizes the random zone index always return a particular section of open zones. As this index is used to return one of the open zones, it was observed that after one of the max_open_zones / job_max_open_zones limit is reached all further I/O's are redirected to only a few open zones till they are full. This patch modifies the random zone index genration logic so that it is uniform across all the open zones. It reverts part of the commit 6463db6c1 ('fio: fix interaction between offset/size limited threads and "max_open_zones"') Tested-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com> Reviewed-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com> Signed-off-by: Ankit Kumar <ankit.kumar@samsung.com> Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'zbd.c')
-rw-r--r--zbd.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/zbd.c b/zbd.c
index 04c68dea..43f12b45 100644
--- a/zbd.c
+++ b/zbd.c
@@ -1184,11 +1184,12 @@ out:
return res;
}
-/* Anything goes as long as it is not a constant. */
+/* Return random zone index for one of the open zones. */
static uint32_t pick_random_zone_idx(const struct fio_file *f,
const struct io_u *io_u)
{
- return io_u->offset * f->zbd_info->num_open_zones / f->real_file_size;
+ return (io_u->offset - f->file_offset) * f->zbd_info->num_open_zones /
+ f->io_size;
}
/*