[PATCH] nrfiles > 1 random fix
authorJens Axboe <jens.axboe@oracle.com>
Wed, 15 Nov 2006 09:00:31 +0000 (10:00 +0100)
committerJens Axboe <axboe@ml370.home.kernel.dk>
Wed, 15 Nov 2006 09:01:04 +0000 (10:01 +0100)
We should only generate a block within the specific file size, not
the total io size.

Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
filesetup.c
io_u.c

index a1633827fe8eca63017bb8a2d91b731dd9854b73..fd50b6f76f460f5291c2debb9098c6fca54d3971 100644 (file)
@@ -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 7698e84581c3399eb771d9ecf1f5df472d688311..318614cdb39b5213fc8d833a9f028b560f27eb84 100644 (file)
--- 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 {