Disable read ahead for files opened with FILE_RANDOM_ACCESS hint on Mac OS X and FreeBSD.
Signed-off-by: Luke Deller luke@deller.id.au --- server/fd.c | 7 +++++++ 1 file changed, 7 insertions(+)
diff --git a/server/fd.c b/server/fd.c index c9a21186722..ebcbd4266cc 100644 --- a/server/fd.c +++ b/server/fd.c @@ -2054,6 +2054,13 @@ struct fd *open_fd( struct fd *root, const char *name, struct unicode_str nt_nam posix_fadvise( fd->unix_fd, 0, 0, POSIX_FADV_RANDOM ); break; } +#elif defined F_RDAHEAD /* Mac OS X, FreeBSD */ + switch (options & (FILE_SEQUENTIAL_ONLY | FILE_RANDOM_ACCESS)) + { + case FILE_RANDOM_ACCESS: + fcntl( fd->unix_fd, F_RDAHEAD, 0 ); + break; + } #endif
if (root_fd != -1) fchdir( server_dir_fd ); /* go back to the server dir */