readahead() which is Linux-only vs. posix_fadvise()

Jeremy Allison jra at samba.org
Thu May 10 19:34:17 GMT 2007


On Thu, May 10, 2007 at 03:16:35PM -0400, derrell at samba.org wrote:
> Jeremy Allison <jra at samba.org> writes:
> 
> > On Wed, May 09, 2007 at 09:35:29PM -0400, derrell at samba.org wrote:
> >> 
> >> The only place that readahead() is used, I think, is in vfs_readahead.c.
> >> It might make sense for the maintainer of this module to look into using
> >> posix_fadvise() instead of readahead().
> >
> > Did you look at the code here :-) ? I'm guessing not....
> 
> Clearly I hadn't noticed that further down it tries posix_fadvise().  Thanks
> for pointing it out.  Based on the fact that there's possibly no reliable
> declaration for readahead() and that there is a POSIX-compliant alternative,
> would it make sense to swap the order... try to use posix_fadvise() first, and
> if it doesn't exist, then look for readahead()?  (Also, since Linux provides
> posix_fadvise(), maybe there's no reason for readahead() at all?)

No it doesn't make sense, as readahead and posix_fadvise actually
do different things. I want the readahead semantics in this case
and only fall back to posix_fadvise as a poor mans alternative.

Jeremy


More information about the samba-technical mailing list