peek() has to update iter->real_pos - there's no need for
bch2_btree_iter_set_pos() to update it as well.
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
bch2_btree_iter_verify(iter);
}
-void bch2_btree_iter_set_pos(struct btree_iter *iter, struct bpos new_pos)
-{
- bkey_init(&iter->k);
- iter->k.p = iter->pos = new_pos;
-
- btree_iter_set_search_pos(iter, btree_iter_search_key(iter));
-}
-
inline bool bch2_btree_iter_advance(struct btree_iter *iter)
{
struct bpos pos = iter->k.p;
__bch2_btree_iter_upgrade_nounlock(iter, 1);
bch2_btree_iter_set_pos(iter, pos);
+ btree_iter_set_search_pos(iter, btree_iter_search_key(iter));
return iter;
}
bool bch2_btree_iter_advance(struct btree_iter *);
bool bch2_btree_iter_rewind(struct btree_iter *);
-void bch2_btree_iter_set_pos(struct btree_iter *, struct bpos);
+
+static inline void bch2_btree_iter_set_pos(struct btree_iter *iter, struct bpos new_pos)
+{
+ bkey_init(&iter->k);
+ iter->k.p = iter->pos = new_pos;
+}
/* Sort order for locking btree iterators: */
static inline int btree_iter_lock_cmp(const struct btree_iter *l,