summaryrefslogtreecommitdiffstats
path: root/fs/bcachefs/move.h
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@linux.dev>2023-10-21 15:03:05 -0400
committerKent Overstreet <kent.overstreet@linux.dev>2023-10-31 12:18:37 -0400
commit8480905765c3729025331720d23735ce085ef070 (patch)
treef66b78b6b97cd8b851a07ec5b15b6b08f0401f25 /fs/bcachefs/move.h
parentbbe682c76789d679cb75effd7792d41b09efea00 (diff)
downloadlinux-8480905765c3729025331720d23735ce085ef070.tar.gz
linux-8480905765c3729025331720d23735ce085ef070.tar.bz2
linux-8480905765c3729025331720d23735ce085ef070.zip
bcachefs: Improve io option handling in data move path
The data move path now correctly picks IO options when inodes in different snapshots have different options applied. Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs/bcachefs/move.h')
-rw-r--r--fs/bcachefs/move.h26
1 files changed, 26 insertions, 0 deletions
diff --git a/fs/bcachefs/move.h b/fs/bcachefs/move.h
index cbdd58db8782..aa4b65c4f960 100644
--- a/fs/bcachefs/move.h
+++ b/fs/bcachefs/move.h
@@ -62,6 +62,32 @@ struct moving_io *bch2_moving_ctxt_next_pending_write(struct moving_context *);
void bch2_moving_ctxt_do_pending_writes(struct moving_context *,
struct btree_trans *);
+/* Inodes in different snapshots may have different IO options: */
+struct snapshot_io_opts_entry {
+ u32 snapshot;
+ struct bch_io_opts io_opts;
+};
+
+struct per_snapshot_io_opts {
+ u64 cur_inum;
+ struct bch_io_opts fs_io_opts;
+ DARRAY(struct snapshot_io_opts_entry) d;
+};
+
+static inline void per_snapshot_io_opts_init(struct per_snapshot_io_opts *io_opts, struct bch_fs *c)
+{
+ memset(io_opts, 0, sizeof(*io_opts));
+ io_opts->fs_io_opts = bch2_opts_to_inode_opts(c->opts);
+}
+
+static inline void per_snapshot_io_opts_exit(struct per_snapshot_io_opts *io_opts)
+{
+ darray_exit(&io_opts->d);
+}
+
+struct bch_io_opts *bch2_move_get_io_opts(struct btree_trans *,
+ struct per_snapshot_io_opts *, struct bkey_s_c);
+
int bch2_scan_old_btree_nodes(struct bch_fs *, struct bch_move_stats *);
int bch2_move_data(struct bch_fs *,