1 /* SPDX-License-Identifier: GPL-2.0 */ 2 #ifndef _BCACHEFS_DEBUG_H 3 #define _BCACHEFS_DEBUG_H 4 5 #include "bcachefs.h" 6 7 struct bio; 8 struct btree; 9 struct bch_fs; 10 11 void __bch2_btree_verify(struct bch_fs *, struct btree *); 12 void bch2_btree_node_ondisk_to_text(struct printbuf *, struct bch_fs *, 13 const struct btree *); 14 15 static inline void bch2_btree_verify(struct bch_fs *c, struct btree *b) 16 { 17 if (static_branch_unlikely(&bch2_verify_btree_ondisk)) 18 __bch2_btree_verify(c, b); 19 } 20 21 #ifdef CONFIG_DEBUG_FS 22 struct dump_iter { 23 struct bch_fs *c; 24 struct async_obj_list *list; 25 enum btree_id id; 26 struct bpos from; 27 struct bpos prev_node; 28 u64 iter; 29 30 struct printbuf buf; 31 32 char __user *ubuf; /* destination user buffer */ 33 size_t size; /* size of requested read */ 34 ssize_t ret; /* bytes read so far */ 35 }; 36 37 ssize_t bch2_debugfs_flush_buf(struct dump_iter *); 38 int bch2_dump_release(struct inode *, struct file *); 39 40 void bch2_fs_debug_exit(struct bch_fs *); 41 void bch2_fs_debug_init(struct bch_fs *); 42 #else 43 static inline void bch2_fs_debug_exit(struct bch_fs *c) {} 44 static inline void bch2_fs_debug_init(struct bch_fs *c) {} 45 #endif 46 47 void bch2_debug_exit(void); 48 int bch2_debug_init(void); 49 50 #endif /* _BCACHEFS_DEBUG_H */ 51