6

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?

leonp
  • 487
  • 5
  • 22
  • Which combination of flags you use for mmap? – lonewasp Dec 27 '14 at 07:52
  • @lonewasp I tried a lot. But the most logical for me looks: mmap(TBuf, TSIZE, PROT_WRITE, MAP_FIXED|MAP_SHARED, fdo, offs) Actually, any working will be OK...:) – leonp Dec 27 '14 at 09:02

0 Answers0