Commit 26d4436a authored by Jim Harris's avatar Jim Harris Committed by Tomasz Zawadzki
Browse files

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: default avatarJim 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: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarAleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: default avatarShuhei Matsumoto <smatsumoto@nvidia.com>
parent 40a9d6a0
Loading
Loading
Loading
Loading
+8 −7
Original line number Diff line number Diff line
@@ -4350,10 +4350,11 @@ struct discovery_ctx {
	 */
	bool					pending;

	/* Signal to the discovery context poller that it should detach from
	 * the discovery controller.
	/* Signal to the discovery context poller that it should stop the
	 * discovery service, including detaching from the current discovery
	 * controller.
	 */
	bool					detach;
	bool					stop;

	struct spdk_thread			*calling_thread;
	uint32_t				index;
@@ -4643,7 +4644,7 @@ discovery_poller(void *arg)
	struct spdk_nvme_transport_id *trid;
	int rc;

	if (ctx->detach) {
	if (ctx->stop) {
		bool detach_done = false;

		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) {
		if (strcmp(name, ctx->name) == 0) {
			if (ctx->detach) {
			if (ctx->stop) {
				return -EALREADY;
			}
			ctx->detach = true;
			ctx->stop = true;
			ctx->stop_cb_fn = cb_fn;
			ctx->cb_ctx = cb_ctx;
			while (!TAILQ_EMPTY(&ctx->nvm_entry_ctxs)) {
@@ -4857,7 +4858,7 @@ bdev_nvme_library_fini(void)
		bdev_nvme_fini_destruct_ctrlrs();
	} else {
		TAILQ_FOREACH(ctx, &g_discovery_ctxs, tailq) {
			ctx->detach = true;
			ctx->stop = true;
			ctx->stop_cb_fn = check_discovery_fini;
		}
	}