OSD: remove 'has_inst', which has the same function as 'is_up'

Signed-off-by: Pan Liu <pan.liu@istuary.com>
This commit is contained in:
Pan Liu 2016-11-18 20:49:15 +08:00
parent e95026f6be
commit 01dfc1ba07
3 changed files with 6 additions and 9 deletions

View File

@ -1566,7 +1566,7 @@ bool OSDMonitor::preprocess_failure(MonOpRequestRef op)
// weird?
if (!osdmap.have_inst(badboy)) {
if (osdmap.is_down(badboy)) {
dout(5) << "preprocess_failure dne(/dup?): " << m->get_target() << ", from " << m->get_orig_source_inst() << dendl;
if (m->get_epoch() < osdmap.get_epoch())
send_incremental(op, m->get_epoch()+1);

View File

@ -6983,15 +6983,15 @@ void OSD::_committed_osd_maps(epoch_t first, epoch_t last, MOSDMap *m)
osdmap->get_all_osds(old);
for (set<int>::iterator p = old.begin(); p != old.end(); ++p) {
if (*p != whoami &&
osdmap->have_inst(*p) && // in old map
!newmap->is_up(*p)) { // but not the new one
osdmap->is_up(*p) && // in old map
newmap->is_down(*p)) { // but not the new one
if (!waited_for_reservations) {
service.await_reserved_maps();
waited_for_reservations = true;
}
note_down_osd(*p);
} else if (*p != whoami &&
!osdmap->have_inst(*p) &&
osdmap->is_down(*p) &&
newmap->is_up(*p)) {
note_up_osd(*p);
}
@ -7502,11 +7502,11 @@ bool OSD::require_same_peer_instance(Message *m, OSDMapRef& map,
{
int from = m->get_source().num();
if (!map->have_inst(from) ||
if (map->is_down(from) ||
(map->get_cluster_addr(from) != m->get_source_inst().addr)) {
dout(5) << "from dead osd." << from << ", marking down, "
<< " msg was " << m->get_source_inst().addr
<< " expected " << (map->have_inst(from) ?
<< " expected " << (map->is_up(from) ?
map->get_cluster_addr(from) : entity_addr_t())
<< dendl;
ConnectionRef con = m->get_connection();

View File

@ -460,9 +460,6 @@ public:
return identify_osd(addr) >= 0;
}
int find_osd_on_ip(const entity_addr_t& ip) const;
bool have_inst(int osd) const {
return exists(osd) && is_up(osd);
}
const entity_addr_t &get_addr(int osd) const {
assert(exists(osd));
return osd_addrs->client_addr[osd] ? *osd_addrs->client_addr[osd] : osd_addrs->blank;