From 04c540d9504fa81608952d6e2ce6b47066d2566c Mon Sep 17 00:00:00 2001 From: Jens Axboe Date: Wed, 28 May 2008 10:35:26 +0200 Subject: [PATCH] Fixup distribution of reads and writes in a mixed workload Signed-off-by: Jens Axboe --- io_u.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/io_u.c b/io_u.c index c3939b32..b10e83ee 100644 --- a/io_u.c +++ b/io_u.c @@ -258,7 +258,6 @@ static unsigned int get_next_buflen(struct thread_data *td, struct io_u *io_u) static void set_rwmix_bytes(struct thread_data *td) { - unsigned long issues; unsigned int diff; /* @@ -266,11 +265,8 @@ static void set_rwmix_bytes(struct thread_data *td) * buffered writes may issue a lot quicker than they complete, * whereas reads do not. */ - issues = td->io_issues[td->rwmix_ddir] - td->rwmix_issues; diff = td->o.rwmix[td->rwmix_ddir ^ 1]; - - td->rwmix_issues = td->io_issues[td->rwmix_ddir] - + (issues * ((100 - diff)) / diff); + td->rwmix_issues = (td->io_issues[td->rwmix_ddir] * diff) / 100; } static inline enum fio_ddir get_rand_ddir(struct thread_data *td) @@ -280,7 +276,7 @@ static inline enum fio_ddir get_rand_ddir(struct thread_data *td) r = os_random_long(&td->rwmix_state); v = 1 + (int) (100.0 * (r / (RAND_MAX + 1.0))); - if (v < td->o.rwmix[DDIR_READ]) + if (v <= td->o.rwmix[DDIR_READ]) return DDIR_READ; return DDIR_WRITE; -- 2.25.1