iolog: cleanup log writing
authorJens Axboe <axboe@fb.com>
Tue, 8 Dec 2015 22:17:27 +0000 (15:17 -0700)
committerJens Axboe <axboe@fb.com>
Tue, 8 Dec 2015 22:17:27 +0000 (15:17 -0700)
Signed-off-by: Jens Axboe <axboe@fb.com>
iolog.c

diff --git a/iolog.c b/iolog.c
index 961c9171f72f21654f17cc84f7ef07c8683b7991..b8330bd9470b70bf336b0e5fd96bc1299ca6a392 100644 (file)
--- a/iolog.c
+++ b/iolog.c
@@ -1205,54 +1205,37 @@ void iolog_compress_exit(struct thread_data *td)
 
 #endif
 
-static int write_iops_log(struct thread_data *td, int try)
+static int __write_log(struct thread_data *td, struct io_log *log, int try)
 {
-       struct io_log *log = td->iops_log;
+       if (log)
+               return finish_log(td, log, try);
 
-       if (!log)
-               return 0;
+       return 0;
+}
 
-       return finish_log(td, log, try);
+static int write_iops_log(struct thread_data *td, int try)
+{
+       return __write_log(td, td->iops_log, try);
 }
 
 static int write_slat_log(struct thread_data *td, int try)
 {
-       struct io_log *log = td->slat_log;
-
-       if (!log)
-               return 0;
-
-       return finish_log(td, log, try);
+       return __write_log(td, td->slat_log, try);
 }
 
 static int write_clat_log(struct thread_data *td, int try)
 {
-       struct io_log *log = td->clat_log;
-
-       if (!log)
-               return 0;
-
-       return finish_log(td, log, try);
+       return __write_log(td, td->clat_log, try);
 }
 
 static int write_lat_log(struct thread_data *td, int try)
 {
-       struct io_log *log = td->lat_log;
-
-       if (!log)
-               return 0;
-
-       return finish_log(td, log, try);
+       return __write_log(td, td->lat_log, try);
 }
 
 static int write_bandw_log(struct thread_data *td, int try)
 {
-       struct io_log *log = td->bw_log;
-
-       if (!log)
-               return 0;
-
-       return finish_log(td, log, try);
+       return __write_log(td, td->bw_log, try);
 }
 
 enum {