From d734ff7d298d0abee4e6f75f94afd2d33e0c8fc6 Mon Sep 17 00:00:00 2001 From: Tatsuhiro Tsujikawa Date: Sun, 12 Aug 2012 16:52:53 +0900 Subject: 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. --- src/MultiFileAllocationIterator.cc | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src/MultiFileAllocationIterator.cc') 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(), -- cgit