]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
crimson/os/seastore: drop retired_extent_gate_t 42729/head
authorYingxin Cheng <yingxin.cheng@intel.com>
Fri, 6 Aug 2021 06:51:50 +0000 (14:51 +0800)
committerYingxin Cheng <yingxin.cheng@intel.com>
Tue, 10 Aug 2021 03:55:55 +0000 (11:55 +0800)
retired_extent_gate_t is no longer needed after integrating
interruptive-future.

Signed-off-by: Yingxin Cheng <yingxin.cheng@intel.com>
src/crimson/os/seastore/cache.cc
src/crimson/os/seastore/cache.h
src/crimson/os/seastore/cached_extent.h
src/crimson/os/seastore/transaction.h

index 0389943a3b6fdc0c55949497bfb4993dce317ea9..c96d535b18221cba5128b51b5233777ff6aa0843 100644 (file)
@@ -497,7 +497,6 @@ void Cache::retire_extent(CachedExtentRef ref)
 
   remove_from_dirty(ref);
   ref->dirty_from_or_retired_at = JOURNAL_SEQ_MAX;
-  retired_extent_gate.add_extent(*ref);
 
   invalidate(*ref);
   extents.erase(*ref);
@@ -851,8 +850,6 @@ void Cache::complete_commit(
     DEBUGT("retiring {}", t, *i);
     i->dirty_from_or_retired_at = last_commit;
   }
-
-  retired_extent_gate.prune();
 }
 
 void Cache::init() {
index 22090c88dbd5b292c12e8f57e618cdc6944946ba..a6212ff6d0330f2650a612a0027e44cf472622b6 100644 (file)
@@ -92,8 +92,6 @@ public:
   Cache(SegmentManager &segment_manager);
   ~Cache();
 
-  retired_extent_gate_t retired_extent_gate;
-
   /// Creates empty transaction by source
   TransactionRef create_transaction(
       Transaction::src_t src) {
@@ -110,7 +108,6 @@ public:
         return on_transaction_destruct(t);
       }
     );
-    retired_extent_gate.add_token(ret->retired_gate_token);
     DEBUGT("created source={}", *ret, src);
     return ret;
   }
@@ -131,7 +128,6 @@ public:
         return on_transaction_destruct(t);
       }
     );
-    retired_extent_gate.add_token(ret->retired_gate_token);
     DEBUGT("created source={}", *ret, src);
     return ret;
   }
@@ -691,7 +687,7 @@ private:
   /// Remove extent from extents handling dirty and refcounting
   void remove_extent(CachedExtentRef ref);
 
-  /// Retire extent, move reference to retired_extent_gate
+  /// Retire extent
   void retire_extent(CachedExtentRef ref);
 
   /// Replace prev with next
index 1168cb9eb9eaae23ed9f6854b239b2847faa8423..851446371e63a04dbbe21a3a3c536663f3b58711 100644 (file)
@@ -350,7 +350,6 @@ private:
   using list = boost::intrusive::list<
     CachedExtent,
     primary_ref_list_member_options>;
-  friend class retired_extent_gate_t;
 
   /**
    * dirty_from_or_retired_at
@@ -620,89 +619,6 @@ using lba_pin_list_t = std::list<LBAPinRef>;
 
 std::ostream &operator<<(std::ostream &out, const lba_pin_list_t &rhs);
 
-/**
- * retired_extent_gate_t
- *
- * We need to keep each retired extent in memory until all transactions
- * that could still reference it has completed.  live_tokens tracks the
- * set of tokens (which will be embedded in Transaction's) still live
- * in order of the commit after which it was created.  retired_extents
- * lists retired extents ordered by the commit at which they were
- * retired.
- */
-class retired_extent_gate_t {
-public:
-  class token_t {
-    friend class retired_extent_gate_t;
-    retired_extent_gate_t *parent = nullptr;
-    journal_seq_t created_after;
-
-    boost::intrusive::list_member_hook<> list_hook;
-    using list_hook_options = boost::intrusive::member_hook<
-      token_t,
-      boost::intrusive::list_member_hook<>,
-      &token_t::list_hook>;
-    using registry =  boost::intrusive::list<
-      token_t,
-      list_hook_options>;
-  public:
-    token_t(journal_seq_t created_after) : created_after(created_after) {}
-
-    void drop_self();
-    void add_self();
-
-    void reset(journal_seq_t _created_after) {
-      drop_self();
-      created_after = _created_after;
-      add_self();
-    }
-
-    ~token_t() {
-      if (parent) {
-       drop_self();
-       parent = nullptr;
-      }
-    }
-  };
-
-  void prune() {
-    journal_seq_t prune_to = live_tokens.empty() ?
-      JOURNAL_SEQ_MAX : live_tokens.front().created_after;
-    while (!retired_extents.empty() &&
-          prune_to > retired_extents.front().get_retired_at()) {
-      auto ext = &retired_extents.front();
-      retired_extents.pop_front();
-      intrusive_ptr_release(ext);
-    }
-  }
-
-  void add_token(token_t &t) {
-    t.parent = this;
-    t.add_self();
-  }
-
-  void add_extent(CachedExtent &extent) {
-    intrusive_ptr_add_ref(&extent);
-    retired_extents.push_back(extent);
-  }
-
-private:
-  token_t::registry live_tokens;
-  CachedExtent::list retired_extents;
-};
-
-inline void retired_extent_gate_t::token_t::add_self() {
-  assert(parent);
-  parent->live_tokens.push_back(*this);
-}
-
-inline void retired_extent_gate_t::token_t::drop_self() {
-  assert(parent);
-  parent->live_tokens.erase(
-    parent->live_tokens.s_iterator_to(*this));
-  parent->prune();
-}
-
 /**
  * RetiredExtentPlaceholder
  *
index b34a314343ddb098d872aafddc28a7d8f1de16e0..11be54a37a388e6ba142bfb7d64fd2dd6456815e 100644 (file)
@@ -14,7 +14,6 @@
 
 namespace crimson::os::seastore {
 
-struct retired_extent_gate_t;
 class SeaStore;
 class Transaction;
 
@@ -179,7 +178,6 @@ public:
     journal_seq_t initiated_after,
     on_destruct_func_t&& f
   ) : weak(weak),
-      retired_gate_token(initiated_after),
       handle(std::move(handle)),
       on_destruct(std::move(f)),
       src(src)
@@ -207,7 +205,6 @@ public:
     mutated_block_list.clear();
     retired_set.clear();
     to_release = NULL_SEG_ID;
-    retired_gate_token.reset(initiated_after);
     conflicted = false;
     if (!has_reset) {
       has_reset = true;
@@ -243,8 +240,6 @@ private:
   ///< if != NULL_SEG_ID, release this segment after completion
   segment_id_t to_release = NULL_SEG_ID;
 
-  retired_extent_gate_t::token_t retired_gate_token;
-
   bool conflicted = false;
 
   bool has_reset = false;