bdev/nvme: Factor out clearing all I/O path caches into a helper function

This is a preparation to the following patches.

Change-Id: I1bb0052c745d4f83ff621e4110907a8ac1f1d597
Signed-off-by: Shuhei Matsumoto <smatsumoto@nvidia.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/11330
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
This commit is contained in:
Shuhei Matsumoto 2022-03-09 15:58:29 +09:00 committed by Tomasz Zawadzki
parent 3182be6d26
commit 3edbcba287

View File

@ -1096,6 +1096,29 @@ _bdev_nvme_clear_io_path_cache(struct nvme_qpair *nvme_qpair)
} }
} }
static void
bdev_nvme_clear_io_path_cache(struct spdk_io_channel_iter *i)
{
struct spdk_io_channel *_ch = spdk_io_channel_iter_get_channel(i);
struct nvme_ctrlr_channel *ctrlr_ch = spdk_io_channel_get_ctx(_ch);
assert(ctrlr_ch->qpair != NULL);
_bdev_nvme_clear_io_path_cache(ctrlr_ch->qpair);
spdk_for_each_channel_continue(i, 0);
}
static void
bdev_nvme_clear_io_path_caches(struct nvme_ctrlr *nvme_ctrlr,
spdk_channel_for_each_cpl cpl)
{
spdk_for_each_channel(nvme_ctrlr,
bdev_nvme_clear_io_path_cache,
NULL,
cpl);
}
static struct nvme_qpair * static struct nvme_qpair *
nvme_poll_group_get_qpair(struct nvme_poll_group *group, struct spdk_nvme_qpair *qpair) nvme_poll_group_get_qpair(struct nvme_poll_group *group, struct spdk_nvme_qpair *qpair)
{ {
@ -3242,20 +3265,7 @@ nvme_ctrlr_set_ana_states(const struct spdk_nvme_ana_group_descriptor *desc,
} }
static void static void
bdev_nvme_clear_io_path_cache(struct spdk_io_channel_iter *i) _nvme_ctrlr_read_ana_log_page_done(struct spdk_io_channel_iter *i, int status)
{
struct spdk_io_channel *_ch = spdk_io_channel_iter_get_channel(i);
struct nvme_ctrlr_channel *ctrlr_ch = spdk_io_channel_get_ctx(_ch);
assert(ctrlr_ch->qpair != NULL);
_bdev_nvme_clear_io_path_cache(ctrlr_ch->qpair);
spdk_for_each_channel_continue(i, 0);
}
static void
bdev_nvme_clear_io_path_cache_done(struct spdk_io_channel_iter *i, int status)
{ {
struct nvme_ctrlr *nvme_ctrlr = spdk_io_channel_iter_get_io_device(i); struct nvme_ctrlr *nvme_ctrlr = spdk_io_channel_iter_get_io_device(i);
@ -3302,10 +3312,7 @@ nvme_ctrlr_read_ana_log_page_done(void *ctx, const struct spdk_nvme_cpl *cpl)
bdev_nvme_disable_read_ana_log_page(nvme_ctrlr); bdev_nvme_disable_read_ana_log_page(nvme_ctrlr);
} }
spdk_for_each_channel(nvme_ctrlr, bdev_nvme_clear_io_path_caches(nvme_ctrlr, _nvme_ctrlr_read_ana_log_page_done);
bdev_nvme_clear_io_path_cache,
NULL,
bdev_nvme_clear_io_path_cache_done);
} }
static int static int