Commit ce28b772 authored by Keith Busch's avatar Keith Busch
Browse files

nvme: make prp passthrough usage less scary



The warning is a bit alarming, and it only prints for the very first
non-sgl capable device that receives a passthrough command. Just log an
informational message on initial discovery for every device.

Reviewed-by: default avatarJens Axboe <axboe@kernel.dk>
Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
Signed-off-by: default avatarKeith Busch <kbusch@kernel.org>
parent 86f33ca9
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -3749,6 +3749,10 @@ int nvme_init_ctrl_finish(struct nvme_ctrl *ctrl, bool was_suspended)
		ret = nvme_hwmon_init(ctrl);
		if (ret == -EINTR)
			return ret;

		if (!nvme_ctrl_sgl_supported(ctrl))
			dev_info(ctrl->device,
				"passthrough uses implicit buffer lengths\n");
	}

	clear_bit(NVME_CTRL_DIRTY_CAPABILITY, &ctrl->flags);
+2 −11
Original line number Diff line number Diff line
@@ -120,22 +120,13 @@ static int nvme_map_user_request(struct request *req, u64 ubuffer,
	struct nvme_ns *ns = q->queuedata;
	struct block_device *bdev = ns ? ns->disk->part0 : NULL;
	bool supports_metadata = bdev && blk_get_integrity(bdev->bd_disk);
	struct nvme_ctrl *ctrl = nvme_req(req)->ctrl;
	bool has_metadata = meta_buffer && meta_len;
	struct bio *bio = NULL;
	int ret;

	if (!nvme_ctrl_sgl_supported(ctrl))
		dev_warn_once(ctrl->device, "using unchecked data buffer\n");
	if (has_metadata) {
		if (!supports_metadata)
	if (has_metadata && !supports_metadata)
		return -EINVAL;

		if (!nvme_ctrl_meta_sgl_supported(ctrl))
			dev_warn_once(ctrl->device,
				      "using unchecked metadata buffer\n");
	}

	if (iter)
		ret = blk_rq_map_user_iov(q, req, NULL, iter, GFP_KERNEL);
	else