When running checkfs, BPlusTree::Validate() is now called.
This commit is contained in:
parent
82e06fff68
commit
49a2067a17
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2001-2010, Axel Dörfler, axeld@pinc-software.de.
|
* Copyright 2001-2012, Axel Dörfler, axeld@pinc-software.de.
|
||||||
* This file may be used under the terms of the MIT License.
|
* This file may be used under the terms of the MIT License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -1420,8 +1420,7 @@ BlockAllocator::CheckNextNode(check_control* control)
|
|||||||
return B_OK;
|
return B_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
// get iterator for the next directory
|
// Check directory
|
||||||
|
|
||||||
BPlusTree* tree = inode->Tree();
|
BPlusTree* tree = inode->Tree();
|
||||||
if (tree == NULL) {
|
if (tree == NULL) {
|
||||||
FATAL(("check: could not open b+tree from inode at %" B_PRIdOFF
|
FATAL(("check: could not open b+tree from inode at %" B_PRIdOFF
|
||||||
@ -1432,6 +1431,7 @@ BlockAllocator::CheckNextNode(check_control* control)
|
|||||||
fCheckCookie->parent = inode;
|
fCheckCookie->parent = inode;
|
||||||
fCheckCookie->parent_mode = inode->Mode();
|
fCheckCookie->parent_mode = inode->Mode();
|
||||||
|
|
||||||
|
// get iterator for the next directory
|
||||||
fCheckCookie->iterator = new(std::nothrow) TreeIterator(tree);
|
fCheckCookie->iterator = new(std::nothrow) TreeIterator(tree);
|
||||||
if (fCheckCookie->iterator == NULL)
|
if (fCheckCookie->iterator == NULL)
|
||||||
RETURN_ERROR(B_NO_MEMORY);
|
RETURN_ERROR(B_NO_MEMORY);
|
||||||
@ -1917,6 +1917,18 @@ BlockAllocator::CheckInode(Inode* inode)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (inode->IsContainer()) {
|
||||||
|
bool errorsFound = false;
|
||||||
|
status_t status = inode->Tree()->Validate(
|
||||||
|
(fCheckCookie->control.flags & BFS_FIX_BPLUSTREES) != 0,
|
||||||
|
errorsFound);
|
||||||
|
if (errorsFound)
|
||||||
|
fCheckCookie->control.errors |= BFS_INVALID_BPLUSTREE;
|
||||||
|
|
||||||
|
if (status != B_OK)
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
|
||||||
return B_OK;
|
return B_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2001-2010, Axel Dörfler, axeld@pinc-software.de
|
* Copyright 2001-2012, Axel Dörfler, axeld@pinc-software.de
|
||||||
* This file may be used under the terms of the MIT License.
|
* This file may be used under the terms of the MIT License.
|
||||||
*/
|
*/
|
||||||
#ifndef BFS_CONTROL_H
|
#ifndef BFS_CONTROL_H
|
||||||
@ -78,6 +78,7 @@ struct check_control {
|
|||||||
* Also requires the B_FIX_BITMAP_ERRORS to be set.
|
* Also requires the B_FIX_BITMAP_ERRORS to be set.
|
||||||
*/
|
*/
|
||||||
#define BFS_FIX_NAME_MISMATCHES 8
|
#define BFS_FIX_NAME_MISMATCHES 8
|
||||||
|
#define BFS_FIX_BPLUSTREES 16
|
||||||
|
|
||||||
/* values for the errors field */
|
/* values for the errors field */
|
||||||
#define BFS_MISSING_BLOCKS 1
|
#define BFS_MISSING_BLOCKS 1
|
||||||
@ -86,6 +87,7 @@ struct check_control {
|
|||||||
#define BFS_COULD_NOT_OPEN 8
|
#define BFS_COULD_NOT_OPEN 8
|
||||||
#define BFS_WRONG_TYPE 16
|
#define BFS_WRONG_TYPE 16
|
||||||
#define BFS_NAMES_DONT_MATCH 32
|
#define BFS_NAMES_DONT_MATCH 32
|
||||||
|
#define BFS_INVALID_BPLUSTREE 64
|
||||||
|
|
||||||
/* check control magic value */
|
/* check control magic value */
|
||||||
#define BFS_IOCTL_CHECK_MAGIC 'BChk'
|
#define BFS_IOCTL_CHECK_MAGIC 'BChk'
|
||||||
|
Loading…
Reference in New Issue
Block a user