xref: /linux/fs/bcachefs/progress.h (revision 4a4b30ea80d8cb5e8c4c62bb86201f4ea0d9b030)
1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef _BCACHEFS_PROGRESS_H
3 #define _BCACHEFS_PROGRESS_H
4 
5 /*
6  * Lame progress indicators
7  *
8  * We don't like to use these because they print to the dmesg console, which is
9  * spammy - we much prefer to be wired up to a userspace programm (e.g. via
10  * thread_with_file) and have it print the progress indicator.
11  *
12  * But some code is old and doesn't support that, or runs in a context where
13  * that's not yet practical (mount).
14  */
15 
16 struct progress_indicator_state {
17 	unsigned long		next_print;
18 	u64			nodes_seen;
19 	u64			nodes_total;
20 	struct btree		*last_node;
21 };
22 
23 void bch2_progress_init(struct progress_indicator_state *, struct bch_fs *, u64);
24 void bch2_progress_update_iter(struct btree_trans *,
25 			       struct progress_indicator_state *,
26 			       struct btree_iter *,
27 			       const char *);
28 
29 #endif /* _BCACHEFS_PROGRESS_H */
30