aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs/xfs_bmap_btree.h
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@infradead.org>2008-10-30 02:14:34 -0400
committerLachlan McIlroy <lachlan@sgi.com>2008-10-30 02:14:34 -0400
commit7cc95a821df8f09a5d37a923cf8c3a7c3ee00c29 (patch)
tree8fde02d4c9a52b7da7b3e961f8a23cf4b493a4a4 /fs/xfs/xfs_bmap_btree.h
parent136341b41ad4883bd668120f727a52c42331fe8a (diff)
[XFS] Always use struct xfs_btree_block instead of short / longform
structures. Always use the generic xfs_btree_block type instead of the short / long structures. Add XFS_BTREE_SBLOCK_LEN / XFS_BTREE_LBLOCK_LEN defines for the length of a short / long form block. The rationale for this is that we will grow more btree block header variants to support CRCs and other RAS information, and always accessing them through the same datatype with unions for the short / long form pointers makes implementing this much easier. SGI-PV: 988146 SGI-Modid: xfs-linux-melb:xfs-kern:32300a Signed-off-by: Christoph Hellwig <hch@infradead.org> Signed-off-by: Donald Douwsma <donaldd@sgi.com> Signed-off-by: David Chinner <david@fromorbit.com> Signed-off-by: Lachlan McIlroy <lachlan@sgi.com>
Diffstat (limited to 'fs/xfs/xfs_bmap_btree.h')
-rw-r--r--fs/xfs/xfs_bmap_btree.h23
1 files changed, 12 insertions, 11 deletions
diff --git a/fs/xfs/xfs_bmap_btree.h b/fs/xfs/xfs_bmap_btree.h
index 7f001072db47..735a42418c99 100644
--- a/fs/xfs/xfs_bmap_btree.h
+++ b/fs/xfs/xfs_bmap_btree.h
@@ -22,7 +22,6 @@
22 22
23struct xfs_btree_cur; 23struct xfs_btree_cur;
24struct xfs_btree_block; 24struct xfs_btree_block;
25struct xfs_btree_lblock;
26struct xfs_mount; 25struct xfs_mount;
27struct xfs_inode; 26struct xfs_inode;
28struct xfs_trans; 27struct xfs_trans;
@@ -147,27 +146,29 @@ typedef struct xfs_bmbt_key {
147/* btree pointer type */ 146/* btree pointer type */
148typedef __be64 xfs_bmbt_ptr_t, xfs_bmdr_ptr_t; 147typedef __be64 xfs_bmbt_ptr_t, xfs_bmdr_ptr_t;
149 148
150/* btree block header type */ 149/*
151typedef struct xfs_btree_lblock xfs_bmbt_block_t; 150 * Btree block header size depends on a superblock flag.
152 151 *
153#define XFS_BUF_TO_BMBT_BLOCK(bp) ((xfs_bmbt_block_t *)XFS_BUF_PTR(bp)) 152 * (not quite yet, but soon)
153 */
154#define XFS_BMBT_BLOCK_LEN(mp) XFS_BTREE_LBLOCK_LEN
154 155
155#define XFS_BMBT_REC_ADDR(mp, block, index) \ 156#define XFS_BMBT_REC_ADDR(mp, block, index) \
156 ((xfs_bmbt_rec_t *) \ 157 ((xfs_bmbt_rec_t *) \
157 ((char *)(block) + \ 158 ((char *)(block) + \
158 sizeof(struct xfs_btree_lblock) + \ 159 XFS_BMBT_BLOCK_LEN(mp) + \
159 ((index) - 1) * sizeof(xfs_bmbt_rec_t))) 160 ((index) - 1) * sizeof(xfs_bmbt_rec_t)))
160 161
161#define XFS_BMBT_KEY_ADDR(mp, block, index) \ 162#define XFS_BMBT_KEY_ADDR(mp, block, index) \
162 ((xfs_bmbt_key_t *) \ 163 ((xfs_bmbt_key_t *) \
163 ((char *)(block) + \ 164 ((char *)(block) + \
164 sizeof(struct xfs_btree_lblock) + \ 165 XFS_BMBT_BLOCK_LEN(mp) + \
165 ((index) - 1) * sizeof(xfs_bmbt_key_t))) 166 ((index) - 1) * sizeof(xfs_bmbt_key_t)))
166 167
167#define XFS_BMBT_PTR_ADDR(mp, block, index, maxrecs) \ 168#define XFS_BMBT_PTR_ADDR(mp, block, index, maxrecs) \
168 ((xfs_bmbt_ptr_t *) \ 169 ((xfs_bmbt_ptr_t *) \
169 ((char *)(block) + \ 170 ((char *)(block) + \
170 sizeof(struct xfs_btree_lblock) + \ 171 XFS_BMBT_BLOCK_LEN(mp) + \
171 (maxrecs) * sizeof(xfs_bmbt_key_t) + \ 172 (maxrecs) * sizeof(xfs_bmbt_key_t) + \
172 ((index) - 1) * sizeof(xfs_bmbt_ptr_t))) 173 ((index) - 1) * sizeof(xfs_bmbt_ptr_t)))
173 174
@@ -198,7 +199,7 @@ typedef struct xfs_btree_lblock xfs_bmbt_block_t;
198 XFS_BMBT_PTR_ADDR(mp, bb, i, xfs_bmbt_maxrecs(mp, sz, 0)) 199 XFS_BMBT_PTR_ADDR(mp, bb, i, xfs_bmbt_maxrecs(mp, sz, 0))
199 200
200#define XFS_BMAP_BROOT_SPACE_CALC(nrecs) \ 201#define XFS_BMAP_BROOT_SPACE_CALC(nrecs) \
201 (int)(sizeof(xfs_bmbt_block_t) + \ 202 (int)(XFS_BTREE_LBLOCK_LEN + \
202 ((nrecs) * (sizeof(xfs_bmbt_key_t) + sizeof(xfs_bmbt_ptr_t)))) 203 ((nrecs) * (sizeof(xfs_bmbt_key_t) + sizeof(xfs_bmbt_ptr_t))))
203 204
204#define XFS_BMAP_BROOT_SPACE(bb) \ 205#define XFS_BMAP_BROOT_SPACE(bb) \
@@ -223,7 +224,7 @@ typedef struct xfs_btree_lblock xfs_bmbt_block_t;
223 * Prototypes for xfs_bmap.c to call. 224 * Prototypes for xfs_bmap.c to call.
224 */ 225 */
225extern void xfs_bmdr_to_bmbt(struct xfs_mount *, xfs_bmdr_block_t *, int, 226extern void xfs_bmdr_to_bmbt(struct xfs_mount *, xfs_bmdr_block_t *, int,
226 xfs_bmbt_block_t *, int); 227 struct xfs_btree_block *, int);
227extern void xfs_bmbt_get_all(xfs_bmbt_rec_host_t *r, xfs_bmbt_irec_t *s); 228extern void xfs_bmbt_get_all(xfs_bmbt_rec_host_t *r, xfs_bmbt_irec_t *s);
228extern xfs_filblks_t xfs_bmbt_get_blockcount(xfs_bmbt_rec_host_t *r); 229extern xfs_filblks_t xfs_bmbt_get_blockcount(xfs_bmbt_rec_host_t *r);
229extern xfs_fsblock_t xfs_bmbt_get_startblock(xfs_bmbt_rec_host_t *r); 230extern xfs_fsblock_t xfs_bmbt_get_startblock(xfs_bmbt_rec_host_t *r);
@@ -246,7 +247,7 @@ extern void xfs_bmbt_disk_set_all(xfs_bmbt_rec_t *r, xfs_bmbt_irec_t *s);
246extern void xfs_bmbt_disk_set_allf(xfs_bmbt_rec_t *r, xfs_fileoff_t o, 247extern void xfs_bmbt_disk_set_allf(xfs_bmbt_rec_t *r, xfs_fileoff_t o,
247 xfs_fsblock_t b, xfs_filblks_t c, xfs_exntst_t v); 248 xfs_fsblock_t b, xfs_filblks_t c, xfs_exntst_t v);
248 249
249extern void xfs_bmbt_to_bmdr(struct xfs_mount *, xfs_bmbt_block_t *, int, 250extern void xfs_bmbt_to_bmdr(struct xfs_mount *, struct xfs_btree_block *, int,
250 xfs_bmdr_block_t *, int); 251 xfs_bmdr_block_t *, int);
251 252
252extern int xfs_bmbt_get_maxrecs(struct xfs_btree_cur *, int level); 253extern int xfs_bmbt_get_maxrecs(struct xfs_btree_cur *, int level);