From 315fcfec5f22d6c0d059c4c3b70eaed53237eb5f Mon Sep 17 00:00:00 2001 From: Jens Axboe Date: Fri, 8 Feb 2013 19:05:25 +0100 Subject: [PATCH] Fix rate limiting Commit e0224c6b accidentally broke rate limiting, since it bypassed the sleep logic. Rework it slightly to not skip that. Signed-off-by: Jens Axboe --- io_u.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/io_u.c b/io_u.c index 65988819..1013c7fd 100644 --- a/io_u.c +++ b/io_u.c @@ -490,14 +490,14 @@ static enum fio_ddir rate_ddir(struct thread_data *td, enum fio_ddir ddir) assert(ddir_rw(ddir)); - if (td->rate_pending_usleep[ddir] <= 0 || !td->o.rwmix[odir]) + if (td->rate_pending_usleep[ddir] <= 0) return ddir; /* * We have too much pending sleep in this direction. See if we * should switch. */ - if (td_rw(td)) { + if (td_rw(td) && td->o.rwmix[odir]) { /* * Other direction does not have too much pending, switch */ -- 2.25.1