put space map checking back in
This commit is contained in:
@ -89,6 +89,10 @@ namespace {
|
||||
sm_->iterate(it);
|
||||
}
|
||||
|
||||
virtual void count_metadata(block_counter &bc) const {
|
||||
sm_->count_metadata(bc);
|
||||
}
|
||||
|
||||
virtual size_t root_size() const {
|
||||
return sm_->root_size();
|
||||
}
|
||||
|
@ -105,6 +105,9 @@ namespace persistent_data {
|
||||
throw std::runtime_error("'extend' not implemented");
|
||||
}
|
||||
|
||||
void count_metadata(block_counter &bc) const {
|
||||
}
|
||||
|
||||
// FIXME: meaningless, but this class is only used for testing
|
||||
size_t root_size() const {
|
||||
return 0;
|
||||
|
@ -22,6 +22,7 @@
|
||||
#include "persistent-data/space-maps/careful_alloc.h"
|
||||
|
||||
#include "persistent-data/data-structures/btree_damage_visitor.h"
|
||||
#include "persistent-data/data-structures/btree_counter.h"
|
||||
#include "persistent-data/checksum.h"
|
||||
#include "persistent-data/endian_utils.h"
|
||||
#include "persistent-data/math_utils.h"
|
||||
@ -222,6 +223,7 @@ namespace {
|
||||
public:
|
||||
typedef boost::shared_ptr<index_store> ptr;
|
||||
|
||||
virtual void count_metadata(block_counter &bc) const = 0;
|
||||
virtual void resize(block_address nr_indexes) = 0;
|
||||
virtual index_entry find_ie(block_address b) const = 0;
|
||||
virtual void save_ie(block_address b, struct index_entry ie) = 0;
|
||||
@ -405,6 +407,13 @@ namespace {
|
||||
}
|
||||
}
|
||||
|
||||
virtual void count_metadata(block_counter &bc) const {
|
||||
indexes_->count_metadata(bc);
|
||||
|
||||
noop_value_counter<uint32_t> vc;
|
||||
count_btree_blocks(ref_counts_, bc, vc);
|
||||
}
|
||||
|
||||
virtual size_t root_size() const {
|
||||
return sizeof(sm_root_disk);
|
||||
}
|
||||
@ -554,6 +563,29 @@ namespace {
|
||||
bitmaps_(tm, root, index_entry_traits::ref_counter()) {
|
||||
}
|
||||
|
||||
//--------------------------------
|
||||
|
||||
struct index_entry_counter {
|
||||
index_entry_counter(block_counter &bc)
|
||||
: bc_(bc) {
|
||||
}
|
||||
|
||||
void visit(btree_detail::node_location const &loc, index_entry const &ie) {
|
||||
if (ie.blocknr_ != 0)
|
||||
bc_.inc(ie.blocknr_);
|
||||
}
|
||||
|
||||
private:
|
||||
block_counter &bc_;
|
||||
};
|
||||
|
||||
virtual void count_metadata(block_counter &bc) const {
|
||||
index_entry_counter vc(bc);
|
||||
count_btree_blocks(bitmaps_, bc, vc);
|
||||
}
|
||||
|
||||
//--------------------------------
|
||||
|
||||
virtual void resize(block_address nr_entries) {
|
||||
// No op
|
||||
}
|
||||
@ -612,6 +644,15 @@ namespace {
|
||||
load_ies();
|
||||
}
|
||||
|
||||
virtual void count_metadata(block_counter &bc) const {
|
||||
for (unsigned i = 0; i < entries_.size(); i++) {
|
||||
block_address b = entries_[i].blocknr_;
|
||||
|
||||
if (b != 0)
|
||||
bc.inc(b);
|
||||
}
|
||||
}
|
||||
|
||||
virtual void resize(block_address nr_indexes) {
|
||||
entries_.resize(nr_indexes);
|
||||
}
|
||||
|
@ -176,6 +176,10 @@ namespace {
|
||||
sm_->iterate(it);
|
||||
}
|
||||
|
||||
virtual void count_metadata(block_counter &bc) const {
|
||||
sm_->count_metadata(bc);
|
||||
}
|
||||
|
||||
virtual size_t root_size() const {
|
||||
cant_recurse("root_size");
|
||||
recursing_const_lock lock(*this);
|
||||
|
Reference in New Issue
Block a user