osdc/Objecter: _calc_target - inline spgid

A follow-up of https://github.com/ceph/ceph/pull/28487.
For erasure pools this can save us an obviously redundant call
of do_crush and other things.

Signed-off-by: xie xingguo <xie.xingguo@zte.com.cn>
This commit is contained in:
xie xingguo 2019-06-15 14:24:29 +08:00
parent 5ae32b860f
commit 522f2ab0d6
2 changed files with 13 additions and 3 deletions

View File

@ -539,6 +539,9 @@ struct spg_t {
uint64_t pool() const {
return pgid.pool();
}
void reset_shard(shard_id_t s) {
shard = s;
}
static const uint8_t calc_name_buf_size = pg_t::calc_name_buf_size + 4; // 36 + len('s') + len("255");
char *calc_name(char *buf, const char *suffix_backwords) const;

View File

@ -2943,9 +2943,16 @@ int Objecter::_calc_target(op_target_t *t, Connection *con, bool any_change)
t->pg_num = pg_num;
t->pg_num_mask = pg_num_mask;
t->pg_num_pending = pg_num_pending;
osdmap->get_primary_shard(
pg_t(ceph_stable_mod(pgid.ps(), t->pg_num, t->pg_num_mask), pgid.pool()),
&t->actual_pgid);
spg_t spgid(actual_pgid);
if (pi->is_erasure()) {
for (uint8_t i = 0; i < acting.size(); ++i) {
if (acting[i] == acting_primary) {
spgid.reset_shard(shard_id_t(i));
break;
}
}
}
t->actual_pgid = spgid;
t->sort_bitwise = sort_bitwise;
t->recovery_deletes = recovery_deletes;
ldout(cct, 10) << __func__ << " "