diff options
author | Kent Overstreet <kent.overstreet@linux.dev> | 2023-02-28 05:26:07 +0300 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@linux.dev> | 2023-10-23 00:09:55 +0300 |
commit | 0f2ea6550f1fbfabbe2db276107246c1236018ab (patch) | |
tree | a0f302853c63442dd7e0c3a31c5567e0b15a50e5 /fs | |
parent | 94bc95c468344d6a329dd87ab4461532584a7b71 (diff) | |
download | linux-0f2ea6550f1fbfabbe2db276107246c1236018ab.tar.xz |
bcachefs: bch2_btree_iter_peek_and_restart_outlined()
Needed for interfacing with Rust - bindgen can't handle inline
functions, alas.
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/bcachefs/btree_iter.c | 12 | ||||
-rw-r--r-- | fs/bcachefs/btree_iter.h | 2 |
2 files changed, 14 insertions, 0 deletions
diff --git a/fs/bcachefs/btree_iter.c b/fs/bcachefs/btree_iter.c index 63213205a043..eebab7534f62 100644 --- a/fs/bcachefs/btree_iter.c +++ b/fs/bcachefs/btree_iter.c @@ -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 diff --git a/fs/bcachefs/btree_iter.h b/fs/bcachefs/btree_iter.h index 50b39704c56f..8e1f754e641b 100644 --- a/fs/bcachefs/btree_iter.h +++ b/fs/bcachefs/btree_iter.h @@ -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) |