]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
osd/PG.cc: remove unneeded use of count 11228/head
authorMichal Jarzabek <stiopa@gmail.com>
Sun, 25 Sep 2016 14:37:33 +0000 (15:37 +0100)
committerMichal Jarzabek <stiopa@gmail.com>
Sun, 25 Sep 2016 14:37:33 +0000 (15:37 +0100)
Signed-off-by: Michal Jarzabek <stiopa@gmail.com>
src/osd/PG.cc

index c1e2764948d308461bdc98e31415a0e8b1986114..919489f68ead7ea65db24fdac8ef1cece246d06c 100644 (file)
@@ -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