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 */
662b3e0c90SIlya Dryomov 
672b3e0c90SIlya Dryomov /*
682b3e0c90SIlya Dryomov  * The introduction of CEPH_FEATURE_OSD_SNAPMAPPER caused the feature
692b3e0c90SIlya Dryomov  * vector to evaluate to 64 bit ~0.  To cope, we designate 1ULL << 63
702b3e0c90SIlya Dryomov  * to mean 33 bit ~0, and introduce a helper below to do the
712b3e0c90SIlya Dryomov  * translation.
722b3e0c90SIlya Dryomov  *
732b3e0c90SIlya Dryomov  * This was introduced by ceph.git commit
742b3e0c90SIlya Dryomov  *   9ea02b84104045c2ffd7e7f4e7af512953855ecd v0.58-657-g9ea02b8
752b3e0c90SIlya Dryomov  * and fixed by ceph.git commit
762b3e0c90SIlya Dryomov  *   4255b5c2fb54ae40c53284b3ab700fdfc7e61748 v0.65-263-g4255b5c
772b3e0c90SIlya Dryomov  */
782b3e0c90SIlya Dryomov #define CEPH_FEATURE_RESERVED (1ULL<<63)
792b3e0c90SIlya Dryomov 
802b3e0c90SIlya Dryomov static inline u64 ceph_sanitize_features(u64 features)
812b3e0c90SIlya Dryomov {
822b3e0c90SIlya Dryomov 	if (features & CEPH_FEATURE_RESERVED) {
832b3e0c90SIlya Dryomov 		/* everything through OSD_SNAPMAPPER */
842b3e0c90SIlya Dryomov 		return 0x1ffffffffull;
852b3e0c90SIlya Dryomov 	} else {
862b3e0c90SIlya Dryomov 		return features;
872b3e0c90SIlya Dryomov 	}
882b3e0c90SIlya Dryomov }
891fe60e51SSage Weil 
901fe60e51SSage Weil /*
911fe60e51SSage Weil  * Features supported.
921fe60e51SSage Weil  */
931fe60e51SSage Weil #define CEPH_FEATURES_SUPPORTED_DEFAULT		\
94546f04efSSage Weil 	(CEPH_FEATURE_NOSRCADDR |		\
953a23083bSSage Weil 	 CEPH_FEATURE_RECONNECT_SEQ |		\
964f6a7e5eSSage Weil 	 CEPH_FEATURE_PGID64 |			\
974f6a7e5eSSage Weil 	 CEPH_FEATURE_PGPOOL3 |			\
984f6a7e5eSSage Weil 	 CEPH_FEATURE_OSDENC |			\
996e8575faSSam Lang 	 CEPH_FEATURE_CRUSH_TUNABLES |		\
10033d07337SYan, Zheng 	 CEPH_FEATURE_MSG_AUTH |		\
1011604f488SJim Schutt 	 CEPH_FEATURE_CRUSH_TUNABLES2 |		\
10283ca14fdSSage Weil 	 CEPH_FEATURE_REPLY_CREATE_INODE |	\
103cdff4991SIlya Dryomov 	 CEPH_FEATURE_OSDHASHPSPOOL |		\
10480e163a5SIlya Dryomov 	 CEPH_FEATURE_OSD_CACHEPOOL |		\
10580213a84SYan, Zheng 	 CEPH_FEATURE_CRUSH_V2 |		\
10607bd7de4SIlya Dryomov 	 CEPH_FEATURE_EXPORT_PEER |		\
107ddf3a21aSIlya Dryomov 	 CEPH_FEATURE_OSDMAP_ENC |		\
10818cb95afSIlya Dryomov 	 CEPH_FEATURE_CRUSH_TUNABLES3 |		\
1097c1c4747SIlya Dryomov 	 CEPH_FEATURE_OSD_PRIMARY_AFFINITY |	\
110335c2585SIlya Dryomov 	 CEPH_FEATURE_MSGR_KEEPALIVE2 |		\
1117c1c4747SIlya Dryomov 	 CEPH_FEATURE_CRUSH_V4)
1121fe60e51SSage Weil 
1131fe60e51SSage Weil #define CEPH_FEATURES_REQUIRED_DEFAULT   \
1144f6a7e5eSSage Weil 	(CEPH_FEATURE_NOSRCADDR |	 \
1153a23083bSSage Weil 	 CEPH_FEATURE_RECONNECT_SEQ |	 \
1164f6a7e5eSSage Weil 	 CEPH_FEATURE_PGID64 |		 \
1174f6a7e5eSSage Weil 	 CEPH_FEATURE_PGPOOL3 |		 \
1184f6a7e5eSSage Weil 	 CEPH_FEATURE_OSDENC)
1192b3e0c90SIlya Dryomov 
1201fe60e51SSage Weil #endif
121