X-Git-Url: https://git.kernel.dk/?p=fio.git;a=blobdiff_plain;f=io_u.c;h=f1359083528600a17185bd06252430514d053a6c;hp=c51982d88a2468254dda05796db69143c16f1142;hb=66b6c5efc84f1a5fb25648f38409716682bad84c;hpb=ca09be4b1a8e97f0bca5cfbddb399899cf561eaa diff --git a/io_u.c b/io_u.c index c51982d8..f1359083 100644 --- a/io_u.c +++ b/io_u.c @@ -83,13 +83,15 @@ struct rand_off { static int __get_next_rand_offset(struct thread_data *td, struct fio_file *f, enum fio_ddir ddir, uint64_t *b) { - uint64_t r, lastb; - - lastb = last_block(td, f, ddir); - if (!lastb) - return 1; + uint64_t r; if (td->o.random_generator == FIO_RAND_GEN_TAUSWORTHE) { + uint64_t lastb; + + lastb = last_block(td, f, ddir); + if (!lastb) + return 1; + r = __rand(&td->random_state); dprint(FD_RANDOM, "off rand %llu\n", (unsigned long long) r); @@ -98,7 +100,7 @@ static int __get_next_rand_offset(struct thread_data *td, struct fio_file *f, } else { uint64_t off = 0; - if (lfsr_next(&f->lfsr, &off, lastb)) + if (lfsr_next(&f->lfsr, &off)) return 1; *b = off; @@ -1857,9 +1859,9 @@ static void save_buf_state(struct thread_data *td, struct frand_state *rs) void fill_io_buffer(struct thread_data *td, void *buf, unsigned int min_write, unsigned int max_bs) { - if (td->o.buffer_pattern_bytes) - fill_buffer_pattern(td, buf, max_bs); - else if (!td->o.zero_buffers) { + struct thread_options *o = &td->o; + + if (o->compress_percentage) { unsigned int perc = td->o.compress_percentage; struct frand_state *rs; unsigned int left = max_bs; @@ -1877,7 +1879,8 @@ void fill_io_buffer(struct thread_data *td, void *buf, unsigned int min_write, seg = min_write; fill_random_buf_percentage(rs, buf, perc, seg, - min_write); + min_write, o->buffer_pattern, + o->buffer_pattern_bytes); } else fill_random_buf(rs, buf, min_write); @@ -1885,7 +1888,9 @@ void fill_io_buffer(struct thread_data *td, void *buf, unsigned int min_write, left -= min_write; save_buf_state(td, rs); } while (left); - } else + } else if (o->buffer_pattern_bytes) + fill_buffer_pattern(td, buf, max_bs); + else memset(buf, 0, max_bs); }