2017-10-06 01:41:44 +03:00
|
|
|
#ifndef _BCACHEFS_MOVE_H
|
|
|
|
#define _BCACHEFS_MOVE_H
|
2017-01-08 12:13:18 +03:00
|
|
|
|
2018-01-11 14:41:59 +03:00
|
|
|
#include "btree_iter.h"
|
2017-01-08 12:13:18 +03:00
|
|
|
#include "buckets.h"
|
|
|
|
#include "io_types.h"
|
|
|
|
|
2017-12-14 00:01:18 +03:00
|
|
|
struct bch_read_bio;
|
|
|
|
struct moving_context;
|
2017-01-08 12:13:18 +03:00
|
|
|
|
|
|
|
struct migrate_write {
|
2017-12-14 00:01:18 +03:00
|
|
|
struct moving_context *ctxt;
|
2017-01-08 12:13:18 +03:00
|
|
|
|
2017-12-14 00:01:18 +03:00
|
|
|
/* what we read: */
|
|
|
|
struct bch_extent_ptr ptr;
|
|
|
|
u64 offset;
|
2017-01-08 12:13:18 +03:00
|
|
|
|
2017-12-14 00:01:18 +03:00
|
|
|
int move_dev;
|
|
|
|
int btree_insert_flags;
|
|
|
|
struct bch_write_op op;
|
2017-01-08 12:13:18 +03:00
|
|
|
};
|
|
|
|
|
2017-12-14 00:01:18 +03:00
|
|
|
void bch2_migrate_write_init(struct migrate_write *, struct bch_read_bio *);
|
2017-01-08 12:13:18 +03:00
|
|
|
|
2017-12-14 00:01:18 +03:00
|
|
|
#define SECTORS_IN_FLIGHT_PER_DEVICE 2048
|
2017-01-08 12:13:18 +03:00
|
|
|
|
2017-12-14 00:01:18 +03:00
|
|
|
typedef bool (*move_pred_fn)(void *, struct bkey_s_c_extent);
|
2017-01-08 12:13:18 +03:00
|
|
|
|
2018-01-11 14:41:59 +03:00
|
|
|
struct bch_move_stats {
|
|
|
|
struct btree_iter iter;
|
|
|
|
|
|
|
|
atomic64_t keys_moved;
|
|
|
|
atomic64_t sectors_moved;
|
|
|
|
atomic64_t sectors_seen;
|
|
|
|
atomic64_t sectors_raced;
|
|
|
|
};
|
|
|
|
|
2017-12-14 00:01:18 +03:00
|
|
|
int bch2_move_data(struct bch_fs *, struct bch_ratelimit *,
|
|
|
|
unsigned, struct bch_devs_mask *,
|
|
|
|
struct write_point_specifier,
|
|
|
|
int, int, move_pred_fn, void *,
|
2018-01-11 14:41:59 +03:00
|
|
|
struct bch_move_stats *);
|
2017-01-08 12:13:18 +03:00
|
|
|
|
2017-10-06 01:41:44 +03:00
|
|
|
#endif /* _BCACHEFS_MOVE_H */
|