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

derrell at samba.org derrell at samba.org
Thu May 10 01:35:29 GMT 2007


As I was working on a solution to the fact that my system provides the
readahead() function but not a declaration for that function, I discovered
that readahead() is documented as:

 CONFORMING TO
       The  readahead()  system  call is Linux specific, and its use should be
       avoided in portable applications.

Given this, it is possible that different Linux versions may conceivably use
slightly different prototypes for readahead(), so providing a declaration in
lib/replace is somewhat dangerous.

In researching this, I discovered what appears to be a POSIX replacement.  It
looks like readahead is equivalent to posix_fadvise(..., POSIX_FADV_WILLNEED).

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().

Cheers,

Derrell


More information about the samba-technical mailing list