diff options
| author | Kent Overstreet <kent.overstreet@gmail.com> | 2022-08-21 14:29:43 -0400 |
|---|---|---|
| committer | Kent Overstreet <kent.overstreet@linux.dev> | 2023-10-22 17:09:40 -0400 |
| commit | ca7d8fcabf29fae627babb72bda9b51763f9a145 (patch) | |
| tree | ed2ff585e6590f8d16c911837b8e1e1b27e19e6b /fs/bcachefs/btree_locking.c | |
| parent | 546180874ade7225676bc0cd5ea4e2388e2374bc (diff) | |
| download | linux-ca7d8fcabf29fae627babb72bda9b51763f9a145.tar.gz linux-ca7d8fcabf29fae627babb72bda9b51763f9a145.tar.bz2 linux-ca7d8fcabf29fae627babb72bda9b51763f9a145.zip | |
bcachefs: New locking functions
In the future, with the new deadlock cycle detector, we won't be using
bare six_lock_* anymore: lock wait entries will all be embedded in
btree_trans, and we will need a btree_trans context whenever locking a
btree node.
This patch plumbs a btree_trans to the few places that need it, and adds
two new locking functions
- btree_node_lock_nopath, which may fail returning a transaction
restart, and
- btree_node_lock_nopath_nofail, to be used in places where we know we
cannot deadlock (i.e. because we're holding no other locks).
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
Diffstat (limited to 'fs/bcachefs/btree_locking.c')
| -rw-r--r-- | fs/bcachefs/btree_locking.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/fs/bcachefs/btree_locking.c b/fs/bcachefs/btree_locking.c index 301311763d59..24d0ea903380 100644 --- a/fs/bcachefs/btree_locking.c +++ b/fs/bcachefs/btree_locking.c @@ -61,7 +61,7 @@ void __bch2_btree_node_lock_write(struct btree_trans *trans, struct btree *b) * locked: */ six_lock_readers_add(&b->c.lock, -readers); - six_lock_write(&b->c.lock, NULL, NULL); + btree_node_lock_nopath_nofail(trans, &b->c, SIX_LOCK_write); six_lock_readers_add(&b->c.lock, readers); } |
