Ticket #2551: 0003-Don-t-force-sequential-readahead-when-opening-files.patch

File 0003-Don-t-force-sequential-readahead-when-opening-files.patch, 1.5 KB (added by jch, 11 years ago)
  • libtransmission/fdlimit.c

    From 1c4f37163ca9e96ea84f9f1577830022c27ac60d Mon Sep 17 00:00:00 2001
    From: Juliusz Chroboczek <jch@pps.jussieu.fr>
    Date: Mon, 9 Nov 2009 07:18:00 +0100
    Subject: [PATCH 3/3] Don't force sequential readahead when opening files.
     This is no longer necessary now that we have proper prefetching.
    
    ---
     libtransmission/fdlimit.c |   15 ---------------
     1 files changed, 0 insertions(+), 15 deletions(-)
    
    diff --git a/libtransmission/fdlimit.c b/libtransmission/fdlimit.c
    index 06ca001..880dd7b 100644
    a b TrOpenFile( tr_session * session, 
    365365
    366366    /* open the file */
    367367    flags = doWrite ? ( O_RDWR | O_CREAT ) : O_RDONLY;
    368 #ifdef O_SEQUENTIAL
    369     flags |= O_SEQUENTIAL;
    370 #endif
    371368#ifdef O_LARGEFILE
    372369    flags |= O_LARGEFILE;
    373370#endif
    TrOpenFile( tr_session * session, 
    394391    if( doWrite && !alreadyExisted && ( preallocationMode == TR_PREALLOCATE_SPARSE ) )
    395392        preallocateFileSparse( file->fd, desiredFileSize );
    396393
    397 #ifdef HAVE_POSIX_FADVISE
    398     /* this doubles the OS level readahead buffer, which in practice
    399      * turns out to be a good thing, because many (most?) clients request
    400      * chunks of blocks in order.
    401      * It's okay for this to fail silently, so don't let it affect errno */
    402     {
    403         const int err = errno;
    404         posix_fadvise( file->fd, 0, 0, POSIX_FADV_SEQUENTIAL );
    405         errno = err;
    406     }
    407 #endif
    408 
    409394    return 0;
    410395}
    411396