From 5250b74d55e16246a47bdcf1182b7469e28e0652 Mon Sep 17 00:00:00 2001 From: Kent Overstreet Date: Fri, 25 Nov 2022 23:14:30 -0500 Subject: bcachefs: bucket_gens btree To improve mount times, add a btree for just bucket gens, 256 of them per key: this means we'll have to scan drastically less metadata at startup. This adds - trigger for keeping it in sync with the all btree - initialization code, for filesystems from previous versions - new path for reading bucket gens - new fsck code And a new on disk format version. Signed-off-by: Kent Overstreet --- fs/bcachefs/alloc_background.h | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'fs/bcachefs/alloc_background.h') diff --git a/fs/bcachefs/alloc_background.h b/fs/bcachefs/alloc_background.h index b843316d3846..d4957b4557bf 100644 --- a/fs/bcachefs/alloc_background.h +++ b/fs/bcachefs/alloc_background.h @@ -148,6 +148,16 @@ void bch2_alloc_to_text(struct printbuf *, struct bch_fs *, struct bkey_s_c); .atomic_trigger = bch2_mark_alloc, \ }) +int bch2_bucket_gens_invalid(const struct bch_fs *, struct bkey_s_c, int, struct printbuf *); +void bch2_bucket_gens_to_text(struct printbuf *, struct bch_fs *, struct bkey_s_c); + +#define bch2_bkey_ops_bucket_gens ((struct bkey_ops) { \ + .key_invalid = bch2_bucket_gens_invalid, \ + .val_to_text = bch2_bucket_gens_to_text, \ +}) + +int bch2_bucket_gens_init(struct bch_fs *); + static inline bool bkey_is_alloc(const struct bkey *k) { return k->type == KEY_TYPE_alloc || @@ -156,6 +166,7 @@ static inline bool bkey_is_alloc(const struct bkey *k) } int bch2_alloc_read(struct bch_fs *); +int bch2_bucket_gens_read(struct bch_fs *); int bch2_trans_mark_alloc(struct btree_trans *, enum btree_id, unsigned, struct bkey_s_c, struct bkey_i *, unsigned); -- cgit v1.2.3