zero_buffers If this option is given, fio will init the IO buffers to
all zeroes. The default is to fill them with random data.
+refill_buffers If this option is given, fio will refill the IO buffers
+ on every submit. The default is to only fill it at init
+ time and reuse that data. Only makes sense if zero_buffers
+ isn't specified, naturally.
+
nrfiles=int Number of files to use for this job. Defaults to 1.
openfiles=int Number of files to keep open at the same time. Defaults to
free_io_mem(td);
}
-/*
- * "randomly" fill the buffer contents
- */
-static void fill_io_buf(struct thread_data *td, struct io_u *io_u, int max_bs)
-{
- long *ptr = io_u->buf;
-
- if (!td->o.zero_buffers) {
- while ((void *) ptr - io_u->buf < max_bs) {
- *ptr = rand() * GOLDEN_RATIO_PRIME;
- ptr++;
- }
- } else
- memset(ptr, 0, max_bs);
-}
-
static int init_io_u(struct thread_data *td)
{
struct io_u *io_u;
if (!(td->io_ops->flags & FIO_NOIO)) {
io_u->buf = p + max_bs * i;
- if (td_write(td))
- fill_io_buf(td, io_u, max_bs);
+ if (td_write(td) && !td->o.refill_buffers)
+ io_u_fill_buffer(td, io_u, max_bs);
}
io_u->index = i;
unsigned int group_reporting;
unsigned int fadvise_hint;
unsigned int zero_buffers;
+ unsigned int refill_buffers;
unsigned int time_based;
char *read_iolog_file;
extern void io_u_init_timeout(void);
extern void io_u_set_timeout(struct thread_data *);
extern void io_u_mark_depth(struct thread_data *, unsigned int);
+extern void io_u_fill_buffer(struct thread_data *td, struct io_u *, unsigned int);
/*
* io engine entry points
#include <assert.h>
#include "fio.h"
+#include "hash.h"
/*
* Change this define to play with the timeout handling
io_u->endpos = io_u->offset + io_u->buflen;
io_u->xfer_buf = io_u->buf;
io_u->xfer_buflen = io_u->buflen;
+
+ if (td->o.refill_buffers && io_u->ddir == DDIR_WRITE)
+ io_u_fill_buffer(td, io_u, io_u->xfer_buflen);
out:
if (!td_io_prep(td, io_u)) {
fio_gettime(&io_u->start_time, NULL);
add_slat_sample(td, io_u->ddir, slat_time);
}
+/*
+ * "randomly" fill the buffer contents
+ */
+void io_u_fill_buffer(struct thread_data *td, struct io_u *io_u,
+ unsigned int max_bs)
+{
+ long *ptr = io_u->buf;
+
+ if (!td->o.zero_buffers) {
+ while ((void *) ptr - io_u->buf < max_bs) {
+ *ptr = rand() * GOLDEN_RATIO_PRIME;
+ ptr++;
+ }
+ } else
+ memset(ptr, 0, max_bs);
+}
+
#ifdef FIO_USE_TIMEOUT
void io_u_set_timeout(struct thread_data *td)
{
.off1 = td_var_offset(zero_buffers),
.help = "Init IO buffers to all zeroes",
},
+ {
+ .name = "refill_buffers",
+ .type = FIO_OPT_STR_SET,
+ .off1 = td_var_offset(refill_buffers),
+ .help = "Refill IO buffers on every IO submit",
+ },
#ifdef FIO_HAVE_DISK_UTIL
{
.name = "disk_util",