From f697125ab9003d358a37186d610e09799afd190f Mon Sep 17 00:00:00 2001 From: Jens Axboe Date: Wed, 15 Nov 2006 10:00:31 +0100 Subject: [PATCH] [PATCH] nrfiles > 1 random fix We should only generate a block within the specific file size, not the total io size. Signed-off-by: Jens Axboe --- filesetup.c | 9 ++++----- io_u.c | 2 +- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/filesetup.c b/filesetup.c index a1633827..fd50b6f7 100644 --- a/filesetup.c +++ b/filesetup.c @@ -93,15 +93,14 @@ static int create_files(struct thread_data *td) struct fio_file *f; int i, err, need_create; + for_each_file(td, f, i) + f->file_size = td->total_file_size / td->nr_files; + /* * unless specifically asked for overwrite, let normal io extend it */ - if (!td->overwrite) { - for_each_file(td, f, i) - f->file_size = td->total_file_size / td->nr_files; - + if (!td->overwrite) return 0; - } need_create = 0; if (td->filetype == FIO_TYPE_FILE) diff --git a/io_u.c b/io_u.c index 7698e845..318614cd 100644 --- a/io_u.c +++ b/io_u.c @@ -88,7 +88,7 @@ static int get_next_offset(struct thread_data *td, struct fio_file *f, long r; if (!td->sequential) { - unsigned long long max_blocks = td->io_size / td->min_bs[ddir]; + unsigned long long max_blocks = f->file_size / td->min_bs[ddir]; int loops = 50; do { -- 2.25.1