Commit 31d684d7 authored by Changpeng Liu's avatar Changpeng Liu Committed by Tomasz Zawadzki
Browse files

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: default avatarChangpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/10836


Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Community-CI: Mellanox Build Bot
Reviewed-by: default avatarKonrad Sztyber <konrad.sztyber@intel.com>
Reviewed-by: default avatarBen Walker <benjamin.walker@intel.com>
Reviewed-by: default avatarAleksey Marchuk <alexeymar@mellanox.com>
parent 8313dbf9
Loading
Loading
Loading
Loading
+10 −6
Original line number Diff line number Diff line
@@ -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;