From a9afa45a6162ef29fde55e7e992fa5f574c4e4d5 Mon Sep 17 00:00:00 2001 From: Jens Axboe Date: Fri, 20 May 2016 13:57:42 -0600 Subject: [PATCH] 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 --- iolog.c | 2 +- stat.c | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) 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; -- 2.25.1