From: Sage Weil Date: Fri, 22 Aug 2014 16:04:37 +0000 (-0700) Subject: common/shared_cache: take a cct X-Git-Tag: v0.86~222^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=6cf583c4b72790350e4c35278b1c0ea9ffeeb453;p=ceph.git common/shared_cache: take a cct Signed-off-by: Sage Weil --- diff --git a/src/common/shared_cache.hpp b/src/common/shared_cache.hpp index ecb3abe01748..8b48272ee411 100644 --- a/src/common/shared_cache.hpp +++ b/src/common/shared_cache.hpp @@ -24,6 +24,7 @@ template class SharedLRU { + CephContext *cct; typedef ceph::shared_ptr VPtr; typedef ceph::weak_ptr 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 39872f0af789..54f2411fab68 100644 --- a/src/os/FDCache.h +++ b/src/os/FDCache.h @@ -61,6 +61,7 @@ public: cct->_conf->add_observer(this); registry = new SharedLRU[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 1171b7072d8d..2f4cded51c3f 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"),