From 0746a8eafa50b0da0aabcff87e802082fb0c9284 Mon Sep 17 00:00:00 2001 From: Charles Kerr Date: Mon, 6 Apr 2009 23:51:55 +0000 Subject: [PATCH] (trunk libT) posix_fadvise() tweak to the new verify code. --- libtransmission/verify.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/libtransmission/verify.c b/libtransmission/verify.c index 5608d8911..be6a0768d 100644 --- a/libtransmission/verify.c +++ b/libtransmission/verify.c @@ -13,6 +13,11 @@ #include /* S_ISREG */ #include +#ifdef HAVE_POSIX_FADVISE + #define _XOPEN_SOURCE 600 + #include /* posix_fadvise() */ +#endif + #include #include "transmission.h" @@ -70,6 +75,9 @@ verifyTorrent( tr_torrent * tor, tr_bool * stopFlag ) { char * filename = tr_buildPath( tor->downloadDir, file->name, NULL ); fp = fopen( filename, "rb" ); +#ifdef HAVE_POSIX_FADVISE + posix_fadvise( fileno( fp ), 0, 0, POSIX_FADV_SEQUENTIAL ); +#endif /* fprintf( stderr, "opening file #%d (%s) -- %p\n", fileIndex, filename, fp ); */ tr_free( filename ); }