diff options
author | Keith Busch <kbusch@kernel.org> | 2023-01-05 21:28:31 +0100 |
---|---|---|
committer | Christoph Hellwig <hch@lst.de> | 2023-02-01 14:21:59 +0100 |
commit | ae5829350324a6bd93c1d9fc3ac67afc0c647e32 (patch) | |
tree | b19aa60f2552893da62c70cc5a91a4ad5929e9e4 /drivers/nvme | |
parent | nvme-pci: remove SGL segment descriptors (diff) | |
download | linux-ae5829350324a6bd93c1d9fc3ac67afc0c647e32.tar.xz linux-ae5829350324a6bd93c1d9fc3ac67afc0c647e32.zip |
nvme-pci: use mapped entries for sgl decision
The driver uses the dma entries for setting up its command's SGL/PRP
lists. The dma mapping might have fewer entries than the physical
segments, so check the dma mapped count to determine which nvme data
layout method is more optimal.
Signed-off-by: Keith Busch <kbusch@kernel.org>
Reviewed-by: Sagi Grimberg <sagi@grimberg.me>
Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Diffstat (limited to 'drivers/nvme')
-rw-r--r-- | drivers/nvme/host/pci.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c index 9d6d171afa66..5951a516158c 100644 --- a/drivers/nvme/host/pci.c +++ b/drivers/nvme/host/pci.c @@ -515,10 +515,10 @@ static void **nvme_pci_iod_list(struct request *req) return (void **)(iod->sgt.sgl + blk_rq_nr_phys_segments(req)); } -static inline bool nvme_pci_use_sgls(struct nvme_dev *dev, struct request *req) +static inline bool nvme_pci_use_sgls(struct nvme_dev *dev, struct request *req, + int nseg) { struct nvme_queue *nvmeq = req->mq_hctx->driver_data; - int nseg = blk_rq_nr_phys_segments(req); unsigned int avg_seg_size; avg_seg_size = DIV_ROUND_UP(blk_rq_payload_bytes(req), nseg); @@ -818,7 +818,7 @@ static blk_status_t nvme_map_data(struct nvme_dev *dev, struct request *req, goto out_free_sg; } - iod->use_sgl = nvme_pci_use_sgls(dev, req); + iod->use_sgl = nvme_pci_use_sgls(dev, req, iod->sgt.nents); if (iod->use_sgl) ret = nvme_pci_setup_sgls(dev, req, &cmnd->rw); else |