This option will cause all IO buffers to be initialized to all zeroes.
The default is to fill them with random data.
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
may be used as a block range. This typically wont work with
direct IO, as that normally requires sector alignment.
+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.
+
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
/*
* "randomly" fill the buffer contents
*/
-static void fill_rand_buf(struct io_u *io_u, int max_bs)
+static void fill_io_buf(struct thread_data *td, struct io_u *io_u, int max_bs)
{
int *ptr = io_u->buf;
- while ((void *) ptr - io_u->buf < max_bs) {
- *ptr = rand() * 0x9e370001;
- ptr++;
- }
+ if (!td->o.zero_buffers) {
+ while ((void *) ptr - io_u->buf < max_bs) {
+ *ptr = rand() * 0x9e370001;
+ ptr++;
+ }
+ } else
+ memset(ptr, 0, max_bs);
}
static int init_io_u(struct thread_data *td)
INIT_LIST_HEAD(&io_u->list);
io_u->buf = p + max_bs * i;
+
if (td_write(td))
- fill_rand_buf(io_u, max_bs);
+ fill_io_buf(td, io_u, max_bs);
io_u->index = i;
io_u->flags = IO_U_F_FREE;
unsigned int file_service_type;
unsigned int group_reporting;
unsigned int fadvise_hint;
+ unsigned int zero_buffers;
char *read_iolog_file;
char *write_iolog_file;
.off1 = td_var_offset(group_reporting),
.help = "Do reporting on a per-group basis",
},
+ {
+ .name = "zero_buffers",
+ .type = FIO_OPT_STR_SET,
+ .off1 = td_var_offset(zero_buffers),
+ .help = "Init IO buffers to all zeroes",
+ },
{
.name = NULL,
},