From: Jens Axboe Date: Mon, 19 Sep 2011 07:24:44 +0000 (+0200) Subject: Add option for controlling buffer scrambling X-Git-Tag: fio-1.59~7 X-Git-Url: https://git.kernel.dk/?p=fio.git;a=commitdiff_plain;h=fd68418e1f248e85809312d6fa789eaf57b54dc0 Add option for controlling buffer scrambling scramble_buffers bool option, defaults to on. Signed-off-by: Jens Axboe --- diff --git a/HOWTO b/HOWTO index b67a201e..cc2df9b7 100644 --- a/HOWTO +++ b/HOWTO @@ -481,6 +481,13 @@ refill_buffers If this option is given, fio will refill the IO buffers isn't specified, naturally. If data verification is enabled, refill_buffers is also automatically enabled. +scramble_buffers=bool If refill_buffers is too costly and the target is + using data deduplication, then setting this option will + slightly modify the IO buffer contents to defeat normal + de-dupe attempts. This is not enough to defeat more clever + block compression attempts, but it will stop naive dedupe of + blocks. Default: true. + 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 diff --git a/fio.1 b/fio.1 index e8fb57f4..dc10b403 100644 --- a/fio.1 +++ b/fio.1 @@ -329,6 +329,13 @@ default is to only fill it at init time and reuse that data. Only makes sense if zero_buffers isn't specified, naturally. If data verification is enabled, refill_buffers is also automatically enabled. .TP +.BI scramble_buffers \fR=\fPbool +If \fBrefill_buffers\fR is too costly and the target is using data +deduplication, then setting this option will slightly modify the IO buffer +contents to defeat normal de-dupe attempts. This is not enough to defeat +more clever block compression attempts, but it will stop naive dedupe +of blocks. Default: true. +.TP .BI nrfiles \fR=\fPint Number of files to use for this job. Default: 1. .TP diff --git a/fio.h b/fio.h index e93e8f3d..022ba57c 100644 --- a/fio.h +++ b/fio.h @@ -348,6 +348,7 @@ struct thread_options { enum fio_fallocate_mode fallocate_mode; unsigned int zero_buffers; unsigned int refill_buffers; + unsigned int scramble_buffers; unsigned int time_based; unsigned int disable_lat; unsigned int disable_clat; diff --git a/io_u.c b/io_u.c index f4c4aa2c..5959bf7f 100644 --- a/io_u.c +++ b/io_u.c @@ -1203,13 +1203,14 @@ struct io_u *get_io_u(struct thread_data *td) f->last_start = io_u->offset; f->last_pos = io_u->offset + io_u->buflen; - if (td->o.verify != VERIFY_NONE && io_u->ddir == DDIR_WRITE) - populate_verify_io_u(td, io_u); - else if (td->o.refill_buffers && io_u->ddir == DDIR_WRITE) - io_u_fill_buffer(td, io_u, io_u->xfer_buflen); - else if (io_u->ddir == DDIR_WRITE) - do_scramble = 1; - else if (io_u->ddir == DDIR_READ) { + if (io_u->ddir == DDIR_WRITE) { + if (td->o.verify != VERIFY_NONE) + populate_verify_io_u(td, io_u); + else if (td->o.refill_buffers) + io_u_fill_buffer(td, io_u, io_u->xfer_buflen); + else if (td->o.scramble_buffers) + do_scramble = 1; + } else if (io_u->ddir == DDIR_READ) { /* * Reset the buf_filled parameters so next time if the * buffer is used for writes it is refilled. diff --git a/options.c b/options.c index 74c24d02..5252477b 100644 --- a/options.c +++ b/options.c @@ -1966,6 +1966,13 @@ static struct fio_option options[FIO_MAX_OPTS] = { .off1 = td_var_offset(refill_buffers), .help = "Refill IO buffers on every IO submit", }, + { + .name = "scramble_buffers", + .type = FIO_OPT_BOOL, + .off1 = td_var_offset(scramble_buffers), + .help = "Slightly scramble buffers on every IO submit", + .def = "1", + }, { .name = "clat_percentiles", .type = FIO_OPT_BOOL,