The following changes since commit ea51055cbb2fcbca3935e25c78e8b6d358ca2b3f: zbd: ensure that global max open zones limit is respected (2021-06-29 07:43:30 -0600) are available in the Git repository at: git://git.kernel.dk/fio.git master for you to fetch changes up to 77c72e0f504364adf6a0e8f1155fdf3fd68ef248: Merge branch 'dedupe_bugfix' of https://github.com/bardavid/fio (2021-07-01 13:27:39 -0600) ---------------------------------------------------------------- Bar David (1): dedupe: fixing bug with subsequent dedupe buffer generation Jens Axboe (1): Merge branch 'dedupe_bugfix' of https://github.com/bardavid/fio fio.h | 1 + io_u.c | 12 ++++++++++-- 2 files changed, 11 insertions(+), 2 deletions(-) --- Diff of recent changes: diff --git a/fio.h b/fio.h index b05cb3df..83334652 100644 --- a/fio.h +++ b/fio.h @@ -259,6 +259,7 @@ struct thread_data { struct frand_state buf_state; struct frand_state buf_state_prev; + struct frand_state buf_state_ret; struct frand_state dedupe_state; struct frand_state zone_state; struct frand_state prio_state; diff --git a/io_u.c b/io_u.c index b421a579..b60488a3 100644 --- a/io_u.c +++ b/io_u.c @@ -2182,8 +2182,16 @@ static struct frand_state *get_buf_state(struct thread_data *td) v = rand_between(&td->dedupe_state, 1, 100); - if (v <= td->o.dedupe_percentage) - return &td->buf_state_prev; + if (v <= td->o.dedupe_percentage) { + /* + * The caller advances the returned frand_state. + * A copy of prev should be returned instead since + * a subsequent intention to generate a deduped buffer + * might result in generating a unique one + */ + frand_copy(&td->buf_state_ret, &td->buf_state_prev); + return &td->buf_state_ret; + } return &td->buf_state; }