From fc9d5a6ae0c29ae26a8db15f553c7197a3ba9440 Mon Sep 17 00:00:00 2001 From: Jens Axboe Date: Thu, 30 Nov 2017 06:26:21 -0700 Subject: [PATCH] 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 --- io_u.c | 7 ++----- 1 file 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); -- 2.25.1