diff options
author | Kent Overstreet <kent.overstreet@gmail.com> | 2021-10-29 18:43:18 -0400 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@linux.dev> | 2023-10-22 17:09:15 -0400 |
commit | 904823de497fa6637db8bc7c3b017f121b72bdf3 (patch) | |
tree | ade8271b94cd2cabe595a9e8f5ae656f3c74e693 /fs/bcachefs/ec.c | |
parent | 961b2d62821f23f9f963ee069b64eb8806f05e40 (diff) | |
download | lwn-904823de497fa6637db8bc7c3b017f121b72bdf3.tar.gz lwn-904823de497fa6637db8bc7c3b017f121b72bdf3.zip |
bcachefs: Convert bch2_mark_key() to take a btree_trans *
This helps to unify the interface between bch2_mark_key() and
bch2_trans_mark_key() - and it also gives access to the journal
reservation and journal seq in the mark_key path.
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
Diffstat (limited to 'fs/bcachefs/ec.c')
-rw-r--r-- | fs/bcachefs/ec.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/fs/bcachefs/ec.c b/fs/bcachefs/ec.c index ed4a73345e3a..74dc6c40dc9e 100644 --- a/fs/bcachefs/ec.c +++ b/fs/bcachefs/ec.c @@ -1634,13 +1634,14 @@ int bch2_stripes_write(struct bch_fs *c, unsigned flags) return ret; } -static int bch2_stripes_read_fn(struct bch_fs *c, struct bkey_s_c k) +static int bch2_stripes_read_fn(struct btree_trans *trans, struct bkey_s_c k) { + struct bch_fs *c = trans->c; int ret = 0; if (k.k->type == KEY_TYPE_stripe) ret = __ec_stripe_mem_alloc(c, k.k->p.offset, GFP_KERNEL) ?: - bch2_mark_key(c, k, + bch2_mark_key(trans, k, BTREE_TRIGGER_INSERT| BTREE_TRIGGER_NOATOMIC); @@ -1649,8 +1650,13 @@ static int bch2_stripes_read_fn(struct bch_fs *c, struct bkey_s_c k) int bch2_stripes_read(struct bch_fs *c) { - int ret = bch2_btree_and_journal_walk(c, BTREE_ID_stripes, - bch2_stripes_read_fn); + struct btree_trans trans; + int ret; + + bch2_trans_init(&trans, c, 0, 0); + ret = bch2_btree_and_journal_walk(&trans, BTREE_ID_stripes, + bch2_stripes_read_fn); + bch2_trans_exit(&trans); if (ret) bch_err(c, "error reading stripes: %i", ret); |