Skip to content

Commit

Permalink
iolog: ensure that dynamic log entries are at least queue depth sized
Browse files Browse the repository at this point in the history
Signed-off-by: Jens Axboe <axboe@kernel.dk>
  • Loading branch information
axboe committed Jul 27, 2020
1 parent 6d975f2 commit b5aba53
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion iolog.c
Expand Up @@ -19,6 +19,7 @@
#include "smalloc.h"
#include "blktrace.h"
#include "pshared.h"
#include "lib/roundup.h"

#include <netinet/in.h>
#include <netinet/tcp.h>
Expand Down Expand Up @@ -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;
}
Expand Down

0 comments on commit b5aba53

Please sign in to comment.