Scramble IO buffers unless explicitly told not
[fio.git] / io_u.c
diff --git a/io_u.c b/io_u.c
index f61fee8cb32240d2d85929eb0d131b009ec0d47d..a45dd4021c4e161f945367a3aec59dde0ebd4c57 100644 (file)
--- a/io_u.c
+++ b/io_u.c
@@ -590,9 +590,6 @@ static enum fio_ddir rate_ddir(struct thread_data *td, enum fio_ddir ddir)
        if (td_rw(td) && __should_check_rate(td, odir))
                td->rate_pending_usleep[odir] -= usec;
 
-       if (ddir == DDIR_TRIM)
-               return DDIR_TRIM;
-
        return ddir;
 }
 
@@ -1487,7 +1484,8 @@ struct io_u *get_io_u(struct thread_data *td)
                                io_u_fill_buffer(td, io_u,
                                        td->o.min_bs[DDIR_WRITE],
                                        io_u->xfer_buflen);
-                       } else if ((td->flags & TD_F_SCRAMBLE_BUFFERS) &&
+                       }
+                       if ((td->flags & TD_F_SCRAMBLE_BUFFERS) &&
                                   !(td->flags & TD_F_COMPRESS))
                                do_scramble = 1;
                        if (td->flags & TD_F_VER_NONE) {
@@ -1898,8 +1896,10 @@ void fill_io_buffer(struct thread_data *td, void *buf, unsigned int min_write,
                } while (left);
        } else if (o->buffer_pattern_bytes)
                fill_buffer_pattern(td, buf, max_bs);
-       else
+       else if (o->zero_buffers)
                memset(buf, 0, max_bs);
+       else
+               fill_random_buf(get_buf_state(td), buf, max_bs);
 }
 
 /*