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

Jeremy Allison jra at samba.org
Thu May 10 19:08:47 GMT 2007


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

#if defined(HAVE_LINUX_READAHEAD)
                int err = readahead(fromfd, offset, (size_t)rhd->len);
                DEBUG(10,("readahead_sendfile: readahead on fd %u,
offset %llu, len %u returned %d\n",
                        (unsigned int)fromfd,
                        (unsigned long long)offset,
                        (unsigned int)rhd->len,
                        err ));
#elif defined(HAVE_POSIX_FADVISE)
                int err = posix_fadvise(fromfd, offset, (off_t)rhd->len,
POSIX_FADV_WILLNEED);
                DEBUG(10,("readahead_sendfile: posix_fadvise on fd %u,
offset %llu, len %u returned %d\n",
                        (unsigned int)fromfd,
                        (unsigned long long)offset,
                        (unsigned int)rhd->len,
                        err ));
#else
                if (!rhd->didmsg) {
                        DEBUG(0,("readahead_sendfile: no readahead on
this platform\n"));
                        rhd->didmsg = True;
                }
#endif



More information about the samba-technical mailing list