summaryrefslogtreecommitdiff
path: root/src/MultiFileAllocationIterator.cc
diff options
context:
space:
mode:
authorTatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>2012-08-12 16:52:53 +0900
committerTatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>2012-08-12 16:52:53 +0900
commitd734ff7d298d0abee4e6f75f94afd2d33e0c8fc6 (patch)
tree704597e9a322ca8fa85cf3db94ea51299e7fd076 /src/MultiFileAllocationIterator.cc
parente2fcd6d72c577688160ce2ae3886edb67416525d (diff)
Added new file allocation method called 'trunc'
--file-allocation option can now take new value 'trunc'. 'trunc' uses ftruncate() system call or platform-specific counterpart to truncate a file to a specified length.
Diffstat (limited to 'src/MultiFileAllocationIterator.cc')
-rw-r--r--src/MultiFileAllocationIterator.cc7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/MultiFileAllocationIterator.cc b/src/MultiFileAllocationIterator.cc
index f17115fe..24653335 100644
--- a/src/MultiFileAllocationIterator.cc
+++ b/src/MultiFileAllocationIterator.cc
@@ -36,6 +36,7 @@
#include "MultiDiskAdaptor.h"
#include "FileEntry.h"
#include "AdaptiveFileAllocationIterator.h"
+#include "TruncFileAllocationIterator.h"
#ifdef HAVE_SOME_FALLOCATE
# include "FallocFileAllocationIterator.h"
#endif // HAVE_SOME_FALLOCATE
@@ -76,6 +77,12 @@ void MultiFileAllocationIterator::allocateChunk()
fileEntry->getLength()));
break;
#endif // HAVE_SOME_FALLOCATE
+ case(DiskAdaptor::FILE_ALLOC_TRUNC):
+ fileAllocationIterator_.reset
+ (new TruncFileAllocationIterator(entry->getDiskWriter().get(),
+ entry->size(),
+ fileEntry->getLength()));
+ break;
default:
fileAllocationIterator_.reset
(new AdaptiveFileAllocationIterator(entry->getDiskWriter().get(),