From: Omar Sandoval Date: Wed, 5 Oct 2016 22:15:27 +0000 (-0700) Subject: iolog: fix --bandwidth-log segfaults X-Git-Tag: fio-2.15~21 X-Git-Url: https://git.kernel.dk/?p=fio.git;a=commitdiff_plain;h=a9179eebb0e70013b4a7be0073c9c55efdd6058c;ds=sidebyside iolog: fix --bandwidth-log segfaults The global bandwidth log doesn't have thread data. Fixes: 1e613c9c2393 ("This commit / feature adds completion latency histogram output to fio") Fixes: 3aea75b14510 ("Option for changing log files to use Unix epoch") Signed-off-by: Omar Sandoval Signed-off-by: Jens Axboe --- diff --git a/iolog.c b/iolog.c index 6576ca55..ab9c8788 100644 --- a/iolog.c +++ b/iolog.c @@ -1065,7 +1065,7 @@ void flush_log(struct io_log *log, bool do_append) cur_log = flist_first_entry(&log->io_logs, struct io_logs, list); flist_del_init(&cur_log->list); - if (log == log->td->clat_hist_log) + if (log->td && log == log->td->clat_hist_log) flush_hist_samples(f, log->hist_coarseness, cur_log->log, log_sample_sz(log, cur_log)); else diff --git a/stat.c b/stat.c index 3c72a6cd..1e889f53 100644 --- a/stat.c +++ b/stat.c @@ -2023,7 +2023,7 @@ static void __add_log_sample(struct io_log *iolog, unsigned long val, s = get_sample(iolog, cur_log, cur_log->nr_samples); s->val = val; - s->time = t + iolog->td->unix_epoch; + s->time = t + (iolog->td ? iolog->td->unix_epoch : 0); io_sample_set_ddir(iolog, s, ddir); s->bs = bs;