From 07fc72e103a6912fd1c7fe1dd8f6f29efbd07164 Mon Sep 17 00:00:00 2001 From: Kent Overstreet Date: Sun, 21 Mar 2021 17:01:34 -0400 Subject: [PATCH] bcachefs: Kill btree_iter_peek_uptodate() Since we're no longer doing next() immediately followed by peek(), this optimization isn't doing anything anymore. Signed-off-by: Kent Overstreet Signed-off-by: Kent Overstreet --- fs/bcachefs/btree_iter.c | 51 ---------------------------------------- 1 file changed, 51 deletions(-) diff --git a/fs/bcachefs/btree_iter.c b/fs/bcachefs/btree_iter.c index c7fa80bf8b9c..6c24e499450b 100644 --- a/fs/bcachefs/btree_iter.c +++ b/fs/bcachefs/btree_iter.c @@ -1346,9 +1346,6 @@ struct btree *bch2_btree_iter_peek_node(struct btree_iter *iter) EBUG_ON(btree_iter_type(iter) != BTREE_ITER_NODES); bch2_btree_iter_verify(iter); - if (iter->uptodate == BTREE_ITER_UPTODATE) - return iter->l[iter->level].b; - ret = bch2_btree_iter_traverse(iter); if (ret) return NULL; @@ -1360,7 +1357,6 @@ struct btree *bch2_btree_iter_peek_node(struct btree_iter *iter) BUG_ON(bkey_cmp(b->key.k.p, iter->pos) < 0); iter->pos = iter->real_pos = b->key.k.p; - iter->uptodate = BTREE_ITER_UPTODATE; bch2_btree_iter_verify(iter); @@ -1417,7 +1413,6 @@ struct btree *bch2_btree_iter_next_node(struct btree_iter *iter) } iter->pos = iter->real_pos = b->key.k.p; - iter->uptodate = BTREE_ITER_UPTODATE; bch2_btree_iter_verify(iter); @@ -1530,34 +1525,6 @@ static inline bool btree_iter_set_pos_to_prev_leaf(struct btree_iter *iter) return ret; } -/** - * btree_iter_peek_uptodate - given an iterator that is uptodate, return the key - * it currently points to - */ -static inline struct bkey_s_c btree_iter_peek_uptodate(struct btree_iter *iter) -{ - struct btree_iter_level *l = &iter->l[0]; - struct bkey_s_c ret = { .k = &iter->k }; - - if (!bkey_deleted(&iter->k)) { - struct bkey_packed *_k = - __bch2_btree_node_iter_peek_all(&l->iter, l->b); - - ret.v = bkeyp_val(&l->b->format, _k); - - if (bch2_debug_check_iterators) { - struct bkey k = bkey_unpack_key(l->b, _k); - - BUG_ON(memcmp(&k, &iter->k, sizeof(k))); - } - - if (bch2_debug_check_bkeys) - bch2_bkey_debugcheck(iter->trans->c, l->b, ret); - } - - return ret; -} - /** * bch2_btree_iter_peek: returns first key greater than or equal to iterator's * current position @@ -1574,10 +1541,6 @@ struct bkey_s_c bch2_btree_iter_peek(struct btree_iter *iter) btree_iter_set_search_pos(iter, btree_iter_search_key(iter)); - if (iter->uptodate == BTREE_ITER_UPTODATE && - !bkey_deleted(&iter->k)) - return btree_iter_peek_uptodate(iter); - while (1) { ret = bch2_btree_iter_traverse(iter); if (unlikely(ret)) @@ -1600,8 +1563,6 @@ struct bkey_s_c bch2_btree_iter_peek(struct btree_iter *iter) iter->real_pos = k.k->p; - iter->uptodate = BTREE_ITER_UPTODATE; - bch2_btree_iter_verify_entry_exit(iter); bch2_btree_iter_verify(iter); return k; @@ -1686,7 +1647,6 @@ struct bkey_s_c bch2_btree_iter_peek_with_updates(struct btree_iter *iter) if (bkey_cmp(bkey_start_pos(k.k), iter->pos) > 0) iter->pos = bkey_start_pos(k.k); - iter->uptodate = BTREE_ITER_UPTODATE; return k; } @@ -1714,10 +1674,6 @@ struct bkey_s_c bch2_btree_iter_peek_prev(struct btree_iter *iter) btree_iter_set_search_pos(iter, iter->pos); - if (iter->uptodate == BTREE_ITER_UPTODATE && - !bkey_deleted(&iter->k)) - return btree_iter_peek_uptodate(iter); - while (1) { ret = bch2_btree_iter_traverse(iter); if (unlikely(ret)) { @@ -1747,7 +1703,6 @@ struct bkey_s_c bch2_btree_iter_peek_prev(struct btree_iter *iter) if (bkey_cmp(k.k->p, iter->pos) < 0) iter->pos = k.k->p; iter->real_pos = k.k->p; - iter->uptodate = BTREE_ITER_UPTODATE; out: bch2_btree_iter_verify_entry_exit(iter); bch2_btree_iter_verify(iter); @@ -1812,8 +1767,6 @@ __bch2_btree_iter_peek_slot_extents(struct btree_iter *iter) EBUG_ON(!iter->k.size); - iter->uptodate = BTREE_ITER_UPTODATE; - bch2_btree_iter_verify_entry_exit(iter); bch2_btree_iter_verify(iter); @@ -1832,9 +1785,6 @@ struct bkey_s_c bch2_btree_iter_peek_slot(struct btree_iter *iter) btree_iter_set_search_pos(iter, btree_iter_search_key(iter)); - if (iter->uptodate == BTREE_ITER_UPTODATE) - return btree_iter_peek_uptodate(iter); - if (iter->flags & BTREE_ITER_IS_EXTENTS) return __bch2_btree_iter_peek_slot_extents(iter); @@ -1853,7 +1803,6 @@ struct bkey_s_c bch2_btree_iter_peek_slot(struct btree_iter *iter) k = (struct bkey_s_c) { &iter->k, NULL }; } - iter->uptodate = BTREE_ITER_UPTODATE; bch2_btree_iter_verify_entry_exit(iter); bch2_btree_iter_verify(iter); return k;