From 0f94d73aaa16df5a14b4c0ef2fd780a70510bbfa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Sat, 31 Mar 2012 15:14:09 +0200 Subject: [PATCH] Make PrepareIndices() fail if there isn't anything left to do. --- .../kernel/file_systems/bfs/BlockAllocator.cpp | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/add-ons/kernel/file_systems/bfs/BlockAllocator.cpp b/src/add-ons/kernel/file_systems/bfs/BlockAllocator.cpp index 8481897208..3be1567c9f 100644 --- a/src/add-ons/kernel/file_systems/bfs/BlockAllocator.cpp +++ b/src/add-ons/kernel/file_systems/bfs/BlockAllocator.cpp @@ -1360,8 +1360,14 @@ BlockAllocator::CheckNextNode(check_control* control) fCheckCookie->pass = BFS_CHECK_PASS_INDEX; fCheckCookie->control.pass = BFS_CHECK_PASS_INDEX; + + status_t status = _PrepareIndices(); + if (status != B_OK) { + fCheckCookie->control.status = status; + return status; + } + fCheckCookie->stack.Push(fVolume->Root()); - _PrepareIndices(); continue; } @@ -2018,6 +2024,8 @@ BlockAllocator::_CheckInodeBlocks(Inode* inode, const char* name) status_t BlockAllocator::_PrepareIndices() { + int32 count = 0; + for (int32 i = 0; i < fCheckCookie->indices.CountItems(); i++) { check_index* index = fCheckCookie->indices.Array()[i]; Vnode vnode(fVolume, index->run); @@ -2041,9 +2049,10 @@ BlockAllocator::_PrepareIndices() index->inode = inode; vnode.Keep(); + count++; } - return B_OK; + return count == 0 ? B_ENTRY_NOT_FOUND : B_OK; }