Skip to content

Commit b5d8af5

Browse files
Keith BuschChristoph Hellwig
authored andcommitted
nvme/pci: Use req_op to determine DIF remapping
Only read and write commands need DIF remapping. Everything else uses a passthrough integrity payload. Signed-off-by: Keith Busch <[email protected]> Reviewed-by: Sagi Grimberg <[email protected]> Reviewed-by: Max Gurtovoy <[email protected]> Signed-off-by: Christoph Hellwig <[email protected]>
1 parent 1cad656 commit b5d8af5

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

drivers/nvme/host/pci.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -668,7 +668,7 @@ static blk_status_t nvme_map_data(struct nvme_dev *dev, struct request *req,
668668
if (blk_rq_map_integrity_sg(q, req->bio, &iod->meta_sg) != 1)
669669
goto out_unmap;
670670

671-
if (rq_data_dir(req))
671+
if (req_op(req) == REQ_OP_WRITE)
672672
nvme_dif_remap(req, nvme_dif_prep);
673673

674674
if (!dma_map_sg(dev->dev, &iod->meta_sg, 1, dma_dir))
@@ -696,7 +696,7 @@ static void nvme_unmap_data(struct nvme_dev *dev, struct request *req)
696696
if (iod->nents) {
697697
dma_unmap_sg(dev->dev, iod->sg, iod->nents, dma_dir);
698698
if (blk_integrity_rq(req)) {
699-
if (!rq_data_dir(req))
699+
if (req_op(req) == REQ_OP_READ)
700700
nvme_dif_remap(req, nvme_dif_complete);
701701
dma_unmap_sg(dev->dev, &iod->meta_sg, 1, dma_dir);
702702
}

0 commit comments

Comments
 (0)