]> granicus.if.org Git - transmission/commitdiff
(trunk libT) experimental commit to reduce IO lag during fast downloads
authorCharles Kerr <charles@transmissionbt.com>
Fri, 10 Apr 2009 00:58:26 +0000 (00:58 +0000)
committerCharles Kerr <charles@transmissionbt.com>
Fri, 10 Apr 2009 00:58:26 +0000 (00:58 +0000)
libtransmission/fdlimit.c
libtransmission/session.c

index 70100a1a6b305caaaaedf82dd239fa200f10eae8..f9f548ede9d8e79ba21504f8ed39511f6fd6d22e 100644 (file)
@@ -83,9 +83,6 @@ enum
 {
     NOFILE_BUFFER = 512, /* the process' number of open files is
                             globalMaxPeers + NOFILE_BUFFER */
-
-    SYNC_INTERVAL = 15   /* (arbitrary number) how many seconds to go
-                            between fsync calls for files in heavy use */
 };
 
 struct tr_openfile
@@ -96,7 +93,6 @@ struct tr_openfile
     char       filename[MAX_PATH_LENGTH];
     int        fd;
     uint64_t   date;
-    time_t     syncAt;
 };
 
 struct tr_fd_s
@@ -462,7 +458,6 @@ tr_fdFileCheckout( const char             * folder,
                 doWrite ? 'y' : 'n' );
         tr_strlcpy( o->filename, filename, sizeof( o->filename ) );
         o->isWritable = doWrite;
-        o->syncAt = time( NULL ) + SYNC_INTERVAL;
     }
 
     dbgmsg( "checking out '%s' in slot %d", filename, winner );
@@ -490,15 +485,6 @@ tr_fdFileReturn( int fd )
         o->isCheckedOut = 0;
         if( o->closeWhenDone )
             TrCloseFile( i );
-        else if( o->syncAt <= time( NULL ) ) {
-            dbgmsg( "fsync()ing file '%s' in slot #%d", o->filename, i );
-            //fsync( o->fd );
-#ifdef HAVE_POSIX_FADVISE
-            /* TODO: test performance with and without this */
-            posix_fadvise( o->fd, 0, 0, POSIX_FADV_DONTNEED );
-#endif
-            o->syncAt = time( NULL ) + SYNC_INTERVAL;
-        }
 
         break;
     }
index a58b910e922191e1fd4d7a82dcb6ac5f13fd1230..93913ff3b201094eb79d4deed773e8f613f9f142 100644 (file)
@@ -268,7 +268,8 @@ tr_sessionGetDefaultSettings( tr_benc * d )
     tr_bencDictAddInt ( d, TR_PREFS_KEY_PEER_SOCKET_TOS,          atoi( TR_DEFAULT_PEER_SOCKET_TOS_STR ) );
     tr_bencDictAddBool( d, TR_PREFS_KEY_PEX_ENABLED,              TRUE );
     tr_bencDictAddBool( d, TR_PREFS_KEY_PORT_FORWARDING,          TRUE );
-    tr_bencDictAddInt ( d, TR_PREFS_KEY_PREALLOCATION,            TR_PREALLOCATE_SPARSE );
+    tr_bencDictAddInt ( d, TR_PREFS_KEY_PREALLOCATION,            TR_PREALLOCATE_FULL );
+    /* tr_bencDictAddInt ( d, TR_PREFS_KEY_PREALLOCATION,            TR_PREALLOCATE_SPARSE ); */
     tr_bencDictAddStr ( d, TR_PREFS_KEY_PROXY,                    "" );
     tr_bencDictAddBool( d, TR_PREFS_KEY_PROXY_AUTH_ENABLED,       FALSE );
     tr_bencDictAddBool( d, TR_PREFS_KEY_PROXY_ENABLED,            FALSE );