SHORT: I can't find a way to mmap
the O_WRONLY
opened file.
LONG: I am looking for the way to write DMA (s/g mode) provided data to disk PARTITION(!) as fast as possible, avoiding kernel buffering. O_DIRECT
does not work and Linus forbids to use it.
For this I mmap
each DMA buffer with MAP_FIXED and corresponding offset in the file. But if the file is opened as O_RDWR
, this causes the kernel to compete with the DMA on filling the input RAM with file data. In most cases kernel wins...:)
So, I need to explain to the kernel, that it shouldn't touch my pages, just write them into the mapped file when I call msync()
. How?