From 75520acd386a2617e3e90e97edd3bb1774403ad4 Mon Sep 17 00:00:00 2001 From: Charles Kerr Date: Sun, 26 Apr 2009 19:50:31 +0000 Subject: [PATCH] (trunk libT) tweak tr_open_file_for_scanning() on OS X for sequential, non-cached reading suitable for verify() and tr_fileLoad() --- libtransmission/fdlimit.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/libtransmission/fdlimit.c b/libtransmission/fdlimit.c index 2a22479ec..1795d6740 100644 --- a/libtransmission/fdlimit.c +++ b/libtransmission/fdlimit.c @@ -230,6 +230,10 @@ tr_open_file_for_scanning( const char * filename ) #ifdef HAVE_POSIX_FADVISE posix_fadvise( fd, 0, 0, POSIX_FADV_SEQUENTIAL ); #endif +#ifdef SYS_DARWIN + fcntl( fd, F_NOCACHE, 1 ); + fcntl( fd, F_RDAHEAD, 1 ); +#endif return fdopen( fd, "r" ); } @@ -239,8 +243,6 @@ flush_before_closing( int fd ) { #if defined(HAVE_POSIX_FADVISE) posix_fadvise( fd, 0, 0, POSIX_FADV_DONTNEED ); -#elif defined(SYS_DARWIN) - fcntl( fd, F_NOCACHE, 1 ); #endif }