1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef __CEPH_FEATURES
3 #define __CEPH_FEATURES
4 
5 /*
6  * Each time we reclaim bits for reuse we need to specify another bit
7  * that, if present, indicates we have the new incarnation of that
8  * feature.  Base case is 1 (first use).
9  */
10 #define CEPH_FEATURE_INCARNATION_1 (0ull)
11 #define CEPH_FEATURE_INCARNATION_2 (1ull<<57) // CEPH_FEATURE_SERVER_JEWEL
12 
13 #define DEFINE_CEPH_FEATURE(bit, incarnation, name)			\
14 	static const uint64_t CEPH_FEATURE_##name = (1ULL<<bit);		\
15 	static const uint64_t CEPH_FEATUREMASK_##name =			\
16 		(1ULL<<bit | CEPH_FEATURE_INCARNATION_##incarnation);
17 
18 /* this bit is ignored but still advertised by release *when* */
19 #define DEFINE_CEPH_FEATURE_DEPRECATED(bit, incarnation, name, when) \
20 	static const uint64_t DEPRECATED_CEPH_FEATURE_##name = (1ULL<<bit); \
21 	static const uint64_t DEPRECATED_CEPH_FEATUREMASK_##name =		\
22 		(1ULL<<bit | CEPH_FEATURE_INCARNATION_##incarnation);
23 
24 /*
25  * this bit is ignored by release *unused* and not advertised by
26  * release *unadvertised*
27  */
28 #define DEFINE_CEPH_FEATURE_RETIRED(bit, inc, name, unused, unadvertised)
29 
30 
31 /*
32  * test for a feature.  this test is safer than a typical mask against
33  * the bit because it ensures that we have the bit AND the marker for the
34  * bit's incarnation.  this must be used in any case where the features
35  * bits may include an old meaning of the bit.
36  */
37 #define CEPH_HAVE_FEATURE(x, name)			\
38 	(((x) & (CEPH_FEATUREMASK_##name)) == (CEPH_FEATUREMASK_##name))
39 
40 
41 /*
42  * Notes on deprecation:
43  *
44  * A *major* release is a release through which all upgrades must pass
45  * (e.g., jewel).  For example, no pre-jewel server will ever talk to
46  * a post-jewel server (mon, osd, etc).
47  *
48  * For feature bits used *only* on the server-side:
49  *
50  *  - In the first phase we indicate that a feature is DEPRECATED as of
51  *    a particular release.  This is the first major release X (say,
52  *    jewel) that does not depend on its peers advertising the feature.
53  *    That is, it safely assumes its peers all have the feature.  We
54  *    indicate this with the DEPRECATED macro.  For example,
55  *
56  *      DEFINE_CEPH_FEATURE_DEPRECATED( 2, 1, MONCLOCKCHECK, JEWEL)
57  *
58  *    because 10.2.z (jewel) did not care if its peers advertised this
59  *    feature bit.
60  *
61  *  - In the second phase we stop advertising the the bit and call it
62  *    RETIRED.  This can normally be done in the *next* major release
63  *    following the one in which we marked the feature DEPRECATED.  In
64  *    the above example, for 12.0.z (luminous) we can say:
65  *
66  *      DEFINE_CEPH_FEATURE_RETIRED( 2, 1, MONCLOCKCHECK, JEWEL, LUMINOUS)
67  *
68  *  - The bit can be reused in the first post-luminous release, 13.0.z
69  *    (m).
70  *
71  * This ensures that no two versions who have different meanings for
72  * the bit ever speak to each other.
73  */
74 
75 DEFINE_CEPH_FEATURE( 0, 1, UID)
76 DEFINE_CEPH_FEATURE( 1, 1, NOSRCADDR)
77 DEFINE_CEPH_FEATURE_RETIRED( 2, 1, MONCLOCKCHECK, JEWEL, LUMINOUS)
78 
79 DEFINE_CEPH_FEATURE( 3, 1, FLOCK)
80 DEFINE_CEPH_FEATURE( 4, 1, SUBSCRIBE2)
81 DEFINE_CEPH_FEATURE( 5, 1, MONNAMES)
82 DEFINE_CEPH_FEATURE( 6, 1, RECONNECT_SEQ)
83 DEFINE_CEPH_FEATURE( 7, 1, DIRLAYOUTHASH)
84 DEFINE_CEPH_FEATURE( 8, 1, OBJECTLOCATOR)
85 DEFINE_CEPH_FEATURE( 9, 1, PGID64)
86 DEFINE_CEPH_FEATURE(10, 1, INCSUBOSDMAP)
87 DEFINE_CEPH_FEATURE(11, 1, PGPOOL3)
88 DEFINE_CEPH_FEATURE(12, 1, OSDREPLYMUX)
89 DEFINE_CEPH_FEATURE(13, 1, OSDENC)
90 DEFINE_CEPH_FEATURE_RETIRED(14, 1, OMAP, HAMMER, JEWEL)
91 DEFINE_CEPH_FEATURE(14, 2, SERVER_KRAKEN)
92 DEFINE_CEPH_FEATURE(15, 1, MONENC)
93 DEFINE_CEPH_FEATURE_RETIRED(16, 1, QUERY_T, JEWEL, LUMINOUS)
94 
95 DEFINE_CEPH_FEATURE_RETIRED(17, 1, INDEP_PG_MAP, JEWEL, LUMINOUS)
96 
97 DEFINE_CEPH_FEATURE(18, 1, CRUSH_TUNABLES)
98 DEFINE_CEPH_FEATURE_RETIRED(19, 1, CHUNKY_SCRUB, JEWEL, LUMINOUS)
99 
100 DEFINE_CEPH_FEATURE_RETIRED(20, 1, MON_NULLROUTE, JEWEL, LUMINOUS)
101 
102 DEFINE_CEPH_FEATURE_RETIRED(21, 1, MON_GV, HAMMER, JEWEL)
103 DEFINE_CEPH_FEATURE(21, 2, SERVER_LUMINOUS)
104 DEFINE_CEPH_FEATURE(21, 2, RESEND_ON_SPLIT)  // overlap
105 DEFINE_CEPH_FEATURE(21, 2, RADOS_BACKOFF)    // overlap
106 DEFINE_CEPH_FEATURE(21, 2, OSDMAP_PG_UPMAP)  // overlap
107 DEFINE_CEPH_FEATURE(21, 2, CRUSH_CHOOSE_ARGS) // overlap
108 DEFINE_CEPH_FEATURE_RETIRED(22, 1, BACKFILL_RESERVATION, JEWEL, LUMINOUS)
109 
110 DEFINE_CEPH_FEATURE(23, 1, MSG_AUTH)
111 DEFINE_CEPH_FEATURE_RETIRED(24, 1, RECOVERY_RESERVATION, JEWEL, LUNINOUS)
112 
113 DEFINE_CEPH_FEATURE(25, 1, CRUSH_TUNABLES2)
114 DEFINE_CEPH_FEATURE(26, 1, CREATEPOOLID)
115 DEFINE_CEPH_FEATURE(27, 1, REPLY_CREATE_INODE)
116 DEFINE_CEPH_FEATURE_RETIRED(28, 1, OSD_HBMSGS, HAMMER, JEWEL)
117 DEFINE_CEPH_FEATURE(28, 2, SERVER_M)
118 DEFINE_CEPH_FEATURE(29, 1, MDSENC)
119 DEFINE_CEPH_FEATURE(30, 1, OSDHASHPSPOOL)
120 DEFINE_CEPH_FEATURE(31, 1, MON_SINGLE_PAXOS)  // deprecate me
121 DEFINE_CEPH_FEATURE_RETIRED(32, 1, OSD_SNAPMAPPER, JEWEL, LUMINOUS)
122 
123 DEFINE_CEPH_FEATURE_RETIRED(33, 1, MON_SCRUB, JEWEL, LUMINOUS)
124 
125 DEFINE_CEPH_FEATURE_RETIRED(34, 1, OSD_PACKED_RECOVERY, JEWEL, LUMINOUS)
126 
127 DEFINE_CEPH_FEATURE(35, 1, OSD_CACHEPOOL)
128 DEFINE_CEPH_FEATURE(36, 1, CRUSH_V2)
129 DEFINE_CEPH_FEATURE(37, 1, EXPORT_PEER)
130 DEFINE_CEPH_FEATURE(38, 1, OSD_ERASURE_CODES)
131 DEFINE_CEPH_FEATURE(38, 1, OSD_OSD_TMAP2OMAP) // overlap
132 DEFINE_CEPH_FEATURE(39, 1, OSDMAP_ENC)
133 DEFINE_CEPH_FEATURE(40, 1, MDS_INLINE_DATA)
134 DEFINE_CEPH_FEATURE(41, 1, CRUSH_TUNABLES3)
135 DEFINE_CEPH_FEATURE(41, 1, OSD_PRIMARY_AFFINITY) // overlap
136 DEFINE_CEPH_FEATURE(42, 1, MSGR_KEEPALIVE2)
137 DEFINE_CEPH_FEATURE(43, 1, OSD_POOLRESEND)
138 DEFINE_CEPH_FEATURE(44, 1, ERASURE_CODE_PLUGINS_V2)
139 DEFINE_CEPH_FEATURE_RETIRED(45, 1, OSD_SET_ALLOC_HINT, JEWEL, LUMINOUS)
140 
141 DEFINE_CEPH_FEATURE(46, 1, OSD_FADVISE_FLAGS)
142 DEFINE_CEPH_FEATURE_RETIRED(46, 1, OSD_REPOP, JEWEL, LUMINOUS) // overlap
143 DEFINE_CEPH_FEATURE_RETIRED(46, 1, OSD_OBJECT_DIGEST, JEWEL, LUMINOUS) // overlap
144 DEFINE_CEPH_FEATURE_RETIRED(46, 1, OSD_TRANSACTION_MAY_LAYOUT, JEWEL, LUMINOUS) // overlap
145 
146 DEFINE_CEPH_FEATURE(47, 1, MDS_QUOTA)
147 DEFINE_CEPH_FEATURE(48, 1, CRUSH_V4)
148 DEFINE_CEPH_FEATURE_RETIRED(49, 1, OSD_MIN_SIZE_RECOVERY, JEWEL, LUMINOUS)
149 DEFINE_CEPH_FEATURE_RETIRED(49, 1, OSD_PROXY_FEATURES, JEWEL, LUMINOUS) // overlap
150 
151 DEFINE_CEPH_FEATURE(50, 1, MON_METADATA)
152 DEFINE_CEPH_FEATURE(51, 1, OSD_BITWISE_HOBJ_SORT)
153 DEFINE_CEPH_FEATURE(52, 1, OSD_PROXY_WRITE_FEATURES)
154 DEFINE_CEPH_FEATURE(53, 1, ERASURE_CODE_PLUGINS_V3)
155 DEFINE_CEPH_FEATURE(54, 1, OSD_HITSET_GMT)
156 DEFINE_CEPH_FEATURE(55, 1, HAMMER_0_94_4)
157 DEFINE_CEPH_FEATURE(56, 1, NEW_OSDOP_ENCODING)
158 DEFINE_CEPH_FEATURE(57, 1, MON_STATEFUL_SUB)
159 DEFINE_CEPH_FEATURE(57, 1, MON_ROUTE_OSDMAP) // overlap
160 DEFINE_CEPH_FEATURE(57, 1, OSDSUBOP_NO_SNAPCONTEXT) // overlap
161 DEFINE_CEPH_FEATURE(57, 1, SERVER_JEWEL) // overlap
162 DEFINE_CEPH_FEATURE(58, 1, CRUSH_TUNABLES5)
163 DEFINE_CEPH_FEATURE(58, 1, NEW_OSDOPREPLY_ENCODING) // overlap
164 DEFINE_CEPH_FEATURE(58, 1, FS_FILE_LAYOUT_V2) // overlap
165 DEFINE_CEPH_FEATURE(59, 1, FS_BTIME)
166 DEFINE_CEPH_FEATURE(59, 1, FS_CHANGE_ATTR) // overlap
167 DEFINE_CEPH_FEATURE(59, 1, MSG_ADDR2) // overlap
168 DEFINE_CEPH_FEATURE(60, 1, OSD_RECOVERY_DELETES) // *do not share this bit*
169 DEFINE_CEPH_FEATURE(61, 1, CEPHX_V2)             // *do not share this bit*
170 
171 DEFINE_CEPH_FEATURE(62, 1, RESERVED)           // do not use; used as a sentinal
172 DEFINE_CEPH_FEATURE_DEPRECATED(63, 1, RESERVED_BROKEN, LUMINOUS) // client-facing
173 
174 
175 /*
176  * Features supported.
177  */
178 #define CEPH_FEATURES_SUPPORTED_DEFAULT		\
179 	(CEPH_FEATURE_NOSRCADDR |		\
180 	 CEPH_FEATURE_FLOCK |			\
181 	 CEPH_FEATURE_SUBSCRIBE2 |		\
182 	 CEPH_FEATURE_RECONNECT_SEQ |		\
183 	 CEPH_FEATURE_DIRLAYOUTHASH |		\
184 	 CEPH_FEATURE_PGID64 |			\
185 	 CEPH_FEATURE_PGPOOL3 |			\
186 	 CEPH_FEATURE_OSDENC |			\
187 	 CEPH_FEATURE_CRUSH_TUNABLES |		\
188 	 CEPH_FEATURE_SERVER_LUMINOUS |		\
189 	 CEPH_FEATURE_RESEND_ON_SPLIT |		\
190 	 CEPH_FEATURE_RADOS_BACKOFF |		\
191 	 CEPH_FEATURE_OSDMAP_PG_UPMAP |		\
192 	 CEPH_FEATURE_CRUSH_CHOOSE_ARGS |	\
193 	 CEPH_FEATURE_MSG_AUTH |		\
194 	 CEPH_FEATURE_CRUSH_TUNABLES2 |		\
195 	 CEPH_FEATURE_REPLY_CREATE_INODE |	\
196 	 CEPH_FEATURE_MDSENC |			\
197 	 CEPH_FEATURE_OSDHASHPSPOOL |		\
198 	 CEPH_FEATURE_OSD_CACHEPOOL |		\
199 	 CEPH_FEATURE_CRUSH_V2 |		\
200 	 CEPH_FEATURE_EXPORT_PEER |		\
201 	 CEPH_FEATURE_OSDMAP_ENC |		\
202 	 CEPH_FEATURE_MDS_INLINE_DATA |		\
203 	 CEPH_FEATURE_CRUSH_TUNABLES3 |		\
204 	 CEPH_FEATURE_OSD_PRIMARY_AFFINITY |	\
205 	 CEPH_FEATURE_MSGR_KEEPALIVE2 |		\
206 	 CEPH_FEATURE_OSD_POOLRESEND |		\
207 	 CEPH_FEATURE_MDS_QUOTA |		\
208 	 CEPH_FEATURE_CRUSH_V4 |		\
209 	 CEPH_FEATURE_NEW_OSDOP_ENCODING |	\
210 	 CEPH_FEATURE_SERVER_JEWEL |		\
211 	 CEPH_FEATURE_MON_STATEFUL_SUB |	\
212 	 CEPH_FEATURE_CRUSH_TUNABLES5 |		\
213 	 CEPH_FEATURE_NEW_OSDOPREPLY_ENCODING |	\
214 	 CEPH_FEATURE_CEPHX_V2)
215 
216 #define CEPH_FEATURES_REQUIRED_DEFAULT   \
217 	(CEPH_FEATURE_NOSRCADDR |	 \
218 	 CEPH_FEATURE_SUBSCRIBE2 |	 \
219 	 CEPH_FEATURE_RECONNECT_SEQ |	 \
220 	 CEPH_FEATURE_PGID64 |		 \
221 	 CEPH_FEATURE_PGPOOL3 |		 \
222 	 CEPH_FEATURE_OSDENC)
223 
224 #endif
225