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 */
532b3e0c90SIlya Dryomov 
542b3e0c90SIlya Dryomov /*
552b3e0c90SIlya Dryomov  * The introduction of CEPH_FEATURE_OSD_SNAPMAPPER caused the feature
562b3e0c90SIlya Dryomov  * vector to evaluate to 64 bit ~0.  To cope, we designate 1ULL << 63
572b3e0c90SIlya Dryomov  * to mean 33 bit ~0, and introduce a helper below to do the
582b3e0c90SIlya Dryomov  * translation.
592b3e0c90SIlya Dryomov  *
602b3e0c90SIlya Dryomov  * This was introduced by ceph.git commit
612b3e0c90SIlya Dryomov  *   9ea02b84104045c2ffd7e7f4e7af512953855ecd v0.58-657-g9ea02b8
622b3e0c90SIlya Dryomov  * and fixed by ceph.git commit
632b3e0c90SIlya Dryomov  *   4255b5c2fb54ae40c53284b3ab700fdfc7e61748 v0.65-263-g4255b5c
642b3e0c90SIlya Dryomov  */
652b3e0c90SIlya Dryomov #define CEPH_FEATURE_RESERVED (1ULL<<63)
662b3e0c90SIlya Dryomov 
672b3e0c90SIlya Dryomov static inline u64 ceph_sanitize_features(u64 features)
682b3e0c90SIlya Dryomov {
692b3e0c90SIlya Dryomov 	if (features & CEPH_FEATURE_RESERVED) {
702b3e0c90SIlya Dryomov 		/* everything through OSD_SNAPMAPPER */
712b3e0c90SIlya Dryomov 		return 0x1ffffffffull;
722b3e0c90SIlya Dryomov 	} else {
732b3e0c90SIlya Dryomov 		return features;
742b3e0c90SIlya Dryomov 	}
752b3e0c90SIlya Dryomov }
761fe60e51SSage Weil 
771fe60e51SSage Weil /*
781fe60e51SSage Weil  * Features supported.
791fe60e51SSage Weil  */
801fe60e51SSage Weil #define CEPH_FEATURES_SUPPORTED_DEFAULT		\
81546f04efSSage Weil 	(CEPH_FEATURE_NOSRCADDR |		\
823a23083bSSage Weil 	 CEPH_FEATURE_RECONNECT_SEQ |		\
834f6a7e5eSSage Weil 	 CEPH_FEATURE_PGID64 |			\
844f6a7e5eSSage Weil 	 CEPH_FEATURE_PGPOOL3 |			\
854f6a7e5eSSage Weil 	 CEPH_FEATURE_OSDENC |			\
866e8575faSSam Lang 	 CEPH_FEATURE_CRUSH_TUNABLES |		\
871604f488SJim Schutt 	 CEPH_FEATURE_CRUSH_TUNABLES2 |		\
8883ca14fdSSage Weil 	 CEPH_FEATURE_REPLY_CREATE_INODE |	\
89cdff4991SIlya Dryomov 	 CEPH_FEATURE_OSDHASHPSPOOL |		\
9080e163a5SIlya Dryomov 	 CEPH_FEATURE_OSD_CACHEPOOL |		\
9180213a84SYan, Zheng 	 CEPH_FEATURE_CRUSH_V2 |		\
9207bd7de4SIlya Dryomov 	 CEPH_FEATURE_EXPORT_PEER |		\
93ddf3a21aSIlya Dryomov 	 CEPH_FEATURE_OSDMAP_ENC |		\
9407bd7de4SIlya Dryomov 	 CEPH_FEATURE_CRUSH_TUNABLES3)
951fe60e51SSage Weil 
961fe60e51SSage Weil #define CEPH_FEATURES_REQUIRED_DEFAULT   \
974f6a7e5eSSage Weil 	(CEPH_FEATURE_NOSRCADDR |	 \
983a23083bSSage Weil 	 CEPH_FEATURE_RECONNECT_SEQ |	 \
994f6a7e5eSSage Weil 	 CEPH_FEATURE_PGID64 |		 \
1004f6a7e5eSSage Weil 	 CEPH_FEATURE_PGPOOL3 |		 \
1014f6a7e5eSSage Weil 	 CEPH_FEATURE_OSDENC)
1022b3e0c90SIlya Dryomov 
1031fe60e51SSage Weil #endif
104