Commit 0f2ea655 authored by Kent Overstreet's avatar Kent Overstreet

bcachefs: bch2_btree_iter_peek_and_restart_outlined()

Needed for interfacing with Rust - bindgen can't handle inline
functions, alas.
Signed-off-by: default avatarKent Overstreet <kent.overstreet@linux.dev>
parent 94bc95c4
......@@ -2568,6 +2568,18 @@ struct bkey_s_c bch2_btree_iter_prev_slot(struct btree_iter *iter)
return bch2_btree_iter_peek_slot(iter);
}
struct bkey_s_c bch2_btree_iter_peek_and_restart_outlined(struct btree_iter *iter)
{
struct bkey_s_c k;
while (btree_trans_too_many_iters(iter->trans) ||
(k = bch2_btree_iter_peek_type(iter, iter->flags),
bch2_err_matches(bkey_err(k), BCH_ERR_transaction_restart)))
bch2_trans_begin(iter->trans);
return k;
}
/* new transactional stuff: */
#ifdef CONFIG_BCACHEFS_DEBUG
......
......@@ -595,6 +595,8 @@ static inline int btree_trans_too_many_iters(struct btree_trans *trans)
return 0;
}
struct bkey_s_c bch2_btree_iter_peek_and_restart_outlined(struct btree_iter *);
static inline struct bkey_s_c
__bch2_btree_iter_peek_and_restart(struct btree_trans *trans,
struct btree_iter *iter, unsigned flags)
......
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