Re: [PATCH v7 06/13] nvme-pci: implement dma-buf backed requests

From: Pavel Begunkov

Date: Mon Oct 05 2026 - 07:46:18 EST


On 10/5/26 10:15, Christoph Hellwig wrote:
On Mon, Sep 28, 2026 at 02:32:22PM +0100, Pavel Begunkov wrote:
+static void nvme_dmabuf_map_sync_for_cpu(struct nvme_dev *nvme_dev,
+ struct request *req)
+{
+ struct device *dev = nvme_dev->dev;
+ enum dma_data_direction dma_dir;
+ struct bio *bio = req->bio;
+ struct nvme_dmabuf_map *map = to_nvme_dmabuf_map(bio->bi_dmabuf_map);
+
+ dma_dir = rq_data_dir(req) == READ ? DMA_FROM_DEVICE : DMA_TO_DEVICE;
+ dma_sync_sgtable_for_cpu(dev, map->sgt, dma_dir);

This can use rq_dma_dir in the argument. Same for the other DMA API
calls.

Will change

Btw, given how larger the dmabuf code is now, have you considered
splitting it into a new nvme-pci-dmabuf.c file?

Let me see

--
Pavel Begunkov