]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
crimson/os/seastore: introduce P_ADDR_ROOT 47471/head
authorYingxin Cheng <yingxin.cheng@intel.com>
Fri, 5 Aug 2022 02:20:06 +0000 (10:20 +0800)
committerYingxin Cheng <yingxin.cheng@intel.com>
Fri, 5 Aug 2022 04:04:03 +0000 (12:04 +0800)
Signed-off-by: Yingxin Cheng <yingxin.cheng@intel.com>
src/crimson/os/seastore/cache.cc
src/crimson/os/seastore/seastore_types.cc
src/crimson/os/seastore/seastore_types.h

index d4670e8431f9c437c447d71e8fa11237dae6ab80..5ae8a5205e1082c1e2b16f4c153cbc3ed24ee49e 100644 (file)
@@ -1580,7 +1580,7 @@ void Cache::init()
   }
   root = new RootBlock();
   root->init(CachedExtent::extent_state_t::CLEAN,
-             P_ADDR_NULL,
+             P_ADDR_ROOT,
              PLACEMENT_HINT_NULL,
              NULL_GENERATION);
   INFO("init root -- {}", *root);
index 3134fe3a040b2cea1b90c6c1296b359db48e6296..b97630cd9b96b06efebe3f5ea6b23855cc03792b 100644 (file)
@@ -48,6 +48,8 @@ std::ostream &operator<<(std::ostream &out, const device_id_printer_t &id)
     return out << "Dev(FAKE)";
   } else if (_id == DEVICE_ID_ZERO) {
     return out << "Dev(ZERO)";
+  } else if (_id == DEVICE_ID_ROOT) {
+    return out << "Dev(ROOT)";
   } else {
     return out << "Dev(" << (unsigned)_id << ")";
   }
index e305ac533bb358a824c4636e81b0f9d8dd044771..07b13269c6870fa1ca0596648e46f7b1454c0cf3 100644 (file)
@@ -64,7 +64,8 @@ constexpr device_id_t DEVICE_ID_DELAYED = DEVICE_ID_MAX - 3;
 // for tests which generate fake paddrs
 constexpr device_id_t DEVICE_ID_FAKE = DEVICE_ID_MAX - 4;
 constexpr device_id_t DEVICE_ID_ZERO = DEVICE_ID_MAX - 5;
-constexpr device_id_t DEVICE_ID_MAX_VALID = DEVICE_ID_MAX - 6;
+constexpr device_id_t DEVICE_ID_ROOT = DEVICE_ID_MAX - 6;
+constexpr device_id_t DEVICE_ID_MAX_VALID = DEVICE_ID_MAX - 7;
 constexpr device_id_t DEVICE_ID_MAX_VALID_SEGMENT = DEVICE_ID_MAX >> 1;
 
 struct device_id_printer_t {
@@ -94,7 +95,8 @@ constexpr bool has_seastore_off(device_id_t id) {
   return id == DEVICE_ID_RECORD_RELATIVE ||
          id == DEVICE_ID_BLOCK_RELATIVE ||
          id == DEVICE_ID_DELAYED ||
-         id == DEVICE_ID_FAKE;
+         id == DEVICE_ID_FAKE ||
+         id == DEVICE_ID_ROOT;
 }
 
 // internal segment id type of segment_id_t below, with the top
@@ -578,6 +580,10 @@ public:
   bool is_zero() const {
     return get_device_id() == DEVICE_ID_ZERO;
   }
+  /// Denotes the root addr
+  bool is_root() const {
+    return get_device_id() == DEVICE_ID_ROOT;
+  }
 
   /**
    * is_real
@@ -587,7 +593,7 @@ public:
    * which unit tests use them.
    */
   bool is_real() const {
-    return !is_zero() && !is_null();
+    return !is_zero() && !is_null() && !is_root();
   }
 
   bool is_absolute() const {
@@ -731,6 +737,7 @@ constexpr paddr_t P_ADDR_MIN = paddr_t::create_const(0, 0, 0);
 constexpr paddr_t P_ADDR_MAX = paddr_t::create_const(DEVICE_ID_MAX, 0, 0);
 constexpr paddr_t P_ADDR_NULL = P_ADDR_MAX;
 constexpr paddr_t P_ADDR_ZERO = paddr_t::create_const(DEVICE_ID_ZERO, 0, 0);
+constexpr paddr_t P_ADDR_ROOT = paddr_t::create_const(DEVICE_ID_ROOT, 0, 0);
 
 inline paddr_t make_record_relative_paddr(seastore_off_t off) {
   return paddr_t::make_res_paddr(DEVICE_ID_RECORD_RELATIVE, off);