mirror of
https://github.com/transmission/transmission
synced 2025-02-04 05:22:40 +00:00
(trunk libT) possible IO speedup on OS X based on feedback from ticket #1967
This commit is contained in:
parent
4f571c38e0
commit
2b8f8166bd
1 changed files with 2 additions and 8 deletions
|
@ -227,10 +227,7 @@ tr_open_file_for_reading( const char * filename, tr_bool sequential )
|
||||||
if( fd < 0 )
|
if( fd < 0 )
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
#if defined( SYS_DARWIN )
|
#ifdef HAVE_POSIX_FADVISE
|
||||||
fcntl( fd, F_NOCACHE, 1 );
|
|
||||||
fcntl( fd, F_RDAHEAD, sequential );
|
|
||||||
#elif defined( HAVE_POSIX_FADVISE )
|
|
||||||
posix_fadvise( fd, 0, 0, sequential ? POSIX_FADV_SEQUENTIAL : POSIX_FADV_RANDOM );
|
posix_fadvise( fd, 0, 0, sequential ? POSIX_FADV_SEQUENTIAL : POSIX_FADV_RANDOM );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -307,10 +304,7 @@ TrOpenFile( int i,
|
||||||
if( doWrite && !alreadyExisted && ( preallocationMode == TR_PREALLOCATE_SPARSE ) )
|
if( doWrite && !alreadyExisted && ( preallocationMode == TR_PREALLOCATE_SPARSE ) )
|
||||||
preallocateFileSparse( file->fd, desiredFileSize );
|
preallocateFileSparse( file->fd, desiredFileSize );
|
||||||
|
|
||||||
#if defined( SYS_DARWIN )
|
#ifdef HAVE_POSIX_FADVISE
|
||||||
fcntl( file->fd, F_NOCACHE, 1 );
|
|
||||||
fcntl( file->fd, F_RDAHEAD, 0 );
|
|
||||||
#elif defined( HAVE_POSIX_FADVISE )
|
|
||||||
posix_fadvise( file->fd, 0, 0, POSIX_FADV_RANDOM );
|
posix_fadvise( file->fd, 0, 0, POSIX_FADV_RANDOM );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue