Commit ae1ede58 authored by Kent Overstreet's avatar Kent Overstreet Committed by Kent Overstreet

bcachefs: Don't embed btree iters in btree_trans

These haven't been in used since reallocing iterators has been disabled,
and saves us a lot of stack if we get rid of it.
Signed-off-by: default avatarKent Overstreet <kent.overstreet@gmail.com>
Signed-off-by: default avatarKent Overstreet <kent.overstreet@linux.dev>
parent 692d4031
...@@ -2039,8 +2039,7 @@ static int bch2_trans_realloc_iters(struct btree_trans *trans, ...@@ -2039,8 +2039,7 @@ static int bch2_trans_realloc_iters(struct btree_trans *trans,
sizeof(struct btree_iter) * trans->nr_iters + sizeof(struct btree_iter) * trans->nr_iters +
sizeof(struct btree_insert_entry) * trans->nr_iters); sizeof(struct btree_insert_entry) * trans->nr_iters);
if (trans->iters != trans->iters_onstack) kfree(trans->iters);
kfree(trans->iters);
trans->iters = new_iters; trans->iters = new_iters;
trans->updates = new_updates; trans->updates = new_updates;
...@@ -2331,21 +2330,15 @@ void bch2_trans_init(struct btree_trans *trans, struct bch_fs *c, ...@@ -2331,21 +2330,15 @@ void bch2_trans_init(struct btree_trans *trans, struct bch_fs *c,
unsigned expected_nr_iters, unsigned expected_nr_iters,
size_t expected_mem_bytes) size_t expected_mem_bytes)
{ {
memset(trans, 0, offsetof(struct btree_trans, iters_onstack));
/* /*
* reallocating iterators currently completely breaks * reallocating iterators currently completely breaks
* bch2_trans_iter_put(): * bch2_trans_iter_put():
*/ */
expected_nr_iters = BTREE_ITER_MAX; expected_nr_iters = BTREE_ITER_MAX;
memset(trans, 0, sizeof(*trans));
trans->c = c; trans->c = c;
trans->ip = _RET_IP_; trans->ip = _RET_IP_;
trans->size = ARRAY_SIZE(trans->iters_onstack);
trans->iters = trans->iters_onstack;
trans->updates = trans->updates_onstack;
trans->updates2 = trans->updates2_onstack;
trans->fs_usage_deltas = NULL;
if (expected_nr_iters > trans->size) if (expected_nr_iters > trans->size)
bch2_trans_realloc_iters(trans, expected_nr_iters); bch2_trans_realloc_iters(trans, expected_nr_iters);
...@@ -2377,7 +2370,7 @@ int bch2_trans_exit(struct btree_trans *trans) ...@@ -2377,7 +2370,7 @@ int bch2_trans_exit(struct btree_trans *trans)
kfree(trans->mem); kfree(trans->mem);
if (trans->used_mempool) if (trans->used_mempool)
mempool_free(trans->iters, &trans->c->btree_iters_pool); mempool_free(trans->iters, &trans->c->btree_iters_pool);
else if (trans->iters != trans->iters_onstack) else
kfree(trans->iters); kfree(trans->iters);
trans->mem = (void *) 0x1; trans->mem = (void *) 0x1;
trans->iters = (void *) 0x1; trans->iters = (void *) 0x1;
......
...@@ -381,10 +381,6 @@ struct btree_trans { ...@@ -381,10 +381,6 @@ struct btree_trans {
unsigned journal_u64s; unsigned journal_u64s;
unsigned journal_preres_u64s; unsigned journal_preres_u64s;
struct replicas_delta_list *fs_usage_deltas; struct replicas_delta_list *fs_usage_deltas;
struct btree_iter iters_onstack[2];
struct btree_insert_entry updates_onstack[2];
struct btree_insert_entry updates2_onstack[2];
}; };
#define BTREE_FLAG(flag) \ #define BTREE_FLAG(flag) \
......
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