From 2e6ebc597b2d268da34188cf2a7ed4646f28e819 Mon Sep 17 00:00:00 2001
From: ahenriksson <sausageboy@gmail.com>
Date: Tue, 24 Jul 2012 12:37:53 +0200
Subject: [PATCH] Single values are allowed in regular duplicate nodes
Not in duplicate fragments, however. This oversight in hrev44359 made
checkfs incorrectly rebuild valid indices, causing #8762.
---
src/add-ons/kernel/file_systems/bfs/BPlusTree.cpp | 5 ++++-
1 fil ändrad, 4 tillägg(+), 1 borttagning(-)
diff --git a/src/add-ons/kernel/file_systems/bfs/BPlusTree.cpp b/src/add-ons/kernel/file_systems/bfs/BPlusTree.cpp
index 51b896a..82b0046 100644
a
|
b
|
BPlusTree::_ValidateChildren(TreeCheck& check, uint32 level, off_t offset,
|
2350 | 2350 | check.SetVisitedFragment(duplicateOffset); |
2351 | 2351 | |
2352 | 2352 | duplicate_array* array; |
| 2353 | int32 minSize; |
2353 | 2354 | int32 maxSize; |
2354 | 2355 | if (isFragmentNode) { |
2355 | 2356 | array = node->FragmentAt( |
2356 | 2357 | bplustree_node::FragmentIndex(childOffset)); |
| 2358 | minSize = 2; |
2357 | 2359 | maxSize = NUM_FRAGMENT_VALUES; |
2358 | 2360 | } else { |
2359 | 2361 | array = node->DuplicateArray(); |
| 2362 | minSize = 1; |
2360 | 2363 | maxSize = NUM_DUPLICATE_VALUES; |
2361 | 2364 | } |
2362 | 2365 | int32 arrayCount = array->Count(); |
2363 | 2366 | |
2364 | | if (arrayCount <= 1 || arrayCount > maxSize) { |
| 2367 | if (arrayCount < minSize || arrayCount > maxSize) { |
2365 | 2368 | dprintf("inode %" B_PRIdOFF ": duplicate at %" B_PRIdOFF |
2366 | 2369 | " has invalid array size %" B_PRId32 "!\n", |
2367 | 2370 | fStream->ID(), duplicateOffset, arrayCount); |