Fix random location generation with offset != 0
authorJens Axboe <jens.axboe@oracle.com>
Mon, 18 Feb 2008 13:13:08 +0000 (14:13 +0100)
committerJens Axboe <jens.axboe@oracle.com>
Mon, 18 Feb 2008 13:13:08 +0000 (14:13 +0100)
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
io_u.c

diff --git a/io_u.c b/io_u.c
index 8f10bfdc0ce3552d1a1f7ccd6f1cdc613bf4ad73..a56a6f2d32af8d5a49ba54bd186ba9ed1e235c5f 100644 (file)
--- a/io_u.c
+++ b/io_u.c
@@ -44,7 +44,7 @@ static void mark_random_map(struct thread_data *td, struct io_u *io_u)
        unsigned int blocks;
        unsigned int nr_blocks;
 
-       block = io_u->offset / (unsigned long long) min_bs;
+       block = (io_u->offset - f->file_offset) / (unsigned long long) min_bs;
        blocks = 0;
        nr_blocks = (io_u->buflen + min_bs - 1) / min_bs;