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

David Collier-Brown davec-b at rogers.com
Thu May 10 12:59:03 GMT 2007


   And even that isn't extant on Solaris, so both calls are no-ops.

   In general, you will find most filesystems try to do coalescence on
writes and readahed on reads, irrespective of vendor.
On solaris this is controlled by the -C option on newfs, and affected
by the -a (maxcontig) option to newfs/tunefs.

--dave

derrell at samba.org wrote:
> 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
> 

-- 
David Collier-Brown,         | Always do right. This will gratify
System Programmer and Author | some people and astonish the rest
davecb at spamcop.net           |                      -- Mark Twain
(416) 223-5943


More information about the samba-technical mailing list