1b2441318SGreg Kroah-Hartman /* SPDX-License-Identifier: GPL-2.0 */
21fe60e51SSage Weil #ifndef __CEPH_FEATURES
31fe60e51SSage Weil #define __CEPH_FEATURES
41fe60e51SSage Weil 
51fe60e51SSage Weil /*
6f179d3baSIlya Dryomov  * Each time we reclaim bits for reuse we need to specify another bit
7f179d3baSIlya Dryomov  * that, if present, indicates we have the new incarnation of that
8f179d3baSIlya Dryomov  * feature.  Base case is 1 (first use).
91fe60e51SSage Weil  */
10f179d3baSIlya Dryomov #define CEPH_FEATURE_INCARNATION_1 (0ull)
11*a5cbd5fcSIlya Dryomov #define CEPH_FEATURE_INCARNATION_2 (1ull<<57)              // SERVER_JEWEL
12*a5cbd5fcSIlya Dryomov #define CEPH_FEATURE_INCARNATION_3 ((1ull<<57)|(1ull<<28)) // SERVER_MIMIC
132b3e0c90SIlya Dryomov 
14f179d3baSIlya Dryomov #define DEFINE_CEPH_FEATURE(bit, incarnation, name)			\
15f062f025SIlya Dryomov 	static const uint64_t __maybe_unused CEPH_FEATURE_##name = (1ULL<<bit);		\
16f062f025SIlya Dryomov 	static const uint64_t __maybe_unused CEPH_FEATUREMASK_##name =			\
17f179d3baSIlya Dryomov 		(1ULL<<bit | CEPH_FEATURE_INCARNATION_##incarnation);
18f179d3baSIlya Dryomov 
19f179d3baSIlya Dryomov /* this bit is ignored but still advertised by release *when* */
20f179d3baSIlya Dryomov #define DEFINE_CEPH_FEATURE_DEPRECATED(bit, incarnation, name, when) \
21f062f025SIlya Dryomov 	static const uint64_t __maybe_unused DEPRECATED_CEPH_FEATURE_##name = (1ULL<<bit);	\
22f062f025SIlya Dryomov 	static const uint64_t __maybe_unused DEPRECATED_CEPH_FEATUREMASK_##name =		\
23f179d3baSIlya Dryomov 		(1ULL<<bit | CEPH_FEATURE_INCARNATION_##incarnation);
24f179d3baSIlya Dryomov 
25f179d3baSIlya Dryomov /*
26f179d3baSIlya Dryomov  * this bit is ignored by release *unused* and not advertised by
27f179d3baSIlya Dryomov  * release *unadvertised*
28f179d3baSIlya Dryomov  */
29f179d3baSIlya Dryomov #define DEFINE_CEPH_FEATURE_RETIRED(bit, inc, name, unused, unadvertised)
30f179d3baSIlya Dryomov 
31f179d3baSIlya Dryomov 
32f179d3baSIlya Dryomov /*
33f179d3baSIlya Dryomov  * test for a feature.  this test is safer than a typical mask against
34f179d3baSIlya Dryomov  * the bit because it ensures that we have the bit AND the marker for the
35f179d3baSIlya Dryomov  * bit's incarnation.  this must be used in any case where the features
36f179d3baSIlya Dryomov  * bits may include an old meaning of the bit.
37f179d3baSIlya Dryomov  */
38f179d3baSIlya Dryomov #define CEPH_HAVE_FEATURE(x, name)			\
39f179d3baSIlya Dryomov 	(((x) & (CEPH_FEATUREMASK_##name)) == (CEPH_FEATUREMASK_##name))
40f179d3baSIlya Dryomov 
41f179d3baSIlya Dryomov 
42f179d3baSIlya Dryomov /*
43f179d3baSIlya Dryomov  * Notes on deprecation:
44f179d3baSIlya Dryomov  *
45f179d3baSIlya Dryomov  * A *major* release is a release through which all upgrades must pass
46f179d3baSIlya Dryomov  * (e.g., jewel).  For example, no pre-jewel server will ever talk to
47f179d3baSIlya Dryomov  * a post-jewel server (mon, osd, etc).
48f179d3baSIlya Dryomov  *
49f179d3baSIlya Dryomov  * For feature bits used *only* on the server-side:
50f179d3baSIlya Dryomov  *
51f179d3baSIlya Dryomov  *  - In the first phase we indicate that a feature is DEPRECATED as of
52f179d3baSIlya Dryomov  *    a particular release.  This is the first major release X (say,
53f179d3baSIlya Dryomov  *    jewel) that does not depend on its peers advertising the feature.
54f179d3baSIlya Dryomov  *    That is, it safely assumes its peers all have the feature.  We
55f179d3baSIlya Dryomov  *    indicate this with the DEPRECATED macro.  For example,
56f179d3baSIlya Dryomov  *
57f179d3baSIlya Dryomov  *      DEFINE_CEPH_FEATURE_DEPRECATED( 2, 1, MONCLOCKCHECK, JEWEL)
58f179d3baSIlya Dryomov  *
59f179d3baSIlya Dryomov  *    because 10.2.z (jewel) did not care if its peers advertised this
60f179d3baSIlya Dryomov  *    feature bit.
61f179d3baSIlya Dryomov  *
62f1f565a2SRandy Dunlap  *  - In the second phase we stop advertising the bit and call it
63f179d3baSIlya Dryomov  *    RETIRED.  This can normally be done in the *next* major release
64f179d3baSIlya Dryomov  *    following the one in which we marked the feature DEPRECATED.  In
65f179d3baSIlya Dryomov  *    the above example, for 12.0.z (luminous) we can say:
66f179d3baSIlya Dryomov  *
67f179d3baSIlya Dryomov  *      DEFINE_CEPH_FEATURE_RETIRED( 2, 1, MONCLOCKCHECK, JEWEL, LUMINOUS)
68f179d3baSIlya Dryomov  *
69f179d3baSIlya Dryomov  *  - The bit can be reused in the first post-luminous release, 13.0.z
70f179d3baSIlya Dryomov  *    (m).
71f179d3baSIlya Dryomov  *
72f179d3baSIlya Dryomov  * This ensures that no two versions who have different meanings for
73f179d3baSIlya Dryomov  * the bit ever speak to each other.
74f179d3baSIlya Dryomov  */
75f179d3baSIlya Dryomov 
76f179d3baSIlya Dryomov DEFINE_CEPH_FEATURE( 0, 1, UID)
77f179d3baSIlya Dryomov DEFINE_CEPH_FEATURE( 1, 1, NOSRCADDR)
78f179d3baSIlya Dryomov DEFINE_CEPH_FEATURE_RETIRED( 2, 1, MONCLOCKCHECK, JEWEL, LUMINOUS)
79*a5cbd5fcSIlya Dryomov DEFINE_CEPH_FEATURE( 2, 3, SERVER_NAUTILUS)
80f179d3baSIlya Dryomov DEFINE_CEPH_FEATURE( 3, 1, FLOCK)
81f179d3baSIlya Dryomov DEFINE_CEPH_FEATURE( 4, 1, SUBSCRIBE2)
82f179d3baSIlya Dryomov DEFINE_CEPH_FEATURE( 5, 1, MONNAMES)
83f179d3baSIlya Dryomov DEFINE_CEPH_FEATURE( 6, 1, RECONNECT_SEQ)
84f179d3baSIlya Dryomov DEFINE_CEPH_FEATURE( 7, 1, DIRLAYOUTHASH)
85f179d3baSIlya Dryomov DEFINE_CEPH_FEATURE( 8, 1, OBJECTLOCATOR)
86f179d3baSIlya Dryomov DEFINE_CEPH_FEATURE( 9, 1, PGID64)
87f179d3baSIlya Dryomov DEFINE_CEPH_FEATURE(10, 1, INCSUBOSDMAP)
88f179d3baSIlya Dryomov DEFINE_CEPH_FEATURE(11, 1, PGPOOL3)
89f179d3baSIlya Dryomov DEFINE_CEPH_FEATURE(12, 1, OSDREPLYMUX)
90f179d3baSIlya Dryomov DEFINE_CEPH_FEATURE(13, 1, OSDENC)
91f179d3baSIlya Dryomov DEFINE_CEPH_FEATURE_RETIRED(14, 1, OMAP, HAMMER, JEWEL)
92f179d3baSIlya Dryomov DEFINE_CEPH_FEATURE(14, 2, SERVER_KRAKEN)
93f179d3baSIlya Dryomov DEFINE_CEPH_FEATURE(15, 1, MONENC)
94f179d3baSIlya Dryomov DEFINE_CEPH_FEATURE_RETIRED(16, 1, QUERY_T, JEWEL, LUMINOUS)
95f179d3baSIlya Dryomov 
96f179d3baSIlya Dryomov DEFINE_CEPH_FEATURE_RETIRED(17, 1, INDEP_PG_MAP, JEWEL, LUMINOUS)
97f179d3baSIlya Dryomov 
98f179d3baSIlya Dryomov DEFINE_CEPH_FEATURE(18, 1, CRUSH_TUNABLES)
99f179d3baSIlya Dryomov DEFINE_CEPH_FEATURE_RETIRED(19, 1, CHUNKY_SCRUB, JEWEL, LUMINOUS)
100f179d3baSIlya Dryomov 
101f179d3baSIlya Dryomov DEFINE_CEPH_FEATURE_RETIRED(20, 1, MON_NULLROUTE, JEWEL, LUMINOUS)
102f179d3baSIlya Dryomov 
103f179d3baSIlya Dryomov DEFINE_CEPH_FEATURE_RETIRED(21, 1, MON_GV, HAMMER, JEWEL)
104f179d3baSIlya Dryomov DEFINE_CEPH_FEATURE(21, 2, SERVER_LUMINOUS)
105f179d3baSIlya Dryomov DEFINE_CEPH_FEATURE(21, 2, RESEND_ON_SPLIT)  // overlap
106f179d3baSIlya Dryomov DEFINE_CEPH_FEATURE(21, 2, RADOS_BACKOFF)    // overlap
107f179d3baSIlya Dryomov DEFINE_CEPH_FEATURE(21, 2, OSDMAP_PG_UPMAP)  // overlap
108f179d3baSIlya Dryomov DEFINE_CEPH_FEATURE(21, 2, CRUSH_CHOOSE_ARGS) // overlap
109f179d3baSIlya Dryomov DEFINE_CEPH_FEATURE_RETIRED(22, 1, BACKFILL_RESERVATION, JEWEL, LUMINOUS)
110f179d3baSIlya Dryomov 
111f179d3baSIlya Dryomov DEFINE_CEPH_FEATURE(23, 1, MSG_AUTH)
112f179d3baSIlya Dryomov DEFINE_CEPH_FEATURE_RETIRED(24, 1, RECOVERY_RESERVATION, JEWEL, LUNINOUS)
113f179d3baSIlya Dryomov 
114f179d3baSIlya Dryomov DEFINE_CEPH_FEATURE(25, 1, CRUSH_TUNABLES2)
115f179d3baSIlya Dryomov DEFINE_CEPH_FEATURE(26, 1, CREATEPOOLID)
116f179d3baSIlya Dryomov DEFINE_CEPH_FEATURE(27, 1, REPLY_CREATE_INODE)
117f179d3baSIlya Dryomov DEFINE_CEPH_FEATURE_RETIRED(28, 1, OSD_HBMSGS, HAMMER, JEWEL)
118*a5cbd5fcSIlya Dryomov DEFINE_CEPH_FEATURE(28, 2, SERVER_MIMIC)
119f179d3baSIlya Dryomov DEFINE_CEPH_FEATURE(29, 1, MDSENC)
120f179d3baSIlya Dryomov DEFINE_CEPH_FEATURE(30, 1, OSDHASHPSPOOL)
121f179d3baSIlya Dryomov DEFINE_CEPH_FEATURE(31, 1, MON_SINGLE_PAXOS)  // deprecate me
122f179d3baSIlya Dryomov DEFINE_CEPH_FEATURE_RETIRED(32, 1, OSD_SNAPMAPPER, JEWEL, LUMINOUS)
123f179d3baSIlya Dryomov 
124f179d3baSIlya Dryomov DEFINE_CEPH_FEATURE_RETIRED(33, 1, MON_SCRUB, JEWEL, LUMINOUS)
125f179d3baSIlya Dryomov 
126f179d3baSIlya Dryomov DEFINE_CEPH_FEATURE_RETIRED(34, 1, OSD_PACKED_RECOVERY, JEWEL, LUMINOUS)
127f179d3baSIlya Dryomov 
128f179d3baSIlya Dryomov DEFINE_CEPH_FEATURE(35, 1, OSD_CACHEPOOL)
129f179d3baSIlya Dryomov DEFINE_CEPH_FEATURE(36, 1, CRUSH_V2)
130f179d3baSIlya Dryomov DEFINE_CEPH_FEATURE(37, 1, EXPORT_PEER)
131f179d3baSIlya Dryomov DEFINE_CEPH_FEATURE(38, 1, OSD_ERASURE_CODES)
132f179d3baSIlya Dryomov DEFINE_CEPH_FEATURE(38, 1, OSD_OSD_TMAP2OMAP) // overlap
133f179d3baSIlya Dryomov DEFINE_CEPH_FEATURE(39, 1, OSDMAP_ENC)
134f179d3baSIlya Dryomov DEFINE_CEPH_FEATURE(40, 1, MDS_INLINE_DATA)
135f179d3baSIlya Dryomov DEFINE_CEPH_FEATURE(41, 1, CRUSH_TUNABLES3)
136f179d3baSIlya Dryomov DEFINE_CEPH_FEATURE(41, 1, OSD_PRIMARY_AFFINITY) // overlap
137f179d3baSIlya Dryomov DEFINE_CEPH_FEATURE(42, 1, MSGR_KEEPALIVE2)
138f179d3baSIlya Dryomov DEFINE_CEPH_FEATURE(43, 1, OSD_POOLRESEND)
139f179d3baSIlya Dryomov DEFINE_CEPH_FEATURE(44, 1, ERASURE_CODE_PLUGINS_V2)
140f179d3baSIlya Dryomov DEFINE_CEPH_FEATURE_RETIRED(45, 1, OSD_SET_ALLOC_HINT, JEWEL, LUMINOUS)
141f179d3baSIlya Dryomov 
142f179d3baSIlya Dryomov DEFINE_CEPH_FEATURE(46, 1, OSD_FADVISE_FLAGS)
143f179d3baSIlya Dryomov DEFINE_CEPH_FEATURE_RETIRED(46, 1, OSD_REPOP, JEWEL, LUMINOUS) // overlap
144f179d3baSIlya Dryomov DEFINE_CEPH_FEATURE_RETIRED(46, 1, OSD_OBJECT_DIGEST, JEWEL, LUMINOUS) // overlap
145f179d3baSIlya Dryomov DEFINE_CEPH_FEATURE_RETIRED(46, 1, OSD_TRANSACTION_MAY_LAYOUT, JEWEL, LUMINOUS) // overlap
146f179d3baSIlya Dryomov 
147f179d3baSIlya Dryomov DEFINE_CEPH_FEATURE(47, 1, MDS_QUOTA)
148f179d3baSIlya Dryomov DEFINE_CEPH_FEATURE(48, 1, CRUSH_V4)
149f179d3baSIlya Dryomov DEFINE_CEPH_FEATURE_RETIRED(49, 1, OSD_MIN_SIZE_RECOVERY, JEWEL, LUMINOUS)
150f179d3baSIlya Dryomov DEFINE_CEPH_FEATURE_RETIRED(49, 1, OSD_PROXY_FEATURES, JEWEL, LUMINOUS) // overlap
151f179d3baSIlya Dryomov 
152f179d3baSIlya Dryomov DEFINE_CEPH_FEATURE(50, 1, MON_METADATA)
153f179d3baSIlya Dryomov DEFINE_CEPH_FEATURE(51, 1, OSD_BITWISE_HOBJ_SORT)
154f179d3baSIlya Dryomov DEFINE_CEPH_FEATURE(52, 1, OSD_PROXY_WRITE_FEATURES)
155f179d3baSIlya Dryomov DEFINE_CEPH_FEATURE(53, 1, ERASURE_CODE_PLUGINS_V3)
156f179d3baSIlya Dryomov DEFINE_CEPH_FEATURE(54, 1, OSD_HITSET_GMT)
157f179d3baSIlya Dryomov DEFINE_CEPH_FEATURE(55, 1, HAMMER_0_94_4)
158f179d3baSIlya Dryomov DEFINE_CEPH_FEATURE(56, 1, NEW_OSDOP_ENCODING)
159f179d3baSIlya Dryomov DEFINE_CEPH_FEATURE(57, 1, MON_STATEFUL_SUB)
160f179d3baSIlya Dryomov DEFINE_CEPH_FEATURE(57, 1, MON_ROUTE_OSDMAP) // overlap
161f179d3baSIlya Dryomov DEFINE_CEPH_FEATURE(57, 1, OSDSUBOP_NO_SNAPCONTEXT) // overlap
162f179d3baSIlya Dryomov DEFINE_CEPH_FEATURE(57, 1, SERVER_JEWEL) // overlap
163f179d3baSIlya Dryomov DEFINE_CEPH_FEATURE(58, 1, CRUSH_TUNABLES5)
164f179d3baSIlya Dryomov DEFINE_CEPH_FEATURE(58, 1, NEW_OSDOPREPLY_ENCODING) // overlap
165f179d3baSIlya Dryomov DEFINE_CEPH_FEATURE(58, 1, FS_FILE_LAYOUT_V2) // overlap
166f179d3baSIlya Dryomov DEFINE_CEPH_FEATURE(59, 1, FS_BTIME)
167f179d3baSIlya Dryomov DEFINE_CEPH_FEATURE(59, 1, FS_CHANGE_ATTR) // overlap
168f179d3baSIlya Dryomov DEFINE_CEPH_FEATURE(59, 1, MSG_ADDR2) // overlap
169cc255c76SIlya Dryomov DEFINE_CEPH_FEATURE(60, 1, OSD_RECOVERY_DELETES) // *do not share this bit*
170cc255c76SIlya Dryomov DEFINE_CEPH_FEATURE(61, 1, CEPHX_V2)             // *do not share this bit*
171f179d3baSIlya Dryomov 
172f179d3baSIlya Dryomov DEFINE_CEPH_FEATURE(62, 1, RESERVED)           // do not use; used as a sentinal
173f179d3baSIlya Dryomov DEFINE_CEPH_FEATURE_DEPRECATED(63, 1, RESERVED_BROKEN, LUMINOUS) // client-facing
174f179d3baSIlya Dryomov 
1752b3e0c90SIlya Dryomov 
1761fe60e51SSage Weil /*
1771fe60e51SSage Weil  * Features supported.
1781fe60e51SSage Weil  */
1791fe60e51SSage Weil #define CEPH_FEATURES_SUPPORTED_DEFAULT		\
180546f04efSSage Weil 	(CEPH_FEATURE_NOSRCADDR |		\
181*a5cbd5fcSIlya Dryomov 	 CEPH_FEATURE_SERVER_NAUTILUS |		\
18274da4a0fSIlya Dryomov 	 CEPH_FEATURE_FLOCK |			\
18382dcabadSIlya Dryomov 	 CEPH_FEATURE_SUBSCRIBE2 |		\
184*a5cbd5fcSIlya Dryomov 	 CEPH_FEATURE_MONNAMES |		\
1853a23083bSSage Weil 	 CEPH_FEATURE_RECONNECT_SEQ |		\
18674da4a0fSIlya Dryomov 	 CEPH_FEATURE_DIRLAYOUTHASH |		\
1874f6a7e5eSSage Weil 	 CEPH_FEATURE_PGID64 |			\
1884f6a7e5eSSage Weil 	 CEPH_FEATURE_PGPOOL3 |			\
1894f6a7e5eSSage Weil 	 CEPH_FEATURE_OSDENC |			\
190*a5cbd5fcSIlya Dryomov 	 CEPH_FEATURE_MONENC |			\
1916e8575faSSam Lang 	 CEPH_FEATURE_CRUSH_TUNABLES |		\
19233e9c8dbSIlya Dryomov 	 CEPH_FEATURE_SERVER_LUMINOUS |		\
19333e9c8dbSIlya Dryomov 	 CEPH_FEATURE_RESEND_ON_SPLIT |		\
19433e9c8dbSIlya Dryomov 	 CEPH_FEATURE_RADOS_BACKOFF |		\
19533e9c8dbSIlya Dryomov 	 CEPH_FEATURE_OSDMAP_PG_UPMAP |		\
19633e9c8dbSIlya Dryomov 	 CEPH_FEATURE_CRUSH_CHOOSE_ARGS |	\
19733d07337SYan, Zheng 	 CEPH_FEATURE_MSG_AUTH |		\
1981604f488SJim Schutt 	 CEPH_FEATURE_CRUSH_TUNABLES2 |		\
19983ca14fdSSage Weil 	 CEPH_FEATURE_REPLY_CREATE_INODE |	\
200*a5cbd5fcSIlya Dryomov 	 CEPH_FEATURE_SERVER_MIMIC |		\
20174da4a0fSIlya Dryomov 	 CEPH_FEATURE_MDSENC |			\
202cdff4991SIlya Dryomov 	 CEPH_FEATURE_OSDHASHPSPOOL |		\
20380e163a5SIlya Dryomov 	 CEPH_FEATURE_OSD_CACHEPOOL |		\
20480213a84SYan, Zheng 	 CEPH_FEATURE_CRUSH_V2 |		\
20507bd7de4SIlya Dryomov 	 CEPH_FEATURE_EXPORT_PEER |		\
206ddf3a21aSIlya Dryomov 	 CEPH_FEATURE_OSDMAP_ENC |		\
20774da4a0fSIlya Dryomov 	 CEPH_FEATURE_MDS_INLINE_DATA |		\
20818cb95afSIlya Dryomov 	 CEPH_FEATURE_CRUSH_TUNABLES3 |		\
2097c1c4747SIlya Dryomov 	 CEPH_FEATURE_OSD_PRIMARY_AFFINITY |	\
210335c2585SIlya Dryomov 	 CEPH_FEATURE_MSGR_KEEPALIVE2 |		\
2112d7522e0SIlya Dryomov 	 CEPH_FEATURE_OSD_POOLRESEND |		\
212fb18a575SLuis Henriques 	 CEPH_FEATURE_MDS_QUOTA |		\
21397db9a88SIlya Dryomov 	 CEPH_FEATURE_CRUSH_V4 |		\
21433e9c8dbSIlya Dryomov 	 CEPH_FEATURE_NEW_OSDOP_ENCODING |	\
215220abf5aSIlya Dryomov 	 CEPH_FEATURE_SERVER_JEWEL |		\
216220abf5aSIlya Dryomov 	 CEPH_FEATURE_MON_STATEFUL_SUB |	\
217b0b31a8fSIlya Dryomov 	 CEPH_FEATURE_CRUSH_TUNABLES5 |		\
218cc255c76SIlya Dryomov 	 CEPH_FEATURE_NEW_OSDOPREPLY_ENCODING |	\
2196adaaafdSJeff Layton 	 CEPH_FEATURE_MSG_ADDR2 |		\
220cc255c76SIlya Dryomov 	 CEPH_FEATURE_CEPHX_V2)
2211fe60e51SSage Weil 
22223c625ceSIlya Dryomov #define CEPH_FEATURES_REQUIRED_DEFAULT	0
2232b3e0c90SIlya Dryomov 
2241fe60e51SSage Weil #endif
225