xref: /linux/fs/bcachefs/rebalance_types.h (revision ff0905bbf991f4337b5ebc19c0d43525ebb0d96b)
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 	u32				kick;
22 	struct bch_pd_controller pd;
23 
24 	enum bch_rebalance_states	state;
25 	u64				wait_iotime_start;
26 	u64				wait_iotime_end;
27 	u64				wait_wallclock_start;
28 
29 	struct bch_move_stats		work_stats;
30 
31 	struct bbpos			scan_start;
32 	struct bbpos			scan_end;
33 	struct bch_move_stats		scan_stats;
34 
35 	bool				on_battery;
36 #ifdef CONFIG_POWER_SUPPLY
37 	struct notifier_block		power_notifier;
38 #endif
39 };
40 
41 #endif /* _BCACHEFS_REBALANCE_TYPES_H */
42