]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
crimson/os/seastore/CachedExtent: add/rename the help methods of intrusive hook
authorZhang Song <zhangsong02@qianxin.com>
Tue, 1 Jul 2025 08:53:18 +0000 (16:53 +0800)
committerZhang Song <zhangsong02@qianxin.com>
Fri, 18 Jul 2025 03:54:20 +0000 (11:54 +0800)
Signed-off-by: Zhang Song <zhangsong02@qianxin.com>
src/crimson/os/seastore/cache.cc
src/crimson/os/seastore/cached_extent.cc
src/crimson/os/seastore/cached_extent.h
src/crimson/os/seastore/extent_pinboard.cc

index 1e1abdc41fb3a3658093e7aaa08f7a2ecf938293..4bc45f6c5e479b6567d5dfcf8e3497026b0147d7 100644 (file)
@@ -727,7 +727,7 @@ void Cache::mark_dirty(CachedExtentRef ref)
 {
   assert(ref->get_paddr().is_absolute());
   if (ref->is_stable_dirty()) {
-    assert(ref->primary_ref_list_hook.is_linked());
+    assert(ref->is_linked_to_list());
     return;
   }
 
@@ -741,7 +741,7 @@ void Cache::add_to_dirty(
     const Transaction::src_t* p_src)
 {
   assert(ref->is_stable_dirty());
-  assert(!ref->primary_ref_list_hook.is_linked());
+  assert(!ref->is_linked_to_list());
   ceph_assert(ref->get_modify_time() != NULL_TIME);
   assert(ref->is_fully_loaded());
   assert(ref->get_paddr().is_absolute() ||
@@ -771,7 +771,7 @@ void Cache::remove_from_dirty(
     const Transaction::src_t* p_src)
 {
   assert(ref->is_stable_dirty());
-  ceph_assert(ref->primary_ref_list_hook.is_linked());
+  ceph_assert(ref->is_linked_to_list());
   assert(ref->is_fully_loaded());
   assert(ref->get_paddr().is_absolute() ||
          ref->get_paddr().is_root());
@@ -803,11 +803,11 @@ void Cache::replace_dirty(
     const Transaction::src_t& src)
 {
   assert(prev->is_stable_dirty());
-  ceph_assert(prev->primary_ref_list_hook.is_linked());
+  ceph_assert(prev->is_linked_to_list());
   assert(prev->is_fully_loaded());
 
   assert(next->is_stable_dirty());
-  assert(!next->primary_ref_list_hook.is_linked());
+  assert(!next->is_linked_to_list());
   ceph_assert(next->get_modify_time() != NULL_TIME);
   assert(next->is_fully_loaded());
 
@@ -833,7 +833,7 @@ void Cache::clear_dirty()
   for (auto i = dirty.begin(); i != dirty.end(); ) {
     auto ptr = &*i;
     assert(ptr->is_stable_dirty());
-    ceph_assert(ptr->primary_ref_list_hook.is_linked());
+    ceph_assert(ptr->is_linked_to_list());
     assert(ptr->is_fully_loaded());
 
     auto extent_length = ptr->get_length();
@@ -889,7 +889,7 @@ void Cache::commit_replace_extent(
   const auto t_src = t.get_src();
   if (is_root_type(prev->get_type())) {
     assert(prev->is_stable_dirty());
-    assert(prev->primary_ref_list_hook.is_linked());
+    assert(prev->is_linked_to_list());
     // add the new dirty root to front
     remove_from_dirty(prev, nullptr/* exclude root */);
     add_to_dirty(next, nullptr/* exclude root */);
index 3e3b900acb36ac5b9ffaeed49b4a7be5d5bf4ccd..c6144b72f204fe908ff9c7b0716c72b4f72b4698 100644 (file)
@@ -70,7 +70,7 @@ std::ostream &operator<<(std::ostream &out, const CachedExtent &ext)
 CachedExtent::~CachedExtent()
 {
   if (parent_index) {
-    assert(is_linked());
+    assert(is_linked_to_index());
     parent_index->erase(*this);
   }
 }
index 18edd0c98c9cc281c1dd2c0003e4f616e6907210..073291f8526b39b8352de8d04b11011a2480b52a 100644 (file)
@@ -840,10 +840,14 @@ private:
   friend class ExtentIndex;
   friend class Transaction;
 
-  bool is_linked() {
+  bool is_linked_to_index() {
     return extent_index_hook.is_linked();
   }
 
+  bool is_linked_to_list() {
+    return primary_ref_list_hook.is_linked();
+  }
+
   /// hook for intrusive ref list (mainly dirty or lru list)
   boost::intrusive::list_member_hook<> primary_ref_list_hook;
   using primary_ref_list_member_options = boost::intrusive::member_hook<
@@ -1272,7 +1276,7 @@ public:
 
   void erase(CachedExtent &extent) {
     assert(extent.parent_index);
-    assert(extent.is_linked());
+    assert(extent.is_linked_to_index());
     [[maybe_unused]] auto erased = extent_index.erase(
       extent_index.s_iterator_to(extent));
     extent.parent_index = nullptr;
index 776d1502df3713d33eff77af5c43aa06824b140d..f77e30ea58c38f62318a8a4c5657f424a9776042 100644 (file)
@@ -40,7 +40,7 @@ class ExtentQueue {
     const Transaction::src_t* p_src) {
     assert(extent.is_stable_clean());
     assert(!extent.is_placeholder());
-    assert(extent.primary_ref_list_hook.is_linked());
+    assert(extent.is_linked_to_list());
     assert(list.size() > 0);
     auto extent_loaded_length = extent.get_loaded_length();
     assert(current_size >= extent_loaded_length);
@@ -90,7 +90,7 @@ public:
     assert(extent.is_stable_clean());
     assert(!extent.is_placeholder());
 
-    if (extent.primary_ref_list_hook.is_linked()) {
+    if (extent.is_linked_to_list()) {
       do_remove_from_list(extent, nullptr);
     }
   }
@@ -102,7 +102,7 @@ public:
     assert(!extent.is_placeholder());
 
     auto extent_loaded_length = extent.get_loaded_length();
-    if (extent.primary_ref_list_hook.is_linked()) {
+    if (extent.is_linked_to_list()) {
       // present, move to top (back)
       assert(list.size() > 0);
       assert(current_size >= extent_loaded_length);
@@ -135,7 +135,7 @@ public:
     const Transaction::src_t* p_src) {
     assert(extent.is_data_stable());
 
-    if (extent.primary_ref_list_hook.is_linked()) {
+    if (extent.is_linked_to_list()) {
       assert(extent.is_stable_clean());
       assert(!extent.is_placeholder());
       // present, increase size