The following changes since commit 23f394d5d70902c6f1d71ac03fa1d70e13c9c0b9: Scramble on a 512b boundary (2011-09-16 22:47:15 +0200) are available in the git repository at: git://git.kernel.dk/fio.git master Jens Axboe (2): Add option for controlling buffer scrambling Scramble fix HOWTO | 7 +++++++ fio.1 | 7 +++++++ fio.h | 1 + io_u.c | 23 ++++++++++++++--------- options.c | 7 +++++++ 5 files changed, 36 insertions(+), 9 deletions(-) --- Diff of recent changes: diff --git a/HOWTO b/HOWTO index b67a201..cc2df9b 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 e8fb57f..dc10b40 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 e93e8f3..022ba57 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 f4c4aa2..38efcc1 100644 --- a/io_u.c +++ b/io_u.c @@ -1129,6 +1129,7 @@ static int check_get_verify(struct thread_data *td, struct io_u *io_u) static void small_content_scramble(struct io_u *io_u) { unsigned int i, nr_blocks = io_u->buflen / 512; + unsigned long long boffset; unsigned int offset; void *p, *end; @@ -1136,20 +1137,23 @@ static void small_content_scramble(struct io_u *io_u) return; p = io_u->xfer_buf; + boffset= io_u->offset; + for (i = 0; i < nr_blocks; i++) { /* * Fill the byte offset into a "random" start offset of * the buffer, given by the product of the usec time * and the actual offset. */ - offset = (io_u->start_time.tv_usec * io_u->offset) & 511; + offset = (io_u->start_time.tv_usec ^ boffset) & 511; if (offset >= 512 - sizeof(unsigned long long)) offset -= sizeof(unsigned long long); - *((unsigned long long *) p + offset) = io_u->offset; + *((unsigned long long *) p + offset) = boffset; end = p + 512 - sizeof(io_u->start_time); memcpy(end, &io_u->start_time, sizeof(io_u->start_time)); p += 512; + boffset += 512; } } @@ -1203,13 +1207,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 74c24d0..5252477 100644 --- a/options.c +++ b/options.c @@ -1967,6 +1967,13 @@ static struct fio_option options[FIO_MAX_OPTS] = { .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), -- To unsubscribe from this list: send the line "unsubscribe fio" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html