mirror of
https://github.com/ceph/ceph
synced 2025-04-11 04:02:04 +00:00
osd/PG: count "num_want_acting" and fill "have" in single round
This is good for performance under most cases. Signed-off-by: xie xingguo <xie.xingguo@zte.com.cn>
This commit is contained in:
parent
2fd28eab67
commit
10036d63f9
@ -1409,11 +1409,15 @@ bool PG::choose_acting(pg_shard_t &auth_log_shard_id, bool *history_les_bound)
|
|||||||
dout(10) << ss.str() << dendl;
|
dout(10) << ss.str() << dendl;
|
||||||
|
|
||||||
unsigned num_want_acting = 0;
|
unsigned num_want_acting = 0;
|
||||||
for (vector<int>::iterator i = want.begin();
|
set<pg_shard_t> have;
|
||||||
i != want.end();
|
for (int i = 0; i < (int)want.size(); ++i) {
|
||||||
++i) {
|
if (want[i] != CRUSH_ITEM_NONE) {
|
||||||
if (*i != CRUSH_ITEM_NONE)
|
|
||||||
++num_want_acting;
|
++num_want_acting;
|
||||||
|
have.insert(
|
||||||
|
pg_shard_t(
|
||||||
|
want[i],
|
||||||
|
pool.info.ec_pool() ? shard_id_t(i) : shard_id_t::NO_SHARD));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// We go incomplete if below min_size for ec_pools since backfill
|
// We go incomplete if below min_size for ec_pools since backfill
|
||||||
@ -1430,14 +1434,6 @@ bool PG::choose_acting(pg_shard_t &auth_log_shard_id, bool *history_les_bound)
|
|||||||
/* Check whether we have enough acting shards to later perform recovery */
|
/* Check whether we have enough acting shards to later perform recovery */
|
||||||
boost::scoped_ptr<IsPGRecoverablePredicate> recoverable_predicate(
|
boost::scoped_ptr<IsPGRecoverablePredicate> recoverable_predicate(
|
||||||
get_pgbackend()->get_is_recoverable_predicate());
|
get_pgbackend()->get_is_recoverable_predicate());
|
||||||
set<pg_shard_t> have;
|
|
||||||
for (int i = 0; i < (int)want.size(); ++i) {
|
|
||||||
if (want[i] != CRUSH_ITEM_NONE)
|
|
||||||
have.insert(
|
|
||||||
pg_shard_t(
|
|
||||||
want[i],
|
|
||||||
pool.info.ec_pool() ? shard_id_t(i) : shard_id_t::NO_SHARD));
|
|
||||||
}
|
|
||||||
if (!(*recoverable_predicate)(have)) {
|
if (!(*recoverable_predicate)(have)) {
|
||||||
want_acting.clear();
|
want_acting.clear();
|
||||||
dout(10) << "choose_acting failed, not recoverable" << dendl;
|
dout(10) << "choose_acting failed, not recoverable" << dendl;
|
||||||
|
Loading…
Reference in New Issue
Block a user