mirror of
https://github.com/ceph/ceph
synced 2025-03-25 11:48:05 +00:00
Merge pull request #43018 from cyx1231st/wip-seastore-onode-tree-alloc-hint
crimson/onode-staged-tree: improve laddr hints during allocation Reviewed-by: Samuel Just <sjust@redhat.com>
This commit is contained in:
commit
57b09dbaa7
@ -400,7 +400,7 @@ void Node::test_make_destructable(
|
||||
eagain_ifuture<> Node::mkfs(context_t c, RootNodeTracker& root_tracker)
|
||||
{
|
||||
LOG_PREFIX(OTree::Node::mkfs);
|
||||
return LeafNode::allocate_root(c, L_ADDR_MIN, root_tracker
|
||||
return LeafNode::allocate_root(c, root_tracker
|
||||
).si_then([c, FNAME](auto ret) {
|
||||
INFOT("allocated root {}", c.t, ret->get_name());
|
||||
});
|
||||
@ -605,7 +605,7 @@ Node::try_merge_adjacent(
|
||||
// so use rebuild_extent() as a workaround to rebuild the node from a
|
||||
// fresh extent, thus no need to generate delta.
|
||||
auto left_addr = left_for_merge->impl->laddr();
|
||||
return left_for_merge->rebuild_extent(c, L_ADDR_MIN
|
||||
return left_for_merge->rebuild_extent(c
|
||||
).si_then([c, update_index_after_merge,
|
||||
left_addr,
|
||||
merge_stage = merge_stage,
|
||||
@ -744,7 +744,7 @@ eagain_ifuture<Ref<Node>> Node::load(
|
||||
});
|
||||
}
|
||||
|
||||
eagain_ifuture<NodeExtentMutable> Node::rebuild_extent(context_t c, laddr_t hint)
|
||||
eagain_ifuture<NodeExtentMutable> Node::rebuild_extent(context_t c)
|
||||
{
|
||||
LOG_PREFIX(OTree::Node::rebuild_extent);
|
||||
DEBUGT("{} ...", c.t, get_name());
|
||||
@ -753,7 +753,7 @@ eagain_ifuture<NodeExtentMutable> Node::rebuild_extent(context_t c, laddr_t hint
|
||||
|
||||
// note: laddr can be changed after rebuild, but we don't fix the parent
|
||||
// mapping as it is part of the merge process.
|
||||
return impl->rebuild_extent(c, hint);
|
||||
return impl->rebuild_extent(c);
|
||||
}
|
||||
|
||||
eagain_ifuture<> Node::retire(context_t c, Ref<Node>&& this_ref)
|
||||
@ -1490,11 +1490,19 @@ eagain_ifuture<Ref<InternalNode>> InternalNode::insert_or_split(
|
||||
|
||||
// proceed to split with insert
|
||||
// assume I'm already ref-counted by caller
|
||||
auto hint = insert_key.get_hint();
|
||||
return (is_root() ? upgrade_root(c, hint) : eagain_iertr::now()
|
||||
).si_then([this, c, hint] {
|
||||
laddr_t left_hint, right_hint;
|
||||
{
|
||||
key_view_t left_key;
|
||||
impl->get_slot(search_position_t::begin(), &left_key, nullptr);
|
||||
left_hint = left_key.get_hint();
|
||||
key_view_t right_key;
|
||||
impl->get_largest_slot(nullptr, &right_key, nullptr);
|
||||
right_hint = right_key.get_hint();
|
||||
}
|
||||
return (is_root() ? upgrade_root(c, left_hint) : eagain_iertr::now()
|
||||
).si_then([this, c, right_hint] {
|
||||
return InternalNode::allocate(
|
||||
c, hint, impl->field_type(), impl->is_level_tail(), impl->level());
|
||||
c, right_hint, impl->field_type(), impl->is_level_tail(), impl->level());
|
||||
}).si_then([this, insert_key, insert_child, insert_pos,
|
||||
insert_stage=insert_stage, insert_size=insert_size,
|
||||
outdated_child, c, FNAME](auto fresh_right) mutable {
|
||||
@ -2064,10 +2072,18 @@ eagain_ifuture<Ref<tree_cursor_t>> LeafNode::insert_value(
|
||||
}
|
||||
// split and insert
|
||||
Ref<Node> this_ref = this;
|
||||
auto hint = key.get_hint();
|
||||
return (is_root() ? upgrade_root(c, hint) : eagain_iertr::now()
|
||||
).si_then([this, c, hint] {
|
||||
return LeafNode::allocate(c, hint, impl->field_type(), impl->is_level_tail());
|
||||
laddr_t left_hint, right_hint;
|
||||
{
|
||||
key_view_t left_key;
|
||||
impl->get_slot(search_position_t::begin(), &left_key, nullptr);
|
||||
left_hint = left_key.get_hint();
|
||||
key_view_t right_key;
|
||||
impl->get_largest_slot(nullptr, &right_key, nullptr);
|
||||
right_hint = right_key.get_hint();
|
||||
}
|
||||
return (is_root() ? upgrade_root(c, left_hint) : eagain_iertr::now()
|
||||
).si_then([this, c, right_hint] {
|
||||
return LeafNode::allocate(c, right_hint, impl->field_type(), impl->is_level_tail());
|
||||
}).si_then([this_ref = std::move(this_ref), this, c, &key, vconf, FNAME,
|
||||
insert_pos, insert_stage=insert_stage, insert_size=insert_size](auto fresh_right) mutable {
|
||||
auto right_node = fresh_right.node;
|
||||
@ -2101,10 +2117,10 @@ eagain_ifuture<Ref<tree_cursor_t>> LeafNode::insert_value(
|
||||
}
|
||||
|
||||
eagain_ifuture<Ref<LeafNode>> LeafNode::allocate_root(
|
||||
context_t c, laddr_t hint, RootNodeTracker& root_tracker)
|
||||
context_t c, RootNodeTracker& root_tracker)
|
||||
{
|
||||
LOG_PREFIX(OTree::LeafNode::allocate_root);
|
||||
return LeafNode::allocate(c, hint, field_type_t::N0, true
|
||||
return LeafNode::allocate(c, L_ADDR_MIN, field_type_t::N0, true
|
||||
).si_then([c, &root_tracker, FNAME](auto fresh_node) {
|
||||
auto root = fresh_node.node;
|
||||
return c.nm.get_super(c.t, root_tracker
|
||||
|
@ -428,7 +428,7 @@ class Node
|
||||
eagain_ifuture<> erase_node(context_t, Ref<Node>&&);
|
||||
template <bool FORCE_MERGE = false>
|
||||
eagain_ifuture<> fix_parent_index(context_t, Ref<Node>&&, bool);
|
||||
eagain_ifuture<NodeExtentMutable> rebuild_extent(context_t, laddr_t);
|
||||
eagain_ifuture<NodeExtentMutable> rebuild_extent(context_t);
|
||||
eagain_ifuture<> retire(context_t, Ref<Node>&&);
|
||||
void make_tail(context_t);
|
||||
|
||||
@ -681,7 +681,7 @@ class LeafNode final : public Node {
|
||||
context_t, const key_hobj_t&, value_config_t,
|
||||
const search_position_t&, const MatchHistory&,
|
||||
match_stat_t mstat);
|
||||
static eagain_ifuture<Ref<LeafNode>> allocate_root(context_t, laddr_t, RootNodeTracker&);
|
||||
static eagain_ifuture<Ref<LeafNode>> allocate_root(context_t, RootNodeTracker&);
|
||||
friend class Node;
|
||||
|
||||
private:
|
||||
|
@ -90,7 +90,7 @@ class DummyNodeExtentManager final: public NodeExtentManager {
|
||||
|
||||
alloc_iertr::future<NodeExtentRef> alloc_extent(
|
||||
Transaction& t, laddr_t hint, extent_len_t len) override {
|
||||
TRACET("allocating {}B ...", t, len);
|
||||
TRACET("allocating {}B with hint {:#x} ...", t, len, hint);
|
||||
if constexpr (SYNC) {
|
||||
return alloc_extent_sync(t, len);
|
||||
} else {
|
||||
|
@ -122,7 +122,7 @@ class SeastoreNodeExtentManager final: public TransactionManagerHandle {
|
||||
|
||||
alloc_iertr::future<NodeExtentRef> alloc_extent(
|
||||
Transaction& t, laddr_t hint, extent_len_t len) override {
|
||||
TRACET("allocating {}B ...", t, len);
|
||||
TRACET("allocating {}B with hint {:#x} ...", t, len, hint);
|
||||
if constexpr (INJECT_EAGAIN) {
|
||||
if (trigger_eagain()) {
|
||||
DEBUGT("allocating {}B: trigger eagain", t, len);
|
||||
|
@ -90,7 +90,7 @@ class NodeImpl {
|
||||
virtual std::tuple<match_stage_t, search_position_t> erase(const search_position_t&) = 0;
|
||||
virtual std::tuple<match_stage_t, std::size_t> evaluate_merge(NodeImpl&) = 0;
|
||||
virtual search_position_t merge(NodeExtentMutable&, NodeImpl&, match_stage_t, extent_len_t) = 0;
|
||||
virtual eagain_ifuture<NodeExtentMutable> rebuild_extent(context_t, laddr_t) = 0;
|
||||
virtual eagain_ifuture<NodeExtentMutable> rebuild_extent(context_t) = 0;
|
||||
virtual eagain_ifuture<> retire_extent(context_t) = 0;
|
||||
virtual search_position_t make_tail() = 0;
|
||||
|
||||
|
@ -306,7 +306,12 @@ class NodeLayoutT final : public InternalNodeImpl, public LeafNodeImpl {
|
||||
}
|
||||
|
||||
eagain_ifuture<NodeExtentMutable>
|
||||
rebuild_extent(context_t c, laddr_t hint) override {
|
||||
rebuild_extent(context_t c) override {
|
||||
assert(!is_keys_empty());
|
||||
full_key_t<KeyT::VIEW> first_index;
|
||||
STAGE_T::template get_slot<true, false>(
|
||||
extent.read(), position_t::begin(), &first_index, nullptr);
|
||||
auto hint = first_index.get_hint();
|
||||
return extent.rebuild(c, hint).si_then([this] (auto mut) {
|
||||
// addr may change
|
||||
build_name();
|
||||
|
@ -908,7 +908,7 @@ class DummyChildPool {
|
||||
ceph_abort("impossible path"); }
|
||||
search_position_t merge(NodeExtentMutable&, NodeImpl&, match_stage_t, extent_len_t) override {
|
||||
ceph_abort("impossible path"); }
|
||||
eagain_ifuture<NodeExtentMutable> rebuild_extent(context_t, laddr_t) override {
|
||||
eagain_ifuture<NodeExtentMutable> rebuild_extent(context_t) override {
|
||||
ceph_abort("impossible path"); }
|
||||
node_stats_t get_stats() const override {
|
||||
ceph_abort("impossible path"); }
|
||||
|
Loading…
Reference in New Issue
Block a user