Ticket #2551: prefetch-no-sequential.patch

File prefetch-no-sequential.patch, 1.1 KB (added by jch, 11 years ago)
  • libtransmission/fdlimit.c

    diff --git a/libtransmission/fdlimit.c b/libtransmission/fdlimit.c
    index 8132ed1..905a19d 100644
    a b TrOpenFile( tr_session * session, 
    366366
    367367    /* open the file */
    368368    flags = doWrite ? ( O_RDWR | O_CREAT ) : O_RDONLY;
    369 #ifdef O_SEQUENTIAL
    370     flags |= O_SEQUENTIAL;
    371 #endif
    372369#ifdef O_LARGEFILE
    373370    flags |= O_LARGEFILE;
    374371#endif
    TrOpenFile( tr_session * session, 
    395392    if( doWrite && !alreadyExisted && ( preallocationMode == TR_PREALLOCATE_SPARSE ) )
    396393        preallocateFileSparse( file->fd, desiredFileSize );
    397394
    398 #ifdef HAVE_POSIX_FADVISE
    399     /* this doubles the OS level readahead buffer, which in practice
    400      * turns out to be a good thing, because many (most?) clients request
    401      * chunks of blocks in order.
    402      * It's okay for this to fail silently, so don't let it affect errno */
    403     {
    404         const int err = errno;
    405         posix_fadvise( file->fd, 0, 0, POSIX_FADV_SEQUENTIAL );
    406         errno = err;
    407     }
    408 #endif
    409 
    410395    return 0;
    411396}
    412397