summaryrefslogtreecommitdiff
path: root/fs/bcachefs/btree_iter.c
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@linux.dev>2023-03-06 12:01:22 +0300
committerKent Overstreet <kent.overstreet@linux.dev>2023-10-23 00:09:56 +0300
commit511b629aca6007a8784a6005a023dd166ffaa787 (patch)
tree170e48f00449fe2bcb7f2142108b47c9944d5e54 /fs/bcachefs/btree_iter.c
parentb65499b7b16b99575f1e7921da402b3b59c47de6 (diff)
downloadlinux-511b629aca6007a8784a6005a023dd166ffaa787.tar.xz
bcachefs: bch2_btree_iter_peek_node_and_restart()
Minor refactoring for the Rust interface. Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs/bcachefs/btree_iter.c')
-rw-r--r--fs/bcachefs/btree_iter.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/fs/bcachefs/btree_iter.c b/fs/bcachefs/btree_iter.c
index e6dcca59e31a..a1be6c81c3be 100644
--- a/fs/bcachefs/btree_iter.c
+++ b/fs/bcachefs/btree_iter.c
@@ -1723,6 +1723,17 @@ err:
goto out;
}
+struct btree *bch2_btree_iter_peek_node_and_restart(struct btree_iter *iter)
+{
+ struct btree *b;
+
+ while (b = bch2_btree_iter_peek_node(iter),
+ bch2_err_matches(PTR_ERR_OR_ZERO(b), BCH_ERR_transaction_restart))
+ bch2_trans_begin(iter->trans);
+
+ return b;
+}
+
struct btree *bch2_btree_iter_next_node(struct btree_iter *iter)
{
struct btree_trans *trans = iter->trans;