diff options
author | Kent Overstreet <kent.overstreet@gmail.com> | 2022-02-24 19:04:11 -0500 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@linux.dev> | 2023-10-22 17:09:25 -0400 |
commit | eb7bd15fe4e7a4a6cf05d9086722aad49f80c259 (patch) | |
tree | ab2d7e971215f968be12d3f114b913ac4a2ccc08 /fs | |
parent | eac91bf27f088ecb0676873ff298db2dcd5ff9fa (diff) |
bcachefs: Improve debug assertion
We're hitting a strange bug with transaction paths not being sorted
correctly - this dumps transaction paths in the order we thought was
sorted, which will hopefully shed some light as to what's going on.
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/bcachefs/btree_iter.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/fs/bcachefs/btree_iter.c b/fs/bcachefs/btree_iter.c index 8aacaa05fc14..b58219292f34 100644 --- a/fs/bcachefs/btree_iter.c +++ b/fs/bcachefs/btree_iter.c @@ -1410,7 +1410,7 @@ static int btree_path_traverse_one(struct btree_trans *, struct btree_path *, static int bch2_btree_path_traverse_all(struct btree_trans *trans) { struct bch_fs *c = trans->c; - struct btree_path *path, *prev = NULL; + struct btree_path *path, *prev; unsigned long trace_ip = _RET_IP_; int i, ret = 0; @@ -1419,6 +1419,7 @@ static int bch2_btree_path_traverse_all(struct btree_trans *trans) trans->in_traverse_all = true; retry_all: + prev = NULL; trans->restarted = false; trans_for_each_path(trans, path) @@ -1852,6 +1853,7 @@ struct btree_path *bch2_path_get(struct btree_trans *trans, int i; BUG_ON(trans->restarted); + btree_trans_sort_paths(trans); btree_trans_sort_paths(trans); @@ -2722,7 +2724,10 @@ static void btree_trans_verify_sorted(struct btree_trans *trans) unsigned i; trans_for_each_path_inorder(trans, path, i) { - BUG_ON(prev && btree_path_cmp(prev, path) > 0); + if (prev && btree_path_cmp(prev, path) > 0) { + bch2_dump_trans_paths_updates(trans); + panic("trans paths out of order!\n"); + } prev = path; } } |