Fix bad min rate check
[fio.git] / fio.c
diff --git a/fio.c b/fio.c
index 70d4b2b166f8208f6081c8544d2173c5ecfeee94..61aabb301d35e4abacbd070f9b528122d8fd3de8 100644 (file)
--- a/fio.c
+++ b/fio.c
@@ -186,6 +186,9 @@ static int __check_min_rate(struct thread_data *td, struct timeval *now,
        unsigned int rate_iops = 0;
        unsigned int rate_iops_min = 0;
 
+       if (!td->o.ratemin[ddir] && !td->o.rate_iops_min[ddir])
+               return 0;
+
        /*
         * allow a 2 second settle period in the beginning
         */
@@ -1368,8 +1371,12 @@ static void run_threads(void)
                         * its own files. so close them, if we opened them
                         * for creation
                         */
-                       for_each_file(td, f, i)
-                               td_io_close_file(td, f);
+                       for_each_file(td, f, i) {
+                               if (fio_file_open(f))
+                                       td_io_close_file(td, f);
+                               else
+                                       assert(f->fd == -1);
+                       }
                }
 
                init_disk_util(td);