Merge pull request #143 from mingnus/thin-generate-metadata-wip

btree::remove bug fixes
This commit is contained in:
Joe Thornber 2020-06-30 15:23:20 +01:00 committed by GitHub
commit 7f4fa9c58a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 7 deletions

View File

@ -48,8 +48,10 @@ namespace {
base::sector_t next_offset() {
sector_t r = current_;
current_ += block_size_;
if (current_ > end_)
if (current_ > end_) {
current_ = begin_;
return begin_;
}
return r;
}

View File

@ -93,11 +93,12 @@ namespace persistent_data {
{
using namespace btree_detail;
unsigned i = 0;
bool r = false;
unsigned i = *index;
for (;;) {
r = spine.step(block);
bool inc = spine.step(block);
if (inc)
inc_children<ValueTraits>(spine, leaf_rc);
// patch up the parent to point to the new shadow
if (spine.has_parent()) {
@ -115,9 +116,9 @@ namespace persistent_data {
return true;
}
r = rebalance_children<ValueTraits>(spine, key);
bool r = rebalance_children<ValueTraits>(spine, key);
if (!r)
break;
return false;
n = spine.get_node<block_traits>();
if (n.get_type() == btree_detail::LEAF) {
@ -133,7 +134,7 @@ namespace persistent_data {
block = n.value_at(i);
}
return r;
return true;
}
template <unsigned Levels, typename _>