dedupe: if percentage is 100, don't go through random + math
authorJens Axboe <axboe@fb.com>
Mon, 22 Sep 2014 20:20:05 +0000 (14:20 -0600)
committerJens Axboe <axboe@fb.com>
Mon, 22 Sep 2014 20:20:05 +0000 (14:20 -0600)
Signed-off-by: Jens Axboe <axboe@fb.com>
io_u.c

diff --git a/io_u.c b/io_u.c
index af3b415160609d9dbb5317ef27c4d67d004be23b..eac871bfe9d91890e70e9110bd575e9a725b1a4c 100644 (file)
--- a/io_u.c
+++ b/io_u.c
@@ -1838,6 +1838,8 @@ static struct frand_state *get_buf_state(struct thread_data *td)
 
        if (!td->o.dedupe_percentage)
                return &td->buf_state;
+       else if (td->o.dedupe_percentage == 100)
+               return &td->buf_state_prev;
 
        r = __rand(&td->dedupe_state);
        v = 1 + (int) (100.0 * (r / (FRAND_MAX + 1.0)));