* checkfs is now also able to fix name mismatches (when the inode contains a

different name than the directory entry pointing to it). The BeOS BFS is known
  to create such problems from time to time.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31937 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler 2009-07-29 19:24:21 +00:00
parent c74bdf0919
commit 64b145930e
3 changed files with 21 additions and 4 deletions

View File

@ -230,7 +230,8 @@ BFSPartitionHandle::Repair(bool checkOnly)
result.flags = !checkOnly ? BFS_FIX_BITMAP_ERRORS : 0;
if (!checkOnly) {
//printf("will fix any severe errors!\n");
result.flags |= BFS_REMOVE_WRONG_TYPES | BFS_REMOVE_INVALID;
result.flags |= BFS_REMOVE_WRONG_TYPES | BFS_REMOVE_INVALID
| BFS_FIX_NAME_MISMATCHES;
}
// start checking

View File

@ -1433,7 +1433,7 @@ BlockAllocator::CheckNextNode(check_control* control)
} else
status = B_ERROR;
control->status = B_ERROR;
control->status = status;
return B_OK;
}
@ -1447,6 +1447,21 @@ BlockAllocator::CheckNextNode(check_control* control)
control->errors |= BFS_NAMES_DONT_MATCH;
FATAL(("Names differ: tree \"%s\", inode \"%s\"\n", name,
localName));
if ((control->flags & BFS_FIX_NAME_MISMATCHES) != 0) {
// Rename the inode
Transaction transaction(fVolume, inode->BlockNumber());
status = inode->SetName(transaction, name);
if (status == B_OK)
status = inode->WriteBack(transaction);
if (status == B_OK)
status = transaction.Done();
if (status != B_OK) {
control->status = status;
return B_OK;
}
}
}
}

View File

@ -1,5 +1,5 @@
/*
* Copyright 2001-2008, Axel Dörfler, axeld@pinc-software.de
* Copyright 2001-2009, Axel Dörfler, axeld@pinc-software.de
* This file may be used under the terms of the MIT License.
*/
#ifndef BFS_CONTROL_H
@ -51,7 +51,7 @@ struct check_control {
uint64 freed;
} stats;
status_t status;
void *cookie;
void* cookie;
};
/* values for the flags field */
@ -66,6 +66,7 @@ struct check_control {
* directory.
* Also requires the B_FIX_BITMAP_ERRORS to be set.
*/
#define BFS_FIX_NAME_MISMATCHES 8
/* values for the errors field */
#define BFS_MISSING_BLOCKS 1