Work-around too large block count
authorJens Axboe <jens.axboe@oracle.com>
Fri, 23 May 2008 10:37:23 +0000 (12:37 +0200)
committerJens Axboe <jens.axboe@oracle.com>
Fri, 23 May 2008 10:37:23 +0000 (12:37 +0200)
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
io_u.c

diff --git a/io_u.c b/io_u.c
index ce08c59ce84dea7f79487592e5a7d14febe61431..c728168d7ce48086c9e15d777eb0c2e9ab13f166 100644 (file)
--- a/io_u.c
+++ b/io_u.c
@@ -79,8 +79,16 @@ static inline unsigned long long last_block(struct thread_data *td,
                                            enum fio_ddir ddir)
 {
        unsigned long long max_blocks;
+       unsigned long long max_size;
 
-       max_blocks = f->io_size / (unsigned long long) td->o.min_bs[ddir];
+       /*
+        * Hmm, should we make sure that ->io_size <= ->real_file_size?
+        */
+       max_size = f->io_size;
+       if (max_size > f->real_file_size)
+               max_size = f->real_file_size;
+
+       max_blocks = max_size / (unsigned long long) td->o.min_bs[ddir];
        if (!max_blocks)
                return 0;