diff options
author | Kent Overstreet <kent.overstreet@linux.dev> | 2023-12-13 04:30:44 +0300 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@linux.dev> | 2024-01-01 19:47:44 +0300 |
commit | 5cc6daf74979ca951ce2550847995b3b18398af4 (patch) | |
tree | eff7bc84a6fefbddea7fb1076d5a429205415de5 /fs/bcachefs | |
parent | 31403dca5bb1e55ea0ea6ad1264b81fa8c9a3768 (diff) | |
download | linux-5cc6daf74979ca951ce2550847995b3b18398af4.tar.xz |
bcachefs: trans->updates will also be resizable
the reflink triggers are also bumping up against the maximum number of
paths in a transaction - and generating proportional numbers of updates.
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs/bcachefs')
-rw-r--r-- | fs/bcachefs/btree_iter.c | 3 | ||||
-rw-r--r-- | fs/bcachefs/btree_types.h | 4 | ||||
-rw-r--r-- | fs/bcachefs/btree_update.c | 2 |
3 files changed, 5 insertions, 4 deletions
diff --git a/fs/bcachefs/btree_iter.c b/fs/bcachefs/btree_iter.c index c35a262f6081..3c45d9e195d0 100644 --- a/fs/bcachefs/btree_iter.c +++ b/fs/bcachefs/btree_iter.c @@ -2888,7 +2888,7 @@ struct btree_trans *__bch2_trans_get(struct bch_fs *c, unsigned fn_idx) if (IS_ENABLED(__KERNEL__)) { trans = this_cpu_xchg(c->btree_trans_bufs->trans, NULL); if (trans) { - memset(trans, 0, offsetof(struct btree_trans, updates)); + memset(trans, 0, offsetof(struct btree_trans, list)); goto got_trans; } } @@ -2936,6 +2936,7 @@ got_trans: trans->paths_allocated = trans->_paths_allocated; trans->sorted = trans->_sorted; trans->paths = trans->_paths; + trans->updates = trans->_updates; *trans_paths_nr(trans->paths) = BTREE_ITER_MAX; diff --git a/fs/bcachefs/btree_types.h b/fs/bcachefs/btree_types.h index 3baf688177c4..81f54a2c4e81 100644 --- a/fs/bcachefs/btree_types.h +++ b/fs/bcachefs/btree_types.h @@ -383,6 +383,7 @@ struct btree_trans { unsigned long *paths_allocated; struct btree_path *paths; u8 *sorted; + struct btree_insert_entry *updates; void *mem; unsigned mem_top; @@ -433,8 +434,6 @@ struct btree_trans { /* Entries before this are zeroed out on every bch2_trans_get() call */ - struct btree_insert_entry updates[BTREE_ITER_MAX]; - struct list_head list; struct closure ref; @@ -442,6 +441,7 @@ struct btree_trans { struct btree_trans_paths trans_paths; struct btree_path _paths[BTREE_ITER_MAX]; u8 _sorted[BTREE_ITER_MAX + 8]; + struct btree_insert_entry _updates[BTREE_ITER_MAX]; }; static inline struct btree_path *btree_iter_path(struct btree_trans *trans, struct btree_iter *iter) diff --git a/fs/bcachefs/btree_update.c b/fs/bcachefs/btree_update.c index 37d4039dd0fe..140a44aeb321 100644 --- a/fs/bcachefs/btree_update.c +++ b/fs/bcachefs/btree_update.c @@ -386,7 +386,7 @@ bch2_trans_update_by_path(struct btree_trans *trans, btree_path_idx_t path_idx, struct btree_path *path = trans->paths + path_idx; EBUG_ON(!path->should_be_locked); - EBUG_ON(trans->nr_updates >= ARRAY_SIZE(trans->updates)); + EBUG_ON(trans->nr_updates >= BTREE_ITER_MAX); EBUG_ON(!bpos_eq(k->k.p, path->pos)); n = (struct btree_insert_entry) { |