From 921aa6eb0176be53b5ffa272022e79666ee9a452 Mon Sep 17 00:00:00 2001 From: Michal Jarzabek Date: Sun, 25 Sep 2016 15:37:33 +0100 Subject: [PATCH] osd/PG.cc: remove unneeded use of count Signed-off-by: Michal Jarzabek --- src/osd/PG.cc | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/osd/PG.cc b/src/osd/PG.cc index c1e2764948d30..919489f68ead7 100644 --- a/src/osd/PG.cc +++ b/src/osd/PG.cc @@ -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 } @@ -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 -- 2.39.5