bdev/nvme:Print multiple namespace attributes of nvme bdev in bdev_get_bdevs

Current code only print the last namespace of nvme bdev, fix the print
way to show all the namespace.

And this patch will be prepared for the next patch to show io path status for multipath, like: which one is the primary or the backup, and the old status and current status,etc.

Signed-off-by: tanlong <948985618@qq.com>
Change-Id: I4fca154df52c929b8d046198934db0e58586c378
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/10140
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Community-CI: Mellanox Build Bot
This commit is contained in:
tanlong 2021-11-07 21:16:40 -05:00 committed by Jim Harris
parent 1421a35e44
commit 0cedafeb63

View File

@ -1931,7 +1931,7 @@ nvme_namespace_info_json(struct spdk_json_write_ctx *w,
trid = spdk_nvme_ctrlr_get_transport_id(ctrlr);
vs = spdk_nvme_ctrlr_get_regs_vs(ctrlr);
spdk_json_write_named_object_begin(w, "nvme");
spdk_json_write_object_begin(w);
if (trid->trtype == SPDK_NVME_TRANSPORT_PCIE) {
spdk_json_write_named_string(w, "pci_address", trid->traddr);
@ -2025,9 +2025,11 @@ bdev_nvme_dump_info_json(void *ctx, struct spdk_json_write_ctx *w)
struct nvme_ns *nvme_ns;
pthread_mutex_lock(&nvme_bdev->mutex);
spdk_json_write_named_array_begin(w, "nvme");
TAILQ_FOREACH(nvme_ns, &nvme_bdev->nvme_ns_list, tailq) {
nvme_namespace_info_json(w, nvme_ns);
}
spdk_json_write_array_end(w);
pthread_mutex_unlock(&nvme_bdev->mutex);
return 0;