Commit f366dac4 authored by Marcin Spiewak's avatar Marcin Spiewak Committed by Konrad Sztyber
Browse files

bdev/nvme: removed 'multipath' param from spdk_bdev_nvme_create()



Changed 'spdk_bdev_nvme_create' API function, the 'multipath prameter
was removed as it is redundant to 'multipath' field in
spdk_bdev_nvme_ctrlr_opts structure passed as a parameter to this
function. If multipathing shall be enabled for nvme bdev, the
'bdev_opts.multipath' field shall be set to 'true'. When
'bdev_opts.multipath' is set to 'false', failover mode is enabled.

Change-Id: I3ba5ac159b4c97a4d8566257b0505b1154a158f8
Signed-off-by: default avatarMarcin Spiewak <marcin.spiewak@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/25161


Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: default avatarKonrad Sztyber <konrad.sztyber@intel.com>
Reviewed-by: default avatarJim Harris <jim.harris@samsung.com>
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
parent aa7c3b1e
Loading
Loading
Loading
Loading
+1 −3
Original line number Diff line number Diff line
@@ -61,7 +61,6 @@ struct spdk_bdev_nvme_ctrlr_opts {
 * \param cb_ctx Context to pass to cb_fn.
 * \param drv_opts NVMe driver options.
 * \param bdev_opts NVMe bdev options.
 * \param multipath Whether to enable multipathing (if true) else failover mode.
 * \return 0 on success, negative errno on failure.
 */
int spdk_bdev_nvme_create(struct spdk_nvme_transport_id *trid,
@@ -71,8 +70,7 @@ int spdk_bdev_nvme_create(struct spdk_nvme_transport_id *trid,
			  spdk_bdev_nvme_create_cb cb_fn,
			  void *cb_ctx,
			  struct spdk_nvme_ctrlr_opts *drv_opts,
			  struct spdk_bdev_nvme_ctrlr_opts *bdev_opts,
			  bool multipath);
			  struct spdk_bdev_nvme_ctrlr_opts *bdev_opts);

/**
 * Set multipath policy of the NVMe bdev.
+4 −5
Original line number Diff line number Diff line
@@ -6320,8 +6320,7 @@ spdk_bdev_nvme_create(struct spdk_nvme_transport_id *trid,
		      spdk_bdev_nvme_create_cb cb_fn,
		      void *cb_ctx,
		      struct spdk_nvme_ctrlr_opts *drv_opts,
		      struct spdk_bdev_nvme_ctrlr_opts *bdev_opts,
		      bool multipath)
		      struct spdk_bdev_nvme_ctrlr_opts *bdev_opts)
{
	struct nvme_probe_skip_entry *entry, *tmp;
	struct nvme_async_probe_ctx *ctx;
@@ -6418,14 +6417,14 @@ spdk_bdev_nvme_create(struct spdk_nvme_transport_id *trid,
		}
	}

	if (nvme_bdev_ctrlr_get_by_name(base_name) == NULL || multipath) {
	if (nvme_bdev_ctrlr_get_by_name(base_name) == NULL || ctx->bdev_opts.multipath) {
		attach_cb = connect_attach_cb;
	} else {
		attach_cb = connect_set_failover_cb;
	}

	nvme_ctrlr = nvme_ctrlr_get_by_name(ctx->base_name);
	if (nvme_ctrlr  && nvme_ctrlr->opts.multipath != multipath) {
	if (nvme_ctrlr  && nvme_ctrlr->opts.multipath != ctx->bdev_opts.multipath) {
		/* All controllers with the same name must be configured the same
		 * way, either for multipath or failover. If the configuration doesn't
		 * match - report error.
@@ -7088,7 +7087,7 @@ discovery_log_page_cb(void *cb_arg, int rc, const struct spdk_nvme_cpl *cpl,
			snprintf(new_ctx->drv_opts.hostnqn, sizeof(new_ctx->drv_opts.hostnqn), "%s", ctx->hostnqn);
			rc = spdk_bdev_nvme_create(&new_ctx->trid, new_ctx->name, NULL, 0,
						   discovery_attach_controller_done, new_ctx,
						   &new_ctx->drv_opts, &ctx->bdev_opts, true);
						   &new_ctx->drv_opts, &ctx->bdev_opts);
			if (rc == 0) {
				TAILQ_INSERT_TAIL(&ctx->nvm_entry_ctxs, new_ctx, tailq);
				ctx->attach_in_progress++;
+3 −5
Original line number Diff line number Diff line
@@ -402,7 +402,6 @@ rpc_bdev_nvme_attach_controller(struct spdk_jsonrpc_request *request,
	const struct spdk_nvme_transport_id *ctrlr_trid;
	struct nvme_ctrlr *ctrlr = NULL;
	size_t len, maxlen;
	bool multipath = false;
	int rc;

	ctx = calloc(1, sizeof(*ctx));
@@ -597,8 +596,8 @@ rpc_bdev_nvme_attach_controller(struct spdk_jsonrpc_request *request,
		ctx->req.bdev_opts.prchk_flags = ctrlr->opts.prchk_flags;
	}

	if (ctx->req.multipath == BDEV_NVME_MP_MODE_MULTIPATH) {
		multipath = true;
	if (ctx->req.multipath != BDEV_NVME_MP_MODE_MULTIPATH) {
		ctx->req.bdev_opts.multipath = false;
	}

	if (ctx->req.drv_opts.num_io_queues == 0 || ctx->req.drv_opts.num_io_queues > UINT16_MAX + 1) {
@@ -614,10 +613,9 @@ rpc_bdev_nvme_attach_controller(struct spdk_jsonrpc_request *request,
	ctx->req.bdev_opts.psk = ctx->req.psk;
	ctx->req.bdev_opts.dhchap_key = ctx->req.dhchap_key;
	ctx->req.bdev_opts.dhchap_ctrlr_key = ctx->req.dhchap_ctrlr_key;
	ctx->req.bdev_opts.multipath = multipath;
	rc = spdk_bdev_nvme_create(&trid, ctx->req.name, ctx->names, ctx->req.max_bdevs,
				   rpc_bdev_nvme_attach_controller_done, ctx, &ctx->req.drv_opts,
				   &ctx->req.bdev_opts, multipath);
				   &ctx->req.bdev_opts);
	if (rc) {
		spdk_jsonrpc_send_error_response(request, rc, spdk_strerror(-rc));
		goto cleanup;
+79 −106

File changed.

Preview size limit exceeded, changes collapsed.