diff options
author | Kent Overstreet <kent.overstreet@gmail.com> | 2019-09-26 22:21:39 -0400 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@linux.dev> | 2023-10-22 17:08:28 -0400 |
commit | 64bc00115335450c4178fea04c5b664cf73a9729 (patch) | |
tree | 3e491d56806bfa5037273a1dd4fb631a2c8177c7 /fs/bcachefs/buckets.c | |
parent | a7199432c3cbcd42141cfd5c047bf8828c2390d8 (diff) |
bcachefs: Rework btree iterator lifetimes
The btree_trans struct needs to memoize/cache btree iterators, so that
on transaction restart we don't have to completely redo btree lookups,
and so that we can do them all at once in the correct order when the
transaction had to restart to avoid a deadlock.
This switches the btree iterator lookups to work based on iterator
position, instead of trying to match them up based on the stack trace.
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs/bcachefs/buckets.c')
-rw-r--r-- | fs/bcachefs/buckets.c | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/fs/bcachefs/buckets.c b/fs/bcachefs/buckets.c index 9c97a1522d9d..5e0e699c679a 100644 --- a/fs/bcachefs/buckets.c +++ b/fs/bcachefs/buckets.c @@ -1369,13 +1369,11 @@ static int trans_get_key(struct btree_trans *trans, return 1; } - *iter = __bch2_trans_get_iter(trans, btree_id, pos, - BTREE_ITER_SLOTS|BTREE_ITER_INTENT, 0); + *iter = bch2_trans_get_iter(trans, btree_id, pos, + BTREE_ITER_SLOTS|BTREE_ITER_INTENT); if (IS_ERR(*iter)) return PTR_ERR(*iter); - bch2_trans_iter_free_on_commit(trans, *iter); - *k = bch2_btree_iter_peek_slot(*iter); ret = bkey_err(*k); if (ret) |