blob: 1c39b5a2489bd1158782f0afb1a28ef4fcb0a7a4 [file] [log] [blame]
Kent Overstreetcafe5632013-03-23 16:11:31 -07001#ifndef _BCACHE_DEBUG_H
2#define _BCACHE_DEBUG_H
3
4/* Btree/bkey debug printing */
5
Kent Overstreet85b14922013-05-14 20:33:16 -07006int bch_bkey_to_text(char *buf, size_t size, const struct bkey *k);
7int bch_btree_to_text(char *buf, size_t size, const struct btree *b);
Kent Overstreetcafe5632013-03-23 16:11:31 -07008
9#ifdef CONFIG_BCACHE_EDEBUG
10
11unsigned bch_count_data(struct btree *);
12void bch_check_key_order_msg(struct btree *, struct bset *, const char *, ...);
13void 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
31void bch_btree_verify(struct btree *, struct bset *);
32void bch_data_verify(struct search *);
33
34#else /* DEBUG */
35
36static inline void bch_btree_verify(struct btree *b, struct bset *i) {}
37static inline void bch_data_verify(struct search *s) {};
38
39#endif
40
41#ifdef CONFIG_DEBUG_FS
42void bch_debug_init_cache_set(struct cache_set *);
43#else
44static inline void bch_debug_init_cache_set(struct cache_set *c) {}
45#endif
46
47#endif