summaryrefslogtreecommitdiffstats
path: root/fs/bcachefs/btree_trans_commit.c
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@linux.dev>2023-12-15 15:21:40 -0500
committerKent Overstreet <kent.overstreet@linux.dev>2024-01-01 11:47:44 -0500
commitff70ad2c8dfdcc24f98b645481116d4c2ea20e37 (patch)
tree6ea34e5a6f698872131530c15dd28518de310bea /fs/bcachefs/btree_trans_commit.c
parent2c3b0fc3bd0a5db0d10260b08a7139fdb7a4d3a8 (diff)
downloadlinux-ff70ad2c8dfdcc24f98b645481116d4c2ea20e37.tar.gz
linux-ff70ad2c8dfdcc24f98b645481116d4c2ea20e37.tar.bz2
linux-ff70ad2c8dfdcc24f98b645481116d4c2ea20e37.zip
bcachefs: Fix interior update path btree_path uses
Since the btree_paths array is now about to become growable, we have to be careful not to refer to paths by pointer across contexts where they may be reallocated. This fixes the remaining btree_interior_update() paths - split and merge. Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs/bcachefs/btree_trans_commit.c')
-rw-r--r--fs/bcachefs/btree_trans_commit.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/fs/bcachefs/btree_trans_commit.c b/fs/bcachefs/btree_trans_commit.c
index 7e6ba3061e7c..2ec9ff06f1a6 100644
--- a/fs/bcachefs/btree_trans_commit.c
+++ b/fs/bcachefs/btree_trans_commit.c
@@ -823,7 +823,7 @@ static inline int do_bch2_trans_commit(struct btree_trans *trans, unsigned flags
if (!same_leaf_as_next(trans, i)) {
if (u64s_delta <= 0) {
- ret = bch2_foreground_maybe_merge(trans, trans->paths + i->path,
+ ret = bch2_foreground_maybe_merge(trans, i->path,
i->level, flags);
if (unlikely(ret))
return ret;
@@ -877,14 +877,12 @@ int bch2_trans_commit_error(struct btree_trans *trans, unsigned flags,
struct bch_fs *c = trans->c;
switch (ret) {
- case -BCH_ERR_btree_insert_btree_node_full: {
- struct btree_path *path = trans->paths + i->path;
-
- ret = bch2_btree_split_leaf(trans, path, flags);
+ case -BCH_ERR_btree_insert_btree_node_full:
+ ret = bch2_btree_split_leaf(trans, i->path, flags);
if (bch2_err_matches(ret, BCH_ERR_transaction_restart))
- trace_and_count(c, trans_restart_btree_node_split, trans, trace_ip, path);
+ trace_and_count(c, trans_restart_btree_node_split, trans,
+ trace_ip, trans->paths + i->path);
break;
- }
case -BCH_ERR_btree_insert_need_mark_replicas:
ret = drop_locks_do(trans,
bch2_replicas_delta_list_mark(c, trans->fs_usage_deltas));