[space-maps] remove count_possibly_greater_than_one

This is only ever called with a recursive space map wrapper,
and that causes too many false positives.  False positives trigger
a copy of a metadata page, so this is a false economy.
This commit is contained in:
Joe Thornber 2020-05-28 07:38:58 +01:00
parent 29cfdd8979
commit 128ecc27f2
7 changed files with 1 additions and 32 deletions

View File

@ -77,10 +77,6 @@ namespace {
return sm_->find_free(filtered_it);
}
virtual bool count_possibly_greater_than_one(block_address b) const {
return sm_->count_possibly_greater_than_one(b);
}
virtual void extend(block_address extra_blocks) {
return sm_->extend(extra_blocks);
}

View File

@ -43,7 +43,6 @@ namespace {
void inc(block_address b, ref_t count) override;
void dec(block_address b, ref_t count) override;
maybe_block find_free(span_iterator &it) override;
bool count_possibly_greater_than_one(block_address b) const override;
void extend(block_address extra_blocks) override;
void count_metadata(block_counter &bc) const override;
@ -131,11 +130,6 @@ namespace {
return maybe_block();
}
bool
core_map::count_possibly_greater_than_one(block_address b) const {
return get_count(b) > 1;
}
void
core_map::extend(block_address extra_blocks) {
throw std::runtime_error("'extend' not implemented");

View File

@ -429,10 +429,6 @@ namespace {
return maybe_block();
}
bool count_possibly_greater_than_one(block_address b) const {
return get_count(b) > 1;
}
virtual void extend(block_address extra_blocks) {
block_address nr_blocks = nr_blocks_ + extra_blocks;

View File

@ -64,11 +64,6 @@ namespace persistent_data {
return boost::optional<block_address>(0);
}
bool count_possibly_greater_than_one(block_address b) const {
fail();
return false;
}
void extend(block_address extra_blocks) {
fail();
}

View File

@ -132,16 +132,6 @@ namespace {
return sm_->find_free(filtered_it);
}
virtual bool count_possibly_greater_than_one(block_address b) const {
recursing_const_lock lock(*this);
bool gto = sm_->count_possibly_greater_than_one(b);
if (gto)
return true;
return modify_count(b, 1) > 1;
}
virtual void extend(block_address extra_blocks) {
cant_recurse("extend");
recursing_lock lock(*this);

View File

@ -88,8 +88,6 @@ namespace persistent_data {
virtual maybe_block find_free(span_iterator &it) = 0;
virtual bool count_possibly_greater_than_one(block_address b) const = 0;
virtual void extend(block_address extra_blocks) = 0;
struct iterator {

View File

@ -62,7 +62,7 @@ transaction_manager::new_block(validator v)
pair<transaction_manager::write_ref, bool>
transaction_manager::shadow(block_address orig, validator v)
{
bool need_inc = sm_->count_possibly_greater_than_one(orig);
bool need_inc = sm_->get_count(orig) > 1;
if (is_shadow(orig) && !need_inc)
return make_pair(bm_->write_lock(orig, v), need_inc);