bcachefs: for_each_btree_key2()
authorKent Overstreet <kent.overstreet@gmail.com>
Sat, 16 Jul 2022 00:51:09 +0000 (20:51 -0400)
committerKent Overstreet <kent.overstreet@linux.dev>
Sun, 22 Oct 2023 21:09:35 +0000 (17:09 -0400)
commita1783320d46e878ddf5d2bb3380c181d515a5ff3
tree679a1d7df61a5b8431f3288888f9e01e63eea61b
parent0d06b4eca687b3a6a07b62fd4ca83d635103c77f
bcachefs: for_each_btree_key2()

This introduces two new macros for iterating through the btree, with
transaction restart handling
 - for_each_btree_key2()
 - for_each_btree_key_commit()

Every iteration is now in an implicit transaction, and - as with
lockrestart_do() and commit_do() - returning -EINTR will cause the
transaction to be restarted, at the same key.

This patch converts a bunch of code that was open coding this to these
new macros, saving a substantial amount of code.

Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
fs/bcachefs/alloc_background.c
fs/bcachefs/btree_gc.c
fs/bcachefs/btree_iter.h
fs/bcachefs/fsck.c
fs/bcachefs/quota.c
fs/bcachefs/subvolume.c