From b5aba537d844f73187eb931179ac59e7da570e7c Mon Sep 17 00:00:00 2001 From: Jens Axboe Date: Mon, 27 Jul 2020 16:00:20 -0600 Subject: [PATCH] iolog: ensure that dynamic log entries are at least queue depth sized Signed-off-by: Jens Axboe --- iolog.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/iolog.c b/iolog.c index 4a79fc46..4af10da3 100644 --- a/iolog.c +++ b/iolog.c @@ -19,6 +19,7 @@ #include "smalloc.h" #include "blktrace.h" #include "pshared.h" +#include "lib/roundup.h" #include #include @@ -748,10 +749,13 @@ void setup_log(struct io_log **log, struct log_params *p, } if (l->td && l->td->o.io_submit_mode != IO_MODE_OFFLOAD) { + unsigned int def_samples = DEF_LOG_ENTRIES; struct io_logs *__p; __p = calloc(1, sizeof(*l->pending)); - __p->max_samples = DEF_LOG_ENTRIES; + if (l->td->o.iodepth > DEF_LOG_ENTRIES) + def_samples = roundup_pow2(l->td->o.iodepth); + __p->max_samples = def_samples; __p->log = calloc(__p->max_samples, log_entry_sz(l)); l->pending = __p; } -- 2.25.1