11fe60e51SSage Weil #ifndef __CEPH_FEATURES
21fe60e51SSage Weil #define __CEPH_FEATURES
31fe60e51SSage Weil 
41fe60e51SSage Weil /*
5f179d3baSIlya Dryomov  * Each time we reclaim bits for reuse we need to specify another bit
6f179d3baSIlya Dryomov  * that, if present, indicates we have the new incarnation of that
7f179d3baSIlya Dryomov  * feature.  Base case is 1 (first use).
81fe60e51SSage Weil  */
9f179d3baSIlya Dryomov #define CEPH_FEATURE_INCARNATION_1 (0ull)
10f179d3baSIlya Dryomov #define CEPH_FEATURE_INCARNATION_2 (1ull<<57) // CEPH_FEATURE_SERVER_JEWEL
112b3e0c90SIlya Dryomov 
12f179d3baSIlya Dryomov #define DEFINE_CEPH_FEATURE(bit, incarnation, name)			\
13f179d3baSIlya Dryomov 	const static uint64_t CEPH_FEATURE_##name = (1ULL<<bit);		\
14f179d3baSIlya Dryomov 	const static uint64_t CEPH_FEATUREMASK_##name =			\
15f179d3baSIlya Dryomov 		(1ULL<<bit | CEPH_FEATURE_INCARNATION_##incarnation);
16f179d3baSIlya Dryomov 
17f179d3baSIlya Dryomov /* this bit is ignored but still advertised by release *when* */
18f179d3baSIlya Dryomov #define DEFINE_CEPH_FEATURE_DEPRECATED(bit, incarnation, name, when) \
19f179d3baSIlya Dryomov 	const static uint64_t DEPRECATED_CEPH_FEATURE_##name = (1ULL<<bit); \
20f179d3baSIlya Dryomov 	const static uint64_t DEPRECATED_CEPH_FEATUREMASK_##name =		\
21f179d3baSIlya Dryomov 		(1ULL<<bit | CEPH_FEATURE_INCARNATION_##incarnation);
22f179d3baSIlya Dryomov 
23f179d3baSIlya Dryomov /*
24f179d3baSIlya Dryomov  * this bit is ignored by release *unused* and not advertised by
25f179d3baSIlya Dryomov  * release *unadvertised*
26f179d3baSIlya Dryomov  */
27f179d3baSIlya Dryomov #define DEFINE_CEPH_FEATURE_RETIRED(bit, inc, name, unused, unadvertised)
28f179d3baSIlya Dryomov 
29f179d3baSIlya Dryomov 
30f179d3baSIlya Dryomov /*
31f179d3baSIlya Dryomov  * test for a feature.  this test is safer than a typical mask against
32f179d3baSIlya Dryomov  * the bit because it ensures that we have the bit AND the marker for the
33f179d3baSIlya Dryomov  * bit's incarnation.  this must be used in any case where the features
34f179d3baSIlya Dryomov  * bits may include an old meaning of the bit.
35f179d3baSIlya Dryomov  */
36f179d3baSIlya Dryomov #define CEPH_HAVE_FEATURE(x, name)			\
37f179d3baSIlya Dryomov 	(((x) & (CEPH_FEATUREMASK_##name)) == (CEPH_FEATUREMASK_##name))
38f179d3baSIlya Dryomov 
39f179d3baSIlya Dryomov 
40f179d3baSIlya Dryomov /*
41f179d3baSIlya Dryomov  * Notes on deprecation:
42f179d3baSIlya Dryomov  *
43f179d3baSIlya Dryomov  * A *major* release is a release through which all upgrades must pass
44f179d3baSIlya Dryomov  * (e.g., jewel).  For example, no pre-jewel server will ever talk to
45f179d3baSIlya Dryomov  * a post-jewel server (mon, osd, etc).
46f179d3baSIlya Dryomov  *
47f179d3baSIlya Dryomov  * For feature bits used *only* on the server-side:
48f179d3baSIlya Dryomov  *
49f179d3baSIlya Dryomov  *  - In the first phase we indicate that a feature is DEPRECATED as of
50f179d3baSIlya Dryomov  *    a particular release.  This is the first major release X (say,
51f179d3baSIlya Dryomov  *    jewel) that does not depend on its peers advertising the feature.
52f179d3baSIlya Dryomov  *    That is, it safely assumes its peers all have the feature.  We
53f179d3baSIlya Dryomov  *    indicate this with the DEPRECATED macro.  For example,
54f179d3baSIlya Dryomov  *
55f179d3baSIlya Dryomov  *      DEFINE_CEPH_FEATURE_DEPRECATED( 2, 1, MONCLOCKCHECK, JEWEL)
56f179d3baSIlya Dryomov  *
57f179d3baSIlya Dryomov  *    because 10.2.z (jewel) did not care if its peers advertised this
58f179d3baSIlya Dryomov  *    feature bit.
59f179d3baSIlya Dryomov  *
60f179d3baSIlya Dryomov  *  - In the second phase we stop advertising the the bit and call it
61f179d3baSIlya Dryomov  *    RETIRED.  This can normally be done in the *next* major release
62f179d3baSIlya Dryomov  *    following the one in which we marked the feature DEPRECATED.  In
63f179d3baSIlya Dryomov  *    the above example, for 12.0.z (luminous) we can say:
64f179d3baSIlya Dryomov  *
65f179d3baSIlya Dryomov  *      DEFINE_CEPH_FEATURE_RETIRED( 2, 1, MONCLOCKCHECK, JEWEL, LUMINOUS)
66f179d3baSIlya Dryomov  *
67f179d3baSIlya Dryomov  *  - The bit can be reused in the first post-luminous release, 13.0.z
68f179d3baSIlya Dryomov  *    (m).
69f179d3baSIlya Dryomov  *
70f179d3baSIlya Dryomov  * This ensures that no two versions who have different meanings for
71f179d3baSIlya Dryomov  * the bit ever speak to each other.
72f179d3baSIlya Dryomov  */
73f179d3baSIlya Dryomov 
74f179d3baSIlya Dryomov DEFINE_CEPH_FEATURE( 0, 1, UID)
75f179d3baSIlya Dryomov DEFINE_CEPH_FEATURE( 1, 1, NOSRCADDR)
76f179d3baSIlya Dryomov DEFINE_CEPH_FEATURE_RETIRED( 2, 1, MONCLOCKCHECK, JEWEL, LUMINOUS)
77f179d3baSIlya Dryomov 
78f179d3baSIlya Dryomov DEFINE_CEPH_FEATURE( 3, 1, FLOCK)
79f179d3baSIlya Dryomov DEFINE_CEPH_FEATURE( 4, 1, SUBSCRIBE2)
80f179d3baSIlya Dryomov DEFINE_CEPH_FEATURE( 5, 1, MONNAMES)
81f179d3baSIlya Dryomov DEFINE_CEPH_FEATURE( 6, 1, RECONNECT_SEQ)
82f179d3baSIlya Dryomov DEFINE_CEPH_FEATURE( 7, 1, DIRLAYOUTHASH)
83f179d3baSIlya Dryomov DEFINE_CEPH_FEATURE( 8, 1, OBJECTLOCATOR)
84f179d3baSIlya Dryomov DEFINE_CEPH_FEATURE( 9, 1, PGID64)
85f179d3baSIlya Dryomov DEFINE_CEPH_FEATURE(10, 1, INCSUBOSDMAP)
86f179d3baSIlya Dryomov DEFINE_CEPH_FEATURE(11, 1, PGPOOL3)
87f179d3baSIlya Dryomov DEFINE_CEPH_FEATURE(12, 1, OSDREPLYMUX)
88f179d3baSIlya Dryomov DEFINE_CEPH_FEATURE(13, 1, OSDENC)
89f179d3baSIlya Dryomov DEFINE_CEPH_FEATURE_RETIRED(14, 1, OMAP, HAMMER, JEWEL)
90f179d3baSIlya Dryomov DEFINE_CEPH_FEATURE(14, 2, SERVER_KRAKEN)
91f179d3baSIlya Dryomov DEFINE_CEPH_FEATURE(15, 1, MONENC)
92f179d3baSIlya Dryomov DEFINE_CEPH_FEATURE_RETIRED(16, 1, QUERY_T, JEWEL, LUMINOUS)
93f179d3baSIlya Dryomov 
94f179d3baSIlya Dryomov DEFINE_CEPH_FEATURE_RETIRED(17, 1, INDEP_PG_MAP, JEWEL, LUMINOUS)
95f179d3baSIlya Dryomov 
96f179d3baSIlya Dryomov DEFINE_CEPH_FEATURE(18, 1, CRUSH_TUNABLES)
97f179d3baSIlya Dryomov DEFINE_CEPH_FEATURE_RETIRED(19, 1, CHUNKY_SCRUB, JEWEL, LUMINOUS)
98f179d3baSIlya Dryomov 
99f179d3baSIlya Dryomov DEFINE_CEPH_FEATURE_RETIRED(20, 1, MON_NULLROUTE, JEWEL, LUMINOUS)
100f179d3baSIlya Dryomov 
101f179d3baSIlya Dryomov DEFINE_CEPH_FEATURE_RETIRED(21, 1, MON_GV, HAMMER, JEWEL)
102f179d3baSIlya Dryomov DEFINE_CEPH_FEATURE(21, 2, SERVER_LUMINOUS)
103f179d3baSIlya Dryomov DEFINE_CEPH_FEATURE(21, 2, RESEND_ON_SPLIT)  // overlap
104f179d3baSIlya Dryomov DEFINE_CEPH_FEATURE(21, 2, RADOS_BACKOFF)    // overlap
105f179d3baSIlya Dryomov DEFINE_CEPH_FEATURE(21, 2, OSDMAP_PG_UPMAP)  // overlap
106f179d3baSIlya Dryomov DEFINE_CEPH_FEATURE(21, 2, CRUSH_CHOOSE_ARGS) // overlap
107f179d3baSIlya Dryomov DEFINE_CEPH_FEATURE_RETIRED(22, 1, BACKFILL_RESERVATION, JEWEL, LUMINOUS)
108f179d3baSIlya Dryomov 
109f179d3baSIlya Dryomov DEFINE_CEPH_FEATURE(23, 1, MSG_AUTH)
110f179d3baSIlya Dryomov DEFINE_CEPH_FEATURE_RETIRED(24, 1, RECOVERY_RESERVATION, JEWEL, LUNINOUS)
111f179d3baSIlya Dryomov 
112f179d3baSIlya Dryomov DEFINE_CEPH_FEATURE(25, 1, CRUSH_TUNABLES2)
113f179d3baSIlya Dryomov DEFINE_CEPH_FEATURE(26, 1, CREATEPOOLID)
114f179d3baSIlya Dryomov DEFINE_CEPH_FEATURE(27, 1, REPLY_CREATE_INODE)
115f179d3baSIlya Dryomov DEFINE_CEPH_FEATURE_RETIRED(28, 1, OSD_HBMSGS, HAMMER, JEWEL)
116f179d3baSIlya Dryomov DEFINE_CEPH_FEATURE(28, 2, SERVER_M)
117f179d3baSIlya Dryomov DEFINE_CEPH_FEATURE(29, 1, MDSENC)
118f179d3baSIlya Dryomov DEFINE_CEPH_FEATURE(30, 1, OSDHASHPSPOOL)
119f179d3baSIlya Dryomov DEFINE_CEPH_FEATURE(31, 1, MON_SINGLE_PAXOS)  // deprecate me
120f179d3baSIlya Dryomov DEFINE_CEPH_FEATURE_RETIRED(32, 1, OSD_SNAPMAPPER, JEWEL, LUMINOUS)
121f179d3baSIlya Dryomov 
122f179d3baSIlya Dryomov DEFINE_CEPH_FEATURE_RETIRED(33, 1, MON_SCRUB, JEWEL, LUMINOUS)
123f179d3baSIlya Dryomov 
124f179d3baSIlya Dryomov DEFINE_CEPH_FEATURE_RETIRED(34, 1, OSD_PACKED_RECOVERY, JEWEL, LUMINOUS)
125f179d3baSIlya Dryomov 
126f179d3baSIlya Dryomov DEFINE_CEPH_FEATURE(35, 1, OSD_CACHEPOOL)
127f179d3baSIlya Dryomov DEFINE_CEPH_FEATURE(36, 1, CRUSH_V2)
128f179d3baSIlya Dryomov DEFINE_CEPH_FEATURE(37, 1, EXPORT_PEER)
129f179d3baSIlya Dryomov DEFINE_CEPH_FEATURE(38, 1, OSD_ERASURE_CODES)
130f179d3baSIlya Dryomov DEFINE_CEPH_FEATURE(38, 1, OSD_OSD_TMAP2OMAP) // overlap
131f179d3baSIlya Dryomov DEFINE_CEPH_FEATURE(39, 1, OSDMAP_ENC)
132f179d3baSIlya Dryomov DEFINE_CEPH_FEATURE(40, 1, MDS_INLINE_DATA)
133f179d3baSIlya Dryomov DEFINE_CEPH_FEATURE(41, 1, CRUSH_TUNABLES3)
134f179d3baSIlya Dryomov DEFINE_CEPH_FEATURE(41, 1, OSD_PRIMARY_AFFINITY) // overlap
135f179d3baSIlya Dryomov DEFINE_CEPH_FEATURE(42, 1, MSGR_KEEPALIVE2)
136f179d3baSIlya Dryomov DEFINE_CEPH_FEATURE(43, 1, OSD_POOLRESEND)
137f179d3baSIlya Dryomov DEFINE_CEPH_FEATURE(44, 1, ERASURE_CODE_PLUGINS_V2)
138f179d3baSIlya Dryomov DEFINE_CEPH_FEATURE_RETIRED(45, 1, OSD_SET_ALLOC_HINT, JEWEL, LUMINOUS)
139f179d3baSIlya Dryomov 
140f179d3baSIlya Dryomov DEFINE_CEPH_FEATURE(46, 1, OSD_FADVISE_FLAGS)
141f179d3baSIlya Dryomov DEFINE_CEPH_FEATURE_RETIRED(46, 1, OSD_REPOP, JEWEL, LUMINOUS) // overlap
142f179d3baSIlya Dryomov DEFINE_CEPH_FEATURE_RETIRED(46, 1, OSD_OBJECT_DIGEST, JEWEL, LUMINOUS) // overlap
143f179d3baSIlya Dryomov DEFINE_CEPH_FEATURE_RETIRED(46, 1, OSD_TRANSACTION_MAY_LAYOUT, JEWEL, LUMINOUS) // overlap
144f179d3baSIlya Dryomov 
145f179d3baSIlya Dryomov DEFINE_CEPH_FEATURE(47, 1, MDS_QUOTA)
146f179d3baSIlya Dryomov DEFINE_CEPH_FEATURE(48, 1, CRUSH_V4)
147f179d3baSIlya Dryomov DEFINE_CEPH_FEATURE_RETIRED(49, 1, OSD_MIN_SIZE_RECOVERY, JEWEL, LUMINOUS)
148f179d3baSIlya Dryomov DEFINE_CEPH_FEATURE_RETIRED(49, 1, OSD_PROXY_FEATURES, JEWEL, LUMINOUS) // overlap
149f179d3baSIlya Dryomov 
150f179d3baSIlya Dryomov DEFINE_CEPH_FEATURE(50, 1, MON_METADATA)
151f179d3baSIlya Dryomov DEFINE_CEPH_FEATURE(51, 1, OSD_BITWISE_HOBJ_SORT)
152f179d3baSIlya Dryomov DEFINE_CEPH_FEATURE(52, 1, OSD_PROXY_WRITE_FEATURES)
153f179d3baSIlya Dryomov DEFINE_CEPH_FEATURE(53, 1, ERASURE_CODE_PLUGINS_V3)
154f179d3baSIlya Dryomov DEFINE_CEPH_FEATURE(54, 1, OSD_HITSET_GMT)
155f179d3baSIlya Dryomov DEFINE_CEPH_FEATURE(55, 1, HAMMER_0_94_4)
156f179d3baSIlya Dryomov DEFINE_CEPH_FEATURE(56, 1, NEW_OSDOP_ENCODING)
157f179d3baSIlya Dryomov DEFINE_CEPH_FEATURE(57, 1, MON_STATEFUL_SUB)
158f179d3baSIlya Dryomov DEFINE_CEPH_FEATURE(57, 1, MON_ROUTE_OSDMAP) // overlap
159f179d3baSIlya Dryomov DEFINE_CEPH_FEATURE(57, 1, OSDSUBOP_NO_SNAPCONTEXT) // overlap
160f179d3baSIlya Dryomov DEFINE_CEPH_FEATURE(57, 1, SERVER_JEWEL) // overlap
161f179d3baSIlya Dryomov DEFINE_CEPH_FEATURE(58, 1, CRUSH_TUNABLES5)
162f179d3baSIlya Dryomov DEFINE_CEPH_FEATURE(58, 1, NEW_OSDOPREPLY_ENCODING) // overlap
163f179d3baSIlya Dryomov DEFINE_CEPH_FEATURE(58, 1, FS_FILE_LAYOUT_V2) // overlap
164f179d3baSIlya Dryomov DEFINE_CEPH_FEATURE(59, 1, FS_BTIME)
165f179d3baSIlya Dryomov DEFINE_CEPH_FEATURE(59, 1, FS_CHANGE_ATTR) // overlap
166f179d3baSIlya Dryomov DEFINE_CEPH_FEATURE(59, 1, MSG_ADDR2) // overlap
167f179d3baSIlya Dryomov DEFINE_CEPH_FEATURE(60, 1, BLKIN_TRACING)  // *do not share this bit*
168f179d3baSIlya Dryomov 
169f179d3baSIlya Dryomov DEFINE_CEPH_FEATURE(61, 1, RESERVED2)          // unused, but slow down!
170f179d3baSIlya Dryomov DEFINE_CEPH_FEATURE(62, 1, RESERVED)           // do not use; used as a sentinal
171f179d3baSIlya Dryomov DEFINE_CEPH_FEATURE_DEPRECATED(63, 1, RESERVED_BROKEN, LUMINOUS) // client-facing
172f179d3baSIlya Dryomov 
1732b3e0c90SIlya Dryomov 
1741fe60e51SSage Weil /*
1751fe60e51SSage Weil  * Features supported.
1761fe60e51SSage Weil  */
1771fe60e51SSage Weil #define CEPH_FEATURES_SUPPORTED_DEFAULT		\
178546f04efSSage Weil 	(CEPH_FEATURE_NOSRCADDR |		\
17974da4a0fSIlya Dryomov 	 CEPH_FEATURE_FLOCK |			\
18082dcabadSIlya Dryomov 	 CEPH_FEATURE_SUBSCRIBE2 |		\
1813a23083bSSage Weil 	 CEPH_FEATURE_RECONNECT_SEQ |		\
18274da4a0fSIlya Dryomov 	 CEPH_FEATURE_DIRLAYOUTHASH |		\
1834f6a7e5eSSage Weil 	 CEPH_FEATURE_PGID64 |			\
1844f6a7e5eSSage Weil 	 CEPH_FEATURE_PGPOOL3 |			\
1854f6a7e5eSSage Weil 	 CEPH_FEATURE_OSDENC |			\
1866e8575faSSam Lang 	 CEPH_FEATURE_CRUSH_TUNABLES |		\
18733d07337SYan, Zheng 	 CEPH_FEATURE_MSG_AUTH |		\
1881604f488SJim Schutt 	 CEPH_FEATURE_CRUSH_TUNABLES2 |		\
18983ca14fdSSage Weil 	 CEPH_FEATURE_REPLY_CREATE_INODE |	\
19074da4a0fSIlya Dryomov 	 CEPH_FEATURE_MDSENC |			\
191cdff4991SIlya Dryomov 	 CEPH_FEATURE_OSDHASHPSPOOL |		\
19280e163a5SIlya Dryomov 	 CEPH_FEATURE_OSD_CACHEPOOL |		\
19380213a84SYan, Zheng 	 CEPH_FEATURE_CRUSH_V2 |		\
19407bd7de4SIlya Dryomov 	 CEPH_FEATURE_EXPORT_PEER |		\
195ddf3a21aSIlya Dryomov 	 CEPH_FEATURE_OSDMAP_ENC |		\
19674da4a0fSIlya Dryomov 	 CEPH_FEATURE_MDS_INLINE_DATA |		\
19718cb95afSIlya Dryomov 	 CEPH_FEATURE_CRUSH_TUNABLES3 |		\
1987c1c4747SIlya Dryomov 	 CEPH_FEATURE_OSD_PRIMARY_AFFINITY |	\
199335c2585SIlya Dryomov 	 CEPH_FEATURE_MSGR_KEEPALIVE2 |		\
2002d7522e0SIlya Dryomov 	 CEPH_FEATURE_OSD_POOLRESEND |		\
20197db9a88SIlya Dryomov 	 CEPH_FEATURE_CRUSH_V4 |		\
202b0b31a8fSIlya Dryomov 	 CEPH_FEATURE_CRUSH_TUNABLES5 |		\
203b0b31a8fSIlya Dryomov 	 CEPH_FEATURE_NEW_OSDOPREPLY_ENCODING)
2041fe60e51SSage Weil 
2051fe60e51SSage Weil #define CEPH_FEATURES_REQUIRED_DEFAULT   \
2064f6a7e5eSSage Weil 	(CEPH_FEATURE_NOSRCADDR |	 \
20782dcabadSIlya Dryomov 	 CEPH_FEATURE_SUBSCRIBE2 |	 \
2083a23083bSSage Weil 	 CEPH_FEATURE_RECONNECT_SEQ |	 \
2094f6a7e5eSSage Weil 	 CEPH_FEATURE_PGID64 |		 \
2104f6a7e5eSSage Weil 	 CEPH_FEATURE_PGPOOL3 |		 \
2114f6a7e5eSSage Weil 	 CEPH_FEATURE_OSDENC)
2122b3e0c90SIlya Dryomov 
2131fe60e51SSage Weil #endif
214