From f1c141fcc8242438b30a26900b2a7b562ab276c7 Mon Sep 17 00:00:00 2001 From: Shuhei Matsumoto Date: Fri, 2 Jul 2021 10:07:32 +0900 Subject: [PATCH] bdev/nvme: Get ctrlr via io_channel_iter_get_io_device() at reset process nvme_ctrlr will be registered as io_device even when multipath is supported. Hence while spdk_for_each_channel() is executed in reset processing, we can get nvme_ctrlr both spdk_io_channel_iter_get_ctx() and spdk_io_channel_iter_get_io_device(). This duplication is not necessary. Use spdk_io_channel_iter_get_io_device() and pass NULL to the context parameter of spdk_for_each_channel() for clarification. Signed-off-by: Shuhei Matsumoto Change-Id: Ifdbd0af4274081c4be7ab0735eb8bf9ae10e3493 Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8588 Tested-by: SPDK CI Jenkins Community-CI: Broadcom CI Community-CI: Mellanox Build Bot Reviewed-by: Tomasz Zawadzki Reviewed-by: Aleksey Marchuk --- module/bdev/nvme/bdev_nvme.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/module/bdev/nvme/bdev_nvme.c b/module/bdev/nvme/bdev_nvme.c index ca853ff6b6..49ef678c12 100644 --- a/module/bdev/nvme/bdev_nvme.c +++ b/module/bdev/nvme/bdev_nvme.c @@ -459,7 +459,7 @@ _bdev_nvme_check_pending_destruct(struct nvme_ctrlr *nvme_ctrlr) static void bdev_nvme_check_pending_destruct(struct spdk_io_channel_iter *i, int status) { - struct nvme_ctrlr *nvme_ctrlr = spdk_io_channel_iter_get_ctx(i); + struct nvme_ctrlr *nvme_ctrlr = spdk_io_channel_iter_get_io_device(i); _bdev_nvme_check_pending_destruct(nvme_ctrlr); } @@ -538,14 +538,14 @@ bdev_nvme_reset_complete(struct nvme_ctrlr *nvme_ctrlr, int rc) spdk_for_each_channel(nvme_ctrlr, rc == 0 ? bdev_nvme_complete_pending_resets : bdev_nvme_abort_pending_resets, - nvme_ctrlr, + NULL, bdev_nvme_check_pending_destruct); } static void bdev_nvme_reset_create_qpairs_done(struct spdk_io_channel_iter *i, int status) { - struct nvme_ctrlr *nvme_ctrlr = spdk_io_channel_iter_get_ctx(i); + struct nvme_ctrlr *nvme_ctrlr = spdk_io_channel_iter_get_io_device(i); bdev_nvme_reset_complete(nvme_ctrlr, status); } @@ -565,7 +565,7 @@ bdev_nvme_reset_create_qpair(struct spdk_io_channel_iter *i) static void bdev_nvme_reset_ctrlr(struct spdk_io_channel_iter *i, int status) { - struct nvme_ctrlr *nvme_ctrlr = spdk_io_channel_iter_get_ctx(i); + struct nvme_ctrlr *nvme_ctrlr = spdk_io_channel_iter_get_io_device(i); int rc; if (status) { @@ -581,7 +581,7 @@ bdev_nvme_reset_ctrlr(struct spdk_io_channel_iter *i, int status) /* Recreate all of the I/O queue pairs */ spdk_for_each_channel(nvme_ctrlr, bdev_nvme_reset_create_qpair, - nvme_ctrlr, + NULL, bdev_nvme_reset_create_qpairs_done); return; @@ -620,7 +620,7 @@ bdev_nvme_reset(struct nvme_ctrlr *nvme_ctrlr) /* First, delete all NVMe I/O queue pairs. */ spdk_for_each_channel(nvme_ctrlr, bdev_nvme_reset_destroy_qpair, - nvme_ctrlr, + NULL, bdev_nvme_reset_ctrlr); return 0; @@ -719,7 +719,7 @@ bdev_nvme_failover(struct nvme_ctrlr *nvme_ctrlr, bool remove) /* First, delete all NVMe I/O queue pairs. */ spdk_for_each_channel(nvme_ctrlr, bdev_nvme_reset_destroy_qpair, - nvme_ctrlr, + NULL, bdev_nvme_reset_ctrlr); } else if (rc != -EBUSY) { return rc;