summaryrefslogtreecommitdiff
path: root/src/common/shared_cache.hpp
diff options
context:
space:
mode:
authorSamuel Just <sam.just@inktank.com>2013-05-29 15:06:18 -0700
committerSamuel Just <sam.just@inktank.com>2013-05-29 15:06:18 -0700
commite21f8df1eb0c459d12911785c69f7427d1ad5689 (patch)
tree716ff1aea76cd3293bf8a5e2c861ef5cd08ca27d /src/common/shared_cache.hpp
parent0071b8e75bd3f5a09cc46e2225a018f6d1ef0680 (diff)
parenta55e03cdfe45754b2aff8110aa1a0518404f1218 (diff)
downloadceph-e21f8df1eb0c459d12911785c69f7427d1ad5689.tar.gz
Merge branch 'wip_osd_throttle'
Fixes: #4782 Reviewed-by: Sage Weil
Diffstat (limited to 'src/common/shared_cache.hpp')
-rw-r--r--src/common/shared_cache.hpp13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/common/shared_cache.hpp b/src/common/shared_cache.hpp
index 69a4c06dfbf..178d1001be3 100644
--- a/src/common/shared_cache.hpp
+++ b/src/common/shared_cache.hpp
@@ -85,12 +85,23 @@ public:
assert(weak_refs.empty());
}
+ void clear(K key) {
+ VPtr val; // release any ref we have after we drop the lock
+ {
+ Mutex::Locker l(lock);
+ if (weak_refs.count(key)) {
+ val = weak_refs[key].lock();
+ }
+ lru_remove(key);
+ }
+ }
+
void set_size(size_t new_size) {
list<VPtr> to_release;
{
Mutex::Locker l(lock);
max_size = new_size;
- trim_cache(to_release);
+ trim_cache(&to_release);
}
}