steadystate: add free helper
authorJens Axboe <axboe@kernel.dk>
Sat, 2 Dec 2017 16:18:46 +0000 (09:18 -0700)
committerJens Axboe <axboe@kernel.dk>
Sat, 2 Dec 2017 16:18:46 +0000 (09:18 -0700)
Also fix a style issue.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
backend.c
helper_thread.c
steadystate.c
steadystate.h

index 10eb90e..6c805c7 100644 (file)
--- a/backend.c
+++ b/backend.c
@@ -2480,12 +2480,7 @@ int fio_backend(struct sk_out *sk_out)
        }
 
        for_each_td(td, i) {
-               if (td->ss.dur) {
-                       if (td->ss.iops_data != NULL) {
-                               free(td->ss.iops_data);
-                               free(td->ss.bw_data);
-                       }
-               }
+               steadystate_free(td);
                fio_options_free(td);
                if (td->rusage_sem) {
                        fio_mutex_remove(td->rusage_sem);
index 9c6e0a2..64e5a3c 100644 (file)
@@ -134,8 +134,7 @@ static void *helper_thread_main(void *data)
                                        next_ss = STEADYSTATE_MSEC - (since_ss - STEADYSTATE_MSEC);
                                else
                                        next_ss = STEADYSTATE_MSEC;
-                       }
-                       else
+                       } else
                                next_ss = STEADYSTATE_MSEC - since_ss;
                 }
 
index 05ce029..d0abb47 100644 (file)
@@ -6,6 +6,14 @@
 
 bool steadystate_enabled = false;
 
+void steadystate_free(struct thread_data *td)
+{
+       free(td->ss.iops_data);
+       free(td->ss.bw_data);
+       td->ss.iops_data = NULL;
+       td->ss.bw_data = NULL;
+}
+
 static void steadystate_alloc(struct thread_data *td)
 {
        td->ss.bw_data = calloc(td->ss.dur, sizeof(uint64_t));
index eaba0d7..9fd88ee 100644 (file)
@@ -5,6 +5,7 @@
 #include "thread_options.h"
 #include "lib/ieee754.h"
 
+extern void steadystate_free(struct thread_data *);
 extern void steadystate_check(void);
 extern void steadystate_setup(void);
 extern int td_steadystate_init(struct thread_data *);