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)
462b3e0c90SIlya Dryomov 
472b3e0c90SIlya Dryomov /*
482b3e0c90SIlya Dryomov  * The introduction of CEPH_FEATURE_OSD_SNAPMAPPER caused the feature
492b3e0c90SIlya Dryomov  * vector to evaluate to 64 bit ~0.  To cope, we designate 1ULL << 63
502b3e0c90SIlya Dryomov  * to mean 33 bit ~0, and introduce a helper below to do the
512b3e0c90SIlya Dryomov  * translation.
522b3e0c90SIlya Dryomov  *
532b3e0c90SIlya Dryomov  * This was introduced by ceph.git commit
542b3e0c90SIlya Dryomov  *   9ea02b84104045c2ffd7e7f4e7af512953855ecd v0.58-657-g9ea02b8
552b3e0c90SIlya Dryomov  * and fixed by ceph.git commit
562b3e0c90SIlya Dryomov  *   4255b5c2fb54ae40c53284b3ab700fdfc7e61748 v0.65-263-g4255b5c
572b3e0c90SIlya Dryomov  */
582b3e0c90SIlya Dryomov #define CEPH_FEATURE_RESERVED (1ULL<<63)
592b3e0c90SIlya Dryomov 
602b3e0c90SIlya Dryomov static inline u64 ceph_sanitize_features(u64 features)
612b3e0c90SIlya Dryomov {
622b3e0c90SIlya Dryomov 	if (features & CEPH_FEATURE_RESERVED) {
632b3e0c90SIlya Dryomov 		/* everything through OSD_SNAPMAPPER */
642b3e0c90SIlya Dryomov 		return 0x1ffffffffull;
652b3e0c90SIlya Dryomov 	} else {
662b3e0c90SIlya Dryomov 		return features;
672b3e0c90SIlya Dryomov 	}
682b3e0c90SIlya Dryomov }
691fe60e51SSage Weil 
701fe60e51SSage Weil /*
711fe60e51SSage Weil  * Features supported.
721fe60e51SSage Weil  */
731fe60e51SSage Weil #define CEPH_FEATURES_SUPPORTED_DEFAULT		\
74546f04efSSage Weil 	(CEPH_FEATURE_NOSRCADDR |		\
753a23083bSSage Weil 	 CEPH_FEATURE_RECONNECT_SEQ |		\
764f6a7e5eSSage Weil 	 CEPH_FEATURE_PGID64 |			\
774f6a7e5eSSage Weil 	 CEPH_FEATURE_PGPOOL3 |			\
784f6a7e5eSSage Weil 	 CEPH_FEATURE_OSDENC |			\
796e8575faSSam Lang 	 CEPH_FEATURE_CRUSH_TUNABLES |		\
801604f488SJim Schutt 	 CEPH_FEATURE_CRUSH_TUNABLES2 |		\
8183ca14fdSSage Weil 	 CEPH_FEATURE_REPLY_CREATE_INODE |	\
82cdff4991SIlya Dryomov 	 CEPH_FEATURE_OSDHASHPSPOOL |		\
8380e163a5SIlya Dryomov 	 CEPH_FEATURE_OSD_CACHEPOOL |		\
8480213a84SYan, Zheng 	 CEPH_FEATURE_CRUSH_V2 |		\
8580213a84SYan, Zheng 	 CEPH_FEATURE_EXPORT_PEER)
861fe60e51SSage Weil 
871fe60e51SSage Weil #define CEPH_FEATURES_REQUIRED_DEFAULT   \
884f6a7e5eSSage Weil 	(CEPH_FEATURE_NOSRCADDR |	 \
893a23083bSSage Weil 	 CEPH_FEATURE_RECONNECT_SEQ |	 \
904f6a7e5eSSage Weil 	 CEPH_FEATURE_PGID64 |		 \
914f6a7e5eSSage Weil 	 CEPH_FEATURE_PGPOOL3 |		 \
924f6a7e5eSSage Weil 	 CEPH_FEATURE_OSDENC)
932b3e0c90SIlya Dryomov 
941fe60e51SSage Weil #endif
95