From 48f5abd393cc614e1984391b28ba491ef9b26f5e Mon Sep 17 00:00:00 2001 From: Jens Axboe Date: Fri, 20 Jul 2007 13:25:04 +0200 Subject: [PATCH] Fix disk zone test case Signed-off-by: Jens Axboe --- fio.c | 5 +++-- fio.h | 1 + io_u.c | 14 +++++++++----- 3 files changed, 13 insertions(+), 7 deletions(-) diff --git a/fio.c b/fio.c index 1e69ce42..6e0dae24 100644 --- 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 d84eecfa..f2e69a7e 100644 --- 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 e0614bd0..b636f576 100644 --- 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); -- 2.25.1