diff options
author | Kent Overstreet <kent.overstreet@linux.dev> | 2023-11-11 21:43:47 -0500 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@linux.dev> | 2024-01-01 11:47:41 -0500 |
commit | 679972348d03fb3644f4e1f7f7304911accd950d (patch) | |
tree | 0eab9f7561bc9c55678ab35e909ab4fcffe6794c /fs/bcachefs/btree_update.h | |
parent | 002c76dcf6a49a82498e8cddcde75e0dd83f745a (diff) | |
download | linux-stable-679972348d03fb3644f4e1f7f7304911accd950d.tar.gz linux-stable-679972348d03fb3644f4e1f7f7304911accd950d.tar.bz2 linux-stable-679972348d03fb3644f4e1f7f7304911accd950d.zip |
bcachefs: kill btree_trans->wb_updates
the btree write buffer path now creates a journal entry directly
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs/bcachefs/btree_update.h')
-rw-r--r-- | fs/bcachefs/btree_update.h | 28 |
1 files changed, 19 insertions, 9 deletions
diff --git a/fs/bcachefs/btree_update.h b/fs/bcachefs/btree_update.h index 1f2a77bfe461..8aec86ca2d20 100644 --- a/fs/bcachefs/btree_update.h +++ b/fs/bcachefs/btree_update.h @@ -101,8 +101,6 @@ int bch2_bkey_get_empty_slot(struct btree_trans *, struct btree_iter *, int __must_check bch2_trans_update(struct btree_trans *, struct btree_iter *, struct bkey_i *, enum btree_update_flags); -int __must_check bch2_trans_update_buffered(struct btree_trans *, - enum btree_id, struct bkey_i *); struct jset_entry *__bch2_trans_jset_entry_alloc(struct btree_trans *, unsigned); @@ -123,6 +121,25 @@ bch2_trans_jset_entry_alloc(struct btree_trans *trans, unsigned u64s) return e; } +int bch2_btree_insert_clone_trans(struct btree_trans *, enum btree_id, struct bkey_i *); + +static inline int __must_check bch2_trans_update_buffered(struct btree_trans *trans, + enum btree_id btree, + struct bkey_i *k) +{ + if (unlikely(trans->journal_replay_not_finished)) + return bch2_btree_insert_clone_trans(trans, btree, k); + + struct jset_entry *e = bch2_trans_jset_entry_alloc(trans, jset_u64s(k->k.u64s)); + int ret = PTR_ERR_OR_ZERO(e); + if (ret) + return ret; + + journal_entry_init(e, BCH_JSET_ENTRY_write_buffer_keys, btree, 0, k->k.u64s); + bkey_copy(e->start, k); + return 0; +} + void bch2_trans_commit_hook(struct btree_trans *, struct btree_trans_commit_hook *); int __bch2_trans_commit(struct btree_trans *, unsigned); @@ -174,11 +191,6 @@ static inline int bch2_trans_commit(struct btree_trans *trans, (_i) < (_trans)->updates + (_trans)->nr_updates; \ (_i)++) -#define trans_for_each_wb_update(_trans, _i) \ - for ((_i) = (_trans)->wb_updates; \ - (_i) < (_trans)->wb_updates + (_trans)->nr_wb_updates; \ - (_i)++) - static inline void bch2_trans_reset_updates(struct btree_trans *trans) { struct btree_insert_entry *i; @@ -189,8 +201,6 @@ static inline void bch2_trans_reset_updates(struct btree_trans *trans) trans->extra_journal_res = 0; trans->nr_updates = 0; trans->journal_entries_u64s = 0; - trans->nr_wb_updates = 0; - trans->wb_updates = NULL; trans->hooks = NULL; if (trans->fs_usage_deltas) { |