diff options
author | Kent Overstreet <kent.overstreet@gmail.com> | 2022-08-10 18:55:53 -0400 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@linux.dev> | 2023-10-22 17:09:37 -0400 |
commit | fd211bc71c9b4093ed39d4fc93294f9ff423febc (patch) | |
tree | 8ce776949db181cf6f2bbd234a22d7d5ff24558f /fs/bcachefs/btree_locking.h | |
parent | 31301dd46975b2423fd38fc64bc58728d89dbcac (diff) | |
download | lwn-fd211bc71c9b4093ed39d4fc93294f9ff423febc.tar.gz lwn-fd211bc71c9b4093ed39d4fc93294f9ff423febc.zip |
bcachefs: Don't set should_be_locked on paths that aren't locked
It doesn't make any sense to set should_be_locked on btree_paths that
aren't locked, and is often a bug - this patch adds assertions and fixes
some of those bugs.
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
Diffstat (limited to 'fs/bcachefs/btree_locking.h')
-rw-r--r-- | fs/bcachefs/btree_locking.h | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/fs/bcachefs/btree_locking.h b/fs/bcachefs/btree_locking.h index 9d4e1a658eef..90bf5c02f504 100644 --- a/fs/bcachefs/btree_locking.h +++ b/fs/bcachefs/btree_locking.h @@ -283,4 +283,12 @@ static inline void bch2_btree_node_lock_write(struct btree_trans *trans, __bch2_btree_node_lock_write(trans, b); } +static inline void btree_path_set_should_be_locked(struct btree_path *path) +{ + EBUG_ON(!btree_node_locked(path, path->level)); + EBUG_ON(path->uptodate); + + path->should_be_locked = true; +} + #endif /* _BCACHEFS_BTREE_LOCKING_H */ |