summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@linux.dev>2023-02-05 16:35:38 -0500
committerKent Overstreet <kent.overstreet@linux.dev>2023-02-05 16:42:02 -0500
commitd504848176c2353fffe42a45511893b80c861763 (patch)
treee489fb898f3a9ff6538b8e8dd7e902ce62fd7202
parent83411ed541841962e1e022f19a41c7b35e6c9688 (diff)
bcachefs: Fix bch2_trans_update_max_paths()
We have to call it before marking the new path as allocated, since otherwise we'll be calling path_to_text() on a path that isn't yet initialized. Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
-rw-r--r--fs/bcachefs/btree_iter.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/fs/bcachefs/btree_iter.c b/fs/bcachefs/btree_iter.c
index 57639b29f798..a7173ca7674c 100644
--- a/fs/bcachefs/btree_iter.c
+++ b/fs/bcachefs/btree_iter.c
@@ -1515,6 +1515,9 @@ static inline struct btree_path *btree_path_alloc(struct btree_trans *trans,
btree_path_overflow(trans);
idx = __ffs64(~trans->paths_allocated);
+ if (unlikely(idx > trans->nr_max_paths))
+ bch2_trans_update_max_paths(trans);
+
trans->paths_allocated |= 1ULL << idx;
path = &trans->paths[idx];
@@ -1525,9 +1528,6 @@ static inline struct btree_path *btree_path_alloc(struct btree_trans *trans,
btree_path_list_add(trans, pos, path);
trans->paths_sorted = false;
-
- if (unlikely(idx > trans->nr_max_paths))
- bch2_trans_update_max_paths(trans);
return path;
}