lib/nvmf: add a global list of targets
As part of moving the nvmf rpc code to the library, we will need to make it more inclusive of use cases outside of the example spdk nvmf_tgt application. That application only supports a single nvmf target structure. As such, many of the RPCs have this assumption built into them. In order to enable the multi-target use case, we need to configure a way to translate between user supplied RPCs and actual target objects in the library. Change-Id: I5d3745afe9c2ca1c33f6e1a1bcc2b8bb3196ccd6 Signed-off-by: Seth Howell <seth.howell@intel.com> Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/465329 Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com> Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com> Reviewed-by: Ben Walker <benjamin.walker@intel.com> Reviewed-by: Paul Luse <paul.e.luse@intel.com>
This commit is contained in:
parent
4ce77af64c
commit
0ac5050624
@ -51,6 +51,8 @@ SPDK_LOG_REGISTER_COMPONENT("nvmf", SPDK_LOG_NVMF)
|
||||
|
||||
#define SPDK_NVMF_DEFAULT_MAX_SUBSYSTEMS 1024
|
||||
|
||||
static TAILQ_HEAD(, spdk_nvmf_tgt) g_nvmf_tgts = TAILQ_HEAD_INITIALIZER(g_nvmf_tgts);
|
||||
|
||||
typedef void (*nvmf_qpair_disconnect_cpl)(void *ctx, int status);
|
||||
static void spdk_nvmf_tgt_destroy_poll_group(void *io_device, void *ctx_buf);
|
||||
|
||||
@ -243,6 +245,8 @@ spdk_nvmf_tgt_create(uint32_t max_subsystems)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
TAILQ_INSERT_HEAD(&g_nvmf_tgts, tgt, link);
|
||||
|
||||
spdk_io_device_register(tgt,
|
||||
spdk_nvmf_tgt_create_poll_group,
|
||||
spdk_nvmf_tgt_destroy_poll_group,
|
||||
@ -297,6 +301,8 @@ spdk_nvmf_tgt_destroy(struct spdk_nvmf_tgt *tgt,
|
||||
tgt->destroy_cb_fn = cb_fn;
|
||||
tgt->destroy_cb_arg = cb_arg;
|
||||
|
||||
TAILQ_REMOVE(&g_nvmf_tgts, tgt, link);
|
||||
|
||||
spdk_io_device_unregister(tgt, spdk_nvmf_tgt_destroy_cb);
|
||||
}
|
||||
|
||||
|
@ -87,6 +87,8 @@ struct spdk_nvmf_tgt {
|
||||
|
||||
spdk_nvmf_tgt_destroy_done_fn *destroy_cb_fn;
|
||||
void *destroy_cb_arg;
|
||||
|
||||
TAILQ_ENTRY(spdk_nvmf_tgt) link;
|
||||
};
|
||||
|
||||
struct spdk_nvmf_host {
|
||||
|
Loading…
Reference in New Issue
Block a user