diff options
author | Kent Overstreet <kent.overstreet@linux.dev> | 2023-02-08 18:04:22 -0500 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@linux.dev> | 2023-10-22 17:09:50 -0400 |
commit | 992fa4e62020d257197efa4ec567499d52e9c381 (patch) | |
tree | 6fbb9fedf889bcf24498ce2ca5a71a405f691b00 /fs/bcachefs/btree_iter.c | |
parent | d7afe651ffa29fca79725a3cf5580a3fd2421fed (diff) |
bcachefs: Fix btree_path_alloc()
We need to call bch2_trans_update_max_paths() before marking the new
path as allocated, since we're not initializing it yet.
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs/bcachefs/btree_iter.c')
-rw-r--r-- | fs/bcachefs/btree_iter.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/fs/bcachefs/btree_iter.c b/fs/bcachefs/btree_iter.c index e5c82aa9bfeb..3d138ae19469 100644 --- a/fs/bcachefs/btree_iter.c +++ b/fs/bcachefs/btree_iter.c @@ -1507,6 +1507,14 @@ static inline struct btree_path *btree_path_alloc(struct btree_trans *trans, btree_path_overflow(trans); idx = __ffs64(~trans->paths_allocated); + + /* + * Do this before marking the new path as allocated, since it won't be + * initialized yet: + */ + if (unlikely(idx > trans->nr_max_paths)) + bch2_trans_update_max_paths(trans); + trans->paths_allocated |= 1ULL << idx; path = &trans->paths[idx]; @@ -1517,9 +1525,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; } |