|
@@ -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()) {
|