From 77ff3d60d226ffb5db11dbe1ef5122d16cf81726 Mon Sep 17 00:00:00 2001 From: Changpeng Liu Date: Thu, 23 Dec 2021 20:29:46 +0800 Subject: [PATCH] bdev_malloc: exit early in case of no acceleration task If acceleration tasks are exhausted, then we can exit the submission loop earlier, also print number of IOVs for each R/W request. Change-Id: Ia98ed43b0bb2be229b7c0054f3ade0ad39337b09 Signed-off-by: Changpeng Liu Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/10836 Tested-by: SPDK CI Jenkins Community-CI: Broadcom CI Community-CI: Mellanox Build Bot Reviewed-by: Konrad Sztyber Reviewed-by: Ben Walker Reviewed-by: Aleksey Marchuk --- module/bdev/malloc/bdev_malloc.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/module/bdev/malloc/bdev_malloc.c b/module/bdev/malloc/bdev_malloc.c index 49e641dd0..5c457740e 100644 --- a/module/bdev/malloc/bdev_malloc.c +++ b/module/bdev/malloc/bdev_malloc.c @@ -167,18 +167,20 @@ bdev_malloc_readv(struct malloc_disk *mdisk, struct spdk_io_channel *ch, return; } - SPDK_DEBUGLOG(bdev_malloc, "read %zu bytes from offset %#" PRIx64 "\n", - len, offset); + SPDK_DEBUGLOG(bdev_malloc, "read %zu bytes from offset %#" PRIx64 ", iovcnt=%d\n", + len, offset, iovcnt); task->status = SPDK_BDEV_IO_STATUS_SUCCESS; - task->num_outstanding = iovcnt; + task->num_outstanding = 0; for (i = 0; i < iovcnt; i++) { + task->num_outstanding++; res = spdk_accel_submit_copy(ch, iov[i].iov_base, src, iov[i].iov_len, malloc_done, task); if (res != 0) { malloc_done(task, res); + break; } src += iov[i].iov_len; @@ -201,18 +203,20 @@ bdev_malloc_writev(struct malloc_disk *mdisk, struct spdk_io_channel *ch, return; } - SPDK_DEBUGLOG(bdev_malloc, "wrote %zu bytes to offset %#" PRIx64 "\n", - len, offset); + SPDK_DEBUGLOG(bdev_malloc, "wrote %zu bytes to offset %#" PRIx64 ", iovcnt=%d\n", + len, offset, iovcnt); task->status = SPDK_BDEV_IO_STATUS_SUCCESS; - task->num_outstanding = iovcnt; + task->num_outstanding = 0; for (i = 0; i < iovcnt; i++) { + task->num_outstanding++; res = spdk_accel_submit_copy(ch, dst, iov[i].iov_base, iov[i].iov_len, malloc_done, task); if (res != 0) { malloc_done(task, res); + break; } dst += iov[i].iov_len;