summaryrefslogtreecommitdiff
path: root/fs/bcachefs/recovery.h
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@gmail.com>2022-04-11 20:28:13 -0400
committerKent Overstreet <kent.overstreet@linux.dev>2023-10-22 17:09:31 -0400
commit5650bb46be89a1254609d47e4c87d1e9cf9121fb (patch)
tree73506214235f46eed04b2e4675463db1b38b2ea4 /fs/bcachefs/recovery.h
parent9b93596c33f6c23de96c05dce82b9aead271a286 (diff)
bcachefs: Introduce bch2_journal_keys_peek_(upto|slot)()
When many journal replay keys have been overwritten, bch2_journal_keys_peek() was taking excessively long to scan before it found a key to return. Fix this by introducing bch2_journal_keys_peek_upto() which takes a parameter for the end of the range we want, so that we can terminate the search much sooner, and replace all uses of bch2_journal_keys_peek() with peek_upto() or peek_slot(). Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
Diffstat (limited to 'fs/bcachefs/recovery.h')
-rw-r--r--fs/bcachefs/recovery.h6
1 files changed, 4 insertions, 2 deletions
diff --git a/fs/bcachefs/recovery.h b/fs/bcachefs/recovery.h
index ab8b116ac7db..e05aac64185d 100644
--- a/fs/bcachefs/recovery.h
+++ b/fs/bcachefs/recovery.h
@@ -30,8 +30,10 @@ struct btree_and_journal_iter {
size_t bch2_journal_key_search(struct journal_keys *, enum btree_id,
unsigned, struct bpos);
-struct bkey_i *bch2_journal_keys_peek(struct bch_fs *, enum btree_id,
- unsigned, struct bpos pos);
+struct bkey_i *bch2_journal_keys_peek_upto(struct bch_fs *, enum btree_id,
+ unsigned, struct bpos, struct bpos);
+struct bkey_i *bch2_journal_keys_peek_slot(struct bch_fs *, enum btree_id,
+ unsigned, struct bpos);
int bch2_journal_key_insert_take(struct bch_fs *, enum btree_id,
unsigned, struct bkey_i *);