From: Sage Weil Date: Fri, 15 Aug 2014 15:55:10 +0000 (-0700) Subject: osd: only require crush features for rules that are actually used X-Git-Tag: v0.84~3^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=16dadb86e02108e11a970252411855d84ab0a4a2;p=ceph.git 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 --- diff --git a/src/osd/OSDMap.cc b/src/osd/OSDMap.cc index 64fab3d7c2a..f807a313eab 100644 --- a/src/osd/OSDMap.cc +++ b/src/osd/OSDMap.cc @@ -967,10 +967,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; @@ -986,6 +983,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)