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 | |
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>
-rw-r--r-- | src/common/shared_cache.hpp | 9 | ||||
-rw-r--r-- | src/os/FDCache.h | 1 | ||||
-rw-r--r-- | src/osd/OSD.cc | 2 |
3 files changed, 9 insertions, 3 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 { diff --git a/src/os/FDCache.h b/src/os/FDCache.h index 39872f0af78..54f2411fab6 100644 --- a/src/os/FDCache.h +++ b/src/os/FDCache.h @@ -61,6 +61,7 @@ public: cct->_conf->add_observer(this); registry = new SharedLRU<ghobject_t, FD>[registry_shards]; for (int i = 0; i < registry_shards; ++i) { + registry[i].set_cct(cct); registry[i].set_size( MAX((cct->_conf->filestore_fd_cache_size / registry_shards), 1)); } diff --git a/src/osd/OSD.cc b/src/osd/OSD.cc index 1171b7072d8..2f4cded51c3 100644 --- a/src/osd/OSD.cc +++ b/src/osd/OSD.cc @@ -230,7 +230,7 @@ OSDService::OSDService(OSD *osd) : cct->_conf->osd_min_recovery_priority), pg_temp_lock("OSDService::pg_temp_lock"), map_cache_lock("OSDService::map_lock"), - map_cache(cct->_conf->osd_map_cache_size), + map_cache(cct, cct->_conf->osd_map_cache_size), map_bl_cache(cct->_conf->osd_map_cache_size), map_bl_inc_cache(cct->_conf->osd_map_cache_size), in_progress_split_lock("OSDService::in_progress_split_lock"), |