From 50df613bb0a767e8b9b948f3032c1455004ac0b7 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Fri, 15 Aug 2014 16:44:46 -0700 Subject: [PATCH] reserve a few feature bits Make sure we have a bit of warning before we reach the end times. Signed-off-by: Sage Weil --- src/include/ceph_features.h | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/src/include/ceph_features.h b/src/include/ceph_features.h index 9b9ef5c0c8726..e60d72c39bfba 100644 --- a/src/include/ceph_features.h +++ b/src/include/ceph_features.h @@ -55,6 +55,10 @@ #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 @@ -66,10 +70,10 @@ * 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 -- 2.39.5