On Sun, Apr 29, 2012 at 11:29 AM, Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx> wrote: > > But I think I have another approach. We can make the *writer* be the > only one that cares about the packetized nature, and if it's a packet > write, it will set a PIPE_BUF_PACKET flag in the pipe buffer. The > reader can react to that. I think that actually has the potential to > make the code a bit prettier too.. Patch attached. This keeps Alan's idea of using O_DIRECT, but only makes it matter for the writer - because now the "packet" thing is a per-pipe-buffer state (we already had per-pipe-buffer flags, so this is not anything new). So when you *write* using a O_DIRECT pipe, it will create packetized buffers, and the reader just sees that directly. So this should "just work", and doesn't need any extra flags in the pipe_inode_info. And the user space interface remains the same: you can create these packet pipes with "pipe2(fd, O_DIRECT)" if you want to, and my test-program gives exactly the same output. Linus
Attachment:
patch.diff
Description: Binary data