summaryrefslogtreecommitdiff
path: root/fs/bcachefs/btree_locking.h
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@gmail.com>2022-08-11 01:55:53 +0300
committerKent Overstreet <kent.overstreet@linux.dev>2023-10-23 00:09:37 +0300
commitfd211bc71c9b4093ed39d4fc93294f9ff423febc (patch)
tree8ce776949db181cf6f2bbd234a22d7d5ff24558f /fs/bcachefs/btree_locking.h
parent31301dd46975b2423fd38fc64bc58728d89dbcac (diff)
downloadlinux-fd211bc71c9b4093ed39d4fc93294f9ff423febc.tar.xz
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.h8
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 */