Skip to content

Commit 463086d

Browse files
author
Kent Overstreet
committed
bcachefs: Convert gc_alloc_start() to for_each_btree_key2()
This eliminates some SRCU warnings: for_each_btree_key2() runs every loop iteration in a distinct transaction context. Signed-off-by: Kent Overstreet <[email protected]>
1 parent 2111f39 commit 463086d

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

fs/bcachefs/btree_gc.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1541,8 +1541,8 @@ static int bch2_gc_alloc_start(struct bch_fs *c, bool metadata_only)
15411541
rcu_assign_pointer(ca->buckets_gc, buckets);
15421542
}
15431543

1544-
for_each_btree_key(trans, iter, BTREE_ID_alloc, POS_MIN,
1545-
BTREE_ITER_PREFETCH, k, ret) {
1544+
ret = for_each_btree_key2(trans, iter, BTREE_ID_alloc, POS_MIN,
1545+
BTREE_ITER_PREFETCH, k, ({
15461546
ca = bch_dev_bkey_exists(c, k.k->p.inode);
15471547
g = gc_bucket(ca, k.k->p.offset);
15481548

@@ -1561,8 +1561,9 @@ static int bch2_gc_alloc_start(struct bch_fs *c, bool metadata_only)
15611561
g->stripe = a->stripe;
15621562
g->stripe_redundancy = a->stripe_redundancy;
15631563
}
1564-
}
1565-
bch2_trans_iter_exit(trans, &iter);
1564+
1565+
0;
1566+
}));
15661567
err:
15671568
bch2_trans_put(trans);
15681569
if (ret)

0 commit comments

Comments
 (0)