Ignore:
Timestamp:
Jan 25, 2009, 11:33:10 PM (13 years ago)
Author:
charles
Message:

(trunk libT) add mac, linux, and win32 support for os-level hints that local data will be read in random order, to disable readahead buffering.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/libtransmission/fdlimit.c

    r7742 r7798  
    232232    /* open the file */
    233233    flags = doWrite ? ( O_RDWR | O_CREAT ) : O_RDONLY;
     234#ifdef O_RANDOM
     235    flags |= O_RANDOM
     236#endif
    234237#ifdef O_LARGEFILE
    235238    flags |= O_LARGEFILE;
     
    249252    if( doWrite && !alreadyExisted && ( preallocationMode == TR_PREALLOCATE_SPARSE ) )
    250253        preallocateFileSparse( file->fd, desiredFileSize );
     254
     255#if defined( SYS_DARWIN )
     256    fcntl( file->fd, F_NOCACHE, 1 );
     257    fcntl( file->fd, F_RDAHEAD, 0 );
     258#elif defined( HAVE_POSIX_FADVISE )
     259    posix_fadvise( file->fd, 0, 0, POSIX_FADV_RANDOM );
     260#endif
    251261
    252262    tr_free( filename );
Note: See TracChangeset for help on using the changeset viewer.