filesetup: improve LFSR init failure error message
authorVincent Fu <vincent.fu@wdc.com>
Mon, 11 Nov 2019 16:30:53 +0000 (11:30 -0500)
committerJens Axboe <axboe@kernel.dk>
Thu, 14 Nov 2019 21:07:22 +0000 (14:07 -0700)
Especially with small sample spaces, the LFSR random generator
occasionally fails to initialize successfully. When this occurs, the
error message refers to problems allocating a random map. Change the
error message to explicitly mention the LFSR failure.

OLD BEHAVIOR
$ ./fio --name=test --ioengine=null --size=4k --random_generator=lfsr --rw=randread --randrepeat=0
test: (g=0): rw=randread, bs=(R) 4096B-4096B, (W) 4096B-4096B, (T) 4096B-4096B, ioengine=null, iodepth=1
fio-3.16-13-g998b-dirty
Starting 1 process
fio: failed allocating random map. If running a large number of jobs, try the 'norandommap' option or set 'softrandommap'. Or give a larger --alloc-size to fio.

NEW BEHAVIOR
$ ./fio --name=test --ioengine=null --size=4k --random_generator=lfsr --rw=randread --randrepeat=0
test: (g=0): rw=randread, bs=(R) 4096B-4096B, (W) 4096B-4096B, (T) 4096B-4096B, ioengine=null, iodepth=1
fio-3.16-37-g65ee
Starting 1 process
fio: failed initializing LFSR

Signed-off-by: Jens Axboe <axboe@kernel.dk>
filesetup.c

index 1d3094c14796509c4f26a5b928bba3975dd8dc74..7d54c9f1ef5bc8f92b0e5bbf19285d2f7ecfed17 100644 (file)
@@ -1354,6 +1354,9 @@ bool init_random_map(struct thread_data *td)
                        if (!lfsr_init(&f->lfsr, blocks, seed, 0)) {
                                fio_file_set_lfsr(f);
                                continue;
+                       } else {
+                               log_err("fio: failed initializing LFSR\n");
+                               return false;
                        }
                } else if (!td->o.norandommap) {
                        f->io_axmap = axmap_new(blocks);