path: root/io_u.c
diff options
authorBart Van Assche <>2018-08-24 11:31:23 -0700
committerJens Axboe <>2018-08-24 12:54:31 -0600
commit7b865a2f23d22f82ffcc25756b1eeea55e57f1e3 (patch)
tree7afe50f4ebb3b819e9c3c2bb6fdced4fd605ab8d /io_u.c
parent4806b82473fea74c517e5e0c7665b0ca0542b3ec (diff)
Add the zonemode job option
Fio's zone support makes fio perform I/O inside a zone before it skips to the next zone. That behavior is the opposite of the behavior needed for zoned block devices, namely to consider all zones when performing random I/O. Hence introduce a new job option that allows users to choose between fio's traditional zone mode and the behavior needed for zoned block devices. This patch makes fio behave identically with --zonemode=none and --zonemode=zbd. A later patch will implement new behavior for --zonemode=zbd. Signed-off-by: Bart Van Assche <> Signed-off-by: Jens Axboe <>
Diffstat (limited to 'io_u.c')
1 files changed, 8 insertions, 7 deletions
diff --git a/io_u.c b/io_u.c
index c58dcf04..e050d9f7 100644
--- a/io_u.c
+++ b/io_u.c
@@ -64,7 +64,7 @@ static uint64_t last_block(struct thread_data *td, struct fio_file *f,
if (max_size > f->real_file_size)
max_size = f->real_file_size;
- if (td->o.zone_range)
+ if (td->o.zone_mode == ZONE_MODE_STRIDED && td->o.zone_range)
max_size = td->o.zone_range;
if (td->o.min_bs[ddir] > td->[ddir])
@@ -815,10 +815,14 @@ void requeue_io_u(struct thread_data *td, struct io_u **io_u)
*io_u = NULL;
-static void __fill_io_u_zone(struct thread_data *td, struct io_u *io_u)
+static void setup_strided_zone_mode(struct thread_data *td, struct io_u *io_u)
struct fio_file *f = io_u->file;
+ assert(td->o.zone_mode == ZONE_MODE_STRIDED);
+ assert(td->o.zone_size);
+ assert(td->o.zone_range);
* See if it's time to switch to a new zone
@@ -869,11 +873,8 @@ static int fill_io_u(struct thread_data *td, struct io_u *io_u)
if (!ddir_rw(io_u->ddir))
goto out;
- /*
- * When file is zoned zone_range is always positive
- */
- if (td->o.zone_range)
- __fill_io_u_zone(td, io_u);
+ if (td->o.zone_mode == ZONE_MODE_STRIDED)
+ setup_strided_zone_mode(td, io_u);
* No log, let the seq/rand engine retrieve the next buflen and