]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
crimson/osd: hide add_blocker() and clear_blocker() in Operation 33528/head
authorYingxin Cheng <yingxin.cheng@intel.com>
Tue, 25 Feb 2020 08:17:50 +0000 (16:17 +0800)
committerYingxin Cheng <yingxin.cheng@intel.com>
Tue, 25 Feb 2020 08:17:50 +0000 (16:17 +0800)
Cleanup. Hide add_blocker() and clear_blocker() as private members
because no one is using them anymore. They are not exception-safe. Also
take the chance to reorder Operation class members.

Signed-off-by: Yingxin Cheng <yingxin.cheng@intel.com>
src/crimson/osd/osd_operation.h

index 7e8a9c2fb54b184dcf640698d01553bca73d6f99..fe06023a4416b0155f16a437daa820ecf71cefec 100644 (file)
@@ -115,18 +115,7 @@ public:
  */
 class Operation : public boost::intrusive_ref_counter<
   Operation, boost::thread_unsafe_counter> {
-  friend class OperationRegistry;
-  registry_hook_t registry_hook;
-
-  std::vector<Blocker*> blockers;
-  uint64_t id = 0;
-  void set_id(uint64_t in_id) {
-    id = in_id;
-  }
-protected:
-  virtual void dump_detail(ceph::Formatter *f) const = 0;
-
-public:
+ public:
   uint64_t get_id() const {
     return id;
   }
@@ -135,17 +124,6 @@ public:
   virtual const char *get_type_name() const = 0;
   virtual void print(std::ostream &) const = 0;
 
-  void add_blocker(Blocker *b) {
-    blockers.push_back(b);
-  }
-
-  void clear_blocker(Blocker *b) {
-    auto iter = std::find(blockers.begin(), blockers.end(), b);
-    if (iter != blockers.end()) {
-      blockers.erase(iter);
-    }
-  }
-
   template <typename... T>
   seastar::future<T...> with_blocking_future(blocking_future<T...> &&f) {
     if (f.fut.available()) {
@@ -162,6 +140,31 @@ public:
   void dump(ceph::Formatter *f);
   void dump_brief(ceph::Formatter *f);
   virtual ~Operation() = default;
+
+ protected:
+  virtual void dump_detail(ceph::Formatter *f) const = 0;
+
+ private:
+  registry_hook_t registry_hook;
+
+  std::vector<Blocker*> blockers;
+  uint64_t id = 0;
+  void set_id(uint64_t in_id) {
+    id = in_id;
+  }
+
+  void add_blocker(Blocker *b) {
+    blockers.push_back(b);
+  }
+
+  void clear_blocker(Blocker *b) {
+    auto iter = std::find(blockers.begin(), blockers.end(), b);
+    if (iter != blockers.end()) {
+      blockers.erase(iter);
+    }
+  }
+
+  friend class OperationRegistry;
 };
 using OperationRef = boost::intrusive_ptr<Operation>;