summaryrefslogtreecommitdiff
path: root/fs/bcachefs/buckets.c
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@gmail.com>2022-02-19 02:48:27 -0500
committerKent Overstreet <kent.overstreet@linux.dev>2023-10-22 17:09:25 -0400
commit78c8fe20be12d0e4b6427d9149fd1eb9a69e2290 (patch)
tree72c720328ea264212feecd81b1ca1f72b28bf852 /fs/bcachefs/buckets.c
parentb66b2bc0f64a57c042ea1fa51dbd5904557bf67f (diff)
downloadlwn-78c8fe20be12d0e4b6427d9149fd1eb9a69e2290.tar.gz
lwn-78c8fe20be12d0e4b6427d9149fd1eb9a69e2290.zip
bcachefs: Normal update/commit path now works before going RW
This improves __bch2_trans_commit - early in the recovery process, when we're running btree_gc and before we want to go RW, it now uses bch2_journal_key_insert() to add the update to the list of updates for journal replay to do, instead of btree_gc having to use separate interfaces depending on whether we're running at bringup or, later, runtime. Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
Diffstat (limited to 'fs/bcachefs/buckets.c')
-rw-r--r--fs/bcachefs/buckets.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/fs/bcachefs/buckets.c b/fs/bcachefs/buckets.c
index edc1918cf140..1c1266fb80df 100644
--- a/fs/bcachefs/buckets.c
+++ b/fs/bcachefs/buckets.c
@@ -1164,9 +1164,11 @@ static int bch2_mark_reservation(struct btree_trans *trans,
return 0;
}
-static s64 __bch2_mark_reflink_p(struct bch_fs *c, struct bkey_s_c_reflink_p p,
+static s64 __bch2_mark_reflink_p(struct btree_trans *trans,
+ struct bkey_s_c_reflink_p p,
u64 *idx, unsigned flags, size_t r_idx)
{
+ struct bch_fs *c = trans->c;
struct reflink_gc *r;
int add = !(flags & BTREE_TRIGGER_OVERWRITE) ? 1 : -1;
s64 ret = 0;
@@ -1199,7 +1201,7 @@ not_found:
new.k.type = KEY_TYPE_error;
new.k.p = p.k->p;
new.k.size = p.k->size;
- ret = bch2_journal_key_insert(c, BTREE_ID_extents, 0, &new.k_i);
+ ret = __bch2_btree_insert(trans, BTREE_ID_extents, &new.k_i);
}
fsck_err:
return ret;
@@ -1238,7 +1240,7 @@ static int bch2_mark_reflink_p(struct btree_trans *trans,
}
while (idx < end && !ret)
- ret = __bch2_mark_reflink_p(c, p, &idx, flags, l++);
+ ret = __bch2_mark_reflink_p(trans, p, &idx, flags, l++);
return ret;
}