summaryrefslogtreecommitdiff
path: root/src/BtFileAllocationEntry.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/BtFileAllocationEntry.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/BtFileAllocationEntry.cc')
-rw-r--r--src/BtFileAllocationEntry.cc7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/BtFileAllocationEntry.cc b/src/BtFileAllocationEntry.cc
index 94f6df94..95d383ec 100644
--- a/src/BtFileAllocationEntry.cc
+++ b/src/BtFileAllocationEntry.cc
@@ -42,6 +42,10 @@
#include "DownloadEngine.h"
#include "DownloadContext.h"
#include "FileEntry.h"
+#include "PieceStorage.h"
+#include "DiskAdaptor.h"
+#include "Option.h"
+#include "prefs.h"
namespace aria2 {
@@ -55,6 +59,9 @@ void BtFileAllocationEntry::prepareForNextAction
{
BtSetup().setup(commands, getRequestGroup(), e,
getRequestGroup()->getOption().get());
+ if(getRequestGroup()->getOption()->getAsBool(PREF_ENABLE_MMAP)) {
+ getRequestGroup()->getPieceStorage()->getDiskAdaptor()->enableMmap();
+ }
if(!getRequestGroup()->downloadFinished()) {
// For DownloadContext::resetDownloadStartTime(), see also
// RequestGroup::createInitialCommand()