nvme: Add remove callback to transport scan

Scanning the transport may result in both new
devices and removed devices, so pass the callback
for both operations.

Change-Id: I6f73dbe6fd7cf61575c354b43f8ae3e2a01e2965
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
This commit is contained in:
Ben Walker 2016-12-06 10:36:34 -07:00
parent d70ff832bf
commit 06557b0a4d
7 changed files with 18 additions and 8 deletions

View File

@ -426,7 +426,7 @@ _spdk_nvme_probe(const struct spdk_nvme_transport_id *trid, void *cb_ctx,
} }
} }
nvme_transport_ctrlr_scan(trid, probe_cb, cb_ctx); nvme_transport_ctrlr_scan(trid, cb_ctx, probe_cb, remove_cb);
if (!spdk_process_is_primary()) { if (!spdk_process_is_primary()) {
TAILQ_FOREACH(ctrlr, &g_spdk_nvme_driver->attached_ctrlrs, tailq) { TAILQ_FOREACH(ctrlr, &g_spdk_nvme_driver->attached_ctrlrs, tailq) {

View File

@ -558,7 +558,7 @@ void nvme_qpair_print_completion(struct spdk_nvme_qpair *qpair, struct spdk_nvme
struct spdk_nvme_ctrlr *nvme_ ## name ## _ctrlr_construct(enum spdk_nvme_transport_type trtype, const struct spdk_nvme_ctrlr_opts *opts, \ struct spdk_nvme_ctrlr *nvme_ ## name ## _ctrlr_construct(enum spdk_nvme_transport_type trtype, const struct spdk_nvme_ctrlr_opts *opts, \
const struct spdk_nvme_probe_info *probe_info, void *devhandle); \ const struct spdk_nvme_probe_info *probe_info, void *devhandle); \
int nvme_ ## name ## _ctrlr_destruct(struct spdk_nvme_ctrlr *ctrlr); \ int nvme_ ## name ## _ctrlr_destruct(struct spdk_nvme_ctrlr *ctrlr); \
int nvme_ ## name ## _ctrlr_scan(const struct spdk_nvme_transport_id *trid, spdk_nvme_probe_cb probe_cb, void *cb_ctx); \ int nvme_ ## name ## _ctrlr_scan(const struct spdk_nvme_transport_id *trid, void *cb_ctx, spdk_nvme_probe_cb probe_cb, spdk_nvme_remove_cb remove_cb); \
int nvme_ ## name ## _ctrlr_attach(enum spdk_nvme_transport_type trtype, spdk_nvme_probe_cb probe_cb, void *cb_ctx, struct spdk_pci_addr *addr); \ int nvme_ ## name ## _ctrlr_attach(enum spdk_nvme_transport_type trtype, spdk_nvme_probe_cb probe_cb, void *cb_ctx, struct spdk_pci_addr *addr); \
int nvme_ ## name ## _ctrlr_enable(struct spdk_nvme_ctrlr *ctrlr); \ int nvme_ ## name ## _ctrlr_enable(struct spdk_nvme_ctrlr *ctrlr); \
int nvme_ ## name ## _ctrlr_get_pci_id(struct spdk_nvme_ctrlr *ctrlr, struct spdk_pci_id *pci_id); \ int nvme_ ## name ## _ctrlr_get_pci_id(struct spdk_nvme_ctrlr *ctrlr, struct spdk_pci_id *pci_id); \

View File

@ -553,7 +553,9 @@ pcie_nvme_enum_cb(void *ctx, struct spdk_pci_device *pci_dev)
int int
nvme_pcie_ctrlr_scan(const struct spdk_nvme_transport_id *trid, nvme_pcie_ctrlr_scan(const struct spdk_nvme_transport_id *trid,
spdk_nvme_probe_cb probe_cb, void *cb_ctx) void *cb_ctx,
spdk_nvme_probe_cb probe_cb,
spdk_nvme_remove_cb remove_cb)
{ {
struct nvme_pcie_enum_ctx enum_ctx; struct nvme_pcie_enum_ctx enum_ctx;

View File

@ -1052,7 +1052,9 @@ nvme_fabrics_get_log_discovery_page(struct spdk_nvme_ctrlr *ctrlr,
/* This function must only be called while holding g_spdk_nvme_driver->lock */ /* This function must only be called while holding g_spdk_nvme_driver->lock */
int int
nvme_rdma_ctrlr_scan(const struct spdk_nvme_transport_id *trid, nvme_rdma_ctrlr_scan(const struct spdk_nvme_transport_id *trid,
spdk_nvme_probe_cb probe_cb, void *cb_ctx) void *cb_ctx,
spdk_nvme_probe_cb probe_cb,
spdk_nvme_remove_cb remove_cb)
{ {
struct spdk_nvme_probe_info probe_info; struct spdk_nvme_probe_info probe_info;
struct spdk_nvme_ctrlr_opts discovery_opts; struct spdk_nvme_ctrlr_opts discovery_opts;

View File

@ -92,9 +92,11 @@ struct spdk_nvme_ctrlr *
int int
nvme_transport_ctrlr_scan(const struct spdk_nvme_transport_id *trid, nvme_transport_ctrlr_scan(const struct spdk_nvme_transport_id *trid,
spdk_nvme_probe_cb probe_cb, void *cb_ctx) void *cb_ctx,
spdk_nvme_probe_cb probe_cb,
spdk_nvme_remove_cb remove_cb)
{ {
NVME_TRANSPORT_CALL(trid->trtype, ctrlr_scan, (trid, probe_cb, cb_ctx)); NVME_TRANSPORT_CALL(trid->trtype, ctrlr_scan, (trid, cb_ctx, probe_cb, remove_cb));
} }
int int

View File

@ -72,7 +72,9 @@ struct spdk_nvme_ctrlr *
int int
nvme_transport_ctrlr_scan(const struct spdk_nvme_transport_id *trid, nvme_transport_ctrlr_scan(const struct spdk_nvme_transport_id *trid,
spdk_nvme_probe_cb probe_cb, void *cb_ctx) void *cb_ctx,
spdk_nvme_probe_cb probe_cb,
spdk_nvme_remove_cb remove_cb)
{ {
return 0; return 0;
} }

View File

@ -195,7 +195,9 @@ nvme_ctrlr_get_ref_count(struct spdk_nvme_ctrlr *ctrlr)
int int
nvme_transport_ctrlr_scan(const struct spdk_nvme_transport_id *trid, nvme_transport_ctrlr_scan(const struct spdk_nvme_transport_id *trid,
spdk_nvme_probe_cb probe_cb, void *cb_ctx) void *cb_ctx,
spdk_nvme_probe_cb probe_cb,
spdk_nvme_remove_cb remove_cb)
{ {
return 0; return 0;
} }