From: Jens Axboe Date: Fri, 20 Jul 2007 11:25:04 +0000 (+0200) Subject: Fix disk zone test case X-Git-Tag: fio-1.16.9~2 X-Git-Url: https://git.kernel.dk/?p=fio.git;a=commitdiff_plain;h=48f5abd393cc614e1984391b28ba491ef9b26f5e;hp=c9f60304a5eb7c3f3d2cdcba5a5a42edf6ce97ff Fix disk zone test case Signed-off-by: Jens Axboe --- 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);