diff options
author | Kent Overstreet <kent.overstreet@linux.dev> | 2024-04-14 01:02:15 +0300 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@linux.dev> | 2024-04-15 20:31:15 +0300 |
commit | ad29cf999a9161e7849aa229d2028854f90728c2 (patch) | |
tree | 12c29e7e3262b406997566d0044e869f45a6e8bb /fs | |
parent | 3078e059a5e984663c5c2b04485375c84c2700f9 (diff) | |
download | linux-ad29cf999a9161e7849aa229d2028854f90728c2.tar.xz |
bcachefs: set_btree_iter_dontneed also clears should_be_locked
This is part of a larger series cleaning up the semantics of
should_be_locked and adding assertions around it; if we don't need an
iterator/path anymore, it clearly doesn't need to be locked.
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/bcachefs/btree_iter.h | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/fs/bcachefs/btree_iter.h b/fs/bcachefs/btree_iter.h index 1d58d447b386..1c70836dd7cc 100644 --- a/fs/bcachefs/btree_iter.h +++ b/fs/bcachefs/btree_iter.h @@ -498,8 +498,13 @@ static inline void set_btree_iter_dontneed(struct btree_iter *iter) { struct btree_trans *trans = iter->trans; - if (!trans->restarted) - btree_iter_path(trans, iter)->preserve = false; + if (!iter->path || trans->restarted) + return; + + struct btree_path *path = btree_iter_path(trans, iter); + path->preserve = false; + if (path->ref == 1) + path->should_be_locked = false; } void *__bch2_trans_kmalloc(struct btree_trans *, size_t); |