2022-06-13 16:07:19 -07:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0 */
|
|
|
|
|
|
|
|
#ifndef _BCACHEFS_DATA_UPDATE_H
|
|
|
|
#define _BCACHEFS_DATA_UPDATE_H
|
|
|
|
|
2022-06-13 16:17:45 -07:00
|
|
|
#include "bkey_buf.h"
|
2023-09-10 15:05:17 -07:00
|
|
|
#include "io_write_types.h"
|
2022-06-13 16:07:19 -07:00
|
|
|
|
2022-06-13 16:17:45 -07:00
|
|
|
struct moving_context;
|
2022-06-13 16:07:19 -07:00
|
|
|
|
2022-06-13 16:17:45 -07:00
|
|
|
struct data_update_opts {
|
|
|
|
unsigned rewrite_ptrs;
|
2022-10-09 00:32:17 -07:00
|
|
|
unsigned kill_ptrs;
|
2022-06-13 16:07:19 -07:00
|
|
|
u16 target;
|
2022-06-13 16:17:45 -07:00
|
|
|
u8 extra_replicas;
|
|
|
|
unsigned btree_insert_flags;
|
|
|
|
unsigned write_flags;
|
2022-06-13 16:07:19 -07:00
|
|
|
};
|
|
|
|
|
2024-07-03 10:25:13 -07:00
|
|
|
void bch2_data_update_opts_to_text(struct printbuf *, struct bch_fs *,
|
|
|
|
struct bch_io_opts *, struct data_update_opts *);
|
|
|
|
|
2022-06-13 16:07:19 -07:00
|
|
|
struct data_update {
|
2022-06-13 16:17:45 -07:00
|
|
|
/* extent being updated: */
|
2022-06-13 16:07:19 -07:00
|
|
|
enum btree_id btree_id;
|
2022-06-13 16:17:45 -07:00
|
|
|
struct bkey_buf k;
|
|
|
|
struct data_update_opts data_opts;
|
2022-06-13 16:07:19 -07:00
|
|
|
struct moving_context *ctxt;
|
2023-10-23 12:36:45 -07:00
|
|
|
struct bch_move_stats *stats;
|
2022-06-13 16:07:19 -07:00
|
|
|
struct bch_write_op op;
|
|
|
|
};
|
|
|
|
|
2024-07-03 10:25:13 -07:00
|
|
|
void bch2_data_update_to_text(struct printbuf *, struct data_update *);
|
|
|
|
|
2022-06-13 16:07:19 -07:00
|
|
|
int bch2_data_update_index_update(struct bch_write_op *);
|
|
|
|
|
2022-06-13 16:17:45 -07:00
|
|
|
void bch2_data_update_read_done(struct data_update *,
|
|
|
|
struct bch_extent_crc_unpacked);
|
|
|
|
|
2023-11-24 19:51:45 -07:00
|
|
|
int bch2_extent_drop_ptrs(struct btree_trans *,
|
|
|
|
struct btree_iter *,
|
|
|
|
struct bkey_s_c,
|
2024-10-20 17:02:09 -07:00
|
|
|
struct bch_io_opts *,
|
|
|
|
struct data_update_opts *);
|
2023-11-24 19:51:45 -07:00
|
|
|
|
2022-06-13 16:17:45 -07:00
|
|
|
void bch2_data_update_exit(struct data_update *);
|
2023-11-24 19:51:45 -07:00
|
|
|
int bch2_data_update_init(struct btree_trans *, struct btree_iter *,
|
|
|
|
struct moving_context *,
|
2023-01-02 15:53:02 -07:00
|
|
|
struct data_update *,
|
2022-06-13 16:07:19 -07:00
|
|
|
struct write_point_specifier,
|
2022-06-13 16:17:45 -07:00
|
|
|
struct bch_io_opts, struct data_update_opts,
|
2022-06-13 16:07:19 -07:00
|
|
|
enum btree_id, struct bkey_s_c);
|
2022-10-09 00:32:17 -07:00
|
|
|
void bch2_data_update_opts_normalize(struct bkey_s_c, struct data_update_opts *);
|
2022-06-13 16:07:19 -07:00
|
|
|
|
|
|
|
#endif /* _BCACHEFS_DATA_UPDATE_H */
|