]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
osd/pg: reset handle during add_batch_sources_info()
authorxie xingguo <xie.xingguo@zte.com.cn>
Wed, 23 Mar 2016 08:50:43 +0000 (16:50 +0800)
committerxie xingguo <xie.xingguo@zte.com.cn>
Wed, 23 Mar 2016 08:50:43 +0000 (16:50 +0800)
So if needs_recovery_map gets too big, we don't starve
serving thread during peering.

Signed-off-by: xie xingguo <xie.xingguo@zte.com.cn>
src/osd/PG.cc
src/osd/PG.h

index a0dd96ce2acdb15a6859ff263c84fafef1aae585..4e3a60349abc1640a7065eb73f08dbf585c8701a 100644 (file)
@@ -487,12 +487,17 @@ bool PG::MissingLoc::readable_with_acting(
 }
 
 void PG::MissingLoc::add_batch_sources_info(
-  const set<pg_shard_t> &sources)
+  const set<pg_shard_t> &sources, ThreadPool::TPHandle* handle)
 {
   dout(10) << __func__ << ": adding sources in batch " << sources.size() << dendl;
+  unsigned loop = 0;
   for (map<hobject_t, pg_missing_t::item, hobject_t::ComparatorWithDefault>::const_iterator i = needs_recovery_map.begin();
       i != needs_recovery_map.end();
       ++i) {
+    if (handle && ++loop >= g_conf->osd_loop_before_reset_tphandle) {
+      handle->reset_tp_timeout();
+      loop = 0;
+    }
     missing_loc[i->first].insert(sources.begin(), sources.end());
     missing_loc_sources.insert(sources.begin(), sources.end());
   }
@@ -1801,7 +1806,7 @@ void PG::activate(ObjectStore::Transaction& t,
       // and covers vast majority of the use cases, like one OSD/host is down for
       // a while for hardware repairing
       if (complete_shards.size() + 1 == actingbackfill.size()) {
-        missing_loc.add_batch_sources_info(complete_shards);
+        missing_loc.add_batch_sources_info(complete_shards, ctx->handle);
       } else {
         missing_loc.add_source_info(pg_whoami, info, pg_log.get_missing(),
                                    get_sort_bitwise(), ctx->handle);
index 941010e225bea97e961722b48115105ce9a6faff..b3c68e9510c9097fa4009e4445c79b8e672f5d3e 100644 (file)
@@ -409,7 +409,8 @@ public:
 
     /// Adds recovery sources in batch
     void add_batch_sources_info(
-      const set<pg_shard_t> &sources  ///< [in] a set of resources which can be used for all objects
+      const set<pg_shard_t> &sources,  ///< [in] a set of resources which can be used for all objects
+      ThreadPool::TPHandle* handle  ///< [in] ThreadPool handle
       );
 
     /// Uses osdmap to update structures for now down sources