summaryrefslogtreecommitdiff
path: root/fs/bcachefs/move.h
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@gmail.com>2022-06-13 19:17:45 -0400
committerKent Overstreet <kent.overstreet@gmail.com>2022-06-17 23:36:53 -0400
commitd7f5d309e953f117e04fbb46cd76622dcc72655c (patch)
treebeaa6a9729c4bd03476bd6e990f9364120981e58 /fs/bcachefs/move.h
parent2013939f34fa35173ebcf82106c45e75b465f3ab (diff)
bcachefs: Redo data_update interfacedata_update
This patch significantly cleans up and simplifies the data_update interface. Instead of only being able to specify a single pointer by device to rewrite, we're now able to specify any or all of the pointers in the original extent to be rewrited, as a bitmask. data_cmd is no more: the various pred functions now just return true if the extent should be moved/updated. All the data_update path does is rewrite existing replicas, or add new ones. This fixes a bug where with background compression on replicated filesystems, where rebalance -> data_update would incorrectly drop the wrong old replica, and keep trying to recompress an extent pointer and each time failing to drop the right replica. Oops. Now, the data update path doesn't look at the io options to decide which pointers to keep and which to drop - it only goes off of the data_update_options passed to it. Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
Diffstat (limited to 'fs/bcachefs/move.h')
-rw-r--r--fs/bcachefs/move.h8
1 files changed, 3 insertions, 5 deletions
diff --git a/fs/bcachefs/move.h b/fs/bcachefs/move.h
index 8a0500450d52..27fee75c3626 100644
--- a/fs/bcachefs/move.h
+++ b/fs/bcachefs/move.h
@@ -24,9 +24,8 @@ struct moving_context {
wait_queue_head_t wait;
};
-typedef enum data_cmd (*move_pred_fn)(struct bch_fs *, void *,
- struct bkey_s_c,
- struct bch_io_opts *, struct data_opts *);
+typedef bool (*move_pred_fn)(struct bch_fs *, void *, struct bkey_s_c,
+ struct bch_io_opts *, struct data_update_opts *);
int bch2_scan_old_btree_nodes(struct bch_fs *, struct bch_move_stats *);
@@ -41,8 +40,7 @@ int bch2_move_data(struct bch_fs *,
int bch2_evacuate_bucket(struct bch_fs *, struct bpos, int,
struct bch_ratelimit *,
struct write_point_specifier,
- enum data_cmd,
- struct data_opts *,
+ struct data_update_opts *,
struct bch_move_stats *);
int bch2_data_job(struct bch_fs *,
struct bch_move_stats *,