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