summaryrefslogtreecommitdiff
path: root/src/StreamFileAllocationEntry.cc
diff options
context:
space:
mode:
authorTatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>2012-06-23 21:28:41 +0900
committerTatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>2012-06-24 16:28:04 +0900
commit96720b297d50d290bda746fab75e0078ac5f975b (patch)
treef2176e1da9b38c69cb0cba9d495201907dbf4625 /src/StreamFileAllocationEntry.cc
parent38426d744b918088a35e41afd6acbe86a904c441 (diff)
Added --enable-mmap option.
If this option is used, map files into memory using mmap(2). This option is experimental.
Diffstat (limited to 'src/StreamFileAllocationEntry.cc')
-rw-r--r--src/StreamFileAllocationEntry.cc5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/StreamFileAllocationEntry.cc b/src/StreamFileAllocationEntry.cc
index dd440a35..b93df899 100644
--- a/src/StreamFileAllocationEntry.cc
+++ b/src/StreamFileAllocationEntry.cc
@@ -44,6 +44,8 @@
#include "Command.h"
#include "PeerStat.h"
#include "FileEntry.h"
+#include "PieceStorage.h"
+#include "DiskAdaptor.h"
namespace aria2 {
@@ -61,6 +63,9 @@ void StreamFileAllocationEntry::prepareForNextAction
// For DownloadContext::resetDownloadStartTime(), see also
// RequestGroup::createInitialCommand()
getRequestGroup()->getDownloadContext()->resetDownloadStartTime();
+ if(getRequestGroup()->getOption()->getAsBool(PREF_ENABLE_MMAP)) {
+ getRequestGroup()->getPieceStorage()->getDiskAdaptor()->enableMmap();
+ }
if(getNextCommand()) {
// Reset download start time of PeerStat because it is started
// before file allocation begins.