Fix bug with rwmix and multiple loops over the same set
authorJens Axboe <jens.axboe@oracle.com>
Wed, 3 Jun 2009 08:30:33 +0000 (10:30 +0200)
committerJens Axboe <jens.axboe@oracle.com>
Wed, 3 Jun 2009 08:30:33 +0000 (10:30 +0200)
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
fio.c
fio.h
io_u.c

diff --git a/fio.c b/fio.c
index bdf9fd188dde338bcffe13a4eb43df938993fbf6..6ac8ef057b57ed9f98f35f8dfef5ace8a1af196e 100644 (file)
--- a/fio.c
+++ b/fio.c
@@ -880,7 +880,6 @@ static void reset_io_counters(struct thread_data *td)
        td->zone_bytes = 0;
        td->rate_bytes = 0;
        td->rate_blocks = 0;
        td->zone_bytes = 0;
        td->rate_bytes = 0;
        td->rate_blocks = 0;
-       td->rw_end_set[0] = td->rw_end_set[1] = 0;
 
        td->last_was_sync = 0;
 
 
        td->last_was_sync = 0;
 
@@ -1065,21 +1064,11 @@ static void *thread_main(void *data)
                clear_state = 1;
 
                if (td_read(td) && td->io_bytes[DDIR_READ]) {
                clear_state = 1;
 
                if (td_read(td) && td->io_bytes[DDIR_READ]) {
-                       if (td->rw_end_set[DDIR_READ])
-                               elapsed = utime_since(&td->start,
-                                                     &td->rw_end[DDIR_READ]);
-                       else
-                               elapsed = utime_since_now(&td->start);
-
+                       elapsed = utime_since_now(&td->start);
                        runtime[DDIR_READ] += elapsed;
                }
                if (td_write(td) && td->io_bytes[DDIR_WRITE]) {
                        runtime[DDIR_READ] += elapsed;
                }
                if (td_write(td) && td->io_bytes[DDIR_WRITE]) {
-                       if (td->rw_end_set[DDIR_WRITE])
-                               elapsed = utime_since(&td->start,
-                                                     &td->rw_end[DDIR_WRITE]);
-                       else
-                               elapsed = utime_since_now(&td->start);
-
+                       elapsed = utime_since_now(&td->start);
                        runtime[DDIR_WRITE] += elapsed;
                }
 
                        runtime[DDIR_WRITE] += elapsed;
                }
 
diff --git a/fio.h b/fio.h
index b2e40d22ff4ef507b499b13fa546d3f340b25cf3..0a7281925d1b3e5666a7d65da2c8fe24f1d91860 100644 (file)
--- a/fio.h
+++ b/fio.h
@@ -332,12 +332,10 @@ struct thread_data {
 
        struct timeval start;   /* start of this loop */
        struct timeval epoch;   /* time job was started */
 
        struct timeval start;   /* start of this loop */
        struct timeval epoch;   /* time job was started */
-       struct timeval rw_end[2];
        struct timeval last_issue;
        struct timeval tv_cache;
        unsigned int tv_cache_nr;
        unsigned int tv_cache_mask;
        struct timeval last_issue;
        struct timeval tv_cache;
        unsigned int tv_cache_nr;
        unsigned int tv_cache_mask;
-       unsigned int rw_end_set[2];
        unsigned int ramp_time_over;
 
        /*
        unsigned int ramp_time_over;
 
        /*
diff --git a/io_u.c b/io_u.c
index 5cf2526b35ea4536ac978e1a727ab6bf8e8a6043..40fd1968eb08b4a9e8d1bcd6108ab7b6f780d1fe 100644 (file)
--- a/io_u.c
+++ b/io_u.c
@@ -319,7 +319,6 @@ static enum fio_ddir get_rw_ddir(struct thread_data *td)
                 * Check if it's time to seed a new data direction.
                 */
                if (td->io_issues[td->rwmix_ddir] >= td->rwmix_issues) {
                 * Check if it's time to seed a new data direction.
                 */
                if (td->io_issues[td->rwmix_ddir] >= td->rwmix_issues) {
-                       unsigned long long max_bytes;
                        enum fio_ddir ddir;
 
                        /*
                        enum fio_ddir ddir;
 
                        /*
@@ -328,16 +327,6 @@ static enum fio_ddir get_rw_ddir(struct thread_data *td)
                         * ranges too much
                         */
                        ddir = get_rand_ddir(td);
                         * ranges too much
                         */
                        ddir = get_rand_ddir(td);
-                       max_bytes = td->this_io_bytes[ddir];
-                       if (max_bytes >=
-                           (td->o.size * td->o.rwmix[ddir] / 100)) {
-                               if (!td->rw_end_set[ddir]) {
-                                       td->rw_end_set[ddir] = 1;
-                                       fio_gettime(&td->rw_end[ddir], NULL);
-                               }
-
-                               ddir ^= 1;
-                       }
 
                        if (ddir != td->rwmix_ddir)
                                set_rwmix_bytes(td);
 
                        if (ddir != td->rwmix_ddir)
                                set_rwmix_bytes(td);