Commit 403ebd3d authored by Jacek Kalwas's avatar Jacek Kalwas Committed by Tomasz Zawadzki
Browse files

nvme: use nvme log macros instead generic



Change-Id: I69b86e9edbb93f6109ad13ab29e4ff678d82e3a6
Signed-off-by: default avatarJacek Kalwas <jacek.kalwas@nutanix.com>
Reviewed-on: https://review.spdk.io/c/spdk/spdk/+/26531


Community-CI: Mellanox Build Bot
Tested-by: default avatarSPDK Automated Test System <spdkbot@gmail.com>
Reviewed-by: default avatarJim Harris <jim.harris@nvidia.com>
Reviewed-by: default avatarTomasz Zawadzki <tomasz@tzawadzki.com>
parent c71153a8
Loading
Loading
Loading
Loading
+5 −4
Original line number Diff line number Diff line
@@ -601,7 +601,7 @@ nvme_ctrlr_probe(const struct spdk_nvme_transport_id *trid,

			if (ctrlr->is_destructed) {
				/* This ctrlr is being destructed asynchronously. */
				SPDK_ERRLOG("NVMe controller for SSD: %s is being destructed\n",
				NVME_CTRLR_ERRLOG(ctrlr, "NVMe controller for SSD: %s is being destructed\n",
						  trid->traddr);
				probe_ctx->attach_fail_cb(probe_ctx->cb_ctx, trid, -EBUSY);
				return -EBUSY;
@@ -648,7 +648,7 @@ nvme_ctrlr_poll_internal(struct spdk_nvme_ctrlr *ctrlr,
	if (rc) {
		/* Controller failed to initialize. */
		TAILQ_REMOVE(&probe_ctx->init_ctrlrs, ctrlr, tailq);
		SPDK_ERRLOG("Failed to initialize SSD: %s\n", ctrlr->trid.traddr);
		NVME_CTRLR_ERRLOG(ctrlr, "Failed to initialize SSD: %s\n", ctrlr->trid.traddr);
		probe_ctx->attach_fail_cb(probe_ctx->cb_ctx, &ctrlr->trid, rc);
		nvme_ctrlr_lock(ctrlr);
		nvme_ctrlr_fail(ctrlr, false);
@@ -657,7 +657,8 @@ nvme_ctrlr_poll_internal(struct spdk_nvme_ctrlr *ctrlr,
		/* allocate a context to detach this controller asynchronously */
		detach_ctx = calloc(1, sizeof(*detach_ctx));
		if (detach_ctx == NULL) {
			SPDK_WARNLOG("Failed to allocate asynchronous detach context. Performing synchronous destruct.\n");
			NVME_CTRLR_WARNLOG(ctrlr,
					   "Failed to allocate asynchronous detach context. Performing synchronous destruct.\n");
			nvme_ctrlr_destruct(ctrlr);
			return;
		}
+2 −2
Original line number Diff line number Diff line
@@ -1269,12 +1269,12 @@ spdk_nvme_qpair_authenticate(struct spdk_nvme_qpair *qpair,
	int rc;

	if (qpair->auth.cb_fn != NULL) {
		SPDK_ERRLOG("authentication already in-progress\n");
		AUTH_ERRLOG(qpair, "authentication already in-progress\n");
		return -EALREADY;
	}

	if (ctrlr->opts.dhchap_key == NULL) {
		SPDK_ERRLOG("missing DH-HMAC-CHAP key\n");
		AUTH_ERRLOG(qpair, "missing DH-HMAC-CHAP key\n");
		return -ENOKEY;
	}

+4 −4
Original line number Diff line number Diff line
@@ -2464,7 +2464,7 @@ nvme_ctrlr_identify_active_ns_async_done(void *arg, const struct spdk_nvme_cpl *
				   ctx->page_count * sizeof(struct spdk_nvme_ns_list),
				   ctx->ctrlr->page_size);
	if (!new_ns_list) {
		SPDK_ERRLOG("Failed to reallocate active_ns_list!\n");
		NVME_CTRLR_ERRLOG(ctx->ctrlr, "Failed to reallocate active_ns_list!\n");
		ctx->state = NVME_ACTIVE_NS_STATE_ERROR;
		goto out;
	}
@@ -2513,7 +2513,7 @@ nvme_ctrlr_identify_active_ns_async(struct nvme_active_ns_ctx *ctx)
					   ctx->page_count * sizeof(struct spdk_nvme_ns_list),
					   ctx->ctrlr->page_size);
		if (!new_ns_list) {
			SPDK_ERRLOG("Failed to reallocate active_ns_list!\n");
			NVME_CTRLR_ERRLOG(ctrlr, "Failed to reallocate active_ns_list!\n");
			ctx->state = NVME_ACTIVE_NS_STATE_ERROR;
			goto out;
		}
@@ -4431,13 +4431,13 @@ nvme_ctrlr_destruct_finish(struct spdk_nvme_ctrlr *ctrlr)
	int rc;

	if (ctrlr->lock_depth > 0) {
		SPDK_ERRLOG("lock currently held (depth=%d)!\n", ctrlr->lock_depth);
		NVME_CTRLR_ERRLOG(ctrlr, "lock currently held (depth=%d)!\n", ctrlr->lock_depth);
		assert(false);
	}

	rc = pthread_mutex_destroy(&ctrlr->ctrlr_lock);
	if (rc) {
		SPDK_ERRLOG("could not destroy ctrlr_lock: %s\n", spdk_strerror(rc));
		NVME_CTRLR_ERRLOG(ctrlr, "could not destroy ctrlr_lock: %s\n", spdk_strerror(rc));
		assert(false);
	}

+2 −2
Original line number Diff line number Diff line
@@ -505,7 +505,7 @@ nvme_ctrlr_cmd_set_host_id(struct spdk_nvme_ctrlr *ctrlr, void *host_id, uint32_
		/* 64-bit host identifier */
		feat_host_identifier.bits.exhid = 0;
	} else {
		SPDK_ERRLOG("Invalid host ID size %u\n", host_id_size);
		NVME_CTRLR_ERRLOG(ctrlr, "Invalid host ID size %u\n", host_id_size);
		return -EINVAL;
	}

@@ -605,7 +605,7 @@ nvme_ctrlr_retry_queued_abort(struct spdk_nvme_ctrlr *ctrlr)
		ctrlr->outstanding_aborts++;
		rc = nvme_ctrlr_submit_admin_request(ctrlr, next);
		if (rc < 0) {
			SPDK_ERRLOG("Failed to submit queued abort.\n");
			NVME_CTRLR_ERRLOG(ctrlr, "Failed to submit queued abort.\n");
			memset(&next->cpl, 0, sizeof(next->cpl));
			next->cpl.status.sct = SPDK_NVME_SCT_GENERIC;
			next->cpl.status.sc = SPDK_NVME_SC_INTERNAL_DEVICE_ERROR;
+3 −3
Original line number Diff line number Diff line
@@ -85,7 +85,7 @@ discovery_log_header_completion(void *cb_arg, const struct spdk_nvme_cpl *cpl)
	/* Got the first 4K of the discovery log page */
	recfmt = from_le16(&ctx->log_page->recfmt);
	if (recfmt != 0) {
		SPDK_ERRLOG("Unrecognized discovery log record format %" PRIu16 "\n", recfmt);
		NVME_CTRLR_ERRLOG(ctx->ctrlr, "Unrecognized discovery log record format %" PRIu16 "\n", recfmt);
		ctx->cb_fn(ctx->cb_arg, -EINVAL, NULL, NULL);
		free(ctx->log_page);
		free(ctx);
@@ -112,7 +112,7 @@ discovery_log_header_completion(void *cb_arg, const struct spdk_nvme_cpl *cpl)
	page_size += numrec * sizeof(struct spdk_nvmf_discovery_log_page_entry);
	new_page = realloc(ctx->log_page, page_size);
	if (new_page == NULL) {
		SPDK_ERRLOG("Could not allocate buffer for log page (%" PRIu64 " entries)\n",
		NVME_CTRLR_ERRLOG(ctx->ctrlr, "Could not allocate buffer for log page (%" PRIu64 " entries)\n",
				  numrec);
		ctx->cb_fn(ctx->cb_arg, -ENOMEM, NULL, NULL);
		free(ctx->log_page);
Loading