* Now takes the removed but not yet deleted vnodes into account when allocating

spaces on the bitmap.
* This fixes bug #3730.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30177 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler 2009-04-15 16:24:33 +00:00
parent 4e98292b8e
commit e621d84da3
1 changed files with 26 additions and 10 deletions

View File

@ -1120,7 +1120,7 @@ BlockAllocator::_CheckGroup(int32 groupIndex) const
// TODO: implement new FS checking API
// Functions to check the validity of the bitmap - they are used from
// the "chkbfs" command (since this does even a bit more, maybe we should
// the "checkfs" command (since this does even a bit more, maybe we should
// move this some place else?)
@ -1185,6 +1185,17 @@ BlockAllocator::StartChecking(check_control* control)
fCheckCookie = cookie;
// to be able to restore nicely if "chkbfs" exited abnormally
#if !BFS_SHELL
// Put removed vnodes to the stack -- they are not reachable by traversing
// the file system anymore.
void* inode = NULL;
ino_t nodeID;
while (get_next_removed_vnode(fVolume->FSVolume(), &nodeID, &inode)
== B_OK) {
cookie->stack.Push(fVolume->ToBlockRun(nodeID));
}
#endif
// TODO: check reserved area in bitmap!
return B_OK;
@ -1299,8 +1310,6 @@ BlockAllocator::CheckNextNode(check_control* control)
return B_ENTRY_NOT_FOUND;
}
// get iterator for the next directory
Vnode vnode(fVolume, cookie->current);
Inode* inode;
if (vnode.Get(&inode) < B_OK) {
@ -1309,12 +1318,22 @@ BlockAllocator::CheckNextNode(check_control* control)
continue;
}
control->inode = inode->ID();
control->mode = inode->Mode();
if (!inode->IsContainer()) {
FATAL(("check: inode at %Ld should have been a directory\n",
fVolume->ToBlock(cookie->current)));
continue;
// Check file
control->errors = 0;
control->status = CheckInode(inode, control);
if (inode->GetName(control->name) < B_OK)
strcpy(control->name, "(node has no name)");
return B_OK;
}
// get iterator for the next directory
BPlusTree* tree;
if (inode->GetTree(&tree) != B_OK) {
FATAL(("check: could not open b+tree from inode at %Ld\n",
@ -1337,10 +1356,7 @@ BlockAllocator::CheckNextNode(check_control* control)
control->status = CheckInode(inode, control);
if (inode->GetName(control->name) < B_OK)
strcpy(control->name, "(node has no name)");
control->inode = inode->ID();
control->mode = inode->Mode();
strcpy(control->name, "(dir has no name)");
return B_OK;
}