Commit 274ac8f1 authored by Jim Harris's avatar Jim Harris Committed by Konrad Sztyber
Browse files

bdev/nvme: show "current": true for all valid IO paths for active/active



The existing code for showing IO path information does not really take
active/active into account.

For active/active, we should show *all* paths which are considered
current. This means we should show current=true for all of the
optimized paths. Or if there are no optimized paths, show current=true
for all of the non-optimized paths.

Signed-off-by: default avatarJim Harris <jim.harris@samsung.com>
Change-Id: Id1f9354584ad179b5e05a45cda9f8f694bc2909a
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/22813


Reviewed-by: default avatarKonrad Sztyber <konrad.sztyber@intel.com>
Reviewed-by: default avatarShuhei Matsumoto <smatsumoto@nvidia.com>
Community-CI: Mellanox Build Bot
Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
parent 8aad2454
Loading
Loading
Loading
Loading
+14 −0
Original line number Diff line number Diff line
@@ -8499,6 +8499,20 @@ nvme_io_path_info_json(struct spdk_json_write_ctx *w, struct nvme_io_path *io_pa
	nbdev_ch = io_path->nbdev_ch;
	if (nbdev_ch == NULL) {
		current = false;
	} else if (nbdev_ch->mp_policy == BDEV_NVME_MP_POLICY_ACTIVE_ACTIVE) {
		struct nvme_io_path *optimized_io_path = NULL;

		STAILQ_FOREACH(optimized_io_path, &nbdev_ch->io_path_list, stailq) {
			if (optimized_io_path->nvme_ns->ana_state == SPDK_NVME_ANA_OPTIMIZED_STATE) {
				break;
			}
		}

		current = nvme_io_path_is_available(io_path);
		if (io_path->nvme_ns->ana_state == SPDK_NVME_ANA_NON_OPTIMIZED_STATE) {
			/* A non-optimized path is only current if there are no optimized paths. */
			current = current && (optimized_io_path == NULL);
		}
	} else {
		current = (io_path == nbdev_ch->current_io_path);
	}