From: Max Kellermann Date: Wed, 13 Nov 2024 16:33:50 +0000 (+0100) Subject: common/config: make `legacy_values` static X-Git-Tag: v20.0.0~259^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=895691ec47cb027637dbdb4915c7b105c47ad99b;p=ceph.git common/config: make `legacy_values` static This field is `const` and we need only one global instance, and not one copy per `md_config_t` instance. Signed-off-by: Max Kellermann --- diff --git a/src/common/config.cc b/src/common/config.cc index 3a5ee91c347..7d6b1691915 100644 --- a/src/common/config.cc +++ b/src/common/config.cc @@ -68,6 +68,20 @@ const char *CEPH_CONF_FILE_DEFAULT = "$data_dir/config,/etc/ceph/$cluster.conf,$ #define _STR(x) #x #define STRINGIFY(x) _STR(x) +// Populate list of legacy_values according to the OPTION() definitions +// Note that this is just setting up our map of name->member ptr. The +// default values etc will get loaded in along with new-style data, +// as all loads write to both the values map, and the legacy +// members if present. +const std::map md_config_t::legacy_values = { +#define OPTION(name, type) \ + {STRINGIFY(name), &ConfigValues::name}, +#define SAFE_OPTION(name, type) OPTION(name, type) +#include "options/legacy_config_opts.h" +#undef OPTION +#undef SAFE_OPTION +}; + const char *ceph_conf_level_name(int level) { switch (level) { @@ -170,20 +184,6 @@ md_config_t::md_config_t(ConfigValues& values, schema.emplace(opt.name, opt); } - // Populate list of legacy_values according to the OPTION() definitions - // Note that this is just setting up our map of name->member ptr. The - // default values etc will get loaded in along with new-style data, - // as all loads write to both the values map, and the legacy - // members if present. - legacy_values = { -#define OPTION(name, type) \ - {STRINGIFY(name), &ConfigValues::name}, -#define SAFE_OPTION(name, type) OPTION(name, type) -#include "options/legacy_config_opts.h" -#undef OPTION -#undef SAFE_OPTION - }; - validate_schema(); // Validate default values from the schema diff --git a/src/common/config.h b/src/common/config.h index 3e7b51d987d..9df11d52d82 100644 --- a/src/common/config.h +++ b/src/common/config.h @@ -91,7 +91,7 @@ public: /* * Mapping from legacy config option names to class members */ - std::map legacy_values; + static const std::map legacy_values; /** * The configuration schema, in the form of Option objects describing