Fix default scrambling of buffers
Commit 1bf2498d3111 inadvertently made us not scramble by default.
The logic was a bit convoluted, so clear it up and scramble if:
- Asked so by adding scramble_buffers=1
- Or, if not asked to explicitly, but zero_buffers not set to 1.
Reported-by: Chris Wilson <Chris.Wilson@nutanix.com>
Signed-off-by: Jens Axboe <firstname.lastname@example.org>
diff --git a/init.c b/init.c
index 427768c..d3dec0a 100644
@@ -933,12 +933,16 @@
td->flags |= TD_F_REFILL_BUFFERS;
- * Scramble by default, but not if zero_buffer is true and has been
- * set. But if scramble_buffers has been set, always scramble.
+ * Always scramble buffers if asked to
- if (o->scramble_buffers && ((!o->zero_buffers &&
- fio_option_is_set(o, zero_buffers)) ||
- fio_option_is_set(o, scramble_buffers)))
+ if (o->scramble_buffers && fio_option_is_set(o, scramble_buffers))
+ td->flags |= TD_F_SCRAMBLE_BUFFERS;
+ * But also scramble buffers, unless we were explicitly asked
+ * to zero them.
+ if (o->scramble_buffers && !(o->zero_buffers &&
+ fio_option_is_set(o, zero_buffers)))
td->flags |= TD_F_SCRAMBLE_BUFFERS;
if (o->verify != VERIFY_NONE)
td->flags |= TD_F_VER_NONE;