From 33c517c57a429ef16c882a0a0d7cffb8a5dea9b2 Mon Sep 17 00:00:00 2001 From: Tomasz Zawadzki Date: Mon, 19 Nov 2018 05:32:04 -0500 Subject: [PATCH] ioat/perf: handle spdk_mempool_get() failure Change-Id: I3b3ca9ce1db609bda59e991f84f511747f49eb87 Signed-off-by: Tomasz Zawadzki Reviewed-on: https://review.gerrithub.io/433825 Chandler-Test-Pool: SPDK Automated Test System Tested-by: SPDK CI Jenkins Reviewed-by: Ben Walker Reviewed-by: Jim Harris --- examples/ioat/perf/perf.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/examples/ioat/perf/perf.c b/examples/ioat/perf/perf.c index bb120e872..f71b80f7a 100644 --- a/examples/ioat/perf/perf.c +++ b/examples/ioat/perf/perf.c @@ -321,7 +321,7 @@ submit_single_xfer(struct ioat_chan_entry *ioat_chan_entry, struct ioat_task *io ioat_chan_entry->current_queue_depth++; } -static void +static int submit_xfers(struct ioat_chan_entry *ioat_chan_entry, uint64_t queue_depth) { while (queue_depth-- > 0) { @@ -331,9 +331,14 @@ submit_xfers(struct ioat_chan_entry *ioat_chan_entry, uint64_t queue_depth) src = spdk_mempool_get(ioat_chan_entry->data_pool); dst = spdk_mempool_get(ioat_chan_entry->data_pool); ioat_task = spdk_mempool_get(ioat_chan_entry->task_pool); + if (!ioat_task) { + fprintf(stderr, "Unable to get ioat_task\n"); + return -1; + } submit_single_xfer(ioat_chan_entry, ioat_task, dst, src); } + return 0; } static int @@ -350,7 +355,9 @@ work_fn(void *arg) t = worker->ctx; while (t != NULL) { /* begin to submit transfers */ - submit_xfers(t, g_user_config.queue_depth); + if (submit_xfers(t, g_user_config.queue_depth) < 0) { + return -1; + } t = t->next; }