xref: /linux/fs/bcachefs/move_types.h (revision 4a4b30ea80d8cb5e8c4c62bb86201f4ea0d9b030)
1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef _BCACHEFS_MOVE_TYPES_H
3 #define _BCACHEFS_MOVE_TYPES_H
4 
5 #include "bbpos_types.h"
6 #include "bcachefs_ioctl.h"
7 
8 struct bch_move_stats {
9 	char			name[32];
10 	bool			phys;
11 	enum bch_ioctl_data_event_ret	ret;
12 
13 	union {
14 	struct {
15 		enum bch_data_type	data_type;
16 		struct bbpos		pos;
17 	};
18 	struct {
19 		unsigned		dev;
20 		u64			offset;
21 	};
22 	};
23 
24 	atomic64_t		keys_moved;
25 	atomic64_t		keys_raced;
26 	atomic64_t		sectors_seen;
27 	atomic64_t		sectors_moved;
28 	atomic64_t		sectors_raced;
29 	atomic64_t		sectors_error_corrected;
30 	atomic64_t		sectors_error_uncorrected;
31 };
32 
33 struct move_bucket_key {
34 	struct bpos		bucket;
35 	unsigned		gen;
36 };
37 
38 struct move_bucket {
39 	struct move_bucket_key	k;
40 	unsigned		sectors;
41 };
42 
43 struct move_bucket_in_flight {
44 	struct move_bucket_in_flight *next;
45 	struct rhash_head	hash;
46 	struct move_bucket	bucket;
47 	atomic_t		count;
48 };
49 
50 #endif /* _BCACHEFS_MOVE_TYPES_H */
51