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

Christoph Hellwig hch at lst.de
Wed Jun 11 21:59:16 PDT 2025


On Wed, Jun 11, 2025 at 03:38:22PM -0600, Keith Busch wrote:
> 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.

Yeah, looks like I messed up something here.



More information about the Linux-nvme mailing list