LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Kernel (https://www.linuxquestions.org/questions/linux-kernel-70/)
-   -   Doing a zero-copy move of data from a kernel buffer to hard disk. (https://www.linuxquestions.org/questions/linux-kernel-70/doing-a-zero-copy-move-of-data-from-a-kernel-buffer-to-hard-disk-833385/)

neeraj.kumar01 09-20-2010 01:46 PM

Doing a zero-copy move of data from a kernel buffer to hard disk.
 
I am trying to move data from a buffer in kernel space into the hard
disk without having to incur any additional copies from kernel buffer to
user buffers or any other kernel buffers. Any ideas/suggestions would be
most helpful.

The use case is basically a demux driver which collects data into a
demux buffer in kernel space and this buffer has to be emptied
periodically by copying the contents into a FUSE-based partition on the
disk. As the buffer gets full, a user process is signalled which then
determines the sector numbers on the disk the contents need to be copied
to.

I was hoping to mmap the above demux kernel buffer into user address
space and issue a write system call to the raw partition device. But
from what I can see, this data is being cached by the kernel on its
way to the Hard Disk driver. And so I am assuming that involves
additional copies by the linux kernel.

At this point I am wondering if there is any other mechansim to do this
without involving additional copies by the kernel. I realize this is an
unsual usage scenario for non-embedded environments, but I would
appreciate any feedback on possible options.

BTW - I have tried using O_DIRECT when opening the raw partition, but
the subsequent write call fails if the buffer being passed is a
mmapped buffer.


Thanx!

archtoad6 12-17-2010 06:48 PM

3 months & no replies. :( :cry:

Did you solve your problem?
  • If so, please provide your solution -- it might help someone else w/ the same problem.
  • If not, would you like some help w/ re-phrasing your question, or providing more info.?


All times are GMT -5. The time now is 09:02 PM.