From 3d71eda4b86f9384b2278038b93f3101a37efc1d Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Tue, 29 Mar 2016 12:49:36 -0400 Subject: [PATCH] common/ceph_context: add CrushLocation to cct Signed-off-by: Sage Weil --- src/common/ceph_context.cc | 23 ++++++++++++++++------- src/common/ceph_context.h | 5 +++++ 2 files changed, 21 insertions(+), 7 deletions(-) diff --git a/src/common/ceph_context.cc b/src/common/ceph_context.cc index c3ee8e686de..abf9f07e05b 100644 --- a/src/common/ceph_context.cc +++ b/src/common/ceph_context.cc @@ -239,6 +239,7 @@ public: const char** get_tracked_conf_keys() const { static const char *KEYS[] = { "enable_experimental_unrecoverable_data_corrupting_features", + "crush_location", NULL }; return KEYS; @@ -246,13 +247,20 @@ public: void handle_conf_change(const md_config_t *conf, const std::set &changed) { - ceph_spin_lock(&cct->_feature_lock); - get_str_set(conf->enable_experimental_unrecoverable_data_corrupting_features, - cct->_experimental_features); - ceph_spin_unlock(&cct->_feature_lock); - if (!cct->_experimental_features.empty()) - lderr(cct) << "WARNING: the following dangerous and experimental features are enabled: " - << cct->_experimental_features << dendl; + if (changed.count( + "enable_experimental_unrecoverable_data_corrupting_features")) { + ceph_spin_lock(&cct->_feature_lock); + get_str_set( + conf->enable_experimental_unrecoverable_data_corrupting_features, + cct->_experimental_features); + ceph_spin_unlock(&cct->_feature_lock); + if (!cct->_experimental_features.empty()) + lderr(cct) << "WARNING: the following dangerous and experimental features are enabled: " + << cct->_experimental_features << dendl; + } + if (changed.count("crush_location")) { + cct->crush_location.update_from_conf(); + } } }; @@ -459,6 +467,7 @@ CephContext::CephContext(uint32_t module_type_, int init_flags_) _crypto_aes(NULL), _plugin_registry(NULL), _lockdep_obs(NULL), + crush_location(this), _cct_perf(NULL) { ceph_spin_init(&_service_thread_lock); diff --git a/src/common/ceph_context.h b/src/common/ceph_context.h index a455a0c8efd..86c1a4a736d 100644 --- a/src/common/ceph_context.h +++ b/src/common/ceph_context.h @@ -25,6 +25,7 @@ #include "include/atomic.h" #include "common/cmdparse.h" #include "include/Spinlock.h" +#include "crush/CrushLocation.h" #include class AdminSocket; @@ -247,6 +248,10 @@ private: md_config_obs_t *_lockdep_obs; +public: + CrushLocation crush_location; +private: + enum { l_cct_first, l_cct_total_workers, -- 2.39.5