nvme-pci: don't simple map sgl when sgls are disabled
authorNiklas Cassel <niklas.cassel@wdc.com>
Fri, 9 Apr 2021 18:12:55 +0000 (20:12 +0200)
committerChristoph Hellwig <hch@lst.de>
Thu, 15 Apr 2021 06:12:53 +0000 (08:12 +0200)
According to the module parameter description for sgl_threshold,
a value of 0 means that SGLs are disabled.

If SGLs are disabled, we should respect that, even for the case
where the request is made up of a single physical segment.

Fixes: 297910571f08 ("nvme-pci: optimize mapping single segment requests using SGLs")
Signed-off-by: Niklas Cassel <niklas.cassel@wdc.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
drivers/nvme/host/pci.c

index d47bb18b976ad72c4c23c3db8621294947f0c473..b06e685d125009799b484beabb968885b0fb10da 100644 (file)
@@ -854,7 +854,7 @@ static blk_status_t nvme_map_data(struct nvme_dev *dev, struct request *req,
                                return nvme_setup_prp_simple(dev, req,
                                                             &cmnd->rw, &bv);
 
-                       if (iod->nvmeq->qid &&
+                       if (iod->nvmeq->qid && sgl_threshold &&
                            dev->ctrl.sgls & ((1 << 0) | (1 << 1)))
                                return nvme_setup_sgl_simple(dev, req,
                                                             &cmnd->rw, &bv);