]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
crimson/os/seastore: introduce PLACEMENT_HINT_NULL
authorYingxin Cheng <yingxin.cheng@intel.com>
Mon, 18 Jul 2022 03:23:20 +0000 (11:23 +0800)
committerYingxin Cheng <yingxin.cheng@intel.com>
Mon, 18 Jul 2022 03:23:20 +0000 (11:23 +0800)
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/seastore_types.cc
src/crimson/os/seastore/seastore_types.h

index 54922cd02c7a4db4e4af9afbf0ac1c1358640c3c..d1c25a16098bad661aa1bf4998d0a0dddf6b53de 100644 (file)
@@ -96,7 +96,7 @@ Cache::retire_extent_ret Cache::retire_extent_addr(
       RetiredExtentPlaceholder>(length);
     ext->init(CachedExtent::extent_state_t::CLEAN,
               addr,
-              placement_hint_t::NUM_HINTS,
+              PLACEMENT_HINT_NULL,
               NULL_GENERATION);
     DEBUGT("retire {}~{} as placeholder, add extent -- {}",
            t, addr, length, *ext);
index 54a96c12b59aa675d4c232abec3954166c38d834..9d4e3528d108f1517d173bcb73aed665257ab9f5 100644 (file)
@@ -310,7 +310,7 @@ public:
         alloc_cache_buf(length));
       ret->init(CachedExtent::extent_state_t::CLEAN_PENDING,
                 offset,
-                placement_hint_t::NUM_HINTS,
+                PLACEMENT_HINT_NULL,
                 NULL_GENERATION);
       SUBDEBUG(seastore_cache,
           "{} {}~{} is absent, add extent and reading ... -- {}",
@@ -329,7 +329,7 @@ public:
         alloc_cache_buf(length));
       ret->init(CachedExtent::extent_state_t::CLEAN_PENDING,
                 offset,
-                placement_hint_t::NUM_HINTS,
+                PLACEMENT_HINT_NULL,
                 NULL_GENERATION);
       SUBDEBUG(seastore_cache,
           "{} {}~{} is absent(placeholder), reading ... -- {}",
index 83f223f5d42e0a3ff47148e16e08f445c14c53fc..5054aea8f65aabd9cfd76c50b0ece5905a352943 100644 (file)
@@ -399,7 +399,7 @@ public:
   }
 
   void invalidate_hints() {
-    user_hint = placement_hint_t::NUM_HINTS;
+    user_hint = PLACEMENT_HINT_NULL;
     reclaim_generation = NULL_GENERATION;
   }
 
index 7ad95e115160b5524849662a184dd1c265b5e659..a9b0d1c5fd486652097d3c76fcb6a512bbdd4b2a 100644 (file)
@@ -646,11 +646,13 @@ std::ostream& operator<<(std::ostream& out, placement_hint_t h)
 {
   switch (h) {
   case placement_hint_t::HOT:
-    return out << "HOT";
+    return out << "Hint(HOT)";
   case placement_hint_t::COLD:
-    return out << "COLD";
+    return out << "Hint(COLD)";
   case placement_hint_t::REWRITE:
-    return out << "REWRITE";
+    return out << "Hint(REWRITE)";
+  case PLACEMENT_HINT_NULL:
+    return out << "Hint(NULL)";
   default:
     return out << "INVALID_PLACEMENT_HINT_TYPE!";
   }
index a49f2f989d513c5dd4f8b917ab96d514dc353fc8..a14ccaeb277765ff9f30235f94f2755b595b0b34 100644 (file)
@@ -764,9 +764,11 @@ enum class placement_hint_t {
   HOT = 0,   // The default user hint that expects mutations or retirement
   COLD,      // Expect no mutations and no retirement in the near future
   REWRITE,   // Hint for the internal rewrites
-  NUM_HINTS  // Constant for number of hints
+  NUM_HINTS  // Constant for number of hints or as NULL
 };
 
+constexpr auto PLACEMENT_HINT_NULL = placement_hint_t::NUM_HINTS;
+
 std::ostream& operator<<(std::ostream& out, placement_hint_t h);
 
 enum alignas(4) device_type_t : uint_fast8_t {