[PATCH 3/9] nvme-pci: simplify nvme_pci_metadata_use_sgls

Keith Busch kbusch at kernel.org
Wed Jun 11 14:38:22 PDT 2025


On Tue, Jun 10, 2025 at 07:06:41AM +0200, Christoph Hellwig wrote:
> +static inline bool nvme_pci_metadata_use_sgls(struct request *req)
>  {
> -	if (!nvme_ctrl_meta_sgl_supported(&dev->ctrl))
> -		return false;
>  	return req->nr_integrity_segments > 1 ||
>  		nvme_req(req)->flags & NVME_REQ_USERCMD;
>  }

...


> @@ -981,7 +979,7 @@ static blk_status_t nvme_map_metadata(struct nvme_dev *dev, struct request *req)
>  	struct nvme_iod *iod = blk_mq_rq_to_pdu(req);
>  
>  	if ((iod->cmd.common.flags & NVME_CMD_SGL_METABUF) &&
> -	    nvme_pci_metadata_use_sgls(dev, req))
> +	    nvme_pci_metadata_use_sgls(req))
>  		return nvme_pci_setup_meta_sgls(dev, req);
>  	return nvme_pci_setup_meta_mptr(dev, req);
>  }

Am I missing something here? This looks like it forces user commands to
use metadata SGLs even if the controller doesn't support it.



More information about the Linux-nvme mailing list