From 0468ce5343d83c92da1abf41fe9ff82142e5b29f Mon Sep 17 00:00:00 2001 From: Konrad Sztyber Date: Mon, 9 Dec 2019 11:18:35 +0100 Subject: [PATCH] bdev/nvme: mark controllers used by bdev_ftl Currently, the controllers managed by bdev_ftl are skipped in bdev_nvme's config_json output by verifying if they support Open Channel. Since new bdev_ocssd also uses Open Channel controllers and it relies on bdev_nvme's config_json, additional flag was added to mark that a controller is used by bdev_ftl. This is a temporary solution that should be removed once bdev_ftl becomes a virtual bdev and starts using bdevs instead of NVMe controllers. Change-Id: Ib25b61a72f0912d7a51119357f5c221941af50ad Signed-off-by: Konrad Sztyber Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/477297 Community-CI: Broadcom SPDK FC-NVMe CI Community-CI: SPDK CI Jenkins Tested-by: SPDK CI Jenkins Reviewed-by: Ben Walker Reviewed-by: Jim Harris --- module/bdev/nvme/bdev_ftl.c | 1 + module/bdev/nvme/bdev_nvme.c | 3 +-- module/bdev/nvme/common.h | 8 ++++++++ 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/module/bdev/nvme/bdev_ftl.c b/module/bdev/nvme/bdev_ftl.c index 9e5030b30..dbe6572b9 100644 --- a/module/bdev/nvme/bdev_ftl.c +++ b/module/bdev/nvme/bdev_ftl.c @@ -145,6 +145,7 @@ bdev_ftl_add_ctrlr(struct spdk_nvme_ctrlr *ctrlr, const struct spdk_nvme_transpo ftl_ctrlr->ctrlr = ctrlr; ftl_ctrlr->trid = *trid; ftl_ctrlr->ref = 1; + ftl_ctrlr->ftl_managed = true; ftl_ctrlr->name = spdk_sprintf_alloc("NVMe_%s", trid->traddr); if (!ftl_ctrlr->name) { diff --git a/module/bdev/nvme/bdev_nvme.c b/module/bdev/nvme/bdev_nvme.c index 8aaae2662..6ceb541bf 100644 --- a/module/bdev/nvme/bdev_nvme.c +++ b/module/bdev/nvme/bdev_nvme.c @@ -2298,8 +2298,7 @@ bdev_nvme_config_json(struct spdk_json_write_ctx *w) pthread_mutex_lock(&g_bdev_nvme_mutex); TAILQ_FOREACH(nvme_bdev_ctrlr, &g_nvme_bdev_ctrlrs, tailq) { - - if (spdk_nvme_ctrlr_is_ocssd_supported(nvme_bdev_ctrlr->ctrlr)) { + if (nvme_bdev_ctrlr->ftl_managed) { continue; } diff --git a/module/bdev/nvme/common.h b/module/bdev/nvme/common.h index 4ea7f6ff7..2d5cef63f 100644 --- a/module/bdev/nvme/common.h +++ b/module/bdev/nvme/common.h @@ -93,6 +93,14 @@ struct nvme_bdev_ctrlr { struct spdk_poller *adminq_timer_poller; + /** + * Temporary workaround to distinguish between controllers managed by + * bdev_ocssd and those used by bdev_ftl. Once bdev_ftl becomes a + * virtual bdev and starts using bdevs instead of controllers, this flag + * can be removed. + */ + bool ftl_managed; + /** linked list pointer for device list */ TAILQ_ENTRY(nvme_bdev_ctrlr) tailq; };