]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
osd/PG: make get_watchers public, hide locking
authorSage Weil <sage@redhat.com>
Sat, 16 Sep 2017 02:53:20 +0000 (22:53 -0400)
committerSage Weil <sage@redhat.com>
Fri, 6 Oct 2017 18:08:17 +0000 (13:08 -0500)
Signed-off-by: Sage Weil <sage@redhat.com>
src/osd/OSD.cc
src/osd/PG.h
src/osd/PrimaryLogPG.cc
src/osd/PrimaryLogPG.h

index d9e6c2d4949c5d0d33960e30e91f434c885d5ad4..de97baf1a43fe01a438ca89e6aba771c85255b37 100644 (file)
@@ -2130,9 +2130,7 @@ will start to track new ops received afterwards.";
 
         list<obj_watch_item_t> pg_watchers;
         PG *pg = it->second;
-        pg->lock();
-        pg->get_watchers(pg_watchers);
-        pg->unlock();
+        pg->get_watchers(&pg_watchers);
         watchers.splice(watchers.end(), pg_watchers);
       }
     }
index 106ce6606a82521523afe1727e7b859c6fa26ef6..391061cccc89d1e6b97a6f84a2de519c38c9698c 100644 (file)
@@ -380,6 +380,8 @@ public:
   void handle_loaded(RecoveryCtx *rctx);
   void handle_query_state(Formatter *f);
 
+  virtual void get_watchers(std::list<obj_watch_item_t> *ls) = 0;
+
   virtual void do_request(
     OpRequestRef& op,
     ThreadPool::TPHandle &handle
@@ -2677,7 +2679,6 @@ protected:
   virtual void on_flushed() = 0;
   virtual void on_shutdown() = 0;
   virtual void check_blacklisted_watchers() = 0;
-  virtual void get_watchers(std::list<obj_watch_item_t>&) = 0;
 
   friend ostream& operator<<(ostream& out, const PG& pg);
 };
index 0fbdf7da080b37071a8ad7f6443ed4e8bad79dc9..c2ed9c4ce6b3827547678cb18af6c972b2a8610f 100644 (file)
@@ -9452,13 +9452,15 @@ void PrimaryLogPG::cancel_log_updates()
 
 // -------------------------------------------------------
 
-void PrimaryLogPG::get_watchers(list<obj_watch_item_t> &pg_watchers)
+void PrimaryLogPG::get_watchers(list<obj_watch_item_t> *ls)
 {
+  lock();
   pair<hobject_t, ObjectContextRef> i;
   while (object_contexts.get_next(i.first, &i)) {
     ObjectContextRef obc(i.second);
-    get_obc_watchers(obc, pg_watchers);
+    get_obc_watchers(obc, *ls);
   }
+  unlock();
 }
 
 void PrimaryLogPG::get_obc_watchers(ObjectContextRef obc, list<obj_watch_item_t> &pg_watchers)
index fbf459f78584b1919599fb41d815f8845f986dc9..5c95c34ff33403fff8b61a7649e5bac1dc0b66eb 100644 (file)
@@ -956,7 +956,7 @@ protected:
   void populate_obc_watchers(ObjectContextRef obc);
   void check_blacklisted_obc_watchers(ObjectContextRef obc);
   void check_blacklisted_watchers() override;
-  void get_watchers(list<obj_watch_item_t> &pg_watchers) override;
+  void get_watchers(list<obj_watch_item_t> *ls) override;
   void get_obc_watchers(ObjectContextRef obc, list<obj_watch_item_t> &pg_watchers);
 public:
   void handle_watch_timeout(WatchRef watch);