Skip to content

Commit

Permalink
Merge tag 'bcachefs-2024-06-05' of https://evilpiepirate.org/git/bcac…
Browse files Browse the repository at this point in the history
…hefs

Pull bcachefs fixes from Kent Overstreet:
 "Just a few small fixes"

* tag 'bcachefs-2024-06-05' of https://evilpiepirate.org/git/bcachefs:
  bcachefs: Fix trans->locked assert
  bcachefs: Rereplicate now moves data off of durability=0 devices
  bcachefs: Fix GFP_KERNEL allocation in break_cycle()
  • Loading branch information
Linus Torvalds committed Jun 5, 2024
2 parents 558dc49 + 319fef2 commit e20b269
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
1 change: 1 addition & 0 deletions fs/bcachefs/btree_locking.c
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,7 @@ static noinline int break_cycle(struct lock_graph *g, struct printbuf *cycle)

if (unlikely(!best)) {
struct printbuf buf = PRINTBUF;
buf.atomic++;

prt_printf(&buf, bch2_fmt(g->g->trans->c, "cycle of nofail locks"));

Expand Down
16 changes: 15 additions & 1 deletion fs/bcachefs/move.c
Original file line number Diff line number Diff line change
Expand Up @@ -547,6 +547,7 @@ static int bch2_move_data_btree(struct moving_context *ctxt,
ctxt->stats->pos = BBPOS(btree_id, start);
}

bch2_trans_begin(trans);
bch2_trans_iter_init(trans, &iter, btree_id, start,
BTREE_ITER_prefetch|
BTREE_ITER_all_snapshots);
Expand Down Expand Up @@ -920,7 +921,20 @@ static bool rereplicate_pred(struct bch_fs *c, void *arg,
? c->opts.metadata_replicas
: io_opts->data_replicas;

if (!nr_good || nr_good >= replicas)
rcu_read_lock();
struct bkey_ptrs_c ptrs = bch2_bkey_ptrs_c(k);
unsigned i = 0;
bkey_for_each_ptr(ptrs, ptr) {
struct bch_dev *ca = bch2_dev_rcu(c, ptr->dev);
if (!ptr->cached &&
(!ca || !ca->mi.durability))
data_opts->kill_ptrs |= BIT(i);
i++;
}
rcu_read_unlock();

if (!data_opts->kill_ptrs &&
(!nr_good || nr_good >= replicas))
return false;

data_opts->target = 0;
Expand Down

0 comments on commit e20b269

Please sign in to comment.