From: Kent Overstreet Date: Tue, 27 Jun 2023 22:01:09 +0000 (-0400) Subject: bcachefs: Expand BTREE_NODE_ID X-Git-Tag: io_uring-6.7-2023-11-10~119^2~239 X-Git-Url: https://git.kernel.dk/?a=commitdiff_plain;h=4e1430a728499ce8088e1bdd0dd6467ce3447ca0;p=linux-block.git bcachefs: Expand BTREE_NODE_ID We now have 20 bits for the btree ID in the on disk format - sufficient for 1 million distinct btrees. Signed-off-by: Kent Overstreet --- diff --git a/fs/bcachefs/bcachefs_format.h b/fs/bcachefs/bcachefs_format.h index ad87cdff8544..a73f1de8e872 100644 --- a/fs/bcachefs/bcachefs_format.h +++ b/fs/bcachefs/bcachefs_format.h @@ -2195,13 +2195,25 @@ struct btree_node { }; } __packed __aligned(8); -LE64_BITMASK(BTREE_NODE_ID, struct btree_node, flags, 0, 4); +LE64_BITMASK(BTREE_NODE_ID_LO, struct btree_node, flags, 0, 4); LE64_BITMASK(BTREE_NODE_LEVEL, struct btree_node, flags, 4, 8); LE64_BITMASK(BTREE_NODE_NEW_EXTENT_OVERWRITE, struct btree_node, flags, 8, 9); -/* 9-32 unused */ +LE64_BITMASK(BTREE_NODE_ID_HI, struct btree_node, flags, 9, 25); +/* 25-32 unused */ LE64_BITMASK(BTREE_NODE_SEQ, struct btree_node, flags, 32, 64); +static inline __u64 BTREE_NODE_ID(struct btree_node *n) +{ + return BTREE_NODE_ID_LO(n) | (BTREE_NODE_ID_HI(n) << 4); +} + +static inline void SET_BTREE_NODE_ID(struct btree_node *n, u64 v) +{ + SET_BTREE_NODE_ID_LO(n, v); + SET_BTREE_NODE_ID_HI(n, v >> 4); +} + struct btree_node_entry { struct bch_csum csum; @@ -2211,7 +2223,6 @@ struct btree_node_entry { __u8 pad[22]; __le16 u64s; __u64 _data[0]; - }; }; } __packed __aligned(8);