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