put space map checking back in

This commit is contained in:
Joe Thornber
2014-02-19 16:08:05 +00:00
parent 2f1789744f
commit 9f6546f621
8 changed files with 135 additions and 19 deletions

View File

@@ -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);
}

View File

@@ -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