]> www.infradead.org Git - nvme.git/commit
block: add a dma mapping iterator
authorChristoph Hellwig <hch@lst.de>
Mon, 6 Jan 2025 08:15:29 +0000 (09:15 +0100)
committerJens Axboe <axboe@kernel.dk>
Mon, 6 Jan 2025 14:37:11 +0000 (07:37 -0700)
commitb7175e24d6acf79d9f3af9ce9d3d50de1fa748ec
tree1d2a766190544354f0bf32ee76d78f8dbcf6d6ec
parent2caca8fc7aad9ea9a6ea3ed26ed146b1e5f06fab
block: add a dma mapping iterator

blk_rq_map_sg is maze of nested loops.  Untangle it by creating an
iterator that returns [paddr,len] tuples for DMA mapping, and then
implement the DMA logic on top of this.  This not only removes code
at the source level, but also generates nicer binary code:

$ size block/blk-merge.o.*
   text    data     bss     dec     hex filename
  10001     432       0   10433    28c1 block/blk-merge.o.new
  10317     468       0   10785    2a21 block/blk-merge.o.old

Last but not least it will be used as a building block for a new
DMA mapping helper that doesn't rely on struct scatterlist.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Link: https://lore.kernel.org/r/20250106081609.798289-1-hch@lst.de
Signed-off-by: Jens Axboe <axboe@kernel.dk>
block/blk-merge.c