Linux kernel mirror (for testing)
git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel
os
linux
1/* SPDX-License-Identifier: GPL-2.0 */
2#ifndef _BCACHEFS_DEBUG_H
3#define _BCACHEFS_DEBUG_H
4
5#include "bcachefs.h"
6
7struct bio;
8struct btree;
9struct bch_fs;
10
11void __bch2_btree_verify(struct bch_fs *, struct btree *);
12void bch2_btree_node_ondisk_to_text(struct printbuf *, struct bch_fs *,
13 const struct btree *);
14
15static 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
22struct 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
37ssize_t bch2_debugfs_flush_buf(struct dump_iter *);
38int bch2_dump_release(struct inode *, struct file *);
39
40void bch2_fs_debug_exit(struct bch_fs *);
41void bch2_fs_debug_init(struct bch_fs *);
42#else
43static inline void bch2_fs_debug_exit(struct bch_fs *c) {}
44static inline void bch2_fs_debug_init(struct bch_fs *c) {}
45#endif
46
47void bch2_debug_exit(void);
48int bch2_debug_init(void);
49
50#endif /* _BCACHEFS_DEBUG_H */