diff options
author | Kent Overstreet <kent.overstreet@linux.dev> | 2022-09-04 04:09:54 +0300 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@linux.dev> | 2023-10-23 00:09:40 +0300 |
commit | da4474f20961f995a1d54f82b4c462c94ea03552 (patch) | |
tree | 5f0d4340d43b67b85494ba861774eec8ded2e19a /fs/bcachefs/btree_locking.c | |
parent | 4e6defd106b69c3a78da380d694fd43275125dda (diff) | |
download | linux-da4474f20961f995a1d54f82b4c462c94ea03552.tar.xz |
bcachefs: Convert more locking code to btree_bkey_cached_common
Ideally, all the code in btree_locking.c should be converted, but then
we'd want to convert btree_path to point to btree_key_cached_common too,
and then we'd be in for a much bigger cleanup - but a bit of incremental
cleanup will still be helpful for the next patches.
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs/bcachefs/btree_locking.c')
-rw-r--r-- | fs/bcachefs/btree_locking.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/fs/bcachefs/btree_locking.c b/fs/bcachefs/btree_locking.c index c73902c170d4..bfe9780aea3a 100644 --- a/fs/bcachefs/btree_locking.c +++ b/fs/bcachefs/btree_locking.c @@ -52,9 +52,10 @@ void bch2_btree_node_unlock_write(struct btree_trans *trans, /* lock */ -void __bch2_btree_node_lock_write(struct btree_trans *trans, struct btree *b) +void __bch2_btree_node_lock_write(struct btree_trans *trans, + struct btree_bkey_cached_common *b) { - int readers = bch2_btree_node_lock_counts(trans, NULL, &b->c, b->c.level).n[SIX_LOCK_read]; + int readers = bch2_btree_node_lock_counts(trans, NULL, b, b->level).n[SIX_LOCK_read]; /* * Must drop our read locks before calling six_lock_write() - @@ -62,9 +63,9 @@ void __bch2_btree_node_lock_write(struct btree_trans *trans, struct btree *b) * goes to 0, and it's safe because we have the node intent * locked: */ - six_lock_readers_add(&b->c.lock, -readers); - btree_node_lock_nopath_nofail(trans, &b->c, SIX_LOCK_write); - six_lock_readers_add(&b->c.lock, readers); + six_lock_readers_add(&b->lock, -readers); + btree_node_lock_nopath_nofail(trans, b, SIX_LOCK_write); + six_lock_readers_add(&b->lock, readers); } static inline bool path_has_read_locks(struct btree_path *path) |