]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
crimson/os/seastore: drop RetiredExtentPlaceholder 69045/head
authorXuehan Xu <xuxuehan@qianxin.com>
Thu, 21 May 2026 07:10:59 +0000 (15:10 +0800)
committerXuehan Xu <xuxuehan@qianxin.com>
Fri, 22 May 2026 05:53:26 +0000 (13:53 +0800)
Signed-off-by: Xuehan Xu <xuxuehan@qianxin.com>
14 files changed:
src/crimson/os/seastore/backref_entry.h
src/crimson/os/seastore/cache.cc
src/crimson/os/seastore/cache.h
src/crimson/os/seastore/cached_extent.h
src/crimson/os/seastore/extent_pinboard.cc
src/crimson/os/seastore/linked_tree_node.h
src/crimson/os/seastore/logical_child_node.h
src/crimson/os/seastore/seastore_types.cc
src/crimson/os/seastore/seastore_types.h
src/crimson/os/seastore/transaction.h
src/crimson/os/seastore/transaction_manager.cc
src/crimson/os/seastore/transaction_manager.h
src/test/crimson/seastore/test_btree_lba_manager.cc
src/test/crimson/seastore/test_transaction_manager.cc

index 000be853d2b66783de4c4f718cb291b28d82abef..a1cf53269df02afbaaadceb7d492a7bd10b4a251 100644 (file)
@@ -97,8 +97,7 @@ struct backref_entry_t {
       const paddr_t& paddr,
       extent_len_t len,
       extent_types_t type) {
-    assert(is_backref_mapped_type(type) ||
-          is_retired_placeholder_type(type));
+    assert(is_backref_mapped_type(type));
     return std::make_unique<backref_entry_t>(
       paddr, L_ADDR_NULL, len, type);
   }
index 8272db88fde1fe7634bf82fe47a7f89290fb99a9..b991e0c1295a95a2711a74585e4ae973caff1118 100644 (file)
@@ -144,7 +144,6 @@ void Cache::register_metrics(store_index_t store_index)
     {extent_types_t::ONODE_BLOCK_STAGED,  {sm::label_instance("ext", "ONODE_BLOCK_STAGED")}},
     {extent_types_t::COLL_BLOCK,          {sm::label_instance("ext", "COLL_BLOCK")}},
     {extent_types_t::OBJECT_DATA_BLOCK,   {sm::label_instance("ext", "OBJECT_DATA_BLOCK")}},
-    {extent_types_t::RETIRED_PLACEHOLDER, {sm::label_instance("ext", "RETIRED_PLACEHOLDER")}},
     {extent_types_t::ALLOC_INFO,         {sm::label_instance("ext", "ALLOC_INFO")}},
     {extent_types_t::JOURNAL_TAIL,        {sm::label_instance("ext", "JOURNAL_TAIL")}},
     {extent_types_t::TEST_BLOCK,          {sm::label_instance("ext", "TEST_BLOCK")}},
@@ -493,7 +492,7 @@ void Cache::register_metrics(store_index_t store_index)
   }
 
   /**
-   * Cached extents (including placeholders)
+   * Cached extents
    *
    * Dirty extents
    */
@@ -896,7 +895,7 @@ void Cache::remove_extent(
          ref->get_paddr().is_root());
   if (ref->is_stable_dirty()) {
     remove_from_dirty(ref, p_src);
-  } else if (!ref->is_placeholder()) {
+  } else {
     assert(ref->get_paddr().is_absolute());
     pinboard->remove(*ref);
   }
@@ -1193,9 +1192,6 @@ CachedExtentRef Cache::alloc_new_non_data_extent_by_type(
   case extent_types_t::COLL_BLOCK:
     return alloc_new_non_data_extent<collection_manager::CollectionNode>(
       t, length, hint, gen);
-  case extent_types_t::RETIRED_PLACEHOLDER:
-    ceph_assert(0 == "impossible");
-    return CachedExtentRef();
   case extent_types_t::TEST_BLOCK_PHYSICAL:
     return alloc_new_non_data_extent<TestBlockPhysical>(t, length, hint, gen);
   case extent_types_t::LOG_NODE:
@@ -1322,7 +1318,6 @@ record_t Cache::prepare_record(
   auto trans_src = t.get_src();
   assert(!t.is_weak());
   assert(trans_src != Transaction::src_t::READ);
-  assert(t.read_set.size() + t.num_replace_placeholder == t.read_items.size());
 
   auto& efforts = get_by_src(stats.committed_efforts_by_src,
                              trans_src);
@@ -1519,8 +1514,7 @@ record_t Cache::prepare_record(
     }
 
     // Note: commit extents and backref allocations in the same place
-    if (is_backref_mapped_type(extent->get_type()) ||
-       is_retired_placeholder_type(extent->get_type())) {
+    if (is_backref_mapped_type(extent->get_type())) {
       DEBUGT("backref_entry free {}~0x{:x}",
             t,
             extent->get_paddr(),
@@ -2319,9 +2313,6 @@ Cache::replay_delta(
       // replay is not included by the cache hit metrics
       auto ret = query_cache(addr);
       if (ret) {
-        // no retired-placeholder should be exist yet because no transaction
-        // has been created.
-        assert(!is_retired_placeholder_type(ret->get_type()));
         return ret->wait_io().then([ret] {
           return ret;
         });
@@ -2562,9 +2553,6 @@ Cache::_get_absent_extent_by_type(
   case extent_types_t::OBJECT_DATA_BLOCK:
     ret = CachedExtent::make_cached_extent_ref<ObjectDataBlock>(length);
     break;
-  case extent_types_t::RETIRED_PLACEHOLDER:
-    ceph_assert(0 == "impossible");
-    break;
   case extent_types_t::TEST_BLOCK:
     ret = CachedExtent::make_cached_extent_ref<TestBlock>(length);
     break;
@@ -2682,9 +2670,6 @@ Cache::do_get_caching_extent_by_type(
     ).safe_then([](auto extent) {
       return CachedExtentRef(extent.detach(), false /* add_ref */);
     });
-  case extent_types_t::RETIRED_PLACEHOLDER:
-    ceph_assert(0 == "impossible");
-    return get_extent_ertr::make_ready_future<CachedExtentRef>();
   case extent_types_t::TEST_BLOCK:
     return do_get_caching_extent<TestBlock>(
       offset, length, std::move(extent_init_func), std::move(on_cache), p_src
index 207888494c7f7d9ef2f39c8e2ec55b0f9f792373..9d289c1672c2948ca7eb8a97a89960128be9cb28 100644 (file)
@@ -103,8 +103,7 @@ class SegmentProvider;
  * - TRACE: DEBUG details
  * - seastore_t logs
  */
-class Cache : public ExtentTransViewRetriever,
-             public RetiredExtentPlaceholderInvalidater {
+class Cache : public ExtentTransViewRetriever {
 public:
   Cache(ExtentPlacementManager &epm, store_index_t store_index);
   ~Cache();
@@ -268,14 +267,6 @@ public:
       return get_extent_if_cached_iertr::make_ready_future<CachedExtentRef>();
     }
 
-    if (is_retired_placeholder_type(ret->get_type())) {
-      // retired_placeholder is not really cached yet
-      SUBDEBUGT(seastore_cache,
-        "{} {}~0x{:x} ~0x{:x} is absent(placeholder) in cache",
-        t, type, paddr, len, ret->get_length());
-      return get_extent_if_cached_iertr::make_ready_future<CachedExtentRef>();
-    }
-
     if (ret->get_length() != len) {
       SUBDEBUGT(seastore_cache,
         "{} {}~0x{:x} is present in cache with inconsistent length 0x{:x} -- {}",
@@ -305,7 +296,7 @@ public:
           ret->cast<CachedExtent>(), 0, ret->get_length(), &t_src));
     }
 
-    // present in cache(fully loaded) and is not a retired_placeholder
+    // present in cache(fully loaded)
     SUBDEBUGT(seastore_cache,
       "{} {}~0x{:x} is present in cache -- {}",
       t, type, paddr, len, *ret);
@@ -374,18 +365,6 @@ public:
     }
   }
 
-  void invalidate_retired_placeholder(
-    Transaction &t,
-    CachedExtent &retired_placeholder,
-    CachedExtent &extent) {
-    // replace placeholder in transactions
-    while (!retired_placeholder.read_transactions.empty()) {
-      auto t = retired_placeholder.read_transactions.begin()->t;
-      t->replace_placeholder(retired_placeholder, extent);
-    }
-    retired_placeholder.set_invalid(t);
-  }
-
   /*
    * prepare_absent_extent
    *
@@ -536,7 +515,6 @@ public:
     assert(extent.is_fully_loaded());
     const auto t_src = t.get_src();
     auto ext_type = extent.get_type();
-    assert(!is_retired_placeholder_type(ext_type));
     cache_access_stats_t& access_stats = get_by_ext(
       get_by_src(stats.access_by_src_ext, t_src),
       ext_type);
@@ -604,12 +582,6 @@ public:
 
     const auto t_src = t.get_src();
     auto ext_type = extent->get_type();
-    // FIXME: retired-placeholder isn't linked in the lba tree yet.
-    //   We think it's still working because:
-    //   1. A retired-placeholder must be an ObjectDataBlock
-    //   2. Per rados object, no read is possible during write,
-    //      and write cannot be parallel
-    assert(!is_retired_placeholder_type(ext_type));
     cache_access_stats_t& access_stats = get_by_ext(
       get_by_src(stats.access_by_src_ext, t_src),
       ext_type);
@@ -680,8 +652,6 @@ public:
       }
     }
 
-    // user should not see RETIRED_PLACEHOLDER extents
-    ceph_assert(!is_retired_placeholder_type(p_extent->get_type()));
     // for logical extents, handle partial load in TM::read_pin(),
     // also see read_extent_maybe_partial() and get_absent_extent()
     assert(is_logical_type(p_extent->get_type()) ||
@@ -902,32 +872,6 @@ private:
     }
 
     // extent PRESENT in cache
-    if (is_retired_placeholder_type(cached->get_type())) {
-      // partial read
-      TCachedExtentRef<T> ret = CachedExtent::make_cached_extent_ref<T>(length);
-      ret->init(CachedExtent::extent_state_t::CLEAN,
-                offset,
-                PLACEMENT_HINT_NULL,
-                NULL_GENERATION,
-               TRANS_ID_NULL);
-      SUBDEBUG(seastore_cache,
-          "{} {}~0x{:x} is absent(placeholder), add extent and reading range 0x{:x}~0x{:x} ... -- {}",
-          T::TYPE, offset, length, partial_off, partial_len, *ret);
-      extent_init_func(*ret);
-      on_cache(*ret);
-      extents_index.replace(*ret, *cached);
-
-      // replace placeholder in transactions
-      while (!cached->read_transactions.empty()) {
-        auto t = cached->read_transactions.begin()->t;
-        t->replace_placeholder(*cached, *ret);
-      }
-
-      cached->state = CachedExtent::extent_state_t::INVALID;
-      return read_extent<T>(
-       std::move(ret), partial_off, partial_len, p_src);
-    }
-
     auto ret = TCachedExtentRef<T>(static_cast<T*>(cached.get()));
     on_cache(*ret);
     if (ret->is_range_loaded(partial_off, partial_len)) {
@@ -1743,7 +1687,7 @@ private:
     if (hint == CACHE_HINT_NOCACHE && is_logical_type(ext.get_type())) {
       return;
     }
-    if (ext.is_stable_clean() && !ext.is_placeholder()) {
+    if (ext.is_stable_clean()) {
       pinboard->move_to_top(ext, p_src, load_start, load_length);
     }
   }
@@ -1956,7 +1900,6 @@ private:
   /// Add extent to extents handling dirty and refcounting
   ///
   /// Note, it must follows with add_to_dirty() or touch_extent().
-  /// The only exception is RetiredExtentPlaceholder.
   void add_extent(CachedExtentRef ref);
 
   /// Mark exising extent ref dirty -- mainly for replay
@@ -2243,7 +2186,6 @@ void stage_visibility_handoff(Transaction& t,
     }
   }
 
-  // Extents in cache may contain placeholders
   CachedExtentRef query_cache(paddr_t offset) {
     if (auto iter = extents_index.find_offset(offset);
         iter != extents_index.end()) {
index 4c10d1a9e6a6e69be034c4e422e45436cbf0f0c1..043edd61817470c0f2dc69b20bedc5a9c2f4492a 100644 (file)
@@ -689,11 +689,6 @@ public:
     return !is_valid() || (prior_instance && !prior_instance->is_valid());
   }
 
-  /// Returns true if extent is a placeholder
-  bool is_placeholder() const {
-    return is_retired_placeholder_type(get_type());
-  }
-
   bool is_pending_io() const {
     return io_wait.has_value();
   }
@@ -1096,17 +1091,6 @@ protected:
     // must call init() to fully initialize
   }
 
-  struct retired_placeholder_construct_t {};
-  CachedExtent(retired_placeholder_construct_t, extent_len_t _length)
-    : state(extent_state_t::CLEAN),
-      length(_length),
-      loaded_length(0),
-      buffer_space(std::in_place) {
-    assert(!is_fully_loaded());
-    assert(is_aligned(length, CEPH_PAGE_SIZE));
-    // must call init() to fully initialize
-  }
-
   friend class Cache;
   friend class ExtentQueue;
   friend class ExtentPinboardLRU;
index 02fe9fb93d0aaed43406b1a62101f2052046c28e..418afd928baa4d2ad23654bc128dbe6f05a81e12 100644 (file)
@@ -40,7 +40,6 @@ class ExtentQueue {
     CachedExtent &extent,
     const Transaction::src_t* p_src) {
     assert(extent.is_stable_clean());
-    assert(!extent.is_placeholder());
     assert(extent.is_linked_to_list());
     assert(list.size() > 0);
     auto extent_loaded_length = extent.get_loaded_length();
@@ -100,7 +99,6 @@ public:
     CachedExtent &extent,
     const Transaction::src_t* p_src) {
     assert(extent.is_stable_clean());
-    assert(!extent.is_placeholder());
     assert(!extent.is_linked_to_list());
 
     // absent, add to top (back)
@@ -126,7 +124,6 @@ public:
     CachedExtent &extent,
     const Transaction::src_t* p_src) {
     assert(extent.is_stable_clean());
-    assert(!extent.is_placeholder());
     assert(extent.is_linked_to_list());
 
     // present, move to top (back)
@@ -143,7 +140,6 @@ public:
     assert(extent.is_data_stable());
     assert(extent.is_linked_to_list());
     assert(extent.is_stable_clean());
-    assert(!extent.is_placeholder());
 
     // present, increase size
     assert(list.size() > 0);
index bf67a24bf52d1723a3ab944d9e0fb723d767fca1..bd077130f6c8dbdfc4c584692f1704979ea2446f 100644 (file)
@@ -9,27 +9,11 @@
 
 namespace crimson::os::seastore {
 
-struct RetiredExtentPlaceholderInvalidater {
-  virtual void invalidate_retired_placeholder(
-    Transaction &t,
-    CachedExtent &retired_placeholder,
-    CachedExtent &extent) = 0;
-};
-
 template <typename ParentT>
 class child_pos_t {
 public:
   child_pos_t(TCachedExtentRef<ParentT> stable_parent, btreenode_pos_t pos)
     : stable_parent(stable_parent), pos(pos) {}
-  child_pos_t(
-    TCachedExtentRef<ParentT> stable_parent,
-    btreenode_pos_t pos,
-    CachedExtent* placeholder)
-    : stable_parent(stable_parent),
-      pos(pos),
-      retired_placeholder(placeholder) {
-    assert(retired_placeholder->is_placeholder());
-  }
 
   TCachedExtentRef<ParentT> get_parent() {
     ceph_assert(stable_parent);
@@ -42,18 +26,9 @@ public:
   void link_child(ChildT *c) {
     get_parent()->link_child(c, pos);
   }
-  void invalidate_retired_placeholder(
-    Transaction &t,
-    RetiredExtentPlaceholderInvalidater &repi,
-    CachedExtent &extent) {
-    if (retired_placeholder) {
-      repi.invalidate_retired_placeholder(t, *retired_placeholder, extent);
-    }
-  }
 private:
   TCachedExtentRef<ParentT> stable_parent;
   btreenode_pos_t pos = std::numeric_limits<btreenode_pos_t>::max();
-  CachedExtentRef retired_placeholder;
 };
 
 using get_child_iertr = trans_iertr<crimson::errorator<
@@ -236,7 +211,6 @@ public:
     return parent_tracker->get_parent();
   }
   virtual key_t node_begin() const = 0;
-  virtual bool is_retired_placeholder() const = 0;
   virtual bool _is_pending_io() const = 0;
   virtual bool _is_mutable() const = 0;
   virtual bool _is_exist_clean() const = 0;
@@ -365,26 +339,15 @@ public:
     auto child = children[pos];
     ceph_assert(!is_reserved_ptr(child));
     if (is_valid_child_ptr(child)) {
-      if (child->is_retired_placeholder()) {
-       assert(me.is_stable());
-       return child_pos_t<T>(
-         &me, pos, dynamic_cast<CachedExtent*>(child));
-      } else {
-       return etvr.get_extent_viewable_by_trans<ChildT>(
-         t, static_cast<ChildT*>(child));
-      }
+      return etvr.get_extent_viewable_by_trans<ChildT>(
+        t, static_cast<ChildT*>(child));
     } else if (me.is_pending()) {
       auto &sparent = me.get_stable_for_key(key);
       auto spos = sparent.lower_bound(key).get_offset();
       auto child = sparent.children[spos];
       if (is_valid_child_ptr(child)) {
-       if (child->is_retired_placeholder()) {
-         return child_pos_t<T>(
-           &sparent, spos, dynamic_cast<CachedExtent*>(child));
-       } else {
-         return etvr.get_extent_viewable_by_trans<ChildT>(
-           t, static_cast<ChildT*>(child));
-       }
+        return etvr.get_extent_viewable_by_trans<ChildT>(
+          t, static_cast<ChildT*>(child));
       } else {
        return child_pos_t<T>(&sparent, spos);
       }
@@ -402,7 +365,6 @@ public:
     assert(child->_is_stable());
     if (unlikely(children[pos] != nullptr)) {
       assert(is_valid_child_ptr(children[pos]));
-      assert(children[pos]->is_retired_placeholder());
     }
     ceph_assert(is_valid_child_ptr(child));
     update_child_ptr(pos, child);
@@ -1107,10 +1069,6 @@ public:
     }
   }
 
-  bool is_retired_placeholder() const final {
-    auto &me = down_cast();
-    return me.is_placeholder();
-  }
 protected:
   void on_invalidated() {
     this->reset_parent_tracker();
index e143e323755c0c99da6df8a0d907abe683c2360c..43721747faf9e6e3e17a44f646bf542555478c3a 100644 (file)
 
 namespace crimson::os::seastore {
 
-/**
- * RetiredExtentPlaceholder
- *
- * Cache::retire_extent_addr(Transaction&, paddr_t, extent_len_t) can retire an
- * extent not currently in cache. In that case, in order to detect transaction
- * invalidation, we need to add a placeholder to the cache to create the
- * mapping back to the transaction. And whenever there is a transaction tries
- * to read the placeholder extent out, Cache is responsible to replace the
- * placeholder by the real one. Anyway, No placeholder extents should escape
- * the Cache interface boundary.
- */
-class RetiredExtentPlaceholder
-  : public CachedExtent,
-    public ChildNode<lba::LBALeafNode, RetiredExtentPlaceholder, laddr_t> {
-
-  using lba_child_node_t =
-    ChildNode<lba::LBALeafNode, RetiredExtentPlaceholder, laddr_t>;
-public:
-  RetiredExtentPlaceholder(extent_len_t length)
-    : CachedExtent(CachedExtent::retired_placeholder_construct_t{}, length) {}
-
-  ~RetiredExtentPlaceholder() {
-    if (this->is_stable()) {
-      lba_child_node_t::destroy();
-    }
-  }
-
-  void on_invalidated(Transaction&) final {
-    this->lba_child_node_t::on_invalidated();
-  }
-
-  CachedExtentRef duplicate_for_write(Transaction&) final {
-    ceph_abort_msg("Should never happen for a placeholder");
-    return CachedExtentRef();
-  }
-
-  ceph::bufferlist get_delta() final {
-    ceph_abort_msg("Should never happen for a placeholder");
-    return ceph::bufferlist();
-  }
-
-  static constexpr extent_types_t TYPE = extent_types_t::RETIRED_PLACEHOLDER;
-  extent_types_t get_type() const final {
-    return TYPE;
-  }
-
-  void apply_delta_and_adjust_crc(
-    paddr_t base, const ceph::bufferlist &bl) final {
-    ceph_abort_msg("Should never happen for a placeholder");
-  }
-
-  void on_rewrite(Transaction &, CachedExtent&, extent_len_t) final {}
-
-  std::ostream &print_detail(std::ostream &out) const final {
-    return out << ", RetiredExtentPlaceholder";
-  }
-
-  void on_delta_write(paddr_t record_block_offset) final {
-    ceph_abort_msg("Should never happen for a placeholder");
-  }
-
-  void set_laddr(laddr_t laddr) {
-    this->laddr = laddr;
-  }
-
-  bool is_btree_root() const {
-    return false;
-  }
-
-  laddr_t get_begin() const {
-    assert(laddr != L_ADDR_NULL);
-    return laddr;
-  }
-
-  laddr_t get_end() const {
-    assert(laddr != L_ADDR_NULL);
-    return (laddr + get_length()).checked_to_laddr();
-  }
-
-private:
-  laddr_t laddr = L_ADDR_NULL;
-};
-
 class LogicalChildNode : public LogicalCachedExtent,
                         public ChildNode<lba::LBALeafNode,
                                          LogicalChildNode,
index b63aba12ccc697495028072950370b6232a8eb2c..b8a93f7d080653d7c6ab3c93ebd8fae17dcbace0 100644 (file)
@@ -256,8 +256,6 @@ std::ostream &operator<<(std::ostream &out, extent_types_t t)
     return out << "COLL_BLOCK";
   case extent_types_t::OBJECT_DATA_BLOCK:
     return out << "OBJECT_DATA_BLOCK";
-  case extent_types_t::RETIRED_PLACEHOLDER:
-    return out << "RETIRED_PLACEHOLDER";
   case extent_types_t::ALLOC_INFO:
     return out << "ALLOC_INFO";
   case extent_types_t::JOURNAL_TAIL:
index 7adaf4c16f4537db7ce555215c8c04ffa34a9939..683ae1c88f9db2c98a62bd048a66cb17f397c683 100644 (file)
@@ -1465,19 +1465,18 @@ enum class extent_types_t : uint8_t {
   ONODE_BLOCK_STAGED = 7,
   COLL_BLOCK = 8,
   OBJECT_DATA_BLOCK = 9,
-  RETIRED_PLACEHOLDER = 10,
   // the following two types are not extent types,
   // they are just used to indicates paddr allocation deltas
-  ALLOC_INFO = 11,
-  JOURNAL_TAIL = 12,
+  ALLOC_INFO = 10,
+  JOURNAL_TAIL = 11,
   // Test Block Types
-  TEST_BLOCK = 13,
-  TEST_BLOCK_PHYSICAL = 14,
-  BACKREF_INTERNAL = 15,
-  BACKREF_LEAF = 16,
-  LOG_NODE = 17,
+  TEST_BLOCK = 12,
+  TEST_BLOCK_PHYSICAL = 13,
+  BACKREF_INTERNAL = 14,
+  BACKREF_LEAF = 15,
+  LOG_NODE = 16,
   // None and the number of valid extent_types_t
-  NONE = 18,
+  NONE = 17,
 };
 using extent_types_le_t = uint8_t;
 constexpr auto EXTENT_TYPES_MAX = static_cast<uint8_t>(extent_types_t::NONE);
@@ -1512,10 +1511,6 @@ constexpr bool is_logical_type(extent_types_t type) {
   }
 }
 
-constexpr bool is_retired_placeholder_type(extent_types_t type) {
-  return type == extent_types_t::RETIRED_PLACEHOLDER;
-}
-
 constexpr bool is_root_type(extent_types_t type) {
   return type == extent_types_t::ROOT;
 }
@@ -2109,8 +2104,7 @@ struct alloc_blk_t {
       extent_len_t len,
       extent_types_t type) {
     assert(is_backref_mapped_type(type) ||
-          is_backref_node(type) ||
-          is_retired_placeholder_type(type));
+          is_backref_node(type));
     return alloc_blk_t(paddr, L_ADDR_NULL, len, type);
   }
 };
@@ -3055,7 +3049,7 @@ std::ostream& operator<<(std::ostream&, const dirty_io_stats_printer_t&);
  * Doesn't account:
  *   replay
  *   rewrite
- *   retiring/placeholder
+ *   retiring
  *   get_caching_extent() -- test only
  *   get_caching_extent_by_type() -- test only
  */
index cede735aae022fe229c4338330a67599bfcbb1d8..2b56aef47fe6cb38727fea3a081b0bbf08c1531e 100644 (file)
@@ -127,10 +127,6 @@ public:
   get_extent_ret get_extent(paddr_t addr, CachedExtentRef *out) {
     assert(addr.is_real_location() || addr.is_root());
     auto [result, ext] = do_get_extent(addr);
-    // placeholder in read-set must be in the retired-set
-    // at the same time, user should not see a placeholder.
-    assert(result != get_extent_ret::PRESENT ||
-           !is_retired_placeholder_type(ext->get_type()));
     if (out && result == get_extent_ret::PRESENT) {
       *out = ext;
     }
@@ -316,48 +312,6 @@ public:
     }
   }
 
-  void replace_placeholder(CachedExtent& placeholder, CachedExtent& extent) {
-    LOG_PREFIX(Transaction::replace_placeholder);
-    ceph_assert(!is_weak());
-
-    assert(is_retired_placeholder_type(placeholder.get_type()));
-    assert(!is_retired_placeholder_type(extent.get_type()));
-    assert(!is_root_type(extent.get_type()));
-    assert(extent.get_paddr() == placeholder.get_paddr());
-    assert(extent.get_paddr().is_absolute());
-    {
-      auto where = read_set.find(placeholder.get_paddr(), extent_cmp_t{});
-      if (unlikely(where == read_set.end())) {
-       SUBERRORT(seastore_t,
-         "unable to find placeholder {}", *this, placeholder);
-       ceph_abort();
-      }
-      if (unlikely(where->ref.get() != &placeholder)) {
-       SUBERRORT(seastore_t,
-         "inconsistent placeholder, current: {}; should-be: {}",
-         *this, *where->ref.get(), placeholder);
-       ceph_abort();
-      }
-      placeholder.read_transactions.erase(
-       read_trans_set_t<Transaction>::s_iterator_to(*where));
-      where = read_set.erase(where);
-      // Note, the retired-placeholder is not removed from read_items after replace.
-      read_items.emplace_back(this, &extent);
-      auto it = read_set.insert_before(where, read_items.back());
-      extent.read_transactions.insert(const_cast<read_set_item_t<Transaction>&>(*it));
-#ifndef NDEBUG
-      num_replace_placeholder++;
-#endif
-    }
-    {
-      auto where = retired_set.find(&placeholder);
-      assert(where != retired_set.end());
-      assert(where->extent.get() == &placeholder);
-      where = retired_set.erase(where);
-      retired_set.emplace_hint(where, &extent, trans_id);
-    }
-  }
-
   auto get_delayed_alloc_list() {
     std::list<CachedExtentRef> ret;
     for (auto& extent : delayed_alloc_list) {
@@ -701,9 +655,6 @@ private:
   void clear_read_set() {
     read_items.clear();
     assert(read_set.empty());
-#ifndef NDEBUG
-    num_replace_placeholder = 0;
-#endif
     // Automatically unlink this transaction from CachedExtent::read_transactions
   }
 
@@ -839,9 +790,6 @@ private:
    */
   read_extent_set_t<Transaction> read_set; ///< set of extents read by paddr
   std::list<read_set_item_t<Transaction>> read_items;
-#ifndef NDEBUG
-  size_t num_replace_placeholder = 0;
-#endif
 
   uint64_t fresh_backref_extents = 0; // counter of new backref extents
 
index 720719139fafcab286991bce806db8e9d11c0cd3..9d65239e8617f4db8050b414c07c41223d94351c 100644 (file)
@@ -304,13 +304,12 @@ TransactionManager::_remove(
        mapping.get_val(),
        mapping.get_intermediate_length(),
         mapping.get_extent_type(),
-        [this, &child_pos, laddr, &t](auto &extent) mutable {
+        [&child_pos, laddr](auto &extent) mutable {
           auto lextent = extent.template cast<LogicalChildNode>();
           assert(extent.is_logical());
           assert(!lextent->has_laddr());
           assert(!extent.has_been_invalidated());
           child_pos.link_child(lextent.get());
-          child_pos.invalidate_retired_placeholder(t, *cache, extent);
           lextent->set_laddr(laddr);
         }
       );
index 69fcee33df3b30bed27aed36ad35b370c5e7cb59..3bf6abf8db522a7b0adc62a6208399e1d58443a2 100644 (file)
@@ -372,14 +372,12 @@ public:
            pin.partial_len,
            [laddr=pin.mapping.get_intermediate_base(),
             maybe_init=std::move(maybe_init),
-            child_pos=std::move(ret.get_child_pos()),
-            &t, this]
+            child_pos=std::move(ret.get_child_pos())]
            (T &extent) mutable {
              assert(extent.is_logical());
              assert(!extent.has_laddr());
              assert(!extent.has_been_invalidated());
              child_pos.link_child(&extent);
-             child_pos.invalidate_retired_placeholder(t, *cache, extent);
              extent.set_laddr(laddr);
              maybe_init(extent);
              extent.set_seen_by_users();
@@ -1414,13 +1412,12 @@ private:
           auto laddr = pin.get_key();
           std::ignore = cache->retire_absent_extent_addr_by_type(
             t, laddr, original_paddr, original_len, pin.get_extent_type(),
-            [this, &child_pos, laddr, &t](auto &extent) mutable {
+            [&child_pos, laddr](auto &extent) mutable {
               auto lextent = extent.template cast<LogicalChildNode>();
               assert(extent.is_logical());
               assert(!lextent->has_laddr());
               assert(!extent.has_been_invalidated());
               child_pos.link_child(lextent.get());
-              child_pos.invalidate_retired_placeholder(t, *cache, extent);
               lextent->set_laddr(laddr);
             }
           );
@@ -1587,13 +1584,11 @@ private:
       seastar::coroutine::lambda(
         [laddr=pin.get_intermediate_base(),
         maybe_init=std::move(maybe_init),
-        child_pos=std::move(child_pos),
-        &t, this] (T &extent) mutable {
+        child_pos=std::move(child_pos)] (T &extent) mutable {
           assert(extent.is_logical());
           assert(!extent.has_laddr());
           assert(!extent.has_been_invalidated());
           child_pos.link_child(&extent);
-          child_pos.invalidate_retired_placeholder(t, *cache, extent);
           extent.set_laddr(laddr);
           maybe_init(extent);
           extent.set_seen_by_users();
@@ -1636,14 +1631,13 @@ private:
       direct_length,
       // extent_init_func
       seastar::coroutine::lambda(
-      [direct_key, child_pos=std::move(child_pos),
-      &t, this](CachedExtent &extent) mutable {
+      [direct_key, child_pos=std::move(child_pos)]
+      (CachedExtent &extent) mutable {
         assert(extent.is_logical());
         auto &lextent = static_cast<LogicalChildNode&>(extent);
         assert(!lextent.has_laddr());
         assert(!lextent.has_been_invalidated());
         child_pos.link_child(&lextent);
-        child_pos.invalidate_retired_placeholder(t, *cache, lextent);
         lextent.set_laddr(direct_key);
         // No change to extent::seen_by_user because this path is only
         // for background cleaning.
index af05e02b7c7751c677bcabc6c06a68b940c3f1f4..5ba9bde5cd3047d5aa16c3b9b6c812fd78734be0 100644 (file)
@@ -619,13 +619,12 @@ struct btree_lba_manager_test : btree_test_base {
               paddr,
               length,
               cursor->get_extent_type(),
-              [&child_pos, &t, laddr=cursor->key, this](auto &extent) {
+              [&child_pos, laddr=cursor->key](auto &extent) {
                 auto lextent = extent.template cast<LogicalChildNode>();
                 ASSERT_TRUE(extent.is_logical());
                 ASSERT_FALSE(lextent->has_laddr());
                 ASSERT_FALSE(extent.has_been_invalidated());
                 child_pos.link_child(lextent.get());
-                child_pos.invalidate_retired_placeholder(t, *cache, extent);
                 lextent->set_laddr(laddr);
               });
           }
index c1ca8b5d3baf686a6e2cf09acdc329c2db6f241b..490b1df6e4cb853968c066dc65b93b67ff5f4bc8 100644 (file)
@@ -1066,9 +1066,8 @@ struct transaction_manager_test_t :
         extent_types_t::BACKREF_LEAF,
        extent_types_t::LOG_NODE
       };
-      // exclude DINK_LADDR_LEAF, RETIRED_PLACEHOLDER,
-      //         ALLOC_INFO, JOURNAL_TAIL
-      assert(all_extent_types.size() == EXTENT_TYPES_MAX - 4);
+      // exclude DINK_LADDR_LEAF, ALLOC_INFO, JOURNAL_TAIL
+      assert(all_extent_types.size() == EXTENT_TYPES_MAX - 3);
 
       std::vector<rewrite_gen_t> all_generations;
       for (auto i = INIT_GENERATION; i <= epm->dynamic_max_rewrite_generation; i++) {