* 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

View File

@ -1120,7 +1120,7 @@ BlockAllocator::_CheckGroup(int32 groupIndex) const
// TODO: implement new FS checking API // TODO: implement new FS checking API
// Functions to check the validity of the bitmap - they are used from // 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?) // move this some place else?)
@ -1185,6 +1185,17 @@ BlockAllocator::StartChecking(check_control* control)
fCheckCookie = cookie; fCheckCookie = cookie;
// to be able to restore nicely if "chkbfs" exited abnormally // 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! // TODO: check reserved area in bitmap!
return B_OK; return B_OK;
@ -1299,8 +1310,6 @@ BlockAllocator::CheckNextNode(check_control* control)
return B_ENTRY_NOT_FOUND; return B_ENTRY_NOT_FOUND;
} }
// get iterator for the next directory
Vnode vnode(fVolume, cookie->current); Vnode vnode(fVolume, cookie->current);
Inode* inode; Inode* inode;
if (vnode.Get(&inode) < B_OK) { if (vnode.Get(&inode) < B_OK) {
@ -1309,12 +1318,22 @@ BlockAllocator::CheckNextNode(check_control* control)
continue; continue;
} }
control->inode = inode->ID();
control->mode = inode->Mode();
if (!inode->IsContainer()) { if (!inode->IsContainer()) {
FATAL(("check: inode at %Ld should have been a directory\n", // Check file
fVolume->ToBlock(cookie->current))); control->errors = 0;
continue; 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; BPlusTree* tree;
if (inode->GetTree(&tree) != B_OK) { if (inode->GetTree(&tree) != B_OK) {
FATAL(("check: could not open b+tree from inode at %Ld\n", 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); control->status = CheckInode(inode, control);
if (inode->GetName(control->name) < B_OK) if (inode->GetName(control->name) < B_OK)
strcpy(control->name, "(node has no name)"); strcpy(control->name, "(dir has no name)");
control->inode = inode->ID();
control->mode = inode->Mode();
return B_OK; return B_OK;
} }