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_ialloc_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_ialloc_btree.h')
-rw-r--r-- | fs/xfs/xfs_ialloc_btree.h | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/fs/xfs/xfs_ialloc_btree.h b/fs/xfs/xfs_ialloc_btree.h index fa12c85db340..37e5dd01a577 100644 --- a/fs/xfs/xfs_ialloc_btree.h +++ b/fs/xfs/xfs_ialloc_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 | /* |
@@ -70,11 +69,6 @@ typedef struct xfs_inobt_key { | |||
70 | /* btree pointer type */ | 69 | /* btree pointer type */ |
71 | typedef __be32 xfs_inobt_ptr_t; | 70 | typedef __be32 xfs_inobt_ptr_t; |
72 | 71 | ||
73 | /* btree block header type */ | ||
74 | typedef struct xfs_btree_sblock xfs_inobt_block_t; | ||
75 | |||
76 | #define XFS_BUF_TO_INOBT_BLOCK(bp) ((xfs_inobt_block_t *)XFS_BUF_PTR(bp)) | ||
77 | |||
78 | /* | 72 | /* |
79 | * Bit manipulations for ir_free. | 73 | * Bit manipulations for ir_free. |
80 | */ | 74 | */ |
@@ -96,6 +90,13 @@ typedef struct xfs_btree_sblock xfs_inobt_block_t; | |||
96 | #define XFS_PREALLOC_BLOCKS(mp) ((xfs_agblock_t)(XFS_IBT_BLOCK(mp) + 1)) | 90 | #define XFS_PREALLOC_BLOCKS(mp) ((xfs_agblock_t)(XFS_IBT_BLOCK(mp) + 1)) |
97 | 91 | ||
98 | /* | 92 | /* |
93 | * Btree block header size depends on a superblock flag. | ||
94 | * | ||
95 | * (not quite yet, but soon) | ||
96 | */ | ||
97 | #define XFS_INOBT_BLOCK_LEN(mp) XFS_BTREE_SBLOCK_LEN | ||
98 | |||
99 | /* | ||
99 | * Record, key, and pointer address macros for btree blocks. | 100 | * Record, key, and pointer address macros for btree blocks. |
100 | * | 101 | * |
101 | * (note that some of these may appear unused, but they are used in userspace) | 102 | * (note that some of these may appear unused, but they are used in userspace) |
@@ -103,19 +104,19 @@ typedef struct xfs_btree_sblock xfs_inobt_block_t; | |||
103 | #define XFS_INOBT_REC_ADDR(mp, block, index) \ | 104 | #define XFS_INOBT_REC_ADDR(mp, block, index) \ |
104 | ((xfs_inobt_rec_t *) \ | 105 | ((xfs_inobt_rec_t *) \ |
105 | ((char *)(block) + \ | 106 | ((char *)(block) + \ |
106 | sizeof(struct xfs_btree_sblock) + \ | 107 | XFS_INOBT_BLOCK_LEN(mp) + \ |
107 | (((index) - 1) * sizeof(xfs_inobt_rec_t)))) | 108 | (((index) - 1) * sizeof(xfs_inobt_rec_t)))) |
108 | 109 | ||
109 | #define XFS_INOBT_KEY_ADDR(mp, block, index) \ | 110 | #define XFS_INOBT_KEY_ADDR(mp, block, index) \ |
110 | ((xfs_inobt_key_t *) \ | 111 | ((xfs_inobt_key_t *) \ |
111 | ((char *)(block) + \ | 112 | ((char *)(block) + \ |
112 | sizeof(struct xfs_btree_sblock) + \ | 113 | XFS_INOBT_BLOCK_LEN(mp) + \ |
113 | ((index) - 1) * sizeof(xfs_inobt_key_t))) | 114 | ((index) - 1) * sizeof(xfs_inobt_key_t))) |
114 | 115 | ||
115 | #define XFS_INOBT_PTR_ADDR(mp, block, index, maxrecs) \ | 116 | #define XFS_INOBT_PTR_ADDR(mp, block, index, maxrecs) \ |
116 | ((xfs_inobt_ptr_t *) \ | 117 | ((xfs_inobt_ptr_t *) \ |
117 | ((char *)(block) + \ | 118 | ((char *)(block) + \ |
118 | sizeof(struct xfs_btree_sblock) + \ | 119 | XFS_INOBT_BLOCK_LEN(mp) + \ |
119 | (maxrecs) * sizeof(xfs_inobt_key_t) + \ | 120 | (maxrecs) * sizeof(xfs_inobt_key_t) + \ |
120 | ((index) - 1) * sizeof(xfs_inobt_ptr_t))) | 121 | ((index) - 1) * sizeof(xfs_inobt_ptr_t))) |
121 | 122 | ||