Don't scramble buffers if compression is enabled
authorJens Axboe <axboe@fb.com>
Fri, 14 Mar 2014 18:24:28 +0000 (12:24 -0600)
committerJens Axboe <axboe@fb.com>
Fri, 14 Mar 2014 18:24:28 +0000 (12:24 -0600)
For the other buffer settings (like patterns, or whether always
to refill or not), we don't do the slight header scramble if
they are enabled. Do they same for compression settings, otherwise
we can skew the compression results.

Signed-off-by: Jens Axboe <axboe@fb.com>
init.c

diff --git a/init.c b/init.c
index 73ec9eb22a8d2f36ff773f4e468fb1c4e3744bd5..0a872c0f1eed90eb05c05b89abeaab5a7fa104a7 100644 (file)
--- a/init.c
+++ b/init.c
@@ -856,6 +856,11 @@ int ioengine_load(struct thread_data *td)
        return 0;
 }
 
+static int compression_enabled(struct thread_options *o)
+{
+       return o->compress_percentage || o->compress_chunk;
+}
+
 static void init_flags(struct thread_data *td)
 {
        struct thread_options *o = &td->o;
@@ -868,8 +873,14 @@ static void init_flags(struct thread_data *td)
                td->flags |= TD_F_READ_IOLOG;
        if (o->refill_buffers)
                td->flags |= TD_F_REFILL_BUFFERS;
-       if (o->scramble_buffers)
+
+       /*
+        * Don't scramble buffers if we set any of the compression
+        * settings
+        */
+       if (o->scramble_buffers && !compression_enabled(o))
                td->flags |= TD_F_SCRAMBLE_BUFFERS;
+
        if (o->verify != VERIFY_NONE)
                td->flags |= TD_F_VER_NONE;
 }