]> git.sesse.net Git - bcachefs-tools-debian/blob - libbcachefs/move.h
Update bcachefs sources to d5e561b3cc bcachefs: BCH_DATA ioctl
[bcachefs-tools-debian] / libbcachefs / move.h
1 #ifndef _BCACHEFS_MOVE_H
2 #define _BCACHEFS_MOVE_H
3
4 #include "btree_iter.h"
5 #include "buckets.h"
6 #include "io_types.h"
7
8 struct bch_read_bio;
9 struct moving_context;
10
11 struct migrate_write {
12         struct moving_context   *ctxt;
13
14         /* what we read: */
15         struct bch_extent_ptr   ptr;
16         u64                     offset;
17
18         int                     move_dev;
19         int                     btree_insert_flags;
20         struct bch_write_op     op;
21 };
22
23 void bch2_migrate_write_init(struct migrate_write *, struct bch_read_bio *);
24
25 #define SECTORS_IN_FLIGHT_PER_DEVICE    2048
26
27 typedef bool (*move_pred_fn)(void *, struct bkey_s_c_extent);
28
29 struct bch_move_stats {
30         enum bch_data_type      data_type;
31         struct btree_iter       iter;
32
33         atomic64_t              keys_moved;
34         atomic64_t              sectors_moved;
35         atomic64_t              sectors_seen;
36         atomic64_t              sectors_raced;
37 };
38
39 int bch2_move_data(struct bch_fs *, struct bch_ratelimit *,
40                    unsigned, struct bch_devs_mask *,
41                    struct write_point_specifier,
42                    int, int, struct bpos, struct bpos,
43                    move_pred_fn, void *,
44                    struct bch_move_stats *);
45
46 int bch2_data_job(struct bch_fs *,
47                   struct bch_move_stats *,
48                   struct bch_ioctl_data);
49
50 #endif /* _BCACHEFS_MOVE_H */