From: Jens Axboe Date: Thu, 1 Jun 2006 22:54:09 +0000 (-0700) Subject: [PATCH] Fix random io truncate on 32-bit archs X-Git-Tag: fio-1.4~5 X-Git-Url: https://git.kernel.dk/?p=fio.git;a=commitdiff_plain;h=085227ad17c4974e334450302ef8fe1b41ba227e;ds=sidebyside [PATCH] Fix random io truncate on 32-bit archs --- diff --git a/fio.c b/fio.c index bedad68f..864bcb45 100644 --- a/fio.c +++ b/fio.c @@ -288,12 +288,12 @@ static int get_next_offset(struct thread_data *td, unsigned long long *offset) long r; if (!td->sequential) { - unsigned long max_blocks = td->io_size / td->min_bs; + unsigned long long max_blocks = td->io_size / td->min_bs; int loops = 50; do { lrand48_r(&td->random_state, &r); - b = ((max_blocks - 1) * r / (RAND_MAX+1.0)); + b = ((max_blocks - 1) * r / (unsigned long long) (RAND_MAX+1.0)); rb = b + (td->file_offset / td->min_bs); loops--; } while (!random_map_free(td, rb) && loops);