diff options
author | Sage Weil <sage@redhat.com> | 2014-08-22 18:04:37 +0200 |
---|---|---|
committer | Sage Weil <sage@redhat.com> | 2014-08-22 18:04:37 +0200 |
commit | 6cf583c4b72790350e4c35278b1c0ea9ffeeb453 (patch) | |
tree | fe50523f0eff2f26aae47432262a68a0b4a3e1e6 /src/common/shared_cache.hpp | |
parent | Merge pull request #2291 from ceph/wip-fingerprint (diff) | |
download | ceph-6cf583c4b72790350e4c35278b1c0ea9ffeeb453.tar.xz ceph-6cf583c4b72790350e4c35278b1c0ea9ffeeb453.zip |
common/shared_cache: take a cct
Signed-off-by: Sage Weil <sage@redhat.com>
Diffstat (limited to 'src/common/shared_cache.hpp')
-rw-r--r-- | src/common/shared_cache.hpp | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/common/shared_cache.hpp b/src/common/shared_cache.hpp index ecb3abe0174..8b48272ee41 100644 --- a/src/common/shared_cache.hpp +++ b/src/common/shared_cache.hpp @@ -24,6 +24,7 @@ template <class K, class V> class SharedLRU { + CephContext *cct; typedef ceph::shared_ptr<V> VPtr; typedef ceph::weak_ptr<V> WeakVPtr; Mutex lock; @@ -84,8 +85,8 @@ class SharedLRU { }; public: - SharedLRU(size_t max_size = 20) - : lock("SharedLRU::lock"), max_size(max_size), size(0) {} + SharedLRU(CephContext *cct = NULL, size_t max_size = 20) + : cct(cct), lock("SharedLRU::lock"), max_size(max_size), size(0) {} ~SharedLRU() { contents.clear(); @@ -93,6 +94,10 @@ public: assert(weak_refs.empty()); } + void set_cct(CephContext *c) { + cct = c; + } + void clear(const K& key) { VPtr val; // release any ref we have after we drop the lock { |