summaryrefslogtreecommitdiff
path: root/src/BtCheckIntegrityEntry.cc
diff options
context:
space:
mode:
authorTatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>2009-03-25 05:43:07 +0000
committerTatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>2009-03-25 05:43:07 +0000
commit29c5ef9215be004b31cd53ef8841680c3f015d57 (patch)
treeacae3135c9240d627b30629c5a7594951a4cb688 /src/BtCheckIntegrityEntry.cc
parentfe614395d60da75836dbfb3f0a593d91b4024a89 (diff)
2009-03-25 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Added 'falloc' parameter for --file-allocation option. 'falloc' allocation mode uses posix_fallocate() system call to allocate file on disk. If you are using newer file systems such as ext4 (with extents support), btrfs or xfs, 'falloc' is your best choice. It allocates large(few GiB) files almost instantly. Don't use 'falloc' with legacy file systems such as ext3 because it takes almost same time as 'prealloc' and it blocks aria2 entirely until allocation finishes. 'falloc' may not be available if your system doesn't have posix_fallocate() system call. * configure.ac * src/AbstractDiskWriter.cc * src/AbstractDiskWriter.h * src/AbstractSingleDiskAdaptor.cc * src/BinaryStream.h * src/BtCheckIntegrityEntry.cc * src/ByteArrayDiskWriter.h * src/CheckIntegrityEntry.cc * src/CheckIntegrityEntry.h * src/DefaultPieceStorage.cc * src/DiskAdaptor.cc * src/DiskAdaptor.h * src/DiskWriter.h * src/FallocFileAllocationIterator.cc * src/FallocFileAllocationIterator.h * src/FileAllocationEntry.cc * src/FileAllocationEntry.h * src/Makefile.am * src/MultiFileAllocationIterator.cc * src/MultiFileAllocationIterator.h * src/OptionHandlerFactory.cc * src/RequestGroup.cc * src/StreamCheckIntegrityEntry.cc * src/prefs.cc * src/prefs.h * src/usage_text.h * test/FallocFileAllocationIteratorTest.cc * test/Makefile.am
Diffstat (limited to 'src/BtCheckIntegrityEntry.cc')
-rw-r--r--src/BtCheckIntegrityEntry.cc20
1 files changed, 6 insertions, 14 deletions
diff --git a/src/BtCheckIntegrityEntry.cc b/src/BtCheckIntegrityEntry.cc
index bed582c5..1be5e251 100644
--- a/src/BtCheckIntegrityEntry.cc
+++ b/src/BtCheckIntegrityEntry.cc
@@ -37,7 +37,6 @@
#include "RequestGroup.h"
#include "PieceStorage.h"
#include "DownloadEngine.h"
-#include "FileAllocationMan.h"
#include "DiskAdaptor.h"
#include "prefs.h"
#include "Option.h"
@@ -49,17 +48,6 @@ BtCheckIntegrityEntry::BtCheckIntegrityEntry(RequestGroup* requestGroup):
BtCheckIntegrityEntry::~BtCheckIntegrityEntry() {}
-static void proceedFileAllocation
-(std::deque<Command*>& commands, DownloadEngine* e, RequestGroup* requestGroup)
-{
- FileAllocationEntryHandle entry(new BtFileAllocationEntry(requestGroup));
- if(requestGroup->needsFileAllocation()) {
- e->_fileAllocationMan->pushEntry(entry);
- } else {
- entry->prepareForNextAction(commands, e);
- }
-}
-
void BtCheckIntegrityEntry::onDownloadIncomplete(std::deque<Command*>& commands,
DownloadEngine* e)
{
@@ -68,7 +56,9 @@ void BtCheckIntegrityEntry::onDownloadIncomplete(std::deque<Command*>& commands,
_requestGroup->getPieceStorage()->getDiskAdaptor()->disableReadOnly();
_requestGroup->getPieceStorage()->getDiskAdaptor()->openFile();
- proceedFileAllocation(commands, e, _requestGroup);
+ SharedHandle<BtFileAllocationEntry> entry
+ (new BtFileAllocationEntry(_requestGroup));
+ proceedFileAllocation(commands, entry, e);
}
void BtCheckIntegrityEntry::onDownloadFinished(std::deque<Command*>& commands,
@@ -80,7 +70,9 @@ void BtCheckIntegrityEntry::onDownloadFinished(std::deque<Command*>& commands,
// to exit rather than doing seeding. So, it would be good to toggle this
// behavior.
if(e->option->getAsBool(PREF_BT_HASH_CHECK_SEED)) {
- proceedFileAllocation(commands, e, _requestGroup);
+ SharedHandle<BtFileAllocationEntry> entry
+ (new BtFileAllocationEntry(_requestGroup));
+ proceedFileAllocation(commands, entry, e);
}
}