]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
crimson/os/seastore: determine whether lba_backref_node can be allocated to OOL
authormyoungwon oh <ohmyoungwon@gmail.com>
Tue, 13 Dec 2022 00:56:58 +0000 (09:56 +0900)
committermyoungwon oh <ohmyoungwon@gmail.com>
Thu, 16 Feb 2023 13:39:37 +0000 (22:39 +0900)
Signed-off-by: Myoungwon Oh <myoungwon.oh@samsung.com>
Signed-off-by: Yingxin Cheng <yingxin.cheng@intel.com>
src/crimson/os/seastore/extent_placement_manager.cc
src/crimson/os/seastore/extent_placement_manager.h
src/crimson/os/seastore/seastore_types.h
src/crimson/os/seastore/transaction.h

index 4ff9b8d9e14856dc5aa9d0c1c67152a71553d5cc..518a64be59e265ae8b202be05ad968f88d8f5afb 100644 (file)
@@ -226,12 +226,6 @@ void ExtentPlacementManager::set_primary_device(Device *device)
 {
   ceph_assert(primary_device == nullptr);
   primary_device = device;
-  if (device->get_backend_type() == backend_type_t::SEGMENTED) {
-    prefer_ool = false;
-  } else {
-    ceph_assert(device->get_backend_type() == backend_type_t::RANDOM_BLOCK);
-    prefer_ool = true;
-  }
   ceph_assert(devices_by_id[device->get_device_id()] == device);
 }
 
index 45e1f9b1e199bf84b9d47360c8705116b15ae5ee..e4e59de06151c06d4ce76221c65ac2addf5cbcc2 100644 (file)
@@ -220,9 +220,13 @@ public:
              gen};
     };
 
-    if (!is_logical_type(type)) {
-      // TODO: implement out-of-line strategy for physical extent.
-      assert(get_extent_category(type) == data_category_t::METADATA);
+    if (type == extent_types_t::ROOT) {
+      return alloc_paddr(INLINE_GENERATION, data_category_t::METADATA, length);
+    }
+
+    if (get_backend_type() == backend_type_t::SEGMENTED &&
+       is_lba_backref_node(type)) {
+      // with SEGMENTED, lba-backref extents must be INLINE
       return alloc_paddr(INLINE_GENERATION, data_category_t::METADATA, length);
     }
 
@@ -233,12 +237,16 @@ public:
 
     if (get_extent_category(type) == data_category_t::METADATA &&
         gen == INIT_GENERATION) {
-      if (prefer_ool) {
-       return alloc_paddr(OOL_GENERATION, get_extent_category(type), length);
-      } else {
-        // default not to ool metadata extents to reduce padding overhead.
-        // TODO: improve padding so we can default to the prefer_ool path.
+      if (get_backend_type() == backend_type_t::SEGMENTED) {
+       // with SEGMENTED, default not to ool metadata extents to reduce 
+       // padding overhead.
+       // TODO: improve padding so we can default to the ool path.
        return alloc_paddr(INLINE_GENERATION, get_extent_category(type), length);
+      } else {
+        // with RBM, all extents must be OOL
+       assert(get_backend_type() ==
+              backend_type_t::RANDOM_BLOCK);
+       return alloc_paddr(OOL_GENERATION, get_extent_category(type), length);
       }
     } else {
       assert(get_extent_category(type) == data_category_t::DATA ||
@@ -336,6 +344,15 @@ public:
     background_process.release_projected_usage(usage);
   }
 
+  backend_type_t get_backend_type() const {
+    if (!background_process.is_no_background()) {
+      return background_process.get_backend_type();
+    } 
+    // for test
+    assert(primary_device);
+    return primary_device->get_backend_type();
+  }
+
   // Testing interfaces
 
   void test_init_no_background(Device *test_device) {
@@ -470,6 +487,9 @@ private:
     }
 
     seastar::future<> stop_background();
+    backend_type_t get_backend_type() const {
+      return get_journal_type();
+    }
 
     // Testing interfaces
 
@@ -478,6 +498,10 @@ private:
     }
 
     seastar::future<> run_until_halt();
+    
+    bool is_no_background() const {
+      return !trimmer || !cleaner;
+    }
 
   protected:
     state_t get_state() const final {
@@ -573,7 +597,6 @@ private:
     state_t state = state_t::STOP;
   };
 
-  bool prefer_ool;
   std::vector<ExtentOolWriterRef> writer_refs;
   std::vector<ExtentOolWriter*> data_writers_by_gen;
   // gen 0 METADATA writer is the journal writer
index f4c83047ec763dbcc4f419204875a38dbc0944c3..8d1bace0eeadd93c1e283c166bb56c9de74e7c14 100644 (file)
@@ -1113,6 +1113,11 @@ constexpr bool is_backref_node(extent_types_t type)
     type == extent_types_t::BACKREF_LEAF;
 }
 
+constexpr bool is_lba_backref_node(extent_types_t type)
+{
+  return is_lba_node(type) || is_backref_node(type);
+}
+
 std::ostream &operator<<(std::ostream &out, extent_types_t t);
 
 /**
index 11f1f6749d349edd68855c7d6bb75fdc1e0823d5..8899e105cefc529c61ad20fceab712a0d26ff809 100644 (file)
@@ -158,7 +158,6 @@ public:
       delayed_alloc_list.emplace_back(ref->cast<LogicalCachedExtent>());
       fresh_block_stats.increment(ref->get_length());
     } else if (ref->get_paddr().is_absolute()) {
-      assert(ref->is_logical());
       pre_alloc_list.emplace_back(ref->cast<LogicalCachedExtent>());
       fresh_block_stats.increment(ref->get_length());
     } else {