]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
crimson/os/seastore: cleanup, be explicit about stable and stable_written 54351/head
authorYingxin Cheng <yingxin.cheng@intel.com>
Fri, 3 Nov 2023 09:00:07 +0000 (17:00 +0800)
committerYingxin Cheng <yingxin.cheng@intel.com>
Mon, 6 Nov 2023 02:49:57 +0000 (10:49 +0800)
Signed-off-by: Yingxin Cheng <yingxin.cheng@intel.com>
src/crimson/os/seastore/btree/fixed_kv_btree.h
src/crimson/os/seastore/btree/fixed_kv_node.h
src/crimson/os/seastore/cached_extent.h
src/test/crimson/seastore/test_transaction_manager.cc

index 4133be627c10b334ec73aa37bf3f7ed111a5f43a..a2a97e30a50365cb9ac17146cd6d78e38046cd9e 100644 (file)
@@ -513,7 +513,7 @@ public:
           &child_node);
       }
       if (ret == Transaction::get_extent_ret::PRESENT) {
-        if (child_node->is_stable()) {
+        if (child_node->is_stable_written()) {
           assert(child_node->is_valid());
           auto cnode = child_node->template cast<child_node_t>();
           assert(cnode->has_parent_tracker());
index 0ae23b2f4dea9025b657f223a3768a1b4d106d6d..4d32475ee24de133afaf2e971a902ed7676562c4 100644 (file)
@@ -992,16 +992,13 @@ struct FixedKVLeafNode
   }
 
   // children are considered stable if any of the following case is true:
-  // 1. Not in memory
-  // 2. being stable
-  // 3. being mutation pending and under-io
+  // 1. The child extent is absent in cache
+  // 2. The child extent is stable
   bool is_child_stable(uint16_t pos) const final {
     auto child = this->children[pos];
     if (is_valid_child_ptr(child)) {
       ceph_assert(child->is_logical());
-      return child->is_stable() ||
-       (child->is_mutation_pending() &&
-        child->is_pending_io());
+      return child->is_stable();
     } else if (this->is_pending()) {
       auto key = this->iter_idx(pos).get_key();
       auto &sparent = this->get_stable_for_key(key);
@@ -1009,9 +1006,7 @@ struct FixedKVLeafNode
       auto child = sparent.children[spos];
       if (is_valid_child_ptr(child)) {
        ceph_assert(child->is_logical());
-       return child->is_stable() ||
-         (child->is_mutation_pending() &&
-          child->is_pending_io());
+       return child->is_stable();
       } else {
        return true;
       }
index c73839cf1fe8798a8d5e885d8d3778721bed9e45..6ab19282637f26b906fe753726dd4d6e31fe9af0 100644 (file)
@@ -416,13 +416,20 @@ public:
     return is_mutable() || state == extent_state_t::EXIST_CLEAN;
   }
 
-  /// Returns true if extent is stable and shared among transactions
-  bool is_stable() const {
+  /// Returns true if extent is stable, written and shared among transactions
+  bool is_stable_written() const {
     return state == extent_state_t::CLEAN_PENDING ||
       state == extent_state_t::CLEAN ||
       state == extent_state_t::DIRTY;
   }
 
+  /// Returns true if extent is stable and shared among transactions
+  bool is_stable() const {
+    return is_stable_written() ||
+           (is_mutation_pending() &&
+            is_pending_io());
+  }
+
   /// Returns true if extent has a pending delta
   bool is_mutation_pending() const {
     return state == extent_state_t::MUTATION_PENDING;
index 54bd27b8c18112b2258feb832f57b6e372e5c749..dfe599177056e13191705d96c1b881ee9bab3e4d 100644 (file)
@@ -1077,7 +1077,7 @@ struct transaction_manager_test_t :
        test_mappings.alloced(pin->get_key(), *extent, t.mapping_delta);
        EXPECT_TRUE(extent->is_exist_clean());
       } else {
-       EXPECT_TRUE(extent->is_stable());
+       EXPECT_TRUE(extent->is_stable_written());
       }
     } else {
       ceph_assert(t.t->is_conflicted());