]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
os/bluestore: New unit test for BlueFS
authorAdam Kupczyk <akupczyk@ibm.com>
Wed, 16 Apr 2025 06:36:15 +0000 (06:36 +0000)
committerAdam Kupczyk <akupczyk@ibm.com>
Wed, 16 Apr 2025 06:36:15 +0000 (06:36 +0000)
This cherry-pick only 'tracepoint' feature.

Signed-off-by: Adam Kupczyk <akupczyk@ibm.com>
(parial cherry picked from commit a090f14fc7341a76bbbb35b3dab1b65c2e1c9041)

src/os/bluestore/BlueFS.h

index b7353348daec021a0762e22ec799d7e1e7751ccd..af66d9fdcbe9d91c3acf0a9c624c429daabc8e7e 100644 (file)
@@ -216,6 +216,35 @@ struct bluefs_shared_alloc_context_t {
   }
 };
 
+/*
+  Class debug_point is a helper intended for inserting debug tracepoints
+  in a least intrusive way.
+  The intention is to minimize both visual and code footprints.
+
+  In code, it should look like:
+  debug_async_compact(1);
+
+  Which should translate to:
+  if (debug_async_compact) debug_async_compact(1);
+
+  And in release builds be eliminated completely.
+*/
+template <class T>
+class debug_point_t {
+public:
+  debug_point_t() : m_func(nullptr) {};
+  debug_point_t(T&& func)
+  : m_func(func) {}
+  template<typename... Arg>
+  void operator()(Arg... arg) { if (m_func) m_func(std::forward<Arg...>(arg...)); }
+  void operator=(T&& func) { m_func = std::move(func);}
+  void operator=(T& func) { m_func = func;}
+private:
+  T m_func;
+};
+
+
+
 class BlueFS {
 public:
   CephContext* cct;