put space map checking back in
This commit is contained in:
@@ -288,23 +288,8 @@ namespace persistent_data {
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------
|
||||
|
||||
struct ablock_counter {
|
||||
ablock_counter(block_counter &bc)
|
||||
: bc_(bc) {
|
||||
}
|
||||
|
||||
void visit(btree_detail::node_location const &loc, block_address b) {
|
||||
bc_.inc(b);
|
||||
}
|
||||
|
||||
private:
|
||||
block_counter &bc_;
|
||||
};
|
||||
|
||||
void count_metadata_blocks(block_counter &bc) const {
|
||||
ablock_counter vc(bc);
|
||||
block_address_counter vc(bc);
|
||||
count_btree_blocks(block_tree_, bc, vc);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#ifndef PERSISTENT_DATA_DATA_STRUCTURES_BTREE_COUNTER_H
|
||||
#define PERSISTENT_DATA_DATA_STRUCTURES_BTREE_COUNTER_H
|
||||
|
||||
#include "persistent-data/data-structures/btree.h"
|
||||
#include "persistent-data/block_counter.h"
|
||||
|
||||
//----------------------------------------------------------------
|
||||
@@ -65,6 +66,19 @@ namespace persistent_data {
|
||||
}
|
||||
};
|
||||
|
||||
struct block_address_counter {
|
||||
block_address_counter(block_counter &bc)
|
||||
: bc_(bc) {
|
||||
}
|
||||
|
||||
void visit(btree_detail::node_location const &loc, block_address b) {
|
||||
bc_.inc(b);
|
||||
}
|
||||
|
||||
private:
|
||||
block_counter &bc_;
|
||||
};
|
||||
|
||||
// Counts how many times each metadata block is referenced in the
|
||||
// tree. Blocks already referenced in the block counter are not
|
||||
// walked. This walk should only be done once you're sure the tree
|
||||
|
||||
Reference in New Issue
Block a user