11fe60e51SSage Weil #ifndef __CEPH_FEATURES
21fe60e51SSage Weil #define __CEPH_FEATURES
31fe60e51SSage Weil 
41fe60e51SSage Weil /*
51fe60e51SSage Weil  * feature bits
61fe60e51SSage Weil  */
72b3e0c90SIlya Dryomov #define CEPH_FEATURE_UID            (1ULL<<0)
82b3e0c90SIlya Dryomov #define CEPH_FEATURE_NOSRCADDR      (1ULL<<1)
92b3e0c90SIlya Dryomov #define CEPH_FEATURE_MONCLOCKCHECK  (1ULL<<2)
102b3e0c90SIlya Dryomov #define CEPH_FEATURE_FLOCK          (1ULL<<3)
112b3e0c90SIlya Dryomov #define CEPH_FEATURE_SUBSCRIBE2     (1ULL<<4)
122b3e0c90SIlya Dryomov #define CEPH_FEATURE_MONNAMES       (1ULL<<5)
132b3e0c90SIlya Dryomov #define CEPH_FEATURE_RECONNECT_SEQ  (1ULL<<6)
142b3e0c90SIlya Dryomov #define CEPH_FEATURE_DIRLAYOUTHASH  (1ULL<<7)
152b3e0c90SIlya Dryomov #define CEPH_FEATURE_OBJECTLOCATOR  (1ULL<<8)
162b3e0c90SIlya Dryomov #define CEPH_FEATURE_PGID64         (1ULL<<9)
172b3e0c90SIlya Dryomov #define CEPH_FEATURE_INCSUBOSDMAP   (1ULL<<10)
182b3e0c90SIlya Dryomov #define CEPH_FEATURE_PGPOOL3        (1ULL<<11)
192b3e0c90SIlya Dryomov #define CEPH_FEATURE_OSDREPLYMUX    (1ULL<<12)
202b3e0c90SIlya Dryomov #define CEPH_FEATURE_OSDENC         (1ULL<<13)
212b3e0c90SIlya Dryomov #define CEPH_FEATURE_OMAP           (1ULL<<14)
222b3e0c90SIlya Dryomov #define CEPH_FEATURE_MONENC         (1ULL<<15)
232b3e0c90SIlya Dryomov #define CEPH_FEATURE_QUERY_T        (1ULL<<16)
242b3e0c90SIlya Dryomov #define CEPH_FEATURE_INDEP_PG_MAP   (1ULL<<17)
252b3e0c90SIlya Dryomov #define CEPH_FEATURE_CRUSH_TUNABLES (1ULL<<18)
262b3e0c90SIlya Dryomov #define CEPH_FEATURE_CHUNKY_SCRUB   (1ULL<<19)
272b3e0c90SIlya Dryomov #define CEPH_FEATURE_MON_NULLROUTE  (1ULL<<20)
282b3e0c90SIlya Dryomov #define CEPH_FEATURE_MON_GV         (1ULL<<21)
292b3e0c90SIlya Dryomov #define CEPH_FEATURE_BACKFILL_RESERVATION (1ULL<<22)
302b3e0c90SIlya Dryomov #define CEPH_FEATURE_MSG_AUTH	    (1ULL<<23)
312b3e0c90SIlya Dryomov #define CEPH_FEATURE_RECOVERY_RESERVATION (1ULL<<24)
322b3e0c90SIlya Dryomov #define CEPH_FEATURE_CRUSH_TUNABLES2 (1ULL<<25)
332b3e0c90SIlya Dryomov #define CEPH_FEATURE_CREATEPOOLID   (1ULL<<26)
342b3e0c90SIlya Dryomov #define CEPH_FEATURE_REPLY_CREATE_INODE   (1ULL<<27)
352b3e0c90SIlya Dryomov #define CEPH_FEATURE_OSD_HBMSGS     (1ULL<<28)
362b3e0c90SIlya Dryomov #define CEPH_FEATURE_MDSENC         (1ULL<<29)
372b3e0c90SIlya Dryomov #define CEPH_FEATURE_OSDHASHPSPOOL  (1ULL<<30)
382b3e0c90SIlya Dryomov #define CEPH_FEATURE_MON_SINGLE_PAXOS (1ULL<<31)
392b3e0c90SIlya Dryomov #define CEPH_FEATURE_OSD_SNAPMAPPER (1ULL<<32)
402b3e0c90SIlya Dryomov #define CEPH_FEATURE_MON_SCRUB      (1ULL<<33)
412b3e0c90SIlya Dryomov #define CEPH_FEATURE_OSD_PACKED_RECOVERY (1ULL<<34)
422b3e0c90SIlya Dryomov #define CEPH_FEATURE_OSD_CACHEPOOL (1ULL<<35)
432b3e0c90SIlya Dryomov #define CEPH_FEATURE_CRUSH_V2      (1ULL<<36)  /* new indep; SET_* steps */
442b3e0c90SIlya Dryomov #define CEPH_FEATURE_EXPORT_PEER   (1ULL<<37)
452b3e0c90SIlya Dryomov #define CEPH_FEATURE_OSD_ERASURE_CODES (1ULL<<38)
4607bd7de4SIlya Dryomov #define CEPH_FEATURE_OSD_TMAP2OMAP (1ULL<<38)   /* overlap with EC */
4707bd7de4SIlya Dryomov /* The process supports new-style OSDMap encoding. Monitors also use
4807bd7de4SIlya Dryomov    this bit to determine if peers support NAK messages. */
4907bd7de4SIlya Dryomov #define CEPH_FEATURE_OSDMAP_ENC    (1ULL<<39)
5007bd7de4SIlya Dryomov #define CEPH_FEATURE_MDS_INLINE_DATA     (1ULL<<40)
5107bd7de4SIlya Dryomov #define CEPH_FEATURE_CRUSH_TUNABLES3     (1ULL<<41)
5207bd7de4SIlya Dryomov #define CEPH_FEATURE_OSD_PRIMARY_AFFINITY (1ULL<<41)  /* overlap w/ tunables3 */
537c1c4747SIlya Dryomov #define CEPH_FEATURE_MSGR_KEEPALIVE2   (1ULL<<42)
547c1c4747SIlya Dryomov #define CEPH_FEATURE_OSD_POOLRESEND    (1ULL<<43)
557c1c4747SIlya Dryomov #define CEPH_FEATURE_ERASURE_CODE_PLUGINS_V2 (1ULL<<44)
567c1c4747SIlya Dryomov #define CEPH_FEATURE_OSD_SET_ALLOC_HINT (1ULL<<45)
577c1c4747SIlya Dryomov #define CEPH_FEATURE_OSD_FADVISE_FLAGS (1ULL<<46)
587c1c4747SIlya Dryomov #define CEPH_FEATURE_OSD_REPOP         (1ULL<<46)   /* overlap with fadvise */
597c1c4747SIlya Dryomov #define CEPH_FEATURE_OSD_OBJECT_DIGEST  (1ULL<<46)  /* overlap with fadvise */
607c1c4747SIlya Dryomov #define CEPH_FEATURE_OSD_TRANSACTION_MAY_LAYOUT (1ULL<<46) /* overlap w/ fadvise */
617c1c4747SIlya Dryomov #define CEPH_FEATURE_MDS_QUOTA      (1ULL<<47)
627c1c4747SIlya Dryomov #define CEPH_FEATURE_CRUSH_V4      (1ULL<<48)  /* straw2 buckets */
637c1c4747SIlya Dryomov #define CEPH_FEATURE_OSD_MIN_SIZE_RECOVERY (1ULL<<49)
647c1c4747SIlya Dryomov // duplicated since it was introduced at the same time as MIN_SIZE_RECOVERY
657c1c4747SIlya Dryomov #define CEPH_FEATURE_OSD_PROXY_FEATURES (1ULL<<49)  /* overlap w/ above */
6697db9a88SIlya Dryomov #define CEPH_FEATURE_MON_METADATA (1ULL<<50)
6797db9a88SIlya Dryomov #define CEPH_FEATURE_OSD_BITWISE_HOBJ_SORT (1ULL<<51) /* can sort objs bitwise */
6897db9a88SIlya Dryomov #define CEPH_FEATURE_OSD_PROXY_WRITE_FEATURES (1ULL<<52)
6997db9a88SIlya Dryomov #define CEPH_FEATURE_ERASURE_CODE_PLUGINS_V3 (1ULL<<53)
7097db9a88SIlya Dryomov #define CEPH_FEATURE_OSD_HITSET_GMT (1ULL<<54)
7197db9a88SIlya Dryomov #define CEPH_FEATURE_HAMMER_0_94_4 (1ULL<<55)
7297db9a88SIlya Dryomov #define CEPH_FEATURE_NEW_OSDOP_ENCODING   (1ULL<<56) /* New, v7 encoding */
7397db9a88SIlya Dryomov #define CEPH_FEATURE_MON_STATEFUL_SUB (1ULL<<57) /* stateful mon subscription */
7497db9a88SIlya Dryomov #define CEPH_FEATURE_MON_ROUTE_OSDMAP (1ULL<<57) /* peon sends osdmaps */
7597db9a88SIlya Dryomov #define CEPH_FEATURE_CRUSH_TUNABLES5	(1ULL<<58) /* chooseleaf stable mode */
76b0b31a8fSIlya Dryomov // duplicated since it was introduced at the same time as CEPH_FEATURE_CRUSH_TUNABLES5
77b0b31a8fSIlya Dryomov #define CEPH_FEATURE_NEW_OSDOPREPLY_ENCODING   (1ULL<<58) /* New, v7 encoding */
785ea5c5e0SYan, Zheng #define CEPH_FEATURE_FS_FILE_LAYOUT_V2       (1ULL<<58) /* file_layout_t */
792b3e0c90SIlya Dryomov 
802b3e0c90SIlya Dryomov /*
812b3e0c90SIlya Dryomov  * The introduction of CEPH_FEATURE_OSD_SNAPMAPPER caused the feature
822b3e0c90SIlya Dryomov  * vector to evaluate to 64 bit ~0.  To cope, we designate 1ULL << 63
832b3e0c90SIlya Dryomov  * to mean 33 bit ~0, and introduce a helper below to do the
842b3e0c90SIlya Dryomov  * translation.
852b3e0c90SIlya Dryomov  *
862b3e0c90SIlya Dryomov  * This was introduced by ceph.git commit
872b3e0c90SIlya Dryomov  *   9ea02b84104045c2ffd7e7f4e7af512953855ecd v0.58-657-g9ea02b8
882b3e0c90SIlya Dryomov  * and fixed by ceph.git commit
892b3e0c90SIlya Dryomov  *   4255b5c2fb54ae40c53284b3ab700fdfc7e61748 v0.65-263-g4255b5c
902b3e0c90SIlya Dryomov  */
912b3e0c90SIlya Dryomov #define CEPH_FEATURE_RESERVED (1ULL<<63)
922b3e0c90SIlya Dryomov 
932b3e0c90SIlya Dryomov static inline u64 ceph_sanitize_features(u64 features)
942b3e0c90SIlya Dryomov {
952b3e0c90SIlya Dryomov 	if (features & CEPH_FEATURE_RESERVED) {
962b3e0c90SIlya Dryomov 		/* everything through OSD_SNAPMAPPER */
972b3e0c90SIlya Dryomov 		return 0x1ffffffffull;
982b3e0c90SIlya Dryomov 	} else {
992b3e0c90SIlya Dryomov 		return features;
1002b3e0c90SIlya Dryomov 	}
1012b3e0c90SIlya Dryomov }
1021fe60e51SSage Weil 
1031fe60e51SSage Weil /*
1041fe60e51SSage Weil  * Features supported.
1051fe60e51SSage Weil  */
1061fe60e51SSage Weil #define CEPH_FEATURES_SUPPORTED_DEFAULT		\
107546f04efSSage Weil 	(CEPH_FEATURE_NOSRCADDR |		\
10874da4a0fSIlya Dryomov 	 CEPH_FEATURE_FLOCK |			\
10982dcabadSIlya Dryomov 	 CEPH_FEATURE_SUBSCRIBE2 |		\
1103a23083bSSage Weil 	 CEPH_FEATURE_RECONNECT_SEQ |		\
11174da4a0fSIlya Dryomov 	 CEPH_FEATURE_DIRLAYOUTHASH |		\
1124f6a7e5eSSage Weil 	 CEPH_FEATURE_PGID64 |			\
1134f6a7e5eSSage Weil 	 CEPH_FEATURE_PGPOOL3 |			\
1144f6a7e5eSSage Weil 	 CEPH_FEATURE_OSDENC |			\
1156e8575faSSam Lang 	 CEPH_FEATURE_CRUSH_TUNABLES |		\
11633d07337SYan, Zheng 	 CEPH_FEATURE_MSG_AUTH |		\
1171604f488SJim Schutt 	 CEPH_FEATURE_CRUSH_TUNABLES2 |		\
11883ca14fdSSage Weil 	 CEPH_FEATURE_REPLY_CREATE_INODE |	\
11974da4a0fSIlya Dryomov 	 CEPH_FEATURE_MDSENC |			\
120cdff4991SIlya Dryomov 	 CEPH_FEATURE_OSDHASHPSPOOL |		\
12180e163a5SIlya Dryomov 	 CEPH_FEATURE_OSD_CACHEPOOL |		\
12280213a84SYan, Zheng 	 CEPH_FEATURE_CRUSH_V2 |		\
12307bd7de4SIlya Dryomov 	 CEPH_FEATURE_EXPORT_PEER |		\
124ddf3a21aSIlya Dryomov 	 CEPH_FEATURE_OSDMAP_ENC |		\
12574da4a0fSIlya Dryomov 	 CEPH_FEATURE_MDS_INLINE_DATA |		\
12618cb95afSIlya Dryomov 	 CEPH_FEATURE_CRUSH_TUNABLES3 |		\
1277c1c4747SIlya Dryomov 	 CEPH_FEATURE_OSD_PRIMARY_AFFINITY |	\
128335c2585SIlya Dryomov 	 CEPH_FEATURE_MSGR_KEEPALIVE2 |		\
12997db9a88SIlya Dryomov 	 CEPH_FEATURE_CRUSH_V4 |		\
130b0b31a8fSIlya Dryomov 	 CEPH_FEATURE_CRUSH_TUNABLES5 |		\
131b0b31a8fSIlya Dryomov 	 CEPH_FEATURE_NEW_OSDOPREPLY_ENCODING)
1321fe60e51SSage Weil 
1331fe60e51SSage Weil #define CEPH_FEATURES_REQUIRED_DEFAULT   \
1344f6a7e5eSSage Weil 	(CEPH_FEATURE_NOSRCADDR |	 \
13582dcabadSIlya Dryomov 	 CEPH_FEATURE_SUBSCRIBE2 |	 \
1363a23083bSSage Weil 	 CEPH_FEATURE_RECONNECT_SEQ |	 \
1374f6a7e5eSSage Weil 	 CEPH_FEATURE_PGID64 |		 \
1384f6a7e5eSSage Weil 	 CEPH_FEATURE_PGPOOL3 |		 \
1394f6a7e5eSSage Weil 	 CEPH_FEATURE_OSDENC)
1402b3e0c90SIlya Dryomov 
1411fe60e51SSage Weil #endif
142