Improved debug output.

This commit is contained in:
Axel Dörfler
2012-03-31 16:46:07 +02:00
parent 28b813df23
commit e0927e2c44
@@ -1054,8 +1054,8 @@ BPlusTree::_SeekDown(Stack<node_and_key>& stack, const uint8* key,
nodeAndKey.nodeOffset = nextOffset; nodeAndKey.nodeOffset = nextOffset;
} }
FATAL(("BPlusTree::_SeekDown() could not open node %" B_PRIdOFF "\n", FATAL(("BPlusTree::_SeekDown() could not open node %" B_PRIdOFF ", inode %"
nodeAndKey.nodeOffset)); B_PRIdOFF "\n", nodeAndKey.nodeOffset, fStream->ID()));
return B_ERROR; return B_ERROR;
} }
@@ -1079,8 +1079,8 @@ BPlusTree::_FindFreeDuplicateFragment(Transaction& transaction,
const bplustree_node* fragment = cached.SetTo( const bplustree_node* fragment = cached.SetTo(
bplustree_node::FragmentOffset(value), false); bplustree_node::FragmentOffset(value), false);
if (fragment == NULL) { if (fragment == NULL) {
FATAL(("Could not get duplicate fragment at %" B_PRIdOFF "\n", FATAL(("Could not get duplicate fragment at %" B_PRIdOFF ", inode %"
value)); B_PRIdOFF "\n", value, fStream->ID()));
continue; continue;
} }
@@ -1130,10 +1130,11 @@ BPlusTree::_InsertDuplicate(Transaction& transaction, CachedNode& cached,
bplustree_node::FragmentIndex(oldValue)); bplustree_node::FragmentIndex(oldValue));
int32 arrayCount = array->Count(); int32 arrayCount = array->Count();
if (arrayCount > NUM_FRAGMENT_VALUES || arrayCount < 1) { if (arrayCount > NUM_FRAGMENT_VALUES || arrayCount < 1) {
FATAL(("insertDuplicate: Invalid array[%d] size in fragment " FATAL(("_InsertDuplicate: Invalid array[%d] size in fragment "
"%" B_PRIdOFF " == %" B_PRId32 "!\n", "%" B_PRIdOFF " == %" B_PRId32 ", inode %" B_PRIdOFF "!\n",
(int)bplustree_node::FragmentIndex(oldValue), (int)bplustree_node::FragmentIndex(oldValue),
bplustree_node::FragmentOffset(oldValue), arrayCount)); bplustree_node::FragmentOffset(oldValue), arrayCount,
fStream->ID()));
return B_BAD_DATA; return B_BAD_DATA;
} }
@@ -1206,9 +1207,9 @@ BPlusTree::_InsertDuplicate(Transaction& transaction, CachedNode& cached,
array = duplicate->DuplicateArray(); array = duplicate->DuplicateArray();
arrayCount =array->Count(); arrayCount =array->Count();
if (arrayCount > NUM_DUPLICATE_VALUES || arrayCount < 0) { if (arrayCount > NUM_DUPLICATE_VALUES || arrayCount < 0) {
FATAL(("removeDuplicate: Invalid array size in duplicate %" FATAL(("_InsertDuplicate: Invalid array size in duplicate %"
B_PRIdOFF " == %" B_PRId32 "!\n", duplicateOffset, B_PRIdOFF " == %" B_PRId32 ", inode %" B_PRIdOFF "!\n",
arrayCount)); duplicateOffset, arrayCount, fStream->ID()));
return B_BAD_DATA; return B_BAD_DATA;
} }
} while (arrayCount >= NUM_DUPLICATE_VALUES } while (arrayCount >= NUM_DUPLICATE_VALUES
@@ -1338,8 +1339,8 @@ BPlusTree::_SplitNode(bplustree_node* node, off_t nodeOffset,
int32 keyIndex = *_keyIndex; // can become less than zero! int32 keyIndex = *_keyIndex; // can become less than zero!
if (keyIndex > node->NumKeys()) { if (keyIndex > node->NumKeys()) {
FATAL(("key index out of bounds: %d, num keys: %u\n", (int)keyIndex, FATAL(("key index out of bounds: %d, num keys: %u, inode %" B_PRIdOFF
node->NumKeys())); "\n", (int)keyIndex, node->NumKeys(), fStream->ID()));
return B_BAD_VALUE; return B_BAD_VALUE;
} }
@@ -1757,15 +1758,16 @@ BPlusTree::_RemoveDuplicate(Transaction& transaction,
int32 arrayCount = array->Count(); int32 arrayCount = array->Count();
if (arrayCount > NUM_FRAGMENT_VALUES || arrayCount < 1) { if (arrayCount > NUM_FRAGMENT_VALUES || arrayCount < 1) {
FATAL(("removeDuplicate: Invalid array[%d] size in fragment %" FATAL(("_RemoveDuplicate: Invalid array[%d] size in fragment %"
B_PRIdOFF " == %" B_PRId32 "!\n", B_PRIdOFF " == %" B_PRId32 ", inode %" B_PRIdOFF "!\n",
(int)bplustree_node::FragmentIndex(oldValue), duplicateOffset, (int)bplustree_node::FragmentIndex(oldValue), duplicateOffset,
arrayCount)); arrayCount, fStream->ID()));
return B_BAD_DATA; return B_BAD_DATA;
} }
if (!array->Remove(value)) { if (!array->Remove(value)) {
FATAL(("Oh no, value %" B_PRIdOFF " not found in fragments of node " FATAL(("Oh no, value %" B_PRIdOFF " not found in fragments of node "
"%" B_PRIdOFF "...\n", value, duplicateOffset)); "%" B_PRIdOFF "..., inode %" B_PRIdOFF "\n", value,
duplicateOffset, fStream->ID()));
return B_ENTRY_NOT_FOUND; return B_ENTRY_NOT_FOUND;
} }
@@ -1797,7 +1799,7 @@ BPlusTree::_RemoveDuplicate(Transaction& transaction,
if (duplicate->LeftLink() != BPLUSTREE_NULL) { if (duplicate->LeftLink() != BPLUSTREE_NULL) {
FATAL(("invalid duplicate node: first left link points to %" B_PRIdOFF FATAL(("invalid duplicate node: first left link points to %" B_PRIdOFF
"!\n", duplicate->LeftLink())); ", inode %" B_PRIdOFF "!\n", duplicate->LeftLink(), fStream->ID()));
return B_BAD_DATA; return B_BAD_DATA;
} }
@@ -1807,8 +1809,9 @@ BPlusTree::_RemoveDuplicate(Transaction& transaction,
arrayCount = array->Count(); arrayCount = array->Count();
if (arrayCount > NUM_DUPLICATE_VALUES || arrayCount < 0) { if (arrayCount > NUM_DUPLICATE_VALUES || arrayCount < 0) {
FATAL(("removeDuplicate: Invalid array size in duplicate %" FATAL(("_RemoveDuplicate: Invalid array size in duplicate %"
B_PRIdOFF " == %" B_PRId32 "!\n", duplicateOffset, arrayCount)); B_PRIdOFF " == %" B_PRId32 ", inode %" B_PRIdOFF "!\n",
duplicateOffset, arrayCount, fStream->ID()));
return B_BAD_DATA; return B_BAD_DATA;
} }
@@ -1944,7 +1947,8 @@ BPlusTree::_RemoveKey(bplustree_node* node, uint16 index)
{ {
// should never happen, but who knows? // should never happen, but who knows?
if (index > node->NumKeys() && node->NumKeys() > 0) { if (index > node->NumKeys() && node->NumKeys() > 0) {
FATAL(("Asked me to remove key outer limits: %u\n", index)); FATAL(("Asked me to remove key outer limits: %u, inode %" B_PRIdOFF
"\n", index, fStream->ID()));
return; return;
} }
@@ -1960,9 +1964,8 @@ BPlusTree::_RemoveKey(bplustree_node* node, uint16 index)
uint8* key = node->KeyAt(index, &length); uint8* key = node->KeyAt(index, &length);
if (key + length + sizeof(off_t) + sizeof(uint16) > (uint8*)node + fNodeSize if (key + length + sizeof(off_t) + sizeof(uint16) > (uint8*)node + fNodeSize
|| length > BPLUSTREE_MAX_KEY_LENGTH) { || length > BPLUSTREE_MAX_KEY_LENGTH) {
FATAL(("Key length to long: %s, %u (inode at %d,%u)\n", key, length, FATAL(("Key length to long: %s, %u inode %" B_PRIdOFF "\n", key, length,
(int)fStream->BlockRun().allocation_group, fStream->ID()));
fStream->BlockRun().start));
fStream->GetVolume()->Panic(); fStream->GetVolume()->Panic();
return; return;
} }
@@ -2042,7 +2045,7 @@ BPlusTree::Remove(Transaction& transaction, const uint8* key, uint16 keyLength,
} }
FATAL(("dupliate node found where no duplicates are " FATAL(("dupliate node found where no duplicates are "
"allowed!\n")); "allowed, inode %" B_PRIdOFF "!\n", fStream->ID()));
RETURN_ERROR(B_ERROR); RETURN_ERROR(B_ERROR);
} else { } else {
if (node->Values()[nodeAndKey.keyIndex] != value) if (node->Values()[nodeAndKey.keyIndex] != value)
@@ -2225,7 +2228,8 @@ BPlusTree::Find(const uint8* key, uint16 keyLength, off_t* _value)
nodeOffset = nextOffset; nodeOffset = nextOffset;
} }
FATAL(("b+tree node at %" B_PRIdOFF " could not be loaded\n", nodeOffset)); FATAL(("b+tree node at %" B_PRIdOFF " could not be loaded, inode %"
B_PRIdOFF "\n", nodeOffset, fStream->ID()));
RETURN_ERROR(B_ERROR); RETURN_ERROR(B_ERROR);
} }