Add buffer_compress_chunk option
authorJens Axboe <axboe@kernel.dk>
Fri, 9 Mar 2012 18:06:24 +0000 (19:06 +0100)
committerJens Axboe <axboe@kernel.dk>
Fri, 9 Mar 2012 18:06:24 +0000 (19:06 +0100)
Instead of doing bs/2 of incompressible and zeroed data for a 50%
compression setting, use the smaller chunk size specified by
this option.

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

diff --git a/fio.h b/fio.h
index 7443bc06bdd510f79a5b3a550ea41d6d0e953874..4afdd2d469a1de480b7bea19262bfb7f93565b71 100644 (file)
--- a/fio.h
+++ b/fio.h
@@ -195,6 +195,7 @@ struct thread_options {
        unsigned int refill_buffers;
        unsigned int scramble_buffers;
        unsigned int compress_percentage;
+       unsigned int compress_chunk;
        unsigned int time_based;
        unsigned int disable_lat;
        unsigned int disable_clat;
diff --git a/io_u.c b/io_u.c
index ca33e589c6500f36a76e75cbdadc98a73ef4750f..a0020d27b427e9bc21b184238898ac89bddd1e0c 100644 (file)
--- a/io_u.c
+++ b/io_u.c
@@ -1544,8 +1544,11 @@ void io_u_fill_buffer(struct thread_data *td, struct io_u *io_u,
                unsigned int perc = td->o.compress_percentage;
 
                if (perc) {
+                       unsigned int seg = min_write;
+
+                       seg = min(min_write, td->o.compress_chunk);
                        fill_random_buf_percentage(&td->buf_state, io_u->buf,
-                                               perc, min_write, max_bs);
+                                               perc, seg, max_bs);
                } else
                        fill_random_buf(&td->buf_state, io_u->buf, max_bs);
        } else
index 8034cd7dad755b58c5f546e64fb083be79ec49a4..068065966bcf7d910f36666ecc140035f92af8a9 100644 (file)
--- a/options.c
+++ b/options.c
@@ -2021,6 +2021,12 @@ static struct fio_option options[FIO_MAX_OPTS] = {
                .minval = 1,
                .help   = "How compressible the buffer is (approximately)",
        },
+       {
+               .name   = "buffer_compress_chunk",
+               .type   = FIO_OPT_INT,
+               .off1   = td_var_offset(compress_chunk),
+               .help   = "Size of compressible region in buffer",
+       },
        {
                .name   = "clat_percentiles",
                .type   = FIO_OPT_BOOL,