Fix disk zone test case
[fio.git] / io_u.c
diff --git a/io_u.c b/io_u.c
index e0614bd0a11946f132a6b0063e0015ff6e6ad48b..b636f576eb808caa286eef42c3e3e7bc68bc8d8a 100644 (file)
--- a/io_u.c
+++ b/io_u.c
@@ -327,6 +327,15 @@ static int fill_io_u(struct thread_data *td, struct io_u *io_u)
 
        io_u->ddir = get_rw_ddir(td);
 
+       /*
+        * See if it's time to switch to a new zone
+        */
+       if (td->zone_bytes >= td->o.zone_size) {
+               td->zone_bytes = 0;
+               io_u->file->last_pos += td->o.zone_skip;
+               td->io_skip_bytes += td->o.zone_skip;
+       }
+
        /*
         * No log, let the seq/rand engine retrieve the next buflen and
         * position.
@@ -660,11 +669,6 @@ set_file:
 
        assert(io_u->file->flags & FIO_FILE_OPEN);
 
-       if (td->zone_bytes >= td->o.zone_size) {
-               td->zone_bytes = 0;
-               f->last_pos += td->o.zone_skip;
-       }
-
        if (io_u->ddir != DDIR_SYNC) {
                if (!io_u->buflen) {
                        put_io_u(td, io_u);