diff options
author | Kent Overstreet <kent.overstreet@linux.dev> | 2023-11-17 23:13:49 -0500 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@linux.dev> | 2023-11-24 02:43:12 -0500 |
commit | 8a443d3ea1327fea5ac3be77d2e39ebe35bfe9cf (patch) | |
tree | 74f257252a4f1467c8e6a49e2ec93b48924c2595 /fs/bcachefs/btree_journal_iter.h | |
parent | 63807d951803e422cea8bfb4fdd36f57de191ada (diff) | |
download | linux-8a443d3ea1327fea5ac3be77d2e39ebe35bfe9cf.tar.gz linux-8a443d3ea1327fea5ac3be77d2e39ebe35bfe9cf.tar.bz2 linux-8a443d3ea1327fea5ac3be77d2e39ebe35bfe9cf.zip |
bcachefs: Proper refcounting for journal_keys
The btree iterator code overlays keys from the journal until journal
replay is finished; since we're now starting copygc/rebalance etc.
before replay is finished, this is multithreaded access and thus needs
refcounting.
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs/bcachefs/btree_journal_iter.h')
-rw-r--r-- | fs/bcachefs/btree_journal_iter.h | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/fs/bcachefs/btree_journal_iter.h b/fs/bcachefs/btree_journal_iter.h index 5d64e7e22f26..8ca4c100b2e3 100644 --- a/fs/bcachefs/btree_journal_iter.h +++ b/fs/bcachefs/btree_journal_iter.h @@ -49,7 +49,15 @@ void bch2_btree_and_journal_iter_init_node_iter(struct btree_and_journal_iter *, struct bch_fs *, struct btree *); -void bch2_journal_keys_free(struct journal_keys *); +void bch2_journal_keys_put(struct bch_fs *); + +static inline void bch2_journal_keys_put_initial(struct bch_fs *c) +{ + if (c->journal_keys.initial_ref_held) + bch2_journal_keys_put(c); + c->journal_keys.initial_ref_held = false; +} + void bch2_journal_entries_free(struct bch_fs *); int bch2_journal_keys_sort(struct bch_fs *); |