Skip to content

Commit

Permalink
osd/OSDMap: cleanup: s/tmpmap/nextmap/
Browse files Browse the repository at this point in the history
Be consistent with OSDMap.h

Signed-off-by: Sage Weil <[email protected]>
  • Loading branch information
liewegas committed Sep 7, 2018
1 parent f47921f commit d249fa8
Showing 1 changed file with 19 additions and 19 deletions.
38 changes: 19 additions & 19 deletions src/osd/OSDMap.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1642,16 +1642,16 @@ void OSDMap::dedup(const OSDMap *o, OSDMap *n)

void OSDMap::clean_temps(CephContext *cct,
const OSDMap& oldmap,
const OSDMap& tmpmap,
const OSDMap& nextmap,
Incremental *pending_inc)
{
ldout(cct, 10) << __func__ << dendl;

for (auto pg : *tmpmap.pg_temp) {
for (auto pg : *nextmap.pg_temp) {
// if pool does not exist, remove any existing pg_temps associated with
// it. we don't care about pg_temps on the pending_inc either; if there
// are new_pg_temp entries on the pending, clear them out just as well.
if (!tmpmap.have_pg_pool(pg.first.pool())) {
if (!nextmap.have_pg_pool(pg.first.pool())) {
ldout(cct, 10) << __func__ << " removing pg_temp " << pg.first
<< " for nonexistent pool " << pg.first.pool() << dendl;
pending_inc->new_pg_temp[pg.first].clear();
Expand All @@ -1660,7 +1660,7 @@ void OSDMap::clean_temps(CephContext *cct,
// all osds down?
unsigned num_up = 0;
for (auto o : pg.second) {
if (!tmpmap.is_down(o)) {
if (!nextmap.is_down(o)) {
++num_up;
break;
}
Expand All @@ -1674,15 +1674,15 @@ void OSDMap::clean_temps(CephContext *cct,
// redundant pg_temp?
vector<int> raw_up;
int primary;
tmpmap.pg_to_raw_up(pg.first, &raw_up, &primary);
nextmap.pg_to_raw_up(pg.first, &raw_up, &primary);
bool remove = false;
if (raw_up == pg.second) {
ldout(cct, 10) << __func__ << " removing pg_temp " << pg.first << " "
<< pg.second << " that matches raw_up mapping" << dendl;
remove = true;
}
// oversized pg_temp?
if (pg.second.size() > tmpmap.get_pg_pool(pg.first.pool())->get_size()) {
if (pg.second.size() > nextmap.get_pg_pool(pg.first.pool())->get_size()) {
ldout(cct, 10) << __func__ << " removing pg_temp " << pg.first << " "
<< pg.second << " exceeds pool size" << dendl;
remove = true;
Expand All @@ -1695,9 +1695,9 @@ void OSDMap::clean_temps(CephContext *cct,
}
}

for (auto &pg : *tmpmap.primary_temp) {
for (auto &pg : *nextmap.primary_temp) {
// primary down?
if (tmpmap.is_down(pg.second)) {
if (nextmap.is_down(pg.second)) {
ldout(cct, 10) << __func__ << " removing primary_temp " << pg.first
<< " to down " << pg.second << dendl;
pending_inc->new_primary_temp[pg.first] = -1;
Expand All @@ -1707,8 +1707,8 @@ void OSDMap::clean_temps(CephContext *cct,
vector<int> real_up, templess_up;
int real_primary, templess_primary;
pg_t pgid = pg.first;
tmpmap.pg_to_acting_osds(pgid, &real_up, &real_primary);
tmpmap.pg_to_raw_up(pgid, &templess_up, &templess_primary);
nextmap.pg_to_acting_osds(pgid, &real_up, &real_primary);
nextmap.pg_to_raw_up(pgid, &templess_up, &templess_primary);
if (real_primary == templess_primary){
ldout(cct, 10) << __func__ << " removing primary_temp "
<< pgid << " -> " << real_primary
Expand All @@ -1723,18 +1723,18 @@ void OSDMap::clean_temps(CephContext *cct,

void OSDMap::maybe_remove_pg_upmaps(CephContext *cct,
const OSDMap& oldmap,
const OSDMap& tmpmap,
const OSDMap& nextmap,
Incremental *pending_inc)
{
ldout(cct, 10) << __func__ << dendl;
set<pg_t> to_check;
set<pg_t> to_cancel;
map<int, map<int, float>> rule_weight_map;

for (auto& p : tmpmap.pg_upmap) {
for (auto& p : nextmap.pg_upmap) {
to_check.insert(p.first);
}
for (auto& p : tmpmap.pg_upmap_items) {
for (auto& p : nextmap.pg_upmap_items) {
to_check.insert(p.first);
}
for (auto& p : pending_inc->new_pg_upmap) {
Expand All @@ -1744,7 +1744,7 @@ void OSDMap::maybe_remove_pg_upmaps(CephContext *cct,
to_check.insert(p.first);
}
for (auto& pg : to_check) {
auto crush_rule = tmpmap.get_pg_pool_crush_rule(pg);
auto crush_rule = nextmap.get_pg_pool_crush_rule(pg);
if (crush_rule < 0) {
lderr(cct) << __func__ << " unable to load crush-rule of pg "
<< pg << dendl;
Expand All @@ -1753,7 +1753,7 @@ void OSDMap::maybe_remove_pg_upmaps(CephContext *cct,
map<int, float> weight_map;
auto it = rule_weight_map.find(crush_rule);
if (it == rule_weight_map.end()) {
auto r = tmpmap.crush->get_rule_weight_osd_map(crush_rule, &weight_map);
auto r = nextmap.crush->get_rule_weight_osd_map(crush_rule, &weight_map);
if (r < 0) {
lderr(cct) << __func__ << " unable to get crush weight_map for "
<< "crush_rule " << crush_rule << dendl;
Expand All @@ -1763,7 +1763,7 @@ void OSDMap::maybe_remove_pg_upmaps(CephContext *cct,
} else {
weight_map = it->second;
}
auto type = tmpmap.crush->get_rule_failure_domain(crush_rule);
auto type = nextmap.crush->get_rule_failure_domain(crush_rule);
if (type < 0) {
lderr(cct) << __func__ << " unable to load failure-domain-type of pg "
<< pg << dendl;
Expand All @@ -1776,11 +1776,11 @@ void OSDMap::maybe_remove_pg_upmaps(CephContext *cct,
<< dendl;
vector<int> raw;
int primary;
tmpmap.pg_to_raw_up(pg, &raw, &primary);
nextmap.pg_to_raw_up(pg, &raw, &primary);
set<int> parents;
for (auto osd : raw) {
if (type > 0) {
auto parent = tmpmap.crush->get_parent_of_type(osd, type, crush_rule);
auto parent = nextmap.crush->get_parent_of_type(osd, type, crush_rule);
if (parent < 0) {
auto r = parents.insert(parent);
if (!r.second) {
Expand All @@ -1803,7 +1803,7 @@ void OSDMap::maybe_remove_pg_upmaps(CephContext *cct,
to_cancel.insert(pg);
break;
}
auto adjusted_weight = tmpmap.get_weightf(it->first) * it->second;
auto adjusted_weight = nextmap.get_weightf(it->first) * it->second;
if (adjusted_weight == 0) {
// osd is out/crush-out
to_cancel.insert(pg);
Expand Down

0 comments on commit d249fa8

Please sign in to comment.