From: Yingxin Cheng Date: Thu, 4 Feb 2021 07:20:28 +0000 (+0800) Subject: crimson/onode-staged-tree: document create interfaces for tree_cursor_t X-Git-Tag: v17.1.0~3024^2~2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=dc7d5765c95acbc2985bf596a12b50efde618d42;p=ceph.git crimson/onode-staged-tree: document create interfaces for tree_cursor_t Signed-off-by: Yingxin Cheng --- diff --git a/src/crimson/os/seastore/onode_manager/staged-fltree/node.cc b/src/crimson/os/seastore/onode_manager/staged-fltree/node.cc index 8585f461a889..18fb9739d7fb 100644 --- a/src/crimson/os/seastore/onode_manager/staged-fltree/node.cc +++ b/src/crimson/os/seastore/onode_manager/staged-fltree/node.cc @@ -758,7 +758,7 @@ LeafNode::get_next_cursor(context_t c, const search_position_t& pos) if (next_pos.is_end()) { if (unlikely(is_level_tail())) { return node_ertr::make_ready_future>( - new tree_cursor_t(this)); + tree_cursor_t::create_end(this)); } else { return get_next_cursor_from_parent(c); } @@ -796,7 +796,7 @@ LeafNode::lookup_smallest(context_t) if (unlikely(impl->is_empty())) { assert(is_root()); return node_ertr::make_ready_future>( - new tree_cursor_t(this)); + tree_cursor_t::create_end(this)); } auto pos = search_position_t::begin(); key_view_t index_key; @@ -811,7 +811,7 @@ LeafNode::lookup_largest(context_t) if (unlikely(impl->is_empty())) { assert(is_root()); return node_ertr::make_ready_future>( - new tree_cursor_t(this)); + tree_cursor_t::create_end(this)); } search_position_t pos; const value_header_t* p_value_header = nullptr; @@ -830,7 +830,7 @@ LeafNode::lower_bound_tracked( Ref cursor; if (result.position.is_end()) { assert(!result.p_value); - cursor = new tree_cursor_t(this); + cursor = tree_cursor_t::create_end(this); } else { cursor = get_or_track_cursor(result.position, index_key, result.p_value); } @@ -955,7 +955,7 @@ Ref LeafNode::get_or_track_cursor( Ref p_cursor; auto found = tracked_cursors.find(position); if (found == tracked_cursors.end()) { - p_cursor = new tree_cursor_t(this, position, key, p_value_header); + p_cursor = tree_cursor_t::create(this, position, key, p_value_header); } else { p_cursor = found->second; assert(p_cursor->get_leaf_node() == this); @@ -1000,7 +1000,7 @@ Ref LeafNode::track_insert( // track insert // TODO: getting key_view_t from stage::proceed_insert() and // stage::append_insert() has not supported yet - return new tree_cursor_t(this, insert_pos); + return tree_cursor_t::create(this, insert_pos); } void LeafNode::track_split( diff --git a/src/crimson/os/seastore/onode_manager/staged-fltree/node.h b/src/crimson/os/seastore/onode_manager/staged-fltree/node.h index 9c9c02e103ca..cf4a4508c262 100644 --- a/src/crimson/os/seastore/onode_manager/staged-fltree/node.h +++ b/src/crimson/os/seastore/onode_manager/staged-fltree/node.h @@ -137,6 +137,19 @@ class tree_cursor_t final void update_cache(LeafNode&, const key_view_t&, const value_header_t*) const; void maybe_update_cache(value_magic_t magic) const; + static Ref create(Ref node, const search_position_t& pos) { + return new tree_cursor_t(node, pos); + } + + static Ref create(Ref node, const search_position_t& pos, + const key_view_t& key, const value_header_t* p_header) { + return new tree_cursor_t(node, pos, key, p_header); + } + + static Ref create_end(Ref node) { + return new tree_cursor_t(node); + } + /** * Reversed resource management (tree_cursor_t) *