diff options
author | Christoph Hellwig <hch@infradead.org> | 2008-10-30 02:14:34 -0400 |
---|---|---|
committer | Lachlan McIlroy <lachlan@sgi.com> | 2008-10-30 02:14:34 -0400 |
commit | 7cc95a821df8f09a5d37a923cf8c3a7c3ee00c29 (patch) | |
tree | 8fde02d4c9a52b7da7b3e961f8a23cf4b493a4a4 /fs/xfs/xfs_alloc_btree.h | |
parent | 136341b41ad4883bd668120f727a52c42331fe8a (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_alloc_btree.h')
-rw-r--r-- | fs/xfs/xfs_alloc_btree.h | 18 |
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 | ||
25 | struct xfs_buf; | 25 | struct xfs_buf; |
26 | struct xfs_btree_cur; | 26 | struct xfs_btree_cur; |
27 | struct xfs_btree_sblock; | ||
28 | struct xfs_mount; | 27 | struct 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 */ |
52 | typedef __be32 xfs_alloc_ptr_t; | 51 | typedef __be32 xfs_alloc_ptr_t; |
53 | /* btree block header type */ | ||
54 | typedef 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 | ||