From 1c725e7021966a25ad1943ef396cf2c9990a7c55 Mon Sep 17 00:00:00 2001 From: Jens Axboe Date: Tue, 8 Dec 2015 15:17:27 -0700 Subject: [PATCH] iolog: cleanup log writing Signed-off-by: Jens Axboe --- iolog.c | 41 ++++++++++++----------------------------- 1 file changed, 12 insertions(+), 29 deletions(-) diff --git a/iolog.c b/iolog.c index 961c9171..b8330bd9 100644 --- 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 { -- 2.25.1