summaryrefslogtreecommitdiffstats
path: root/drivers/nvme/host/pci.c
diff options
context:
space:
mode:
authorChristoph Hellwig2019-03-03 16:52:21 +0100
committerChristoph Hellwig2019-04-05 08:07:57 +0200
commitb15c592de37ed9d71499a3b8a750d1b235fcba3d (patch)
tree7e68285aa007a151443e21b43bc00ac3e02732d9 /drivers/nvme/host/pci.c
parentnvme-pci: merge nvme_free_iod into nvme_unmap_data (diff)
downloadkernel-qcow2-linux-b15c592de37ed9d71499a3b8a750d1b235fcba3d.tar.gz
kernel-qcow2-linux-b15c592de37ed9d71499a3b8a750d1b235fcba3d.tar.xz
kernel-qcow2-linux-b15c592de37ed9d71499a3b8a750d1b235fcba3d.zip
nvme-pci: only call nvme_unmap_data for requests transferring data
This mirrors how nvme_map_pci is called and will allow simplifying some checks in nvme_unmap_pci later on. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Keith Busch <keith.busch@intel.com> Reviewed-by: Sagi Grimberg <sagi@grimberg.me> Reviewed-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
Diffstat (limited to 'drivers/nvme/host/pci.c')
-rw-r--r--drivers/nvme/host/pci.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c
index de199aff8d05..030ee94452dd 100644
--- a/drivers/nvme/host/pci.c
+++ b/drivers/nvme/host/pci.c
@@ -929,7 +929,8 @@ static void nvme_pci_complete_rq(struct request *req)
struct nvme_iod *iod = blk_mq_rq_to_pdu(req);
nvme_cleanup_cmd(req);
- nvme_unmap_data(iod->nvmeq->dev, req);
+ if (blk_rq_nr_phys_segments(req))
+ nvme_unmap_data(iod->nvmeq->dev, req);
nvme_complete_rq(req);
}