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 <shuhei.matsumoto.xt@hitachi.com> Change-Id: Ifdbd0af4274081c4be7ab0735eb8bf9ae10e3493 Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8588 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: Tomasz Zawadzki <tomasz.zawadzki@intel.com> Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
This commit is contained in:
parent
3a243b7f38
commit
f1c141fcc8
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user