]> 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 20:56:12 +0000 (13:56 -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>
(cherry picked from commit 16dadb86e02108e11a970252411855d84ab0a4a2)

src/osd/OSDMap.cc

index 886463ed3e74767991432a32d2c80cf53063658d..2ba9a8e1de650cea0d8a3325876f2bac12a7c39c 100644 (file)
@@ -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)