From: Jens Axboe Date: Mon, 27 Jul 2020 22:00:20 +0000 (-0600) Subject: iolog: ensure that dynamic log entries are at least queue depth sized X-Git-Tag: fio-3.22~17 X-Git-Url: https://git.kernel.dk/?a=commitdiff_plain;h=b5aba537d844f73187eb931179ac59e7da570e7c;p=fio.git iolog: ensure that dynamic log entries are at least queue depth sized Signed-off-by: Jens Axboe --- 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; }