Commit 5cc6daf7 authored by Kent Overstreet's avatar Kent Overstreet

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: default avatarKent Overstreet <kent.overstreet@linux.dev>
parent 31403dca
......@@ -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 @@ struct btree_trans *__bch2_trans_get(struct bch_fs *c, unsigned fn_idx)
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;
......
......@@ -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)
......
......@@ -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) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment