[PATCH] fio: random io was broken after blocks -> kb conversion
authorJens Axboe <axboe@suse.de>
Fri, 28 Oct 2005 11:42:50 +0000 (13:42 +0200)
committerJens Axboe <axboe@suse.de>
Fri, 28 Oct 2005 11:42:50 +0000 (13:42 +0200)
fio.c

diff --git a/fio.c b/fio.c
index be8958f3eb2d06dc289ac90401e08983ee7da04a..9f02de974e16eddca8b3c3faa80940d1fe8edfe5 100644 (file)
--- a/fio.c
+++ b/fio.c
@@ -373,16 +373,16 @@ static inline unsigned long msec_now(struct timeval *s)
 
 static unsigned long long get_next_offset(struct thread_data *td)
 {
-       unsigned long long b;
+       unsigned long long kb;
        long r;
 
        if (!td->sequential) {
                lrand48_r(&td->random_state, &r);
-               b = (1+(double) (td->kb-1) * r / (RAND_MAX+1.0));
+               kb = (1+(double) (td->kb-1) * r / (RAND_MAX+1.0));
        } else
-               b = td->last_kb << 10;
+               kb = td->last_kb;
 
-       return b + td->file_offset;
+       return (kb << 10) + td->file_offset;
 }
 
 static unsigned int get_next_buflen(struct thread_data *td)