Fix disk zone test case
authorJens Axboe <jens.axboe@oracle.com>
Fri, 20 Jul 2007 11:25:04 +0000 (13:25 +0200)
committerJens Axboe <jens.axboe@oracle.com>
Fri, 20 Jul 2007 11:25:04 +0000 (13:25 +0200)
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
fio.c
fio.h
io_u.c

diff --git a/fio.c b/fio.c
index 1e69ce4228c624f3775a95e3299bde84c1e0baef..6e0dae24d5cf0e8410c0b04e2d25856b7839b8b2 100644 (file)
--- a/fio.c
+++ b/fio.c
@@ -731,7 +731,7 @@ static int keep_running(struct thread_data *td)
                return 1;
        }
 
-       io_done = td->io_bytes[DDIR_READ] + td->io_bytes[DDIR_WRITE];
+       io_done = td->io_bytes[DDIR_READ] + td->io_bytes[DDIR_WRITE] + td->io_skip_bytes;
        if (io_done < td->o.size)
                return 1;
 
@@ -753,7 +753,8 @@ static int clear_io_state(struct thread_data *td)
 
        td->last_was_sync = 0;
 
-       td->nr_done_files = 0;
+       if (td->o.time_based)
+               td->nr_done_files = 0;
 
        for_each_file(td, f, i)
                td_io_close_file(td, f);
diff --git a/fio.h b/fio.h
index d84eecfaba51f4bc305575ae572a4acc02e30226..f2e69a7e17fcd31a5bf3c05a2da2c494af82e7a6 100644 (file)
--- a/fio.h
+++ b/fio.h
@@ -515,6 +515,7 @@ struct thread_data {
        unsigned long io_issues[2];
        unsigned long long io_blocks[2];
        unsigned long long io_bytes[2];
+       unsigned long long io_skip_bytes;
        unsigned long long this_io_bytes[2];
        unsigned long long zone_bytes;
        struct fio_sem *mutex;
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);