]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
bcachefs: add more path idx debug asserts
authorKent Overstreet <kent.overstreet@linux.dev>
Mon, 23 Sep 2024 22:11:07 +0000 (18:11 -0400)
committerKent Overstreet <kent.overstreet@linux.dev>
Sat, 21 Dec 2024 06:36:14 +0000 (01:36 -0500)
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
fs/bcachefs/btree_iter.h

index 24406f7232830596f9f80c39a35c940e6774dcb4..550db3654f2cc3c8fea1b05ba77948b308245caa 100644 (file)
@@ -23,6 +23,7 @@ static inline void __btree_path_get(struct btree_trans *trans, struct btree_path
 {
        unsigned idx = path - trans->paths;
 
+       EBUG_ON(idx >= trans->nr_paths);
        EBUG_ON(!test_bit(idx, trans->paths_allocated));
        if (unlikely(path->ref == U8_MAX)) {
                bch2_dump_trans_paths_updates(trans);
@@ -36,6 +37,7 @@ static inline void __btree_path_get(struct btree_trans *trans, struct btree_path
 
 static inline bool __btree_path_put(struct btree_trans *trans, struct btree_path *path, bool intent)
 {
+       EBUG_ON(path - trans->paths >= trans->nr_paths);
        EBUG_ON(!test_bit(path - trans->paths, trans->paths_allocated));
        EBUG_ON(!path->ref);
        EBUG_ON(!path->intent_ref && intent);