Re: [PATCH] O_STREAMING - flag for optimal streaming I/O

Robert Love (rml@tech9.net)
08 Oct 2002 14:49:09 -0400


On Tue, 2002-10-08 at 14:38, Chris Wedgwood wrote:

> > Attached patch implements an O_STREAMING file I/O flag which enables
> > manual drop-behind of pages.

I answered this in a previous email to this list:

In a lot of ways. This flag changes no semantics except to not let
pages from the mapping populate the page cache for very long.

In other words, this flag pretty much disables the pagecache for
this mapping, although we happily keep it around for write-behind
and read-ahead. But once the data is behind us and safe to kill, we
do. It is manual drop-behind.

O_DIRECT has a lot of semantics, one of which is to attempt to
minimize cache effects. It is also synchronous, requires properly
aligned buffers, and pretty much minimizes interaction with as much
of the kernel as possible. I am not overly familiar with its uses,
but I always assumed the big user is applications that implement
their own caching layer.

O_STREAMING would be for your TiVo or network audio streamer. Any
file I/O that is inherently sequential and access-once. No point
trashing the pagecache with its data - but otherwise the behavior is
normal.

Basically, with O_STREAMING you want normal semantics except drop-behind
of the pages. You even still want the pagecache caching your data -
just the not-yet-written write-behind data and the not-yet-read
read-ahead data.

With O_DIRECT you get a whole different can-of-worms. Basically you cut
out a lot of the kernel. You can do normal libc file I/O on an
O_STREAMING file with no semantic changes; except the drop-behind of the
pages.

Robert Love

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/