Commit e4f9509b authored by Maciej Szwed's avatar Maciej Szwed Committed by Jim Harris
Browse files

bdev/nvme: Use probe context as an argument for bdev_nvme_create_bdevs

parent dd710e64
Loading
Loading
Loading
Loading
+7 −8
Original line number Diff line number Diff line
@@ -1190,15 +1190,14 @@ spdk_bdev_nvme_set_hotplug(bool enabled, uint64_t period_us, spdk_msg_fn cb, voi
}

static int
bdev_nvme_create_bdevs(const char **names, size_t *count,
		       const struct spdk_nvme_transport_id *trid)
bdev_nvme_create_bdevs(struct nvme_async_probe_ctx *ctx)
{
	struct nvme_bdev_ctrlr	*nvme_bdev_ctrlr;
	struct nvme_bdev	*nvme_bdev;
	uint32_t		i, nsid;
	size_t			j;

	nvme_bdev_ctrlr = nvme_bdev_ctrlr_get(trid);
	nvme_bdev_ctrlr = nvme_bdev_ctrlr_get(&ctx->trid);
	assert(nvme_bdev_ctrlr != NULL);

	nvme_ctrlr_create_bdevs(nvme_bdev_ctrlr);
@@ -1215,17 +1214,17 @@ bdev_nvme_create_bdevs(const char **names, size_t *count,
			continue;
		}
		assert(nvme_bdev->id == nsid);
		if (j < *count) {
			names[j] = nvme_bdev->disk.name;
		if (j < *ctx->count) {
			ctx->names[j] = nvme_bdev->disk.name;
			j++;
		} else {
			SPDK_ERRLOG("Maximum number of namespaces supported per NVMe controller is %zu. Unable to return all names of created bdevs\n",
				    *count);
				    *ctx->count);
			return -1;
		}
	}

	*count = j;
	*ctx->count = j;

	return 0;
}
@@ -1246,7 +1245,7 @@ connect_attach_cb(void *cb_ctx, const struct spdk_nvme_transport_id *trid,
		goto end;
	}

	rc = bdev_nvme_create_bdevs(ctx->names, ctx->count, &ctx->trid);
	rc = bdev_nvme_create_bdevs(ctx);
	if (rc) {
		SPDK_ERRLOG("Failed to create bdevs\n");
	}