]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
osd: refactor accessors of RecoveryBackend::temp_contents
authorRadosław Zarzyński <rzarzyns@redhat.com>
Thu, 7 Sep 2023 10:07:13 +0000 (12:07 +0200)
committerRadoslaw Zarzynski <rzarzyns@redhat.com>
Tue, 9 Jan 2024 15:09:53 +0000 (15:09 +0000)
1. Move some of them to .cc and
2. switch their implementations to use lower-layer methods
   instead of touching `temp_contents` directly.

Signed-off-by: Radosław Zarzyński <rzarzyns@redhat.com>
src/crimson/osd/pg_backend.h
src/crimson/osd/recovery_backend.cc
src/crimson/osd/recovery_backend.h

index 981a983075bc90ae7df64240bb769449faa8a5e3..de7223173f1b62b63b761174cbdab7755a96e75c 100644 (file)
@@ -450,4 +450,22 @@ private:
                      std::vector<pg_log_entry_t>&& log_entries) = 0;
   friend class ReplicatedRecoveryBackend;
   friend class ::crimson::osd::PG;
+
+protected:
+  boost::container::flat_set<hobject_t> temp_contents;
+
+  template <class... Args>
+  void add_temp_obj(Args&&... args) {
+    temp_contents.insert(std::forward<Args>(args)...);
+  }
+  void clear_temp_obj(const hobject_t &oid) {
+    temp_contents.erase(oid);
+  }
+  template <class T>
+  void clear_temp_objs(const T &cont) {
+    for (const auto& oid : cont) {
+      clear_temp_obj(oid);
+    }
+  }
+  friend class RecoveryBackend;
 };
index b5394bfdc485dfc63b21e28cb7fc7cbd780a56e1..c9d7246f2f55077b1b43179ace85c90a4cd0a526 100644 (file)
@@ -32,6 +32,16 @@ hobject_t RecoveryBackend::get_temp_recovery_object(
   return hoid;
 }
 
+void RecoveryBackend::add_temp_obj(const hobject_t &oid)
+{
+  backend->add_temp_obj(oid);
+}
+
+void RecoveryBackend::clear_temp_obj(const hobject_t &oid)
+{
+  backend->clear_temp_obj(oid);
+}
+
 void RecoveryBackend::clean_up(ceph::os::Transaction& t,
                               std::string_view why)
 {
index abf6958915966d51ece04ceee3e3726f3a09eded..7d219a8d9ecaaad5b697db7c679443b87b4e1937 100644 (file)
@@ -201,12 +201,9 @@ protected:
 
   boost::container::flat_set<hobject_t> temp_contents;
 
-  void add_temp_obj(const hobject_t &oid) {
-    temp_contents.insert(oid);
-  }
-  void clear_temp_obj(const hobject_t &oid) {
-    temp_contents.erase(oid);
-  }
+  void add_temp_obj(const hobject_t &oid);
+  void clear_temp_obj(const hobject_t &oid);
+
   void clean_up(ceph::os::Transaction& t, std::string_view why);
   virtual seastar::future<> on_stop() = 0;
 private: