]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
crimson/onode-staged-tree: implement hint in NodeImpl::rebuild_extent()
authorYingxin Cheng <yingxin.cheng@intel.com>
Thu, 2 Sep 2021 03:05:18 +0000 (11:05 +0800)
committerYingxin Cheng <yingxin.cheng@intel.com>
Thu, 2 Sep 2021 03:05:18 +0000 (11:05 +0800)
Get the hint from its first key when rebuilding a node extent.

Signed-off-by: Yingxin Cheng <yingxin.cheng@intel.com>
src/crimson/os/seastore/onode_manager/staged-fltree/node.cc
src/crimson/os/seastore/onode_manager/staged-fltree/node.h
src/crimson/os/seastore/onode_manager/staged-fltree/node_impl.h
src/crimson/os/seastore/onode_manager/staged-fltree/node_layout.h
src/test/crimson/seastore/onode_tree/test_staged_fltree.cc

index 4171490e639313eccf5c7dae200dc56ecc8d26ba..1fec53bcfa9da5922d0803d8b19edcb91922a4c5 100644 (file)
@@ -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)
index 6392da50d37f18f7da2e760dd6e5f41fdf349cf9..c02a24d50ff9f76612fa6e5c39813c2c27d433ff 100644 (file)
@@ -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);
 
index f8a8aaa1cd4bd0d8283492353108cda9acb00c9b..cf452618b6fa101a4fff54a93e1154adefe12b0b 100644 (file)
@@ -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;
 
index cc1841ce9fbf9ce554373a0bd7cb78d63ab5ddea..436f883700a5f2c7ac99ed5f5ad44ae72a55a82d 100644 (file)
@@ -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();
index 771e5b0356904302dda902f21dabe209526f041c..a2ef111c8748061e29691a9099ed9703e036bb8f 100644 (file)
@@ -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"); }