Fix TO_MAP_BLOCK() taking offset into account twice
authorJens Axboe <jens.axboe@oracle.com>
Tue, 19 Feb 2008 17:20:14 +0000 (18:20 +0100)
committerJens Axboe <jens.axboe@oracle.com>
Tue, 19 Feb 2008 17:20:14 +0000 (18:20 +0100)
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
fio.h

diff --git a/fio.h b/fio.h
index 9c9002454054e3aa37cbb7bc5da7ef8e0e8e0f2a..d8c65950e03b3d63deb4a9ee2942cc85e2dfb2c9 100644 (file)
--- a/fio.h
+++ b/fio.h
@@ -683,7 +683,7 @@ static inline void fio_ro_check(struct thread_data *td, struct io_u *io_u)
 }
 
 #define BLOCKS_PER_MAP         (8 * sizeof(long))
-#define TO_MAP_BLOCK(td, f, b) ((b) - ((f)->file_offset / (unsigned long long) (td)->o.rw_min_bs))
+#define TO_MAP_BLOCK(td, f, b) ((b) / ((unsigned long long) (td)->o.rw_min_bs))
 #define RAND_MAP_IDX(td, f, b) (TO_MAP_BLOCK(td, f, b) / BLOCKS_PER_MAP)
 #define RAND_MAP_BIT(td, f, b) (TO_MAP_BLOCK(td, f, b) & (BLOCKS_PER_MAP - 1))