summaryrefslogtreecommitdiff
path: root/libbcachefs/alloc_background.c
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@gmail.com>2021-11-01 06:39:12 -0400
committerKent Overstreet <kent.overstreet@gmail.com>2021-11-01 06:39:12 -0400
commit0da2d968eb7d78417693347597ce091a515f646b (patch)
tree3ab44769d7a4ac7c3320afaf2016aca9166396ab /libbcachefs/alloc_background.c
parenta315a3f664f9cf5cc687738ad97210721ccde8fd (diff)
Update bcachefs sources to 043cfba30c fixup! bcachefs: Improve transaction restart handling in fsck code
Diffstat (limited to 'libbcachefs/alloc_background.c')
-rw-r--r--libbcachefs/alloc_background.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/libbcachefs/alloc_background.c b/libbcachefs/alloc_background.c
index 93fa9bf9..67b24576 100644
--- a/libbcachefs/alloc_background.c
+++ b/libbcachefs/alloc_background.c
@@ -261,8 +261,9 @@ void bch2_alloc_to_text(struct printbuf *out, struct bch_fs *c,
#undef x
}
-static int bch2_alloc_read_fn(struct bch_fs *c, struct bkey_s_c k)
+static int bch2_alloc_read_fn(struct btree_trans *trans, struct bkey_s_c k)
{
+ struct bch_fs *c = trans->c;
struct bch_dev *ca;
struct bucket *g;
struct bkey_alloc_unpacked u;
@@ -289,11 +290,14 @@ static int bch2_alloc_read_fn(struct bch_fs *c, struct bkey_s_c k)
int bch2_alloc_read(struct bch_fs *c)
{
+ struct btree_trans trans;
int ret;
+ bch2_trans_init(&trans, c, 0, 0);
down_read(&c->gc_lock);
- ret = bch2_btree_and_journal_walk(c, BTREE_ID_alloc, bch2_alloc_read_fn);
+ ret = bch2_btree_and_journal_walk(&trans, BTREE_ID_alloc, bch2_alloc_read_fn);
up_read(&c->gc_lock);
+ bch2_trans_exit(&trans);
if (ret) {
bch_err(c, "error reading alloc info: %i", ret);
return ret;