From: Jens Axboe Date: Fri, 20 May 2016 19:57:42 +0000 (-0600) Subject: iolog: fix two bugs in deferred growing X-Git-Tag: fio-2.10~2 X-Git-Url: https://git.kernel.dk/?p=fio.git;a=commitdiff_plain;h=a9afa45a6162ef29fde55e7e992fa5f574c4e4d5 iolog: fix two bugs in deferred growing 1) Setup a new current log, if the log doesn't have one. 2) Bump size of pending log. Should be depth + 1, let's just use the default size of a log (1024). Signed-off-by: Jens Axboe --- diff --git a/iolog.c b/iolog.c index 3723e0a8..d9a17a5b 100644 --- a/iolog.c +++ b/iolog.c @@ -591,7 +591,7 @@ void setup_log(struct io_log **log, struct log_params *p, struct io_logs *p; p = calloc(1, sizeof(*l->pending)); - p->max_samples = l->td->o.iodepth; + p->max_samples = DEF_LOG_ENTRIES; p->log = calloc(p->max_samples, log_entry_sz(l)); l->pending = p; } diff --git a/stat.c b/stat.c index f55cb2f5..146090e7 100644 --- a/stat.c +++ b/stat.c @@ -1901,6 +1901,12 @@ static struct io_logs *regrow_log(struct io_log *iolog) return NULL; cur_log = iolog_cur_log(iolog); + if (!cur_log) { + cur_log = get_new_log(iolog); + if (!cur_log) + return NULL; + } + if (cur_log->nr_samples < cur_log->max_samples) return cur_log;