Skip to content

Commit bfb7bda

Browse files
committed
crimson/os/seastore/linked_tree_node: rename
`BaseChildNode::get_parent_node()` to `BaseChildNode::peek_parent_node()` Signed-off-by: Xuehan Xu <[email protected]>
1 parent f6d0bcb commit bfb7bda

File tree

4 files changed

+15
-12
lines changed

4 files changed

+15
-12
lines changed

src/crimson/os/seastore/btree/fixed_kv_btree.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -496,12 +496,12 @@ class FixedKVBtree {
496496
assert(cnode->has_parent_tracker());
497497
if (node->is_pending()) {
498498
auto &n = node->get_stable_for_key(i->get_key());
499-
assert(cnode->get_parent_node().get() == &n);
499+
assert(cnode->peek_parent_node().get() == &n);
500500
auto pos = n.lower_bound(i->get_key()).get_offset();
501501
assert(pos < n.get_size());
502502
assert(n.children[pos] == cnode.get());
503503
} else {
504-
assert(cnode->get_parent_node().get() == node.get());
504+
assert(cnode->peek_parent_node().get() == node.get());
505505
assert(node->children[i->get_offset()] == cnode.get());
506506
}
507507
} else if (child_node->is_pending()) {
@@ -511,12 +511,12 @@ class FixedKVBtree {
511511
assert(prior.is_parent_valid());
512512
if (node->is_mutation_pending()) {
513513
auto &n = node->get_stable_for_key(i->get_key());
514-
assert(prior.get_parent_node().get() == &n);
514+
assert(prior.peek_parent_node().get() == &n);
515515
auto pos = n.lower_bound(i->get_key()).get_offset();
516516
assert(pos < n.get_size());
517517
assert(n.children[pos] == &prior);
518518
} else {
519-
assert(prior.get_parent_node().get() == node.get());
519+
assert(prior.peek_parent_node().get() == node.get());
520520
assert(node->children[i->get_offset()] == &prior);
521521
}
522522
} else {
@@ -567,9 +567,9 @@ class FixedKVBtree {
567567
} else {
568568
auto c = static_cast<child_node_t*>(child);
569569
assert(c->has_parent_tracker());
570-
assert(c->get_parent_node().get() == node.get()
570+
assert(c->peek_parent_node().get() == node.get()
571571
|| (node->is_pending() && c->is_stable()
572-
&& c->get_parent_node().get() == &node->get_stable_for_key(
572+
&& c->peek_parent_node().get() == &node->get_stable_for_key(
573573
i->get_key())));
574574
}
575575
} else {

src/crimson/os/seastore/lba/btree_lba_manager.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1091,7 +1091,7 @@ BtreeLBAManager::_update_mapping(
10911091
}
10921092
assert(!nextent ||
10931093
(nextent->has_parent_tracker() &&
1094-
nextent->get_parent_node().get() == iter.get_leaf_node().get()));
1094+
nextent->peek_parent_node().get() == iter.get_leaf_node().get()));
10951095
return update_mapping_ret_bare_t(iter.get_cursor(c));
10961096
});
10971097
}

src/crimson/os/seastore/linked_tree_node.h

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,10 @@ class BaseChildNode {
196196
bool is_parent_valid() const {
197197
return parent_tracker && parent_tracker->is_valid();
198198
}
199-
TCachedExtentRef<ParentT> get_parent_node() const {
199+
// this method should only be used for asserts and logs, because
200+
// the parent node might be stable writing and should "wait_io"
201+
// before further access
202+
TCachedExtentRef<ParentT> peek_parent_node() const {
200203
assert(parent_tracker);
201204
return parent_tracker->get_parent();
202205
}
@@ -999,7 +1002,7 @@ class ChildNode : public BaseChildNode<ParentT, key_t> {
9991002
assert(!down_cast().is_btree_root());
10001003
assert(this->has_parent_tracker());
10011004
auto off = get_parent_pos();
1002-
auto parent = this->get_parent_node();
1005+
auto parent = this->peek_parent_node();
10031006
assert(parent->children[off] == &down_cast());
10041007
parent->children[off] = nullptr;
10051008
}
@@ -1018,15 +1021,15 @@ class ChildNode : public BaseChildNode<ParentT, key_t> {
10181021
this->parent_tracker = prior.BaseChildNode<ParentT, key_t>::parent_tracker;
10191022
assert(this->has_parent_tracker());
10201023
auto off = get_parent_pos();
1021-
auto parent = this->get_parent_node();
1024+
auto parent = this->peek_parent_node();
10221025
assert(me.get_prior_instance().get() ==
10231026
dynamic_cast<CachedExtent*>(parent->children[off]));
10241027
parent->children[off] = &me;
10251028
}
10261029

10271030
btreenode_pos_t get_parent_pos() const {
10281031
auto &me = down_cast();
1029-
auto parent = this->get_parent_node();
1032+
auto parent = this->peek_parent_node();
10301033
assert(parent);
10311034
//TODO: can this search be avoided?
10321035
auto key = me.get_begin();

src/crimson/os/seastore/omap_manager/btree/omap_btree_node_impl.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -596,7 +596,7 @@ std::ostream &OMapLeafNode::print_detail_l(std::ostream &out) const
596596
<< ", end=" << get_end();
597597
}
598598
if (this->child_node_t::is_parent_valid())
599-
return out << ", parent=" << (void*)this->child_node_t::get_parent_node().get();
599+
return out << ", parent=" << (void*)this->child_node_t::peek_parent_node().get();
600600
else
601601
return out;
602602
}

0 commit comments

Comments
 (0)