Commit 169e19c3 authored by Jim Harris's avatar Jim Harris Committed by Tomasz Zawadzki
Browse files

bdev/nvme: add nvme_ctrlr_populate_namespace_done()



This is in preparation for making this code path
asynchronous.  For now we will just call this function
immediately after calling the per-ns-type populate
namespace function.

Signed-off-by: default avatarJim Harris <james.r.harris@intel.com>
Change-Id: I6e397901b2489287634b1d21e57f92e0abcf48e0

Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/475923


Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarBen Walker <benjamin.walker@intel.com>
Reviewed-by: default avatarShuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: default avatarTomasz Zawadzki <tomasz.zawadzki@intel.com>
parent 394bb22b
Loading
Loading
Loading
Loading
+12 −5
Original line number Diff line number Diff line
@@ -1030,6 +1030,17 @@ static void nvme_ctrlr_depopulate_namespace(struct nvme_bdev_ctrlr *ctrlr, struc
	g_depopulate_namespace_fn[ns->type](ns);
}

void
nvme_ctrlr_populate_namespace_done(struct nvme_async_probe_ctx *ctx,
				   struct nvme_bdev_ns *ns, int rc)
{
	if (rc == 0) {
		ns->populated = true;
	} else {
		memset(ns, 0, sizeof(*ns));
	}
}

static void
nvme_ctrlr_populate_namespaces(struct nvme_bdev_ctrlr *nvme_bdev_ctrlr,
			       struct nvme_async_probe_ctx *ctx)
@@ -1055,11 +1066,7 @@ nvme_ctrlr_populate_namespaces(struct nvme_bdev_ctrlr *nvme_bdev_ctrlr,
			TAILQ_INIT(&ns->bdevs);

			rc = nvme_ctrlr_populate_namespace(nvme_bdev_ctrlr, ns, ctx);
			if (rc == 0) {
				ns->populated = true;
			} else {
				memset(ns, 0, sizeof(*ns));
			}
			nvme_ctrlr_populate_namespace_done(ctx, ns, rc);
		}

		if (ns->populated && !spdk_nvme_ctrlr_is_active_ns(ctrlr, nsid)) {
+3 −0
Original line number Diff line number Diff line
@@ -112,6 +112,9 @@ struct nvme_async_probe_ctx {
	void *cb_ctx;
};

void nvme_ctrlr_populate_namespace_done(struct nvme_async_probe_ctx *ctx,
					struct nvme_bdev_ns *ns, int rc);

struct nvme_bdev_ctrlr *nvme_bdev_ctrlr_get(const struct spdk_nvme_transport_id *trid);
struct nvme_bdev_ctrlr *nvme_bdev_ctrlr_get_by_name(const char *name);
struct nvme_bdev_ctrlr *nvme_bdev_first_ctrlr(void);