Fix Runtime, IOPS, bandwidth recorded incorrectly
[fio.git] / io_u.c
diff --git a/io_u.c b/io_u.c
index 50644850463f3e212381ff552f88ce056b5d83b9..d00e6e3fe44a593033670cd5f226fa07395a5698 100644 (file)
--- a/io_u.c
+++ b/io_u.c
@@ -1896,8 +1896,10 @@ 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;
+       else if (td->o.dedupe_percentage == 100) {
+               frand_copy(&td->buf_state_prev, &td->buf_state);
+               return &td->buf_state;
+       }
 
        r = __rand(&td->dedupe_state);
        v = 1 + (int) (100.0 * (r / (FRAND_MAX + 1.0)));
@@ -1910,7 +1912,9 @@ static struct frand_state *get_buf_state(struct thread_data *td)
 
 static void save_buf_state(struct thread_data *td, struct frand_state *rs)
 {
-       if (rs == &td->buf_state)
+       if (td->o.dedupe_percentage == 100)
+               frand_copy(rs, &td->buf_state_prev);
+       else if (rs == &td->buf_state)
                frand_copy(&td->buf_state_prev, rs);
 }