From 441876f4d2211dee54a5f5af21149163f1166eaf Mon Sep 17 00:00:00 2001 From: xie xingguo Date: Mon, 23 Apr 2018 08:50:21 +0800 Subject: [PATCH] osd/PG: perfer EC async_recovery_targets in reverse order of cost 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 --- src/osd/PG.cc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/osd/PG.cc b/src/osd/PG.cc index 3d6abdff24e..32d83388e42 100644 --- a/src/osd/PG.cc +++ b/src/osd/PG.cc @@ -1528,8 +1528,9 @@ void PG::choose_async_recovery_ec(const map &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 candidate_want(*want); candidate_want[cur_shard.shard.id] = CRUSH_ITEM_NONE; if (recoverable_and_ge_min_size(candidate_want)) { -- 2.39.5