[PATCH 4/5] nvme: open-code __nvme_submit_sync_cmd()

Christoph Hellwig hch at lst.de
Sun Feb 12 22:26:54 PST 2023


On Thu, Feb 09, 2023 at 03:38:19PM +0100, Hannes Reinecke wrote:
> +	if (ret) {
>  		dev_err(ctrl->device,
> -			"qid %d auth_send failed with error %d\n", qid, ret);
> +			"qid %d auth_submit failed to map, error %d\n",
> +			qid, ret);

Plase do a goto out_free_request here instead of indenting the
normal flow in the else path.  The same comment applies in a bunch of
other places.

> -	ret = __nvme_submit_sync_cmd(req, &res, buffer, buflen, 0);
> +	ret = blk_rq_map_kern(req->q, req, buffer, buflen, GFP_KERNEL);
> +	if (ret)
> +		goto out;
> +
> +	ret = nvme_execute_rq(req, &res, false);

This could use nvmf_submit_fabrics_cmd, which has nothing to with
fabrics, but just is a variant of nvme_submit_sync_cmd that returns the
result.  So if we have that helper anyway we might as well move it to
the core and turn nvme_submit_sync_cmd into a wrapper for it.



More information about the Linux-nvme mailing list