Add option for controlling buffer scrambling
scramble_buffers bool option, defaults to on.
Signed-off-by: Jens Axboe <axboe@kernel.dk>
diff --git a/HOWTO b/HOWTO
index b67a201..cc2df9b 100644
--- a/HOWTO
+++ b/HOWTO
@@ -481,6 +481,13 @@
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 e8fb57f..dc10b40 100644
--- a/fio.1
+++ b/fio.1
@@ -329,6 +329,13 @@
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 e93e8f3..022ba57 100644
--- a/fio.h
+++ b/fio.h
@@ -348,6 +348,7 @@
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 f4c4aa2..5959bf7 100644
--- a/io_u.c
+++ b/io_u.c
@@ -1203,13 +1203,14 @@
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 74c24d0..5252477 100644
--- a/options.c
+++ b/options.c
@@ -1967,6 +1967,13 @@
.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,
.off1 = td_var_offset(clat_percentiles),