From b20cd766b79c734167a8f166d718bd0b8dc3088a Mon Sep 17 00:00:00 2001 From: xie xingguo Date: Mon, 14 Mar 2016 14:24:09 +0800 Subject: [PATCH] osd: make needs_backfill() fast Signed-off-by: xie xingguo --- src/osd/PG.cc | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/osd/PG.cc b/src/osd/PG.cc index 8d5cbc3db3e..ca1a2d35c7d 100644 --- a/src/osd/PG.cc +++ b/src/osd/PG.cc @@ -658,8 +658,6 @@ bool PG::needs_backfill() const { assert(is_primary()); - bool ret = false; - // We can assume that only possible osds that need backfill // are on the backfill_targets vector nodes. set::const_iterator end = backfill_targets.end(); @@ -669,13 +667,12 @@ bool PG::needs_backfill() const map::const_iterator pi = peer_info.find(peer); if (!pi->second.last_backfill.is_max()) { dout(10) << __func__ << " osd." << peer << " has last_backfill " << pi->second.last_backfill << dendl; - ret = true; + return true; } } - if (!ret) - dout(10) << __func__ << " does not need backfill" << dendl; - return ret; + dout(10) << __func__ << " does not need backfill" << dendl; + return false; } bool PG::_calc_past_interval_range(epoch_t *start, epoch_t *end, epoch_t oldest_map) -- 2.47.3