diff options
Diffstat (limited to 'libbcachefs/move.c')
-rw-r--r-- | libbcachefs/move.c | 22 |
1 files changed, 9 insertions, 13 deletions
diff --git a/libbcachefs/move.c b/libbcachefs/move.c index 44a61818..0a8fe708 100644 --- a/libbcachefs/move.c +++ b/libbcachefs/move.c @@ -883,9 +883,11 @@ static int bch2_move_btree(struct bch_fs *c, id++) { stats->btree_id = id; - for_each_btree_node(&trans, iter, id, - id == start_btree_id ? start_pos : POS_MIN, - BTREE_ITER_PREFETCH, b) { + bch2_trans_node_iter_init(&trans, &iter, id, POS_MIN, 0, 0, + BTREE_ITER_PREFETCH); + + while (bch2_trans_begin(&trans), + (b = bch2_btree_iter_peek_node(&iter))) { if (kthread && kthread_should_stop()) break; @@ -911,6 +913,7 @@ static int bch2_move_btree(struct bch_fs *c, b->data->keys.seq, 0) ?: ret; next: bch2_trans_cond_resched(&trans); + bch2_btree_iter_next_node(&iter); } bch2_trans_iter_exit(&trans, &iter); @@ -943,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; |