1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef _BCACHEFS_DEBUG_H
3 #define _BCACHEFS_DEBUG_H
11 #define BCH_DEBUG_PARAM(name, description) extern bool bch2_##name;
13 #undef BCH_DEBUG_PARAM
15 #define BCH_DEBUG_PARAM(name, description) \
16 static inline bool name(struct bch_fs *c) \
17 { return bch2_##name || c->name; }
18 BCH_DEBUG_PARAMS_ALWAYS()
19 #undef BCH_DEBUG_PARAM
21 #ifdef CONFIG_BCACHEFS_DEBUG
23 #define BCH_DEBUG_PARAM(name, description) \
24 static inline bool name(struct bch_fs *c) \
25 { return bch2_##name || c->name; }
26 BCH_DEBUG_PARAMS_DEBUG()
27 #undef BCH_DEBUG_PARAM
29 void __bch2_btree_verify(struct bch_fs *, struct btree *);
31 #define bypass_torture_test(d) ((d)->bypass_torture_test)
35 #define BCH_DEBUG_PARAM(name, description) \
36 static inline bool name(struct bch_fs *c) { return false; }
37 BCH_DEBUG_PARAMS_DEBUG()
38 #undef BCH_DEBUG_PARAM
40 static inline void __bch2_btree_verify(struct bch_fs *c, struct btree *b) {}
42 #define bypass_torture_test(d) 0
46 static inline void bch2_btree_verify(struct bch_fs *c, struct btree *b)
48 if (verify_btree_ondisk(c))
49 __bch2_btree_verify(c, b);
52 #ifdef CONFIG_DEBUG_FS
53 void bch2_fs_debug_exit(struct bch_fs *);
54 void bch2_fs_debug_init(struct bch_fs *);
56 static inline void bch2_fs_debug_exit(struct bch_fs *c) {}
57 static inline void bch2_fs_debug_init(struct bch_fs *c) {}
60 void bch2_debug_exit(void);
61 int bch2_debug_init(void);
63 #endif /* _BCACHEFS_DEBUG_H */