bdev: Add num_retries field in bdev_io

Added new field in bdev_io structure for tracking
number of IO retries. It will be used in future patches.

Signed-off-by: Maciej Szwed <maciej.szwed@intel.com>
Change-Id: I8e002e93f54c9ce39c7af0dd3a1960e6aea93580

Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/479828
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Broadcom SPDK FC-NVMe CI <spdk-ci.pdl@broadcom.com>
Community-CI: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
This commit is contained in:
Maciej Szwed 2020-01-09 13:07:17 +01:00 committed by Tomasz Zawadzki
parent ae43c81a30
commit 91dac0f4d0
2 changed files with 5 additions and 0 deletions

View File

@ -462,6 +462,9 @@ struct spdk_bdev_io {
/** Enumerated value representing the I/O type. */
uint8_t type;
/** Number of IO submission retries */
uint16_t num_retries;
/** A single iovec element for use by this bdev_io. */
struct iovec iov;

View File

@ -2049,6 +2049,7 @@ bdev_io_init(struct spdk_bdev_io *bdev_io,
bdev_io->internal.orig_iovcnt = 0;
bdev_io->internal.orig_md_buf = NULL;
bdev_io->internal.error.nvme.cdw0 = 0;
bdev_io->num_retries = 0;
}
static bool
@ -4304,6 +4305,7 @@ bdev_ch_retry_io(struct spdk_bdev_channel *bdev_ch)
shared_resource->io_outstanding++;
bdev_io->internal.status = SPDK_BDEV_IO_STATUS_PENDING;
bdev_io->internal.error.nvme.cdw0 = 0;
bdev_io->num_retries++;
bdev->fn_table->submit_request(spdk_bdev_io_get_io_channel(bdev_io), bdev_io);
if (bdev_io->internal.status == SPDK_BDEV_IO_STATUS_NOMEM) {
break;