filesetup: print warning if chosen random generator can't cover range
authorJens Axboe <axboe@fb.com>
Sat, 30 May 2015 01:40:21 +0000 (19:40 -0600)
committerJens Axboe <axboe@fb.com>
Sat, 30 May 2015 01:40:21 +0000 (19:40 -0600)
If the file or device is huge, we could have an issue with the
default 32-bit random offset generator in that it wont cover
the entire device. If fio detects this and the random generator
wasn't explicitly set, then log an error and exit.

Signed-off-by: Jens Axboe <axboe@fb.com>
filesetup.c

index f4324e23e4f328e4d88fcb3e9952d5333a36b706..51efdf768d3068b1ac6a895b03adfaa4678f54c6 100644 (file)
@@ -1067,6 +1067,16 @@ int init_random_map(struct thread_data *td)
 
                blocks = fsize / (unsigned long long) td->o.rw_min_bs;
 
+               if (blocks > FRAND32_MAX &&
+                   td->o.random_generator == FIO_RAND_GEN_TAUSWORTHE &&
+                   !fio_option_is_set(&td->o, random_generator)) {
+                       log_err("fio: file %s exceeds 32-bit tausworthe "
+                                "random generator. Use lfsr or "
+                                "tausworthe64.\n", f->file_name);
+                       td_verror(td, EINVAL, "init file random");
+                       return 1;
+               }
+
                if (td->o.random_generator == FIO_RAND_GEN_LFSR) {
                        unsigned long seed;