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

bcachefs: Kill BTREE_ITER_NEED_PEEK

This was used for an optimization that hasn't existing in quite awhile
- iter->uptodate will probably be going away as well.
Signed-off-by: default avatarKent Overstreet <kent.overstreet@gmail.com>
parent 6fba6b83
...@@ -238,7 +238,7 @@ static inline bool btree_iter_get_locks(struct btree_trans *trans, ...@@ -238,7 +238,7 @@ static inline bool btree_iter_get_locks(struct btree_trans *trans,
} }
if (iter->uptodate == BTREE_ITER_NEED_RELOCK) if (iter->uptodate == BTREE_ITER_NEED_RELOCK)
iter->uptodate = BTREE_ITER_NEED_PEEK; iter->uptodate = BTREE_ITER_UPTODATE;
bch2_trans_verify_locks(trans); bch2_trans_verify_locks(trans);
...@@ -752,8 +752,6 @@ static void __bch2_btree_iter_fix_key_modified(struct btree_iter *iter, ...@@ -752,8 +752,6 @@ static void __bch2_btree_iter_fix_key_modified(struct btree_iter *iter,
if (bkey_iter_pos_cmp(l->b, where, &iter->real_pos) < 0) if (bkey_iter_pos_cmp(l->b, where, &iter->real_pos) < 0)
bch2_btree_node_iter_advance(&l->iter, l->b); bch2_btree_node_iter_advance(&l->iter, l->b);
btree_iter_set_dirty(iter, BTREE_ITER_NEED_PEEK);
} }
void bch2_btree_iter_fix_key_modified(struct btree_trans *trans, void bch2_btree_iter_fix_key_modified(struct btree_trans *trans,
...@@ -859,11 +857,6 @@ static void __bch2_btree_node_iter_fix(struct btree_iter *iter, ...@@ -859,11 +857,6 @@ static void __bch2_btree_node_iter_fix(struct btree_iter *iter,
b, t, k2); b, t, k2);
} }
} }
if (!b->c.level &&
node_iter == &iter->l[0].iter &&
iter_current_key_modified)
btree_iter_set_dirty(iter, BTREE_ITER_NEED_PEEK);
} }
void bch2_btree_node_iter_fix(struct btree_trans *trans, void bch2_btree_node_iter_fix(struct btree_trans *trans,
...@@ -1037,8 +1030,6 @@ static inline void __btree_iter_level_init(struct btree_iter *iter, ...@@ -1037,8 +1030,6 @@ static inline void __btree_iter_level_init(struct btree_iter *iter,
*/ */
if (level) if (level)
bch2_btree_node_iter_peek(&l->iter, l->b); bch2_btree_node_iter_peek(&l->iter, l->b);
btree_iter_set_dirty(iter, BTREE_ITER_NEED_PEEK);
} }
static inline void btree_iter_level_init(struct btree_trans *trans, static inline void btree_iter_level_init(struct btree_trans *trans,
...@@ -1482,7 +1473,7 @@ static int btree_iter_traverse_one(struct btree_trans *trans, ...@@ -1482,7 +1473,7 @@ static int btree_iter_traverse_one(struct btree_trans *trans,
} }
} }
iter->uptodate = BTREE_ITER_NEED_PEEK; iter->uptodate = BTREE_ITER_UPTODATE;
out: out:
BUG_ON((ret == -EINTR) != !!trans->restarted); BUG_ON((ret == -EINTR) != !!trans->restarted);
trace_iter_traverse(trans->ip, trace_ip, trace_iter_traverse(trans->ip, trace_ip,
...@@ -1672,8 +1663,6 @@ static void btree_iter_set_search_pos(struct btree_iter *iter, struct bpos new_p ...@@ -1672,8 +1663,6 @@ static void btree_iter_set_search_pos(struct btree_iter *iter, struct bpos new_p
out: out:
if (l != iter->level) if (l != iter->level)
btree_iter_set_dirty(iter, BTREE_ITER_NEED_TRAVERSE); btree_iter_set_dirty(iter, BTREE_ITER_NEED_TRAVERSE);
else
btree_iter_set_dirty(iter, BTREE_ITER_NEED_PEEK);
bch2_btree_iter_verify(iter); bch2_btree_iter_verify(iter);
#ifdef CONFIG_BCACHEFS_DEBUG #ifdef CONFIG_BCACHEFS_DEBUG
......
...@@ -165,7 +165,7 @@ static inline bool bch2_btree_iter_upgrade(struct btree_trans *trans, ...@@ -165,7 +165,7 @@ static inline bool bch2_btree_iter_upgrade(struct btree_trans *trans,
return iter->locks_want < new_locks_want return iter->locks_want < new_locks_want
? __bch2_btree_iter_upgrade(trans, iter, new_locks_want) ? __bch2_btree_iter_upgrade(trans, iter, new_locks_want)
: iter->uptodate <= BTREE_ITER_NEED_PEEK; : iter->uptodate == BTREE_ITER_UPTODATE;
} }
void __bch2_btree_iter_downgrade(struct btree_iter *, unsigned); void __bch2_btree_iter_downgrade(struct btree_iter *, unsigned);
......
...@@ -340,7 +340,7 @@ int bch2_btree_iter_traverse_cached(struct btree_trans *trans, struct btree_iter ...@@ -340,7 +340,7 @@ int bch2_btree_iter_traverse_cached(struct btree_trans *trans, struct btree_iter
if (!test_bit(BKEY_CACHED_ACCESSED, &ck->flags)) if (!test_bit(BKEY_CACHED_ACCESSED, &ck->flags))
set_bit(BKEY_CACHED_ACCESSED, &ck->flags); set_bit(BKEY_CACHED_ACCESSED, &ck->flags);
iter->uptodate = BTREE_ITER_NEED_PEEK; iter->uptodate = BTREE_ITER_UPTODATE;
if ((iter->flags & BTREE_ITER_INTENT) && if ((iter->flags & BTREE_ITER_INTENT) &&
!bch2_btree_iter_upgrade(trans, iter, 1)) { !bch2_btree_iter_upgrade(trans, iter, 1)) {
......
...@@ -218,9 +218,8 @@ enum btree_iter_type { ...@@ -218,9 +218,8 @@ enum btree_iter_type {
enum btree_iter_uptodate { enum btree_iter_uptodate {
BTREE_ITER_UPTODATE = 0, BTREE_ITER_UPTODATE = 0,
BTREE_ITER_NEED_PEEK = 1, BTREE_ITER_NEED_RELOCK = 1,
BTREE_ITER_NEED_RELOCK = 2, BTREE_ITER_NEED_TRAVERSE = 2,
BTREE_ITER_NEED_TRAVERSE = 3,
}; };
#define BTREE_ITER_NO_NODE_GET_LOCKS ((struct btree *) 1) #define BTREE_ITER_NO_NODE_GET_LOCKS ((struct btree *) 1)
......
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