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