aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs/xfs_alloc_btree.h
diff options
context:
space:
mode:
Diffstat (limited to 'fs/xfs/xfs_alloc_btree.h')
-rw-r--r--fs/xfs/xfs_alloc_btree.h18
1 files changed, 10 insertions, 8 deletions
diff --git a/fs/xfs/xfs_alloc_btree.h b/fs/xfs/xfs_alloc_btree.h
index 579f9c7e0872..a6caa0022c9b 100644
--- a/fs/xfs/xfs_alloc_btree.h
+++ b/fs/xfs/xfs_alloc_btree.h
@@ -24,7 +24,6 @@
24 24
25struct xfs_buf; 25struct xfs_buf;
26struct xfs_btree_cur; 26struct xfs_btree_cur;
27struct xfs_btree_sblock;
28struct xfs_mount; 27struct xfs_mount;
29 28
30/* 29/*
@@ -50,10 +49,6 @@ typedef struct xfs_alloc_rec_incore {
50 49
51/* btree pointer type */ 50/* btree pointer type */
52typedef __be32 xfs_alloc_ptr_t; 51typedef __be32 xfs_alloc_ptr_t;
53/* btree block header type */
54typedef struct xfs_btree_sblock xfs_alloc_block_t;
55
56#define XFS_BUF_TO_ALLOC_BLOCK(bp) ((xfs_alloc_block_t *)XFS_BUF_PTR(bp))
57 52
58/* 53/*
59 * Minimum and maximum blocksize and sectorsize. 54 * Minimum and maximum blocksize and sectorsize.
@@ -77,6 +72,13 @@ typedef struct xfs_btree_sblock xfs_alloc_block_t;
77#define XFS_CNT_BLOCK(mp) ((xfs_agblock_t)(XFS_BNO_BLOCK(mp) + 1)) 72#define XFS_CNT_BLOCK(mp) ((xfs_agblock_t)(XFS_BNO_BLOCK(mp) + 1))
78 73
79/* 74/*
75 * Btree block header size depends on a superblock flag.
76 *
77 * (not quite yet, but soon)
78 */
79#define XFS_ALLOC_BLOCK_LEN(mp) XFS_BTREE_SBLOCK_LEN
80
81/*
80 * Record, key, and pointer address macros for btree blocks. 82 * Record, key, and pointer address macros for btree blocks.
81 * 83 *
82 * (note that some of these may appear unused, but they are used in userspace) 84 * (note that some of these may appear unused, but they are used in userspace)
@@ -84,19 +86,19 @@ typedef struct xfs_btree_sblock xfs_alloc_block_t;
84#define XFS_ALLOC_REC_ADDR(mp, block, index) \ 86#define XFS_ALLOC_REC_ADDR(mp, block, index) \
85 ((xfs_alloc_rec_t *) \ 87 ((xfs_alloc_rec_t *) \
86 ((char *)(block) + \ 88 ((char *)(block) + \
87 sizeof(struct xfs_btree_sblock) + \ 89 XFS_ALLOC_BLOCK_LEN(mp) + \
88 (((index) - 1) * sizeof(xfs_alloc_rec_t)))) 90 (((index) - 1) * sizeof(xfs_alloc_rec_t))))
89 91
90#define XFS_ALLOC_KEY_ADDR(mp, block, index) \ 92#define XFS_ALLOC_KEY_ADDR(mp, block, index) \
91 ((xfs_alloc_key_t *) \ 93 ((xfs_alloc_key_t *) \
92 ((char *)(block) + \ 94 ((char *)(block) + \
93 sizeof(struct xfs_btree_sblock) + \ 95 XFS_ALLOC_BLOCK_LEN(mp) + \
94 ((index) - 1) * sizeof(xfs_alloc_key_t))) 96 ((index) - 1) * sizeof(xfs_alloc_key_t)))
95 97
96#define XFS_ALLOC_PTR_ADDR(mp, block, index, maxrecs) \ 98#define XFS_ALLOC_PTR_ADDR(mp, block, index, maxrecs) \
97 ((xfs_alloc_ptr_t *) \ 99 ((xfs_alloc_ptr_t *) \
98 ((char *)(block) + \ 100 ((char *)(block) + \
99 sizeof(struct xfs_btree_sblock) + \ 101 XFS_ALLOC_BLOCK_LEN(mp) + \
100 (maxrecs) * sizeof(xfs_alloc_key_t) + \ 102 (maxrecs) * sizeof(xfs_alloc_key_t) + \
101 ((index) - 1) * sizeof(xfs_alloc_ptr_t))) 103 ((index) - 1) * sizeof(xfs_alloc_ptr_t)))
102 104