1 #ifndef _BCACHE_DEBUG_H 2 #define _BCACHE_DEBUG_H 3 4 /* Btree/bkey debug printing */ 5 6 #define KEYHACK_SIZE 80 7 struct keyprint_hack { 8 char s[KEYHACK_SIZE]; 9 }; 10 11 struct keyprint_hack bch_pkey(const struct bkey *k); 12 struct keyprint_hack bch_pbtree(const struct btree *b); 13 #define pkey(k) (&bch_pkey(k).s[0]) 14 #define pbtree(b) (&bch_pbtree(b).s[0]) 15 16 #ifdef CONFIG_BCACHE_EDEBUG 17 18 unsigned bch_count_data(struct btree *); 19 void bch_check_key_order_msg(struct btree *, struct bset *, const char *, ...); 20 void bch_check_keys(struct btree *, const char *, ...); 21 22 #define bch_check_key_order(b, i) \ 23 bch_check_key_order_msg(b, i, "keys out of order") 24 #define EBUG_ON(cond) BUG_ON(cond) 25 26 #else /* EDEBUG */ 27 28 #define bch_count_data(b) 0 29 #define bch_check_key_order(b, i) do {} while (0) 30 #define bch_check_key_order_msg(b, i, ...) do {} while (0) 31 #define bch_check_keys(b, ...) do {} while (0) 32 #define EBUG_ON(cond) do {} while (0) 33 34 #endif 35 36 #ifdef CONFIG_BCACHE_DEBUG 37 38 void bch_btree_verify(struct btree *, struct bset *); 39 void bch_data_verify(struct search *); 40 41 #else /* DEBUG */ 42 43 static inline void bch_btree_verify(struct btree *b, struct bset *i) {} 44 static inline void bch_data_verify(struct search *s) {}; 45 46 #endif 47 48 #ifdef CONFIG_DEBUG_FS 49 void bch_debug_init_cache_set(struct cache_set *); 50 #else 51 static inline void bch_debug_init_cache_set(struct cache_set *c) {} 52 #endif 53 54 #endif 55