mirror of
https://github.com/ceph/ceph
synced 2025-01-19 17:41:39 +00:00
crimson/os/seastore/lba_manager/lba_btree: add at_boundary helper distinct from is_end
From an external caller, the condition is identical. However, internally iterators may be at a leaf boundary without being at end(). For those checks, use at_boundary() instead. Signed-off-by: Samuel Just <sjust@redhat.com>
This commit is contained in:
parent
eb79d8a3bc
commit
dd2c699892
@ -166,7 +166,7 @@ LBABtree::insert_ret LBABtree::insert(
|
||||
return find_insertion(
|
||||
c, laddr, ret
|
||||
).si_then([this, c, laddr, val, &ret] {
|
||||
if (!ret.is_end() && ret.get_key() == laddr) {
|
||||
if (!ret.at_boundary() && ret.get_key() == laddr) {
|
||||
return insert_ret(
|
||||
interruptible::ready_future_marker{},
|
||||
std::make_pair(ret, false));
|
||||
@ -488,7 +488,7 @@ LBABtree::find_insertion_ret LBABtree::find_insertion(
|
||||
// invariant that pos is a valid index for the node in the event
|
||||
// that the insertion point is at the end of a node.
|
||||
p.leaf.pos++;
|
||||
assert(p.is_end());
|
||||
assert(p.at_boundary());
|
||||
iter = p;
|
||||
return seastar::now();
|
||||
});
|
||||
|
@ -87,8 +87,8 @@ public:
|
||||
}
|
||||
|
||||
bool is_end() const {
|
||||
assert(leaf.pos <= leaf.node->get_size());
|
||||
return leaf.pos == leaf.node->get_size();
|
||||
// external methods may only resolve at a boundary if at end
|
||||
return at_boundary();
|
||||
}
|
||||
|
||||
bool is_begin() const {
|
||||
@ -134,6 +134,11 @@ public:
|
||||
node_position_t<LBAInternalNode>, MAX_DEPTH> internal;
|
||||
node_position_t<LBALeafNode> leaf;
|
||||
|
||||
bool at_boundary() const {
|
||||
assert(leaf.pos <= leaf.node->get_size());
|
||||
return leaf.pos == leaf.node->get_size();
|
||||
}
|
||||
|
||||
depth_t check_split() const {
|
||||
if (!leaf.node->at_max_capacity()) {
|
||||
return 0;
|
||||
|
Loading…
Reference in New Issue
Block a user