]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
shared_cache: use a single lookup for lookup() too
authorGreg Farnum <greg@inktank.com>
Thu, 30 Jan 2014 21:47:22 +0000 (13:47 -0800)
committerSomnath Roy <somnath.roy@sandisk.com>
Thu, 14 Aug 2014 20:28:27 +0000 (13:28 -0700)
We didn't convert this one to use iterators before.

Signed-off-by: Greg Farnum <greg@inktank.com>
src/common/shared_cache.hpp

index df52178607d519500e0b2bf585b6a0bb60b1e9a2..2f5f05a0d644963d7e9665b21dc071574745ba0f 100644 (file)
@@ -153,8 +153,9 @@ public:
       bool retry = false;
       do {
        retry = false;
-       if (weak_refs.count(key)) {
-         val = weak_refs[key].lock();
+       typename map<K, WeakVPtr>::iterator i = weak_refs.find(key);
+       if (i != weak_refs.end()) {
+         val = i->second.lock();
          if (val) {
            lru_add(key, val, &to_release);
          } else {