From 64bc00115335450c4178fea04c5b664cf73a9729 Mon Sep 17 00:00:00 2001 From: Kent Overstreet Date: Thu, 26 Sep 2019 22:21:39 -0400 Subject: 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 --- fs/bcachefs/buckets.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'fs/bcachefs/buckets.c') 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) -- cgit