Re: [PATCH v6 03/34] iov_iter: Pass I/O direction into iov_iter_get_pages*()

From: David Hildenbrand
Date: Tue Jan 17 2023 - 03:09:23 EST


On 17.01.23 08:57, Christoph Hellwig wrote:
On Mon, Jan 16, 2023 at 11:08:24PM +0000, David Howells wrote:
Define FOLL_SOURCE_BUF and FOLL_DEST_BUF to indicate to get_user_pages*()
and iov_iter_get_pages*() how the buffer is intended to be used in an I/O
operation. Don't use READ and WRITE as a read I/O writes to memory and
vice versa - which causes confusion.

The direction is checked against the iterator's data_source.

Why can't we use the existing FOLL_WRITE?

Agreed. What I understand, David considers that confusing when considering the I/O side of things.

I recall that there is

DMA_BIDIRECTIONAL -> FOLL_WRITE
DMA_TO_DEVICE -> !FOLL_WRITE
DMA_FROM_DEVICE -> FOLL_WRITE

that used different defines for a different API. Such terminology would be easier to get ... but then, again, not sure if we really need acronyms here.

We're pinning pages and FOLL_WRITE defines how we (pinning the page) are going to access these pages: R/O or R/W. So the read vs. write is never from the POC of the device (DMA read will write to the page).

--
Thanks,

David / dhildenb