bdev/nvme: ctrlr_channel has a list of io_path pointers

This patch enables each nvme_ctrlr_channel to access the underlying
nvme_bdev_channels. This change is used to maintain io_path cache
of nvme_bdev_channel.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I22cd3763da1642d4e68dee3a9273e9cc698a4ca8
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/9893
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Community-CI: Mellanox Build Bot
Reviewed-by: GangCao <gang.cao@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Konrad Sztyber <konrad.sztyber@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
This commit is contained in:
Shuhei Matsumoto 2021-10-15 17:10:42 +09:00 committed by Tomasz Zawadzki
parent f386632dd2
commit 32697257a9
2 changed files with 15 additions and 0 deletions

View File

@ -574,9 +574,13 @@ _bdev_nvme_add_io_path(struct nvme_bdev_channel *nbdev_ch, struct nvme_ns *nvme_
}
io_path->ctrlr_ch = spdk_io_channel_get_ctx(ch);
TAILQ_INSERT_TAIL(&io_path->ctrlr_ch->io_path_list, io_path, tailq);
io_path->nvme_ns = nvme_ns;
io_path->nbdev_ch = nbdev_ch;
STAILQ_INSERT_TAIL(&nbdev_ch->io_path_list, io_path, stailq);
return 0;
}
@ -587,6 +591,7 @@ _bdev_nvme_delete_io_path(struct nvme_bdev_channel *nbdev_ch, struct nvme_io_pat
STAILQ_REMOVE(&nbdev_ch->io_path_list, io_path, nvme_io_path, stailq);
TAILQ_REMOVE(&io_path->ctrlr_ch->io_path_list, io_path, tailq);
ch = spdk_io_channel_from_ctx(io_path->ctrlr_ch);
spdk_put_io_channel(ch);
@ -1750,6 +1755,7 @@ bdev_nvme_create_ctrlr_channel_cb(void *io_device, void *ctx_buf)
#endif
TAILQ_INIT(&ctrlr_ch->pending_resets);
TAILQ_INIT(&ctrlr_ch->io_path_list);
rc = bdev_nvme_create_qpair(ctrlr_ch);
if (rc != 0) {

View File

@ -82,6 +82,7 @@ struct nvme_ns {
struct nvme_bdev_io;
struct nvme_bdev_ctrlr;
struct nvme_bdev;
struct nvme_io_path;
struct nvme_path_id {
struct spdk_nvme_transport_id trid;
@ -164,6 +165,10 @@ struct nvme_ctrlr_channel {
struct nvme_poll_group *group;
TAILQ_HEAD(, spdk_bdev_io) pending_resets;
TAILQ_ENTRY(nvme_ctrlr_channel) tailq;
/* The following is used to update io_path cache of nvme_bdev_channels. */
TAILQ_HEAD(, nvme_io_path) io_path_list;
};
#define nvme_ctrlr_channel_get_ctrlr(ctrlr_ch) \
@ -173,6 +178,10 @@ struct nvme_io_path {
struct nvme_ns *nvme_ns;
struct nvme_ctrlr_channel *ctrlr_ch;
STAILQ_ENTRY(nvme_io_path) stailq;
/* The following are used to update io_path cache of the nvme_bdev_channel. */
struct nvme_bdev_channel *nbdev_ch;
TAILQ_ENTRY(nvme_io_path) tailq;
};
struct nvme_bdev_channel {