bdev/nvme: rename discovery_ctx->detach to ->stop
Detach and stop are two different operations. This ->detach field was used to denote when the associated discovery service should be stopped. So call the field 'stop' instead. That may trigger the currently attached discovery controller to be detached. Signed-off-by: Jim Harris <james.r.harris@intel.com> Change-Id: I61c7fc860cd9dbcfab71eedfd223c06c51a41f27 Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/11771 Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com> Community-CI: Mellanox Build Bot Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com> Reviewed-by: Shuhei Matsumoto <smatsumoto@nvidia.com>
This commit is contained in:
parent
40a9d6a03e
commit
26d4436a52
@ -4350,10 +4350,11 @@ struct discovery_ctx {
|
|||||||
*/
|
*/
|
||||||
bool pending;
|
bool pending;
|
||||||
|
|
||||||
/* Signal to the discovery context poller that it should detach from
|
/* Signal to the discovery context poller that it should stop the
|
||||||
* the discovery controller.
|
* discovery service, including detaching from the current discovery
|
||||||
|
* controller.
|
||||||
*/
|
*/
|
||||||
bool detach;
|
bool stop;
|
||||||
|
|
||||||
struct spdk_thread *calling_thread;
|
struct spdk_thread *calling_thread;
|
||||||
uint32_t index;
|
uint32_t index;
|
||||||
@ -4643,7 +4644,7 @@ discovery_poller(void *arg)
|
|||||||
struct spdk_nvme_transport_id *trid;
|
struct spdk_nvme_transport_id *trid;
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
if (ctx->detach) {
|
if (ctx->stop) {
|
||||||
bool detach_done = false;
|
bool detach_done = false;
|
||||||
|
|
||||||
if (ctx->ctrlr == NULL) {
|
if (ctx->ctrlr == NULL) {
|
||||||
@ -4751,10 +4752,10 @@ bdev_nvme_stop_discovery(const char *name, spdk_bdev_nvme_stop_discovery_fn cb_f
|
|||||||
|
|
||||||
TAILQ_FOREACH(ctx, &g_discovery_ctxs, tailq) {
|
TAILQ_FOREACH(ctx, &g_discovery_ctxs, tailq) {
|
||||||
if (strcmp(name, ctx->name) == 0) {
|
if (strcmp(name, ctx->name) == 0) {
|
||||||
if (ctx->detach) {
|
if (ctx->stop) {
|
||||||
return -EALREADY;
|
return -EALREADY;
|
||||||
}
|
}
|
||||||
ctx->detach = true;
|
ctx->stop = true;
|
||||||
ctx->stop_cb_fn = cb_fn;
|
ctx->stop_cb_fn = cb_fn;
|
||||||
ctx->cb_ctx = cb_ctx;
|
ctx->cb_ctx = cb_ctx;
|
||||||
while (!TAILQ_EMPTY(&ctx->nvm_entry_ctxs)) {
|
while (!TAILQ_EMPTY(&ctx->nvm_entry_ctxs)) {
|
||||||
@ -4857,7 +4858,7 @@ bdev_nvme_library_fini(void)
|
|||||||
bdev_nvme_fini_destruct_ctrlrs();
|
bdev_nvme_fini_destruct_ctrlrs();
|
||||||
} else {
|
} else {
|
||||||
TAILQ_FOREACH(ctx, &g_discovery_ctxs, tailq) {
|
TAILQ_FOREACH(ctx, &g_discovery_ctxs, tailq) {
|
||||||
ctx->detach = true;
|
ctx->stop = true;
|
||||||
ctx->stop_cb_fn = check_discovery_fini;
|
ctx->stop_cb_fn = check_discovery_fini;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user