summaryrefslogtreecommitdiff
path: root/src/MultiFileAllocationIterator.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/MultiFileAllocationIterator.cc')
-rw-r--r--src/MultiFileAllocationIterator.cc23
1 files changed, 14 insertions, 9 deletions
diff --git a/src/MultiFileAllocationIterator.cc b/src/MultiFileAllocationIterator.cc
index 647d4ebf..ff131573 100644
--- a/src/MultiFileAllocationIterator.cc
+++ b/src/MultiFileAllocationIterator.cc
@@ -36,7 +36,9 @@
#include "MultiDiskAdaptor.h"
#include "FileEntry.h"
#include "SingleFileAllocationIterator.h"
-#include "FallocFileAllocationIterator.h"
+#ifdef HAVE_POSIX_FALLOCATE
+# include "FallocFileAllocationIterator.h"
+#endif // HAVE_POSIX_FALLOCATE
#include "DiskWriter.h"
namespace aria2 {
@@ -62,19 +64,22 @@ void MultiFileAllocationIterator::allocateChunk()
_diskAdaptor->openIfNot(entry, &DiskWriterEntry::openFile);
if(entry->needsFileAllocation() && entry->size() < fileEntry->getLength()) {
// Calling private function of MultiDiskAdaptor.
+#ifdef HAVE_POSIX_FALLOCATE
if(_diskAdaptor->doesFallocate()) {
_fileAllocationIterator.reset
(new FallocFileAllocationIterator(entry->getDiskWriter().get(),
entry->size(),
fileEntry->getLength()));
- } else {
- SharedHandle<SingleFileAllocationIterator> fa
- (new SingleFileAllocationIterator(entry->getDiskWriter().get(),
- entry->size(),
- fileEntry->getLength()));
- fa->init();
- _fileAllocationIterator = fa;
- }
+ } else
+#endif // HAVE_POSIX_FALLOCATE
+ {
+ SharedHandle<SingleFileAllocationIterator> fa
+ (new SingleFileAllocationIterator(entry->getDiskWriter().get(),
+ entry->size(),
+ fileEntry->getLength()));
+ fa->init();
+ _fileAllocationIterator = fa;
+ }
}
}
if(finished()) {