Commit 0869265d authored by Shuhei Matsumoto's avatar Shuhei Matsumoto Committed by Tomasz Zawadzki
Browse files

bdev/nvme: Factor out searching io_path operation from find_io_path()



Signed-off-by: default avatarShuhei Matsumoto <smatsumoto@nvidia.com>
Change-Id: I26939b39cfd4b92bdbc1d4ef10961ba35145043c
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/12000


Community-CI: Mellanox Build Bot
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarBen Walker <benjamin.walker@intel.com>
Reviewed-by: default avatarDong Yi <dongx.yi@intel.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
Reviewed-by: default avatarAleksey Marchuk <alexeymar@nvidia.com>
parent 22b77a3c
Loading
Loading
Loading
Loading
+12 −6
Original line number Diff line number Diff line
@@ -825,15 +825,11 @@ nvme_ctrlr_is_available(struct nvme_ctrlr *nvme_ctrlr)
	return true;
}

static inline struct nvme_io_path *
bdev_nvme_find_io_path(struct nvme_bdev_channel *nbdev_ch)
static struct nvme_io_path *
_bdev_nvme_find_io_path(struct nvme_bdev_channel *nbdev_ch)
{
	struct nvme_io_path *io_path, *non_optimized = NULL;

	if (spdk_likely(nbdev_ch->current_io_path != NULL)) {
		return nbdev_ch->current_io_path;
	}

	STAILQ_FOREACH(io_path, &nbdev_ch->io_path_list, stailq) {
		if (spdk_unlikely(!nvme_io_path_is_connected(io_path))) {
			/* The device is currently resetting. */
@@ -861,6 +857,16 @@ bdev_nvme_find_io_path(struct nvme_bdev_channel *nbdev_ch)
	return non_optimized;
}

static inline struct nvme_io_path *
bdev_nvme_find_io_path(struct nvme_bdev_channel *nbdev_ch)
{
	if (spdk_unlikely(nbdev_ch->current_io_path == NULL)) {
		return _bdev_nvme_find_io_path(nbdev_ch);
	}

	return nbdev_ch->current_io_path;
}

/* Return true if there is any io_path whose qpair is active or ctrlr is not failed,
 * or false otherwise.
 *