int npages; /* In the PRP list. 0 means small pool in use */
int nents; /* Used in scatterlist */
dma_addr_t first_dma;
- struct scatterlist meta_sg; /* metadata requires single contiguous buffer */
+ dma_addr_t meta_dma;
struct scatterlist *sg;
struct scatterlist inline_sg[0];
};
dma_addr_t dma_addr = iod->first_dma, next_dma_addr;
int i;
+ if (blk_integrity_rq(req)) {
+ dma_unmap_page(dev->dev, iod->meta_dma,
+ rq_integrity_vec(req)->bv_len, dma_dir);
+ }
+
if (iod->nents) {
/* P2PDMA requests do not need to be unmapped */
if (!is_pci_p2pdma_page(sg_page(iod->sg)))
dma_unmap_sg(dev->dev, iod->sg, iod->nents, dma_dir);
- if (blk_integrity_rq(req))
- dma_unmap_sg(dev->dev, &iod->meta_sg, 1, dma_dir);
}
if (iod->npages == 0)
ret = BLK_STS_IOERR;
if (blk_integrity_rq(req)) {
- if (blk_rq_count_integrity_sg(q, req->bio) != 1)
- goto out;
-
- sg_init_table(&iod->meta_sg, 1);
- if (blk_rq_map_integrity_sg(q, req->bio, &iod->meta_sg) != 1)
- goto out;
-
- if (!dma_map_sg(dev->dev, &iod->meta_sg, 1, dma_dir))
+ iod->meta_dma = dma_map_bvec(dev->dev, rq_integrity_vec(req),
+ dma_dir, 0);
+ if (dma_mapping_error(dev->dev, iod->meta_dma))
goto out;
-
- cmnd->rw.metadata = cpu_to_le64(sg_dma_address(&iod->meta_sg));
+ cmnd->rw.metadata = cpu_to_le64(iod->meta_dma);
}
return BLK_STS_OK;