]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
reserve a few feature bits
authorSage Weil <sage@redhat.com>
Fri, 15 Aug 2014 23:44:46 +0000 (16:44 -0700)
committerSage Weil <sage@redhat.com>
Mon, 10 Nov 2014 22:20:24 +0000 (14:20 -0800)
Make sure we have a bit of warning before we reach the end times.

Signed-off-by: Sage Weil <sage@redhat.com>
src/include/ceph_features.h

index 9b9ef5c0c87260a4d1311ad1e0eb41d1b1f9cad5..e60d72c39bfba874c54807fc358fc093b0b2fcac 100644 (file)
 #define CEPH_FEATURE_ERASURE_CODE_PLUGINS_V2 (1ULL<<44)
 #define CEPH_FEATURE_OSD_SET_ALLOC_HINT (1ULL<<45)
 
+#define CEPH_FEATURE_RESERVED2 (1ULL<<61)  /* slow down, we are almost out... */
+#define CEPH_FEATURE_RESERVED  (1ULL<<62)  /* DO NOT USE THIS ... last bit! */
+#define CEPH_FEATURE_RESERVED_BROKEN  (1ULL<<63)  /* DO NOT USE THIS; see below */
+
 /*
  * The introduction of CEPH_FEATURE_OSD_SNAPMAPPER caused the feature
  * vector to evaluate to 64 bit ~0.  To cope, we designate 1ULL << 63
  * and fixed by commit
  *   4255b5c2fb54ae40c53284b3ab700fdfc7e61748 v0.65-263-g4255b5c
  */
-#define CEPH_FEATURE_RESERVED (1ULL<<63)
+#define CEPH_FEATURE_RESERVED_BROKEN (1ULL<<63)
 
 static inline unsigned long long ceph_sanitize_features(unsigned long long f) {
-       if (f & CEPH_FEATURE_RESERVED) {
+       if (f & CEPH_FEATURE_RESERVED_BROKEN) {
                /* everything through OSD_SNAPMAPPER */
                return 0x1ffffffffull;
        } else {
@@ -141,4 +145,16 @@ static inline unsigned long long ceph_sanitize_features(unsigned long long f) {
         CEPH_FEATURE_CRUSH_TUNABLES3 |         \
         CEPH_FEATURE_CRUSH_V2)
 
+/*
+ * make sure we don't try to use the reserved features
+ */
+#define CEPH_STATIC_ASSERT(x) (void)(sizeof(int[((x)==0) ? -1 : 0]))
+
+static inline void ____build_time_check_for_reserved_bits(void) {
+       CEPH_STATIC_ASSERT((CEPH_FEATURES_ALL &
+                           (CEPH_FEATURE_RESERVED |
+                            CEPH_FEATURE_RESERVED2 |
+                            CEPH_FEATURE_RESERVED_BROKEN)) == 0);
+}
+
 #endif