diff options
author | Kent Overstreet <kent.overstreet@linux.dev> | 2023-03-03 00:03:01 -0500 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@linux.dev> | 2023-10-22 17:09:55 -0400 |
commit | 3329cf1bb91d6293a96cf35ad72b2a2e1e1c0e3d (patch) | |
tree | 4454b632673b2d32057199effc301fc60e7586ef /fs/bcachefs/btree_io.c | |
parent | 1306f87de399a0c791f03d68b50e03bdb3f409ae (diff) | |
download | lwn-3329cf1bb91d6293a96cf35ad72b2a2e1e1c0e3d.tar.gz lwn-3329cf1bb91d6293a96cf35ad72b2a2e1e1c0e3d.zip |
bcachefs: Centralize btree node lock initialization
This fixes some confusion in the lockdep code due to initializing btree
node/key cache locks with the same lockdep key, but different names.
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs/bcachefs/btree_io.c')
-rw-r--r-- | fs/bcachefs/btree_io.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/fs/bcachefs/btree_io.c b/fs/bcachefs/btree_io.c index 7ffdce97214e..358a285c3bcf 100644 --- a/fs/bcachefs/btree_io.c +++ b/fs/bcachefs/btree_io.c @@ -33,6 +33,8 @@ void bch2_btree_node_io_unlock(struct btree *b) void bch2_btree_node_io_lock(struct btree *b) { + bch2_assert_btree_nodes_not_locked(); + wait_on_bit_lock_io(&b->flags, BTREE_NODE_write_in_flight, TASK_UNINTERRUPTIBLE); } @@ -51,12 +53,16 @@ void __bch2_btree_node_wait_on_write(struct btree *b) void bch2_btree_node_wait_on_read(struct btree *b) { + bch2_assert_btree_nodes_not_locked(); + wait_on_bit_io(&b->flags, BTREE_NODE_read_in_flight, TASK_UNINTERRUPTIBLE); } void bch2_btree_node_wait_on_write(struct btree *b) { + bch2_assert_btree_nodes_not_locked(); + wait_on_bit_io(&b->flags, BTREE_NODE_write_in_flight, TASK_UNINTERRUPTIBLE); } |