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 <sage@redhat.com>
This commit is contained in:
Sage Weil 2014-08-15 08:55:10 -07:00
parent 1d95486780
commit 16dadb86e0

View File

@ -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)