From e2fcd6d72c577688160ce2ae3886edb67416525d Mon Sep 17 00:00:00 2001 From: Tatsuhiro Tsujikawa Date: Sat, 11 Aug 2012 23:38:58 +0900 Subject: Use enum to select file allocation method --- src/MultiFileAllocationIterator.cc | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to 'src/MultiFileAllocationIterator.cc') diff --git a/src/MultiFileAllocationIterator.cc b/src/MultiFileAllocationIterator.cc index e45c71e6..f17115fe 100644 --- a/src/MultiFileAllocationIterator.cc +++ b/src/MultiFileAllocationIterator.cc @@ -67,20 +67,22 @@ void MultiFileAllocationIterator::allocateChunk() diskAdaptor_->openIfNot(entry, &DiskWriterEntry::openFile); if(entry->needsFileAllocation() && entry->size() < fileEntry->getLength()) { // Calling private function of MultiDiskAdaptor. + switch(diskAdaptor_->getFileAllocationMethod()) { #ifdef HAVE_SOME_FALLOCATE - if(diskAdaptor_->doesFallocate()) { + case(DiskAdaptor::FILE_ALLOC_FALLOC): fileAllocationIterator_.reset (new FallocFileAllocationIterator(entry->getDiskWriter().get(), entry->size(), fileEntry->getLength())); - } else + break; #endif // HAVE_SOME_FALLOCATE - { - fileAllocationIterator_.reset - (new AdaptiveFileAllocationIterator(entry->getDiskWriter().get(), - entry->size(), - fileEntry->getLength())); - } + default: + fileAllocationIterator_.reset + (new AdaptiveFileAllocationIterator(entry->getDiskWriter().get(), + entry->size(), + fileEntry->getLength())); + break; + } } } if(finished()) { -- cgit