From dd710e6437af2e0293b030c063ac7a61f1a81414 Mon Sep 17 00:00:00 2001 From: Maciej Szwed Date: Fri, 13 Sep 2019 11:45:53 +0200 Subject: [PATCH] bdev/nvme: Move nvme_async_probe_ctx structure to common.h This is required to use spdk_bdev_nvme_create function for other NVMe modes. Signed-off-by: Maciej Szwed Change-Id: I47dcb41689c7ec696ca6e76c35c81b497655d29a Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/468342 Tested-by: SPDK CI Jenkins Reviewed-by: Shuhei Matsumoto Reviewed-by: Ben Walker Reviewed-by: Jim Harris --- module/bdev/nvme/bdev_nvme.c | 14 -------------- module/bdev/nvme/bdev_nvme.h | 3 ++- module/bdev/nvme/common.h | 15 +++++++++++++++ 3 files changed, 17 insertions(+), 15 deletions(-) diff --git a/module/bdev/nvme/bdev_nvme.c b/module/bdev/nvme/bdev_nvme.c index 41fb4955f..e20c5f745 100644 --- a/module/bdev/nvme/bdev_nvme.c +++ b/module/bdev/nvme/bdev_nvme.c @@ -34,7 +34,6 @@ #include "spdk/stdinc.h" #include "bdev_nvme.h" -#include "common.h" #include "spdk/config.h" #include "spdk/conf.h" @@ -1231,19 +1230,6 @@ bdev_nvme_create_bdevs(const char **names, size_t *count, return 0; } -struct nvme_async_probe_ctx { - struct spdk_nvme_probe_ctx *probe_ctx; - const char *base_name; - const char **names; - size_t *count; - uint32_t prchk_flags; - struct spdk_poller *poller; - struct spdk_nvme_transport_id trid; - struct spdk_nvme_ctrlr_opts opts; - spdk_bdev_create_nvme_fn cb_fn; - void *cb_ctx; -}; - static void connect_attach_cb(void *cb_ctx, const struct spdk_nvme_transport_id *trid, struct spdk_nvme_ctrlr *ctrlr, const struct spdk_nvme_ctrlr_opts *opts) diff --git a/module/bdev/nvme/bdev_nvme.h b/module/bdev/nvme/bdev_nvme.h index 8c6455e22..23f65eb89 100644 --- a/module/bdev/nvme/bdev_nvme.h +++ b/module/bdev/nvme/bdev_nvme.h @@ -40,6 +40,8 @@ #include "spdk/nvme.h" #include "spdk/bdev_module.h" +#include "common.h" + enum spdk_bdev_timeout_action { SPDK_BDEV_NVME_TIMEOUT_ACTION_NONE = 0, SPDK_BDEV_NVME_TIMEOUT_ACTION_RESET, @@ -59,7 +61,6 @@ struct spdk_bdev_nvme_opts { uint32_t io_queue_requests; }; -typedef void (*spdk_bdev_create_nvme_fn)(void *ctx, int rc); struct spdk_nvme_qpair *spdk_bdev_nvme_get_io_qpair(struct spdk_io_channel *ctrlr_io_ch); void spdk_bdev_nvme_get_opts(struct spdk_bdev_nvme_opts *opts); int spdk_bdev_nvme_set_opts(const struct spdk_bdev_nvme_opts *opts); diff --git a/module/bdev/nvme/common.h b/module/bdev/nvme/common.h index 77f1de2da..4c9402929 100644 --- a/module/bdev/nvme/common.h +++ b/module/bdev/nvme/common.h @@ -81,6 +81,21 @@ struct nvme_bdev { struct spdk_nvme_ns *ns; }; +typedef void (*spdk_bdev_create_nvme_fn)(void *ctx, int rc); + +struct nvme_async_probe_ctx { + struct spdk_nvme_probe_ctx *probe_ctx; + const char *base_name; + const char **names; + size_t *count; + uint32_t prchk_flags; + struct spdk_poller *poller; + struct spdk_nvme_transport_id trid; + struct spdk_nvme_ctrlr_opts opts; + spdk_bdev_create_nvme_fn cb_fn; + void *cb_ctx; +}; + struct nvme_bdev_ctrlr *nvme_bdev_ctrlr_get(const struct spdk_nvme_transport_id *trid); struct nvme_bdev_ctrlr *nvme_bdev_ctrlr_get_by_name(const char *name); struct nvme_bdev_ctrlr *nvme_bdev_first_ctrlr(void);