1cafe5635SKent Overstreet #ifndef _BCACHE_DEBUG_H 2cafe5635SKent Overstreet #define _BCACHE_DEBUG_H 3cafe5635SKent Overstreet 4cafe5635SKent Overstreet /* Btree/bkey debug printing */ 5cafe5635SKent Overstreet 685b1492eSKent Overstreet int bch_bkey_to_text(char *buf, size_t size, const struct bkey *k); 785b1492eSKent Overstreet int bch_btree_to_text(char *buf, size_t size, const struct btree *b); 8cafe5635SKent Overstreet 9cafe5635SKent Overstreet #ifdef CONFIG_BCACHE_EDEBUG 10cafe5635SKent Overstreet 11cafe5635SKent Overstreet unsigned bch_count_data(struct btree *); 12cafe5635SKent Overstreet void bch_check_key_order_msg(struct btree *, struct bset *, const char *, ...); 13cafe5635SKent Overstreet void bch_check_keys(struct btree *, const char *, ...); 14cafe5635SKent Overstreet 15cafe5635SKent Overstreet #define bch_check_key_order(b, i) \ 16cafe5635SKent Overstreet bch_check_key_order_msg(b, i, "keys out of order") 17cafe5635SKent Overstreet #define EBUG_ON(cond) BUG_ON(cond) 18cafe5635SKent Overstreet 19cafe5635SKent Overstreet #else /* EDEBUG */ 20cafe5635SKent Overstreet 21cafe5635SKent Overstreet #define bch_count_data(b) 0 22cafe5635SKent Overstreet #define bch_check_key_order(b, i) do {} while (0) 23cafe5635SKent Overstreet #define bch_check_key_order_msg(b, i, ...) do {} while (0) 24cafe5635SKent Overstreet #define bch_check_keys(b, ...) do {} while (0) 25cafe5635SKent Overstreet #define EBUG_ON(cond) do {} while (0) 26cafe5635SKent Overstreet 27cafe5635SKent Overstreet #endif 28cafe5635SKent Overstreet 29cafe5635SKent Overstreet #ifdef CONFIG_BCACHE_DEBUG 30cafe5635SKent Overstreet 31cafe5635SKent Overstreet void bch_btree_verify(struct btree *, struct bset *); 32*220bb38cSKent Overstreet void bch_data_verify(struct cached_dev *, struct bio *); 33cafe5635SKent Overstreet 34cafe5635SKent Overstreet #else /* DEBUG */ 35cafe5635SKent Overstreet 36cafe5635SKent Overstreet static inline void bch_btree_verify(struct btree *b, struct bset *i) {} 37*220bb38cSKent Overstreet static inline void bch_data_verify(struct cached_dev *dc, struct bio *bio) {}; 38cafe5635SKent Overstreet 39cafe5635SKent Overstreet #endif 40cafe5635SKent Overstreet 41cafe5635SKent Overstreet #ifdef CONFIG_DEBUG_FS 42cafe5635SKent Overstreet void bch_debug_init_cache_set(struct cache_set *); 43cafe5635SKent Overstreet #else 44cafe5635SKent Overstreet static inline void bch_debug_init_cache_set(struct cache_set *c) {} 45cafe5635SKent Overstreet #endif 46cafe5635SKent Overstreet 47cafe5635SKent Overstreet #endif 48