]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
osd: only require crush features for rules that are actually used
authorSage Weil <sage@redhat.com>
Fri, 15 Aug 2014 15:55:10 +0000 (08:55 -0700)
committerSage Weil <sage@redhat.com>
Fri, 15 Aug 2014 15:55:27 +0000 (08:55 -0700)
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>
src/osd/OSDMap.cc

index 64fab3d7c2a67fa11123a4cf91007124fe3e37e4..f807a313eabf35fdf5e3de875ff4b52ab8a98f78 100644 (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)