aboutsummaryrefslogtreecommitdiff
path: root/fs/bcachefs/recovery.h
diff options
context:
space:
mode:
authorGravatar Kent Overstreet <kent.overstreet@gmail.com> 2021-01-26 20:15:46 -0500
committerGravatar Kent Overstreet <kent.overstreet@linux.dev> 2023-10-22 17:08:52 -0400
commit5b593ee172bd536a2c9fd717de7e4a16d682ef23 (patch)
tree2cc9e4d8acf85afef16a7336feebfb1c2161e72b /fs/bcachefs/recovery.h
parentbcachefs: Add BTREE_PTR_RANGE_UPDATED (diff)
downloadlinux-5b593ee172bd536a2c9fd717de7e4a16d682ef23.tar.gz
linux-5b593ee172bd536a2c9fd717de7e4a16d682ef23.tar.bz2
linux-5b593ee172bd536a2c9fd717de7e4a16d682ef23.zip
bcachefs: Add support for doing btree updates prior to journal replay
Some errors may need to be fixed in order for GC to successfully run - walk and mark all metadata. But we can't start the allocators and do normal btree updates until after GC has completed, and allocation information is known to be consistent, so we need a different method of doing btree updates. Fortunately, we already have code for walking the btree while overlaying keys from the journal to be replayed. This patch adds an update path that adds keys to the list of keys to be replayed by journal replay, and also fixes up iterators. Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com> Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs/bcachefs/recovery.h')
-rw-r--r--fs/bcachefs/recovery.h17
1 files changed, 9 insertions, 8 deletions
diff --git a/fs/bcachefs/recovery.h b/fs/bcachefs/recovery.h
index a66827c9addf..fa91851b9ed7 100644
--- a/fs/bcachefs/recovery.h
+++ b/fs/bcachefs/recovery.h
@@ -6,10 +6,11 @@
for (i = (keys).d; i < (keys).d + (keys).nr; (i)++)
struct journal_iter {
+ struct list_head list;
enum btree_id btree_id;
unsigned level;
+ size_t idx;
struct journal_keys *keys;
- struct journal_key *k;
};
/*
@@ -17,8 +18,6 @@ struct journal_iter {
*/
struct btree_and_journal_iter {
- struct btree_iter *btree;
-
struct btree *b;
struct btree_node_iter node_iter;
struct bkey unpacked;
@@ -32,16 +31,18 @@ struct btree_and_journal_iter {
} last;
};
+int bch2_journal_key_insert(struct bch_fs *, enum btree_id,
+ unsigned, struct bkey_i *);
+int bch2_journal_key_delete(struct bch_fs *, enum btree_id,
+ unsigned, struct bpos);
+
void bch2_btree_and_journal_iter_advance(struct btree_and_journal_iter *);
struct bkey_s_c bch2_btree_and_journal_iter_peek(struct btree_and_journal_iter *);
struct bkey_s_c bch2_btree_and_journal_iter_next(struct btree_and_journal_iter *);
-void bch2_btree_and_journal_iter_init(struct btree_and_journal_iter *,
- struct btree_trans *,
- struct journal_keys *,
- enum btree_id, struct bpos);
+void bch2_btree_and_journal_iter_exit(struct btree_and_journal_iter *);
void bch2_btree_and_journal_iter_init_node_iter(struct btree_and_journal_iter *,
- struct journal_keys *,
+ struct bch_fs *,
struct btree *);
typedef int (*btree_walk_node_fn)(struct bch_fs *c, struct btree *b);