summaryrefslogtreecommitdiff
path: root/fs/xfs/libxfs/xfs_btree.h
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2024-02-22 23:36:17 +0300
committerDarrick J. Wong <djwong@kernel.org>2024-02-22 23:36:17 +0300
commit4f0cd5a555072e21fb589975607b70798e073f8f (patch)
tree44c356ee6fcb0f8d0a3aeca0a5832f9c1169fb5c /fs/xfs/libxfs/xfs_btree.h
parent1a9d26291c68fbb8f8d24f9f694b32223a072745 (diff)
downloadlinux-4f0cd5a555072e21fb589975607b70798e073f8f.tar.xz
xfs: split out a btree type from the btree ops geometry flags
Two of the btree cursor flags are always used together and encode the fundamental btree type. There currently are two such types: 1) an on-disk AG-rooted btree with 32-bit pointers 2) an on-disk inode-rooted btree with 64-bit pointers and we're about to add: 3) an in-memory btree with 64-bit pointers Introduce a new enum and a new type field in struct xfs_btree_geom to encode this type directly instead of using flags and change most code to switch on this enum. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Darrick J. Wong <djwong@kernel.org> [djwong: make the pointer lengths explicit] Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Diffstat (limited to 'fs/xfs/libxfs/xfs_btree.h')
-rw-r--r--fs/xfs/libxfs/xfs_btree.h15
1 files changed, 11 insertions, 4 deletions
diff --git a/fs/xfs/libxfs/xfs_btree.h b/fs/xfs/libxfs/xfs_btree.h
index 559066e3ac12..5f2b5ef858ee 100644
--- a/fs/xfs/libxfs/xfs_btree.h
+++ b/fs/xfs/libxfs/xfs_btree.h
@@ -117,7 +117,15 @@ static inline enum xbtree_key_contig xbtree_key_contig(uint64_t x, uint64_t y)
#define XFS_BTREE_LONG_PTR_LEN (sizeof(__be64))
#define XFS_BTREE_SHORT_PTR_LEN (sizeof(__be32))
+enum xfs_btree_type {
+ XFS_BTREE_TYPE_AG,
+ XFS_BTREE_TYPE_INODE,
+};
+
struct xfs_btree_ops {
+ /* Type of btree - AG-rooted or inode-rooted */
+ enum xfs_btree_type type;
+
/* XFS_BTGEO_* flags that determine the geometry of the btree */
unsigned int geom_flags;
@@ -216,9 +224,8 @@ struct xfs_btree_ops {
};
/* btree geometry flags */
-#define XFS_BTGEO_ROOT_IN_INODE (1U << 0) /* root may be variable size */
-#define XFS_BTGEO_LASTREC_UPDATE (1U << 1) /* track last rec externally */
-#define XFS_BTGEO_OVERLAPPING (1U << 2) /* overlapping intervals */
+#define XFS_BTGEO_LASTREC_UPDATE (1U << 0) /* track last rec externally */
+#define XFS_BTGEO_OVERLAPPING (1U << 1) /* overlapping intervals */
/*
* Reasons for the update_lastrec method to be called.
@@ -292,7 +299,7 @@ struct xfs_btree_cur
/*
* Short btree pointers need an agno to be able to turn the pointers
* into physical addresses for IO, so the btree cursor switches between
- * bc_ino and bc_ag based on whether XFS_BTGEO_ROOT_IN_INODE is set for
+ * bc_ino and bc_ag based on bc_ops->type.
* the cursor.
*/
union {