From e8bde78a178798a414289f2ad5c1f015d8d53139 Mon Sep 17 00:00:00 2001 From: Kent Overstreet Date: Tue, 12 Oct 2021 14:15:45 -0400 Subject: [PATCH] bcachefs: Fix rereplicate_pred() It was switching off of the key type incorrectly - this code must've been quite old, and not rereplicating anything that wasn't a btree_ptr_v1 or a plain old extent. Signed-off-by: Kent Overstreet --- fs/bcachefs/move.c | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/fs/bcachefs/move.c b/fs/bcachefs/move.c index 5e61cd431ef91..fbb6c043ad9bd 100644 --- a/fs/bcachefs/move.c +++ b/fs/bcachefs/move.c @@ -946,16 +946,9 @@ static enum data_cmd rereplicate_pred(struct bch_fs *c, void *arg, struct data_opts *data_opts) { unsigned nr_good = bch2_bkey_durability(c, k); - unsigned replicas = 0; - - switch (k.k->type) { - case KEY_TYPE_btree_ptr: - replicas = c->opts.metadata_replicas; - break; - case KEY_TYPE_extent: - replicas = io_opts->data_replicas; - break; - } + unsigned replicas = bkey_is_btree_ptr(k.k) + ? c->opts.metadata_replicas + : io_opts->data_replicas; if (!nr_good || nr_good >= replicas) return DATA_SKIP; -- 2.30.2