summaryrefslogtreecommitdiff
path: root/src/FallocFileAllocationIterator.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/FallocFileAllocationIterator.cc')
-rw-r--r--src/FallocFileAllocationIterator.cc11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/FallocFileAllocationIterator.cc b/src/FallocFileAllocationIterator.cc
index 1fd53d68..3e4e24d1 100644
--- a/src/FallocFileAllocationIterator.cc
+++ b/src/FallocFileAllocationIterator.cc
@@ -43,12 +43,13 @@ FallocFileAllocationIterator::FallocFileAllocationIterator
void FallocFileAllocationIterator::allocateChunk()
{
- if(static_cast<uint64_t>(offset_) > totalLength_) {
- throw DL_ABORT_EX("FallocFileAllocationIterator: offset is larger than"
- " totalLength");
+ if(static_cast<uint64_t>(offset_) < totalLength_) {
+ stream_->allocate(offset_, totalLength_-offset_);
+ offset_ = totalLength_;
+ } else {
+ stream_->truncate(totalLength_);
+ offset_ = totalLength_;
}
- stream_->allocate(offset_, totalLength_-offset_);
- offset_ = totalLength_;
}
bool FallocFileAllocationIterator::finished()