Skip to content

Commit

Permalink
osd/PG.cc: 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 25, 2016
1 parent 1c81ea2 commit 921aa6e
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions src/osd/PG.cc
Expand Up @@ -87,9 +87,6 @@ void PG::get(const char* tag)
ref++;
#ifdef PG_DEBUG_REFS
Mutex::Locker l(_ref_id_lock);
if (!_tag_counts.count(tag)) {
_tag_counts[tag] = 0;
}
_tag_counts[tag]++;
#endif
}
Expand All @@ -99,10 +96,11 @@ void PG::put(const char* tag)
#ifdef PG_DEBUG_REFS
{
Mutex::Locker l(_ref_id_lock);
assert(_tag_counts.count(tag));
_tag_counts[tag]--;
if (_tag_counts[tag] == 0) {
_tag_counts.erase(tag);
auto tag_counts_entry = _tag_counts.find(tag);
assert(_tag_counts_entry != _tag_counts.end());
--tag_counts_entry->second;
if (tag_counts_entry->second == 0) {
_tag_counts.erase(tag_counts_entry);
}
}
#endif
Expand Down

0 comments on commit 921aa6e

Please sign in to comment.