Go to the documentation of this file.
18 #ifndef __XFS_BMAP_BTREE_H__
19 #define __XFS_BMAP_BTREE_H__
21 #define XFS_BMAP_MAGIC 0x424d4150
44 #define BMBT_EXNTFLAG_BITLEN 1
45 #define BMBT_STARTOFF_BITLEN 54
46 #define BMBT_STARTBLOCK_BITLEN 52
47 #define BMBT_BLOCKCOUNT_BITLEN 21
63 #define STARTBLOCKVALBITS 17
64 #define STARTBLOCKMASKBITS (15 + XFS_BIG_BLKNOS * 20)
65 #define DSTARTBLOCKMASKBITS (15 + 20)
66 #define STARTBLOCKMASK \
67 (((((xfs_fsblock_t)1) << STARTBLOCKMASKBITS) - 1) << STARTBLOCKVALBITS)
68 #define DSTARTBLOCKMASK \
69 (((((xfs_dfsbno_t)1) << DSTARTBLOCKMASKBITS) - 1) << STARTBLOCKVALBITS)
111 #define XFS_EXTFMT_INODE(x) \
112 (xfs_sb_version_hasextflgbit(&((x)->i_mount->m_sb)) ? \
113 XFS_EXTFMT_HASSTATE : XFS_EXTFMT_NOSTATE)
114 #define ISUNWRITTEN(x) ((x)->br_state == XFS_EXT_UNWRITTEN)
142 #define XFS_BMBT_BLOCK_LEN(mp) XFS_BTREE_LBLOCK_LEN
144 #define XFS_BMBT_REC_ADDR(mp, block, index) \
145 ((xfs_bmbt_rec_t *) \
147 XFS_BMBT_BLOCK_LEN(mp) + \
148 ((index) - 1) * sizeof(xfs_bmbt_rec_t)))
150 #define XFS_BMBT_KEY_ADDR(mp, block, index) \
151 ((xfs_bmbt_key_t *) \
153 XFS_BMBT_BLOCK_LEN(mp) + \
154 ((index) - 1) * sizeof(xfs_bmbt_key_t)))
156 #define XFS_BMBT_PTR_ADDR(mp, block, index, maxrecs) \
157 ((xfs_bmbt_ptr_t *) \
159 XFS_BMBT_BLOCK_LEN(mp) + \
160 (maxrecs) * sizeof(xfs_bmbt_key_t) + \
161 ((index) - 1) * sizeof(xfs_bmbt_ptr_t)))
163 #define XFS_BMDR_REC_ADDR(block, index) \
164 ((xfs_bmdr_rec_t *) \
166 sizeof(struct xfs_bmdr_block) + \
167 ((index) - 1) * sizeof(xfs_bmdr_rec_t)))
169 #define XFS_BMDR_KEY_ADDR(block, index) \
170 ((xfs_bmdr_key_t *) \
172 sizeof(struct xfs_bmdr_block) + \
173 ((index) - 1) * sizeof(xfs_bmdr_key_t)))
175 #define XFS_BMDR_PTR_ADDR(block, index, maxrecs) \
176 ((xfs_bmdr_ptr_t *) \
178 sizeof(struct xfs_bmdr_block) + \
179 (maxrecs) * sizeof(xfs_bmdr_key_t) + \
180 ((index) - 1) * sizeof(xfs_bmdr_ptr_t)))
186 #define XFS_BMAP_BROOT_PTR_ADDR(mp, bb, i, sz) \
187 XFS_BMBT_PTR_ADDR(mp, bb, i, xfs_bmbt_maxrecs(mp, sz, 0))
189 #define XFS_BMAP_BROOT_SPACE_CALC(nrecs) \
190 (int)(XFS_BTREE_LBLOCK_LEN + \
191 ((nrecs) * (sizeof(xfs_bmbt_key_t) + sizeof(xfs_bmbt_ptr_t))))
193 #define XFS_BMAP_BROOT_SPACE(bb) \
194 (XFS_BMAP_BROOT_SPACE_CALC(be16_to_cpu((bb)->bb_numrecs)))
195 #define XFS_BMDR_SPACE_CALC(nrecs) \
196 (int)(sizeof(xfs_bmdr_block_t) + \
197 ((nrecs) * (sizeof(xfs_bmbt_key_t) + sizeof(xfs_bmbt_ptr_t))))
202 #define XFS_BM_MAXLEVELS(mp,w) ((mp)->m_bm_maxlevels[(w)])
237 struct xfs_trans *,
struct xfs_inode *,
int);