Skip to content

Commit

Permalink
osd/ReplicatedPG: remove unneeded use of count
Browse files Browse the repository at this point in the history
Signed-off-by: Michal Jarzabek <stiopa@gmail.com>
  • Loading branch information
stiopaa1 committed Sep 28, 2016
1 parent 1c81ea2 commit ec76937
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions src/osd/ReplicatedPG.cc
Original file line number Diff line number Diff line change
Expand Up @@ -545,8 +545,9 @@ bool ReplicatedPG::is_degraded_or_backfilling_object(const hobject_t& soid)
++i) {
if (*i == get_primary()) continue;
pg_shard_t peer = *i;
if (peer_missing.count(peer) &&
peer_missing[peer].get_items().count(soid))
auto peer_missing_entry = peer_missing.find(peer);
if (peer_missing_entry != peer_missing.end() &&
peer_missing_entry->second.get_items().count(soid))
return true;

// Object is degraded if after last_backfill AND
Expand Down Expand Up @@ -5936,7 +5937,8 @@ int ReplicatedPG::do_osd_ops(OpContext *ctx, vector<OSDOp>& ops)
for (map<string, pair<bufferlist, int> >::iterator i = assertions.begin();
i != assertions.end();
++i) {
bufferlist &bl = out.count(i->first) ?
auto out_entry = out.find(i->first);
bufferlist &bl = (out_entry != out.end()) ?
out[i->first] : empty;
switch (i->second.second) {
case CEPH_OSD_CMPXATTR_OP_EQ:
Expand Down Expand Up @@ -6665,8 +6667,9 @@ void ReplicatedPG::complete_disconnect_watches(
i != to_disconnect.end();
++i) {
pair<uint64_t, entity_name_t> watcher(i->cookie, i->name);
if (obc->watchers.count(watcher)) {
WatchRef watch = obc->watchers[watcher];
auto watchers_entry = obc->watchers.find(watcher);
if (watchers_entry != obc->watchers.end()) {
WatchRef watch = watchers_entry->second;
dout(10) << "do_osd_op_effects disconnect watcher " << watcher << dendl;
obc->watchers.erase(watcher);
watch->remove(i->send_disconnect);
Expand Down

0 comments on commit ec76937

Please sign in to comment.