summaryrefslogtreecommitdiff
path: root/io_u.c
diff options
context:
space:
mode:
authorJens Axboe <axboe@kernel.dk>2017-11-30 06:26:21 -0700
committerJens Axboe <axboe@kernel.dk>2017-11-30 06:26:21 -0700
commitfc9d5a6ae0c29ae26a8db15f553c7197a3ba9440 (patch)
tree588b30d04de5a5a0b10b9cbe1194ac19fcf5f4d3 /io_u.c
parent6c3fb04c80c3c241162e743a54761e5e896d4ba2 (diff)
downloadfio-fc9d5a6ae0c29ae26a8db15f553c7197a3ba9440.tar.gz
fio-fc9d5a6ae0c29ae26a8db15f553c7197a3ba9440.tar.bz2
io_u: use nsec value for buffer scramble
Just use the nanosecond value directly, it's pointless to shift it down and lose 10 bits with of scrambling data. Fixes: d5d3795c ("io_u: don't do expensive int divide for buffer scramble") Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'io_u.c')
-rw-r--r--io_u.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/io_u.c b/io_u.c
index ebe82e12..8087bd6a 100644
--- a/io_u.c
+++ b/io_u.c
@@ -1673,8 +1673,8 @@ static bool 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;
- uint64_t boffset, usec;
unsigned int offset;
+ uint64_t boffset;
char *p, *end;
if (!nr_blocks)
@@ -1684,16 +1684,13 @@ static void small_content_scramble(struct io_u *io_u)
boffset = io_u->offset;
io_u->buf_filled_len = 0;
- /* close enough for this purpose */
- usec = io_u->start_time.tv_nsec >> 10;
-
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 = (usec ^ boffset) & 511;
+ offset = (io_u->start_time.tv_nsec ^ boffset) & 511;
offset &= ~(sizeof(uint64_t) - 1);
if (offset >= 512 - sizeof(uint64_t))
offset -= sizeof(uint64_t);