From c2aa74a22718d9a59d60201d71213aaff2492ff8 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Fri, 15 Aug 2014 08:55:10 -0700 Subject: [PATCH] osd: only require crush features for rules that are actually used Often there will be a CRUSH rule present for erasure coding that uses the new CRUSH steps or indep mode. If these rules are not referenced by any pool, we do not need clients to support the mapping behavior. This is true because the encoding has not changed; only the expected CRUSH output. Fixes: #8963 Backport: firefly Signed-off-by: Sage Weil (cherry picked from commit 16dadb86e02108e11a970252411855d84ab0a4a2) --- src/osd/OSDMap.cc | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/osd/OSDMap.cc b/src/osd/OSDMap.cc index 886463ed3e7..2ba9a8e1de6 100644 --- a/src/osd/OSDMap.cc +++ b/src/osd/OSDMap.cc @@ -959,10 +959,7 @@ uint64_t OSDMap::get_features(int entity_type, uint64_t *pmask) const features |= CEPH_FEATURE_CRUSH_TUNABLES; if (crush->has_nondefault_tunables2()) features |= CEPH_FEATURE_CRUSH_TUNABLES2; - if (crush->has_v2_rules()) - features |= CEPH_FEATURE_CRUSH_V2; - if (crush->has_nondefault_tunables3() || - crush->has_v3_rules()) + if (crush->has_nondefault_tunables3()) features |= CEPH_FEATURE_CRUSH_TUNABLES3; mask |= CEPH_FEATURES_CRUSH; @@ -978,6 +975,15 @@ uint64_t OSDMap::get_features(int entity_type, uint64_t *pmask) const p->second.is_tier()) { features |= CEPH_FEATURE_OSD_CACHEPOOL; } + int ruleid = crush->find_rule(p->second.get_crush_ruleset(), + p->second.get_type(), + p->second.get_size()); + if (ruleid >= 0) { + if (crush->is_v2_rule(ruleid)) + features |= CEPH_FEATURE_CRUSH_V2; + if (crush->is_v3_rule(ruleid)) + features |= CEPH_FEATURE_CRUSH_TUNABLES3; + } } mask |= CEPH_FEATURE_OSDHASHPSPOOL | CEPH_FEATURE_OSD_CACHEPOOL; if (entity_type != CEPH_ENTITY_TYPE_CLIENT) -- 2.47.3