nvme-pci: move the call to nvme_cleanup_cmd out of nvme_unmap_data
authorChristoph Hellwig <hch@lst.de>
Sun, 3 Mar 2019 15:13:03 +0000 (08:13 -0700)
committerChristoph Hellwig <hch@lst.de>
Fri, 5 Apr 2019 06:07:57 +0000 (08:07 +0200)
Cleaning up the command setup isn't related to unmapping data, and
disentangling them will simplify error handling a bit down the road.

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>
drivers/nvme/host/pci.c

index 2102a107e09bfd99ae4f44da66c2540cc9f5264f..2af6cfbd77ec37b2cb832d55993354e49ff52d41 100644 (file)
@@ -888,7 +888,6 @@ static void nvme_unmap_data(struct nvme_dev *dev, struct request *req)
                        dma_unmap_sg(dev->dev, &iod->meta_sg, 1, dma_dir);
        }
 
-       nvme_cleanup_cmd(req);
        nvme_free_iod(dev, req);
 }
 
@@ -939,6 +938,7 @@ 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);
        nvme_complete_rq(req);
 }