Add option for controlling buffer scrambling
authorJens Axboe <axboe@kernel.dk>
Mon, 19 Sep 2011 07:24:44 +0000 (09:24 +0200)
committerJens Axboe <axboe@kernel.dk>
Mon, 19 Sep 2011 07:24:44 +0000 (09:24 +0200)
scramble_buffers bool option, defaults to on.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
HOWTO
fio.1
fio.h
io_u.c
options.c

diff --git a/HOWTO b/HOWTO
index b67a201efd78635953b46ded0538de6110ec3e46..cc2df9b72421486d96d47e2d72220a0a5848c55a 100644 (file)
--- 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 e8fb57f4ca33a2035c445d8ab31dbc5f794fbcc1..dc10b4031d9260817618033dc95218c73c96c446 100644 (file)
--- 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 e93e8f3d31edcaf53feed39d1b74701fe11a59f8..022ba57c2eb0e7b5992ddc133bd947bc10bb2b86 100644 (file)
--- 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 f4c4aa2ca432532d894d61c9559940c7b1ee43b4..5959bf7f0587345bc72e094f085634915bad4fa0 100644 (file)
--- 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.
index 74c24d02d5d4bc200da3cf671c64d363d02e92a4..5252477b6e0756888d6cc3bd42b8dcdc5b492e4b 100644 (file)
--- 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,