On 10/5/22 10:00, Keith Busch wrote:
If the hardware's DMA segment is smaller than a page, why doesn't the driver
just split a kernel's larger segment into whatever representation the hardware
wants? We do that in nvme, at least.
Hi Keith,
That's an interesting question. Your question made me realize that the
bio_map_kern() changes I proposed can be dropped if the code for
counting the number of segments is modified to support small segments.
My answer to your question is twofold:
* Splitting segments in a driver is easy to do if that doesn't cause the
number of segments limit to be exceeded (queue_limits.max_segments). It
is the responsibility of the block layer to split bios that exceed the
maximum number of segments into multiple bios - this is something that
cannot be done in a block driver. This is why I think that a (small
number of) block layer changes are needed.
* The blk_rq_map_sg() function really needs to be modified to support
segments smaller than the page size.
Thanks,
Bart.