]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
osd/PG: perfer EC async_recovery_targets in reverse order of cost 21588/head
authorxie xingguo <xie.xingguo@zte.com.cn>
Mon, 23 Apr 2018 00:50:21 +0000 (08:50 +0800)
committerxie xingguo <xie.xingguo@zte.com.cn>
Mon, 23 Apr 2018 01:08:09 +0000 (09:08 +0800)
This is a follow-up fix of https://github.com/ceph/ceph/pull/21578,
in which I forget that erasure-coded-pools share the same logic
when determining the async_recovery_targets..

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

index 3d6abdff24ed500b9a175dbc6017f3537ca43454..32d83388e426eb79ea0ede99a86557e23dfe3ad5 100644 (file)
@@ -1528,8 +1528,9 @@ void PG::choose_async_recovery_ec(const map<pg_shard_t, pg_info_t> &all_info,
            << dendl;
 
   // take out as many osds as we can for async recovery, in order of cost
-  for (auto weighted_shard : candidates_by_cost) {
-    pg_shard_t cur_shard = weighted_shard.second;
+  for (auto rit = candidates_by_cost.rbegin();
+       rit != candidates_by_cost.rend(); ++rit) {
+    pg_shard_t cur_shard = rit->second;
     vector<int> candidate_want(*want);
     candidate_want[cur_shard.shard.id] = CRUSH_ITEM_NONE;
     if (recoverable_and_ge_min_size(candidate_want)) {