From: Jens Axboe Date: Wed, 15 Nov 2006 09:00:31 +0000 (+0100) Subject: [PATCH] nrfiles > 1 random fix X-Git-Tag: fio-1.10~28 X-Git-Url: https://git.kernel.dk/?a=commitdiff_plain;h=f697125ab9003d358a37186d610e09799afd190f;p=fio.git [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 --- 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 {