diff --git a/deprecation.md b/deprecation.md index 6125a3597..668e2a628 100644 --- a/deprecation.md +++ b/deprecation.md @@ -19,3 +19,8 @@ ABI cannot be removed without providing deprecation notice for at least single S Deprecated `spdk_nvme_ctrlr_reset_async` and `spdk_nvme_ctrlr_reset_poll_async` APIs, which will be removed in SPDK 22.01. `spdk_nvme_ctrlr_disconnect`, `spdk_nvme_ctrlr_reconnect_async`, and `spdk_nvme_ctrlr_reconnect_poll_async` should be used instead. + +### bdev + +Deprecated `spdk_bdev_module_finish_done()` API, which will be removed in SPDK 22.01. +Bdev modules should use `spdk_bdev_module_fini_done()` instead. diff --git a/include/spdk/nvme.h b/include/spdk/nvme.h index f3321dfb3..c77ee73f7 100644 --- a/include/spdk/nvme.h +++ b/include/spdk/nvme.h @@ -1077,46 +1077,6 @@ int spdk_nvme_ctrlr_reset(struct spdk_nvme_ctrlr *ctrlr); */ void spdk_nvme_ctrlr_prepare_for_reset(struct spdk_nvme_ctrlr *ctrlr); -struct spdk_nvme_ctrlr_reset_ctx; - -/** - * Create a context object that can be polled to perform a full hardware reset of the NVMe controller. - * (Deprecated, please use spdk_nvme_ctrlr_disconnect(), spdk_nvme_ctrlr_reconnect_async(), and - * spdk_nvme_ctrlr_reconnect_poll_async() instead.) - * - * The function will set the controller reset context on success, user must call - * spdk_nvme_ctrlr_reset_poll_async() until it returns a value other than -EAGAIN. - * - * \param ctrlr Opaque handle to NVMe controller. - * \param reset_ctx Double pointer to reset context. - * - * \return 0 on success. - * \return -ENOMEM if context could not be allocated. - * \return -EBUSY if controller is already resetting. - * \return -ENXIO if controller has been removed. - * - */ -int spdk_nvme_ctrlr_reset_async(struct spdk_nvme_ctrlr *ctrlr, - struct spdk_nvme_ctrlr_reset_ctx **reset_ctx); - -/** - * Proceed with resetting controller associated with the controller reset context. - * (Deprecated, please use spdk_nvme_ctrlr_disconnect(), spdk_nvme_ctrlr_reconnect_async(), and - * spdk_nvme_ctrlr_reconnect_poll_async() instead.) - * - * The controller reset context is one returned from a previous call to - * spdk_nvme_ctrlr_reset_async(). Users must call this function on the - * controller reset context until it returns a value other than -EAGAIN. - * - * \param ctrlr_reset_ctx Context used to track controller reset actions. - * - * \return 0 if all controller reset operations are complete; the ctrlr_reset_ctx - * is also freed and no longer valid. - * \return -EAGAIN if there are still pending controller reset operations; user must call - * spdk_nvme_ctrlr_reset_poll_async again to continue progress. - */ -int spdk_nvme_ctrlr_reset_poll_async(struct spdk_nvme_ctrlr_reset_ctx *ctrlr_reset_ctx); - /** * Disconnect the given NVMe controller. * diff --git a/lib/nvme/nvme_ctrlr.c b/lib/nvme/nvme_ctrlr.c index 44be95050..7ffa80f5f 100644 --- a/lib/nvme/nvme_ctrlr.c +++ b/lib/nvme/nvme_ctrlr.c @@ -1686,20 +1686,6 @@ spdk_nvme_ctrlr_reconnect_async(struct spdk_nvme_ctrlr *ctrlr) */ } -static int -nvme_ctrlr_reset_pre(struct spdk_nvme_ctrlr *ctrlr) -{ - int rc; - - rc = spdk_nvme_ctrlr_disconnect(ctrlr); - if (rc != 0) { - return rc; - } - - spdk_nvme_ctrlr_reconnect_async(ctrlr); - return 0; -} - /** * This function will be called when the controller is being reinitialized. * Note: the ctrlr_lock must be held when calling this function. @@ -1778,77 +1764,23 @@ spdk_nvme_ctrlr_reconnect_poll_async(struct spdk_nvme_ctrlr *ctrlr) return rc; } -static void -nvme_ctrlr_reset_ctx_init(struct spdk_nvme_ctrlr_reset_ctx *ctrlr_reset_ctx, - struct spdk_nvme_ctrlr *ctrlr) -{ - ctrlr_reset_ctx->ctrlr = ctrlr; -} - -static int -nvme_ctrlr_reset_poll_async(struct spdk_nvme_ctrlr_reset_ctx *ctrlr_reset_ctx) -{ - struct spdk_nvme_ctrlr *ctrlr = ctrlr_reset_ctx->ctrlr; - - return spdk_nvme_ctrlr_reconnect_poll_async(ctrlr); -} - -int -spdk_nvme_ctrlr_reset_poll_async(struct spdk_nvme_ctrlr_reset_ctx *ctrlr_reset_ctx) -{ - int rc; - if (!ctrlr_reset_ctx) { - return -EINVAL; - } - rc = nvme_ctrlr_reset_poll_async(ctrlr_reset_ctx); - if (rc == -EAGAIN) { - return rc; - } - - free(ctrlr_reset_ctx); - return rc; -} - -int -spdk_nvme_ctrlr_reset_async(struct spdk_nvme_ctrlr *ctrlr, - struct spdk_nvme_ctrlr_reset_ctx **reset_ctx) -{ - struct spdk_nvme_ctrlr_reset_ctx *ctrlr_reset_ctx; - int rc; - - ctrlr_reset_ctx = calloc(1, sizeof(*ctrlr_reset_ctx)); - if (!ctrlr_reset_ctx) { - return -ENOMEM; - } - - rc = nvme_ctrlr_reset_pre(ctrlr); - if (rc != 0) { - free(ctrlr_reset_ctx); - } else { - nvme_ctrlr_reset_ctx_init(ctrlr_reset_ctx, ctrlr); - *reset_ctx = ctrlr_reset_ctx; - } - - return rc; -} - int spdk_nvme_ctrlr_reset(struct spdk_nvme_ctrlr *ctrlr) { - struct spdk_nvme_ctrlr_reset_ctx reset_ctx = {}; int rc; - rc = nvme_ctrlr_reset_pre(ctrlr); + rc = spdk_nvme_ctrlr_disconnect(ctrlr); if (rc != 0) { if (rc == -EBUSY) { rc = 0; } return rc; } - nvme_ctrlr_reset_ctx_init(&reset_ctx, ctrlr); + + spdk_nvme_ctrlr_reconnect_async(ctrlr); while (true) { - rc = nvme_ctrlr_reset_poll_async(&reset_ctx); + rc = spdk_nvme_ctrlr_reconnect_poll_async(ctrlr); if (rc != -EAGAIN) { break; } diff --git a/lib/nvme/nvme_internal.h b/lib/nvme/nvme_internal.h index fe920d217..5df0ba7fb 100644 --- a/lib/nvme/nvme_internal.h +++ b/lib/nvme/nvme_internal.h @@ -1044,10 +1044,6 @@ struct spdk_nvme_detach_ctx { TAILQ_HEAD(, nvme_ctrlr_detach_ctx) head; }; -struct spdk_nvme_ctrlr_reset_ctx { - struct spdk_nvme_ctrlr *ctrlr; -}; - struct nvme_driver { pthread_mutex_t lock;