summaryrefslogtreecommitdiffstats
path: root/fs/bcachefs/bcachefs_format.h
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@linux.dev>2022-11-26 05:14:30 +0100
committerKent Overstreet <kent.overstreet@linux.dev>2023-10-22 23:09:51 +0200
commit5250b74d55e16246a47bdcf1182b7469e28e0652 (patch)
treeb7f758f4e3a40f27caf1e1bee89eedd3df5f5924 /fs/bcachefs/bcachefs_format.h
parentbcachefs: Inline bch2_two_state_(trylock|unlock) (diff)
downloadlinux-5250b74d55e16246a47bdcf1182b7469e28e0652.tar.xz
linux-5250b74d55e16246a47bdcf1182b7469e28e0652.zip
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 <kent.overstreet@linux.dev>
Diffstat (limited to 'fs/bcachefs/bcachefs_format.h')
-rw-r--r--fs/bcachefs/bcachefs_format.h18
1 files changed, 15 insertions, 3 deletions
diff --git a/fs/bcachefs/bcachefs_format.h b/fs/bcachefs/bcachefs_format.h
index 024a714955f2..7e67d2e94a29 100644
--- a/fs/bcachefs/bcachefs_format.h
+++ b/fs/bcachefs/bcachefs_format.h
@@ -371,7 +371,8 @@ static inline void bkey_init(struct bkey *k)
x(lru, 26) \
x(alloc_v4, 27) \
x(backpointer, 28) \
- x(inode_v3, 29)
+ x(inode_v3, 29) \
+ x(bucket_gens, 30)
enum bch_bkey_type {
#define x(name, nr) KEY_TYPE_##name = nr,
@@ -1013,6 +1014,15 @@ struct bch_backpointer {
struct bpos pos;
} __packed __aligned(8);
+#define KEY_TYPE_BUCKET_GENS_BITS 8
+#define KEY_TYPE_BUCKET_GENS_NR (1U << KEY_TYPE_BUCKET_GENS_BITS)
+#define KEY_TYPE_BUCKET_GENS_MASK (KEY_TYPE_BUCKET_GENS_NR - 1)
+
+struct bch_bucket_gens {
+ struct bch_val v;
+ u8 gens[KEY_TYPE_BUCKET_GENS_NR];
+} __packed __aligned(8);
+
/* Quotas: */
enum quota_types {
@@ -1551,7 +1561,8 @@ struct bch_sb_field_journal_seq_blacklist {
x(new_data_types, 21) \
x(backpointers, 22) \
x(inode_v3, 23) \
- x(unwritten_extents, 24)
+ x(unwritten_extents, 24) \
+ x(bucket_gens, 25)
enum bcachefs_metadata_version {
bcachefs_metadata_version_min = 9,
@@ -2086,7 +2097,8 @@ LE32_BITMASK(JSET_NO_FLUSH, struct jset, flags, 5, 6);
x(lru, 10) \
x(freespace, 11) \
x(need_discard, 12) \
- x(backpointers, 13)
+ x(backpointers, 13) \
+ x(bucket_gens, 14)
enum btree_id {
#define x(kwd, val) BTREE_ID_##kwd = val,