* checkfs should now also remove unaccessible files. Not yet tested.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31771 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
71e439ea3e
commit
84ce48c248
@ -1347,7 +1347,7 @@ BlockAllocator::CheckNextNode(check_control* control)
|
|||||||
|
|
||||||
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) {
|
||||||
FATAL(("check: Could not open inode at %Ld\n",
|
FATAL(("check: Could not open inode at %Ld\n",
|
||||||
fVolume->ToBlock(cookie->current)));
|
fVolume->ToBlock(cookie->current)));
|
||||||
continue;
|
continue;
|
||||||
@ -1423,9 +1423,15 @@ BlockAllocator::CheckNextNode(check_control* control)
|
|||||||
|
|
||||||
Vnode vnode(fVolume, id);
|
Vnode vnode(fVolume, id);
|
||||||
Inode* inode;
|
Inode* inode;
|
||||||
if (vnode.Get(&inode) < B_OK) {
|
if (vnode.Get(&inode) != B_OK) {
|
||||||
FATAL(("Could not open inode ID %Ld!\n", id));
|
FATAL(("Could not open inode ID %Ld!\n", id));
|
||||||
control->errors |= BFS_COULD_NOT_OPEN;
|
control->errors |= BFS_COULD_NOT_OPEN;
|
||||||
|
|
||||||
|
if ((control->flags & BFS_REMOVE_INVALID) != 0)
|
||||||
|
status = _RemoveInvalidNode(cookie->parent, inode, name);
|
||||||
|
else
|
||||||
|
status = B_ERROR;
|
||||||
|
|
||||||
control->status = B_ERROR;
|
control->status = B_ERROR;
|
||||||
return B_OK;
|
return B_OK;
|
||||||
}
|
}
|
||||||
@ -1459,21 +1465,9 @@ BlockAllocator::CheckNextNode(check_control* control)
|
|||||||
|
|
||||||
// if we are allowed to fix errors, we should remove the file
|
// if we are allowed to fix errors, we should remove the file
|
||||||
if ((control->flags & BFS_REMOVE_WRONG_TYPES) != 0
|
if ((control->flags & BFS_REMOVE_WRONG_TYPES) != 0
|
||||||
&& (control->flags & BFS_FIX_BITMAP_ERRORS) != 0) {
|
&& (control->flags & BFS_FIX_BITMAP_ERRORS) != 0)
|
||||||
// it's safe to start a transaction, because Inode::Remove()
|
status = _RemoveInvalidNode(cookie->parent, inode, name);
|
||||||
// won't touch the block bitmap (which we hold the lock for)
|
else
|
||||||
// if we set the INODE_DONT_FREE_SPACE flag - since we fix
|
|
||||||
// the bitmap anyway
|
|
||||||
Transaction transaction(fVolume,
|
|
||||||
cookie->parent->BlockNumber());
|
|
||||||
|
|
||||||
inode->Node().flags
|
|
||||||
|= HOST_ENDIAN_TO_BFS_INT32(INODE_DONT_FREE_SPACE);
|
|
||||||
status = cookie->parent->Remove(transaction, name, NULL,
|
|
||||||
inode->IsContainer());
|
|
||||||
if (status == B_OK)
|
|
||||||
transaction.Done();
|
|
||||||
} else
|
|
||||||
status = B_ERROR;
|
status = B_ERROR;
|
||||||
|
|
||||||
control->errors |= BFS_WRONG_TYPE;
|
control->errors |= BFS_WRONG_TYPE;
|
||||||
@ -1496,6 +1490,26 @@ BlockAllocator::CheckNextNode(check_control* control)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
status_t
|
||||||
|
BlockAllocator::_RemoveInvalidNode(Inode* parent, Inode* inode,
|
||||||
|
const char* name)
|
||||||
|
{
|
||||||
|
// it's safe to start a transaction, because Inode::Remove()
|
||||||
|
// won't touch the block bitmap (which we hold the lock for)
|
||||||
|
// if we set the INODE_DONT_FREE_SPACE flag - since we fix
|
||||||
|
// the bitmap anyway
|
||||||
|
Transaction transaction(fVolume, parent->BlockNumber());
|
||||||
|
|
||||||
|
inode->Node().flags |= HOST_ENDIAN_TO_BFS_INT32(INODE_DONT_FREE_SPACE);
|
||||||
|
status_t status
|
||||||
|
= parent->Remove(transaction, name, NULL, inode->IsContainer());
|
||||||
|
if (status == B_OK)
|
||||||
|
transaction.Done();
|
||||||
|
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
bool
|
bool
|
||||||
BlockAllocator::_CheckBitmapIsUsedAt(off_t block) const
|
BlockAllocator::_CheckBitmapIsUsedAt(off_t block) const
|
||||||
{
|
{
|
||||||
|
@ -64,6 +64,8 @@ public:
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
status_t _RemoveInvalidNode(Inode* parent, Inode* inode,
|
||||||
|
const char* name);
|
||||||
#ifdef DEBUG_ALLOCATION_GROUPS
|
#ifdef DEBUG_ALLOCATION_GROUPS
|
||||||
void _CheckGroup(int32 group) const;
|
void _CheckGroup(int32 group) const;
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user