]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
crush: introduce CRUSH_V4 feature bit
authorSage Weil <sage@redhat.com>
Wed, 3 Dec 2014 01:42:50 +0000 (17:42 -0800)
committerSage Weil <sage@redhat.com>
Thu, 22 Jan 2015 18:16:42 +0000 (10:16 -0800)
Introduce a feature bit that reflects whether straw2 buckets are in use.
Clients need to support them before they can be used!

Signed-off-by: Sage Weil <sage@redhat.com>
src/crush/CrushWrapper.cc
src/crush/CrushWrapper.h
src/include/ceph_features.h
src/osd/OSDMap.cc

index 0c7502bd16886fd425ead1567e1a4544e7b2fd4b..ba217c4ef201279f15abbb9f22957dac23a5f4ac 100644 (file)
@@ -66,6 +66,18 @@ bool CrushWrapper::is_v3_rule(unsigned ruleid) const
   return false;
 }
 
+bool CrushWrapper::has_v4_buckets() const
+{
+  for (int i=0; i<crush->max_buckets; ++i) {
+    crush_bucket *b = crush->buckets[i];
+    if (!b)
+      continue;
+    if (b->type == CRUSH_BUCKET_STRAW2)
+      return true;
+  }
+  return false;
+}
+
 int CrushWrapper::can_rename_item(const string& srcname,
                                   const string& dstname,
                                   ostream *ss) const
index 5b7124b908bba8541eb15bd51f5f8f59cf518724..632e9e49181d9295c805894116f45da0e01920a7 100644 (file)
@@ -243,8 +243,10 @@ public:
     return
       crush->chooseleaf_vary_r != 0;
   }
+
   bool has_v2_rules() const;
   bool has_v3_rules() const;
+  bool has_v4_buckets() const;
 
   bool is_v2_rule(unsigned ruleid) const;
   bool is_v3_rule(unsigned ruleid) const;
index 0812911455227c018aabd698abf209aa638804a3..ed2b7ee47010ea13e59a4939213e41e10ef42a06 100644 (file)
@@ -59,6 +59,7 @@
 #define CEPH_FEATURE_OSD_OBJECT_DIGEST  (1ULL<<46)  /* overlap with fadvise */
 #define CEPH_FEATURE_OSD_TRANSACTION_MAY_LAYOUT (1ULL<<46) /* overlap w/ fadvise */
 #define CEPH_FEATURE_MDS_QUOTA      (1ULL<<47)
+#define CEPH_FEATURE_CRUSH_V4      (1ULL<<48)  /* straw2 buckets */
 
 #define CEPH_FEATURE_RESERVED2 (1ULL<<61)  /* slow down, we are almost out... */
 #define CEPH_FEATURE_RESERVED  (1ULL<<62)  /* DO NOT USE THIS ... last bit! */
@@ -142,6 +143,7 @@ static inline unsigned long long ceph_sanitize_features(unsigned long long f) {
         CEPH_FEATURE_OSD_OBJECT_DIGEST |    \
          CEPH_FEATURE_OSD_TRANSACTION_MAY_LAYOUT |   \
         CEPH_FEATURE_MDS_QUOTA | \
+         CEPH_FEATURE_CRUSH_V4 |            \
         0ULL)
 
 #define CEPH_FEATURES_SUPPORTED_DEFAULT  CEPH_FEATURES_ALL
@@ -153,7 +155,8 @@ static inline unsigned long long ceph_sanitize_features(unsigned long long f) {
        (CEPH_FEATURE_CRUSH_TUNABLES |          \
         CEPH_FEATURE_CRUSH_TUNABLES2 |         \
         CEPH_FEATURE_CRUSH_TUNABLES3 |         \
-        CEPH_FEATURE_CRUSH_V2)
+        CEPH_FEATURE_CRUSH_V2 |                \
+        CEPH_FEATURE_CRUSH_V4)
 
 /*
  * make sure we don't try to use the reserved features
index a9ab413d1617f7e2bf6a3baf623b096388b18636..1b9b22b29452131662f64bdf2a2e76234250b93d 100644 (file)
@@ -1034,6 +1034,8 @@ uint64_t OSDMap::get_features(int entity_type, uint64_t *pmask) const
     features |= CEPH_FEATURE_CRUSH_TUNABLES2;
   if (crush->has_nondefault_tunables3())
     features |= CEPH_FEATURE_CRUSH_TUNABLES3;
+  if (crush->has_v4_buckets())
+    features |= CEPH_FEATURE_CRUSH_V4;
   mask |= CEPH_FEATURES_CRUSH;
 
   for (map<int64_t,pg_pool_t>::const_iterator p = pools.begin(); p != pools.end(); ++p) {