[PATCH] Fix file_size_high
[fio.git] / filesetup.c
index b8b22b5a54da51504b369b67975c46ef10f95084..58c5015c97f1ddbe5150fad0ef11af006de58d9f 100644 (file)
@@ -104,7 +104,7 @@ static unsigned long long get_rand_file_size(struct thread_data *td)
        long r;
 
        r = os_random_long(&td->file_size_state);
-       ret = td->o.file_size_low + (unsigned long long) ((double) td->o.file_size_high * (r / (RAND_MAX + 1.0)));
+       ret = td->o.file_size_low + (unsigned long long) ((double) (td->o.file_size_high - td->o.file_size_low) * (r / (RAND_MAX + 1.0)));
        ret -= (ret % td->o.rw_min_bs);
        return ret;
 }