xref: /linux/fs/bcachefs/rebalance_types.h (revision 0ea5c948cb64bab5bc7a5516774eb8536f05aa0d)
1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef _BCACHEFS_REBALANCE_TYPES_H
3 #define _BCACHEFS_REBALANCE_TYPES_H
4 
5 #include "bbpos_types.h"
6 #include "move_types.h"
7 
8 #define BCH_REBALANCE_STATES()		\
9 	x(waiting)			\
10 	x(working)			\
11 	x(scanning)
12 
13 enum bch_rebalance_states {
14 #define x(t)	BCH_REBALANCE_##t,
15 	BCH_REBALANCE_STATES()
16 #undef x
17 };
18 
19 struct bch_fs_rebalance {
20 	struct task_struct __rcu	*thread;
21 	struct bch_pd_controller pd;
22 
23 	enum bch_rebalance_states	state;
24 	u64				wait_iotime_start;
25 	u64				wait_iotime_end;
26 	u64				wait_wallclock_start;
27 
28 	struct bch_move_stats		work_stats;
29 
30 	struct bbpos			scan_start;
31 	struct bbpos			scan_end;
32 	struct bch_move_stats		scan_stats;
33 
34 	unsigned			enabled:1;
35 };
36 
37 #endif /* _BCACHEFS_REBALANCE_TYPES_H */
38