]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
OSD,PG: pass tphandle down to _scan_list
authorSamuel Just <sam.just@inktank.com>
Thu, 23 May 2013 22:23:05 +0000 (15:23 -0700)
committerSamuel Just <sam.just@inktank.com>
Thu, 23 May 2013 22:23:05 +0000 (15:23 -0700)
Signed-off-by: Samuel Just <sam.just@inktank.com>
src/osd/OSD.h
src/osd/PG.cc
src/osd/PG.h

index 3eda976bfbcc3a299da0ff0168d8238f99f91687..bb2ca33f79a4cf3863e33a185423e73d59e6fe09 100644 (file)
@@ -1242,8 +1242,10 @@ protected:
       osd->scrub_queue.pop_front();
       return pg;
     }
-    void _process(PG *pg) {
-      pg->scrub();
+    void _process(
+      PG *pg,
+      ThreadPool::TPHandle &handle) {
+      pg->scrub(handle);
       pg->put();
     }
     void _clear() {
@@ -1327,12 +1329,14 @@ protected:
       rep_scrub_queue.pop_front();
       return msg;
     }
-    void _process(MOSDRepScrub *msg) {
+    void _process(
+      MOSDRepScrub *msg,
+      ThreadPool::TPHandle &handle) {
       osd->osd_lock.Lock();
       if (osd->_have_pg(msg->pgid)) {
        PG *pg = osd->_lookup_lock_pg(msg->pgid);
        osd->osd_lock.Unlock();
-       pg->replica_scrub(msg);
+       pg->replica_scrub(msg, handle);
        msg->put();
        pg->unlock();
       } else {
index 44a5965658f50aef8d556750bdd08032afec8474..5dc0f1972292257d61862eaadac5a7de6b080ad5 100644 (file)
@@ -3149,7 +3149,9 @@ void PG::sub_op_scrub_map(OpRequestRef op)
 /* 
  * pg lock may or may not be held
  */
-void PG::_scan_list(ScrubMap &map, vector<hobject_t> &ls, bool deep)
+void PG::_scan_list(
+  ScrubMap &map, vector<hobject_t> &ls, bool deep,
+  ThreadPool::TPHandle &handle)
 {
   dout(10) << "_scan_list scanning " << ls.size() << " objects"
            << (deep ? " deeply" : "") << dendl;
@@ -3372,8 +3374,10 @@ void PG::scrub_unreserve_replicas()
  * build a scrub map over a chunk without releasing the lock
  * only used by chunky scrub
  */
-int PG::build_scrub_map_chunk(ScrubMap &map,
-                              hobject_t start, hobject_t end, bool deep)
+int PG::build_scrub_map_chunk(
+  ScrubMap &map,
+  hobject_t start, hobject_t end, bool deep,
+  ThreadPool::TPHandle &handle)
 {
   dout(10) << "build_scrub_map" << dendl;
   dout(20) << "scrub_map_chunk [" << start << "," << end << ")" << dendl;
@@ -3388,7 +3392,7 @@ int PG::build_scrub_map_chunk(ScrubMap &map,
     return ret;
   }
 
-  _scan_list(map, ls, deep);
+  _scan_list(map, ls, deep, handle);
 
   // pg attrs
   osd->store->collection_getattrs(coll, map.attrs);
@@ -3404,7 +3408,7 @@ int PG::build_scrub_map_chunk(ScrubMap &map,
  * build a (sorted) summary of pg content for purposes of scrubbing
  * called while holding pg lock
  */ 
-void PG::build_scrub_map(ScrubMap &map)
+void PG::build_scrub_map(ScrubMap &map, ThreadPool::TPHandle &handle)
 {
   dout(10) << "build_scrub_map" << dendl;
 
@@ -3421,7 +3425,7 @@ void PG::build_scrub_map(ScrubMap &map)
   vector<hobject_t> ls;
   osd->store->collection_list(coll, ls);
 
-  _scan_list(map, ls, false);
+  _scan_list(map, ls, false, handle);
   lock();
 
   if (epoch != info.history.same_interval_since) {
@@ -3445,7 +3449,9 @@ void PG::build_scrub_map(ScrubMap &map)
  * build a summary of pg content changed starting after v
  * called while holding pg lock
  */
-void PG::build_inc_scrub_map(ScrubMap &map, eversion_t v)
+void PG::build_inc_scrub_map(
+  ScrubMap &map, eversion_t v,
+  ThreadPool::TPHandle &handle)
 {
   map.valid_through = last_update_applied;
   map.incr_since = v;
@@ -3469,7 +3475,7 @@ void PG::build_inc_scrub_map(ScrubMap &map, eversion_t v)
     }
   }
 
-  _scan_list(map, ls, false);
+  _scan_list(map, ls, false, handle);
   // pg attrs
   osd->store->collection_getattrs(coll, map.attrs);
 
@@ -3517,7 +3523,9 @@ void PG::repair_object(const hobject_t& soid, ScrubMap::object *po, int bad_peer
  * for pushes to complete in case of recent recovery. Build a single
  * scrubmap of objects that are in the range [msg->start, msg->end).
  */
-void PG::replica_scrub(MOSDRepScrub *msg)
+void PG::replica_scrub(
+  MOSDRepScrub *msg,
+  ThreadPool::TPHandle &handle)
 {
   assert(!scrubber.active_rep_scrub);
   dout(7) << "replica_scrub" << dendl;
@@ -3551,7 +3559,9 @@ void PG::replica_scrub(MOSDRepScrub *msg)
       return;
     }
 
-    build_scrub_map_chunk(map, msg->start, msg->end, msg->deep);
+    build_scrub_map_chunk(
+      map, msg->start, msg->end, msg->deep,
+      handle);
 
   } else {
     if (msg->scrub_from > eversion_t()) {
@@ -3566,10 +3576,10 @@ void PG::replica_scrub(MOSDRepScrub *msg)
           return;
         }
       }
-      build_inc_scrub_map(map, msg->scrub_from);
+      build_inc_scrub_map(map, msg->scrub_from, handle);
       scrubber.finalizing = 0;
     } else {
-      build_scrub_map(map);
+      build_scrub_map(map, handle);
     }
 
     if (msg->map_epoch < info.history.same_interval_since) {
@@ -3597,7 +3607,7 @@ void PG::replica_scrub(MOSDRepScrub *msg)
  * scrub will be chunky if all OSDs in PG support chunky scrub
  * scrub will fall back to classic in any other case
  */
-void PG::scrub()
+void PG::scrub(ThreadPool::TPHandle &handle)
 {
   lock();
   if (deleting) {
@@ -3643,9 +3653,9 @@ void PG::scrub()
   }
 
   if (scrubber.is_chunky) {
-    chunky_scrub();
+    chunky_scrub(handle);
   } else {
-    classic_scrub();
+    classic_scrub(handle);
   }
 
   unlock();
@@ -3690,7 +3700,7 @@ void PG::scrub()
  *    Flag set when we're in the finalize stage.
  *
  */
-void PG::classic_scrub()
+void PG::classic_scrub(ThreadPool::TPHandle &handle)
 {
   if (!scrubber.active) {
     dout(10) << "scrub start" << dendl;
@@ -3721,7 +3731,7 @@ void PG::classic_scrub()
 
     // Unlocks and relocks...
     scrubber.primary_scrubmap = ScrubMap();
-    build_scrub_map(scrubber.primary_scrubmap);
+    build_scrub_map(scrubber.primary_scrubmap, handle);
 
     if (scrubber.epoch_start != info.history.same_interval_since) {
       dout(10) << "scrub  pg changed, aborting" << dendl;
@@ -3768,7 +3778,7 @@ void PG::classic_scrub()
   
   if (scrubber.primary_scrubmap.valid_through != log.head) {
     ScrubMap incr;
-    build_inc_scrub_map(incr, scrubber.primary_scrubmap.valid_through);
+    build_inc_scrub_map(incr, scrubber.primary_scrubmap.valid_through, handle);
     scrubber.primary_scrubmap.merge_incr(incr);
   }
   
@@ -3851,7 +3861,7 @@ void PG::classic_scrub()
  * scrubber.state encodes the current state of the scrub (refer to state diagram
  * for details).
  */
-void PG::chunky_scrub() {
+void PG::chunky_scrub(ThreadPool::TPHandle &handle) {
   // check for map changes
   if (scrubber.is_chunky_scrub_active()) {
     if (scrubber.epoch_start != info.history.same_interval_since) {
@@ -3983,7 +3993,8 @@ void PG::chunky_scrub() {
         // build my own scrub map
         ret = build_scrub_map_chunk(scrubber.primary_scrubmap,
                                     scrubber.start, scrubber.end,
-                                    scrubber.deep);
+                                    scrubber.deep,
+                                   handle);
         if (ret < 0) {
           dout(5) << "error building scrub map: " << ret << ", aborting" << dendl;
           scrub_clear_state();
index 8b76c2d7b47128d1c2facc2bb8322e6efe9d25c1..4317832697e1de479dfd2216082f879d6bc5b538 100644 (file)
@@ -41,6 +41,7 @@
 #include "msg/Messenger.h"
 #include "messages/MOSDRepScrub.h"
 #include "messages/MOSDPGLog.h"
+#include "common/WorkQueue.h"
 
 #include "common/DecayCounter.h"
 
@@ -972,23 +973,28 @@ public:
                          map<hobject_t, int> &authoritative,
                          map<hobject_t, set<int> > &inconsistent_snapcolls,
                          ostream &errorstream);
-  void scrub();
-  void classic_scrub();
-  void chunky_scrub();
+  void scrub(ThreadPool::TPHandle &handle);
+  void classic_scrub(ThreadPool::TPHandle &handle);
+  void chunky_scrub(ThreadPool::TPHandle &handle);
   void scrub_compare_maps();
   void scrub_process_inconsistent();
   void scrub_finalize();
   void scrub_finish();
   void scrub_clear_state();
   bool scrub_gather_replica_maps();
-  void _scan_list(ScrubMap &map, vector<hobject_t> &ls, bool deep);
+  void _scan_list(
+    ScrubMap &map, vector<hobject_t> &ls, bool deep,
+    ThreadPool::TPHandle &handle);
   void _request_scrub_map_classic(int replica, eversion_t version);
   void _request_scrub_map(int replica, eversion_t version,
                           hobject_t start, hobject_t end, bool deep);
-  int build_scrub_map_chunk(ScrubMap &map,
-                            hobject_t start, hobject_t end, bool deep);
-  void build_scrub_map(ScrubMap &map);
-  void build_inc_scrub_map(ScrubMap &map, eversion_t v);
+  int build_scrub_map_chunk(
+    ScrubMap &map,
+    hobject_t start, hobject_t end, bool deep,
+    ThreadPool::TPHandle &handle);
+  void build_scrub_map(ScrubMap &map, ThreadPool::TPHandle &handle);
+  void build_inc_scrub_map(
+    ScrubMap &map, eversion_t v, ThreadPool::TPHandle &handle);
   virtual void _scrub(ScrubMap &map) { }
   virtual void _scrub_clear_state() { }
   virtual void _scrub_finish() { }
@@ -1013,7 +1019,9 @@ public:
   void reg_next_scrub();
   void unreg_next_scrub();
 
-  void replica_scrub(class MOSDRepScrub *op);
+  void replica_scrub(
+    class MOSDRepScrub *op,
+    ThreadPool::TPHandle &handle);
   void sub_op_scrub_map(OpRequestRef op);
   void sub_op_scrub_reserve(OpRequestRef op);
   void sub_op_scrub_reserve_reply(OpRequestRef op);