aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs/xfs_bmap_btree.h
diff options
context:
space:
mode:
Diffstat (limited to 'fs/xfs/xfs_bmap_btree.h')
-rw-r--r--fs/xfs/xfs_bmap_btree.h46
1 files changed, 11 insertions, 35 deletions
diff --git a/fs/xfs/xfs_bmap_btree.h b/fs/xfs/xfs_bmap_btree.h
index 49539de9525b..153480f5bc63 100644
--- a/fs/xfs/xfs_bmap_btree.h
+++ b/fs/xfs/xfs_bmap_btree.h
@@ -175,19 +175,11 @@ typedef struct xfs_btree_lblock xfs_bmbt_block_t;
175 175
176#define XFS_BUF_TO_BMBT_BLOCK(bp) ((xfs_bmbt_block_t *)XFS_BUF_PTR(bp)) 176#define XFS_BUF_TO_BMBT_BLOCK(bp) ((xfs_bmbt_block_t *)XFS_BUF_PTR(bp))
177 177
178#define XFS_BMAP_IBLOCK_SIZE(lev,cur) (1 << (cur)->bc_blocklog)
179#define XFS_BMAP_RBLOCK_DSIZE(lev,cur) ((cur)->bc_private.b.forksize) 178#define XFS_BMAP_RBLOCK_DSIZE(lev,cur) ((cur)->bc_private.b.forksize)
180#define XFS_BMAP_RBLOCK_ISIZE(lev,cur) \ 179#define XFS_BMAP_RBLOCK_ISIZE(lev,cur) \
181 ((int)XFS_IFORK_PTR((cur)->bc_private.b.ip, \ 180 ((int)XFS_IFORK_PTR((cur)->bc_private.b.ip, \
182 (cur)->bc_private.b.whichfork)->if_broot_bytes) 181 (cur)->bc_private.b.whichfork)->if_broot_bytes)
183 182
184#define XFS_BMAP_BLOCK_DSIZE(lev,cur) \
185 (((lev) == (cur)->bc_nlevels - 1 ? \
186 XFS_BMAP_RBLOCK_DSIZE(lev,cur) : XFS_BMAP_IBLOCK_SIZE(lev,cur)))
187#define XFS_BMAP_BLOCK_ISIZE(lev,cur) \
188 (((lev) == (cur)->bc_nlevels - 1 ? \
189 XFS_BMAP_RBLOCK_ISIZE(lev,cur) : XFS_BMAP_IBLOCK_SIZE(lev,cur)))
190
191#define XFS_BMAP_BLOCK_DMAXRECS(lev,cur) \ 183#define XFS_BMAP_BLOCK_DMAXRECS(lev,cur) \
192 (((lev) == (cur)->bc_nlevels - 1 ? \ 184 (((lev) == (cur)->bc_nlevels - 1 ? \
193 XFS_BTREE_BLOCK_MAXRECS(XFS_BMAP_RBLOCK_DSIZE(lev,cur), \ 185 XFS_BTREE_BLOCK_MAXRECS(XFS_BMAP_RBLOCK_DSIZE(lev,cur), \
@@ -210,37 +202,21 @@ typedef struct xfs_btree_lblock xfs_bmbt_block_t;
210 xfs_bmbt, (lev) == 0) : \ 202 xfs_bmbt, (lev) == 0) : \
211 ((cur)->bc_mp->m_bmap_dmnr[(lev) != 0]))) 203 ((cur)->bc_mp->m_bmap_dmnr[(lev) != 0])))
212 204
213#define XFS_BMAP_REC_DADDR(bb,i,cur) \ 205#define XFS_BMAP_REC_DADDR(bb,i,cur) (XFS_BTREE_REC_ADDR(xfs_bmbt, bb, i))
214 (XFS_BTREE_REC_ADDR(XFS_BMAP_BLOCK_DSIZE( \ 206
215 be16_to_cpu((bb)->bb_level), cur), \ 207#define XFS_BMAP_REC_IADDR(bb,i,cur) (XFS_BTREE_REC_ADDR(xfs_bmbt, bb, i))
216 xfs_bmbt, bb, i, XFS_BMAP_BLOCK_DMAXRECS( \
217 be16_to_cpu((bb)->bb_level), cur)))
218#define XFS_BMAP_REC_IADDR(bb,i,cur) \
219 (XFS_BTREE_REC_ADDR(XFS_BMAP_BLOCK_ISIZE( \
220 be16_to_cpu((bb)->bb_level), cur), \
221 xfs_bmbt, bb, i, XFS_BMAP_BLOCK_IMAXRECS( \
222 be16_to_cpu((bb)->bb_level), cur)))
223 208
224#define XFS_BMAP_KEY_DADDR(bb,i,cur) \ 209#define XFS_BMAP_KEY_DADDR(bb,i,cur) \
225 (XFS_BTREE_KEY_ADDR(XFS_BMAP_BLOCK_DSIZE( \ 210 (XFS_BTREE_KEY_ADDR(xfs_bmbt, bb, i))
226 be16_to_cpu((bb)->bb_level), cur), \ 211
227 xfs_bmbt, bb, i, XFS_BMAP_BLOCK_DMAXRECS( \
228 be16_to_cpu((bb)->bb_level), cur)))
229#define XFS_BMAP_KEY_IADDR(bb,i,cur) \ 212#define XFS_BMAP_KEY_IADDR(bb,i,cur) \
230 (XFS_BTREE_KEY_ADDR(XFS_BMAP_BLOCK_ISIZE( \ 213 (XFS_BTREE_KEY_ADDR(xfs_bmbt, bb, i))
231 be16_to_cpu((bb)->bb_level), cur), \
232 xfs_bmbt, bb, i, XFS_BMAP_BLOCK_IMAXRECS( \
233 be16_to_cpu((bb)->bb_level), cur)))
234 214
235#define XFS_BMAP_PTR_DADDR(bb,i,cur) \ 215#define XFS_BMAP_PTR_DADDR(bb,i,cur) \
236 (XFS_BTREE_PTR_ADDR(XFS_BMAP_BLOCK_DSIZE( \ 216 (XFS_BTREE_PTR_ADDR(xfs_bmbt, bb, i, XFS_BMAP_BLOCK_DMAXRECS( \
237 be16_to_cpu((bb)->bb_level), cur), \
238 xfs_bmbt, bb, i, XFS_BMAP_BLOCK_DMAXRECS( \
239 be16_to_cpu((bb)->bb_level), cur))) 217 be16_to_cpu((bb)->bb_level), cur)))
240#define XFS_BMAP_PTR_IADDR(bb,i,cur) \ 218#define XFS_BMAP_PTR_IADDR(bb,i,cur) \
241 (XFS_BTREE_PTR_ADDR(XFS_BMAP_BLOCK_ISIZE( \ 219 (XFS_BTREE_PTR_ADDR(xfs_bmbt, bb, i, XFS_BMAP_BLOCK_IMAXRECS( \
242 be16_to_cpu((bb)->bb_level), cur), \
243 xfs_bmbt, bb, i, XFS_BMAP_BLOCK_IMAXRECS( \
244 be16_to_cpu((bb)->bb_level), cur))) 220 be16_to_cpu((bb)->bb_level), cur)))
245 221
246/* 222/*
@@ -248,11 +224,11 @@ typedef struct xfs_btree_lblock xfs_bmbt_block_t;
248 * we don't have a cursor. 224 * we don't have a cursor.
249 */ 225 */
250#define XFS_BMAP_BROOT_REC_ADDR(bb,i,sz) \ 226#define XFS_BMAP_BROOT_REC_ADDR(bb,i,sz) \
251 (XFS_BTREE_REC_ADDR(sz,xfs_bmbt,bb,i,XFS_BMAP_BROOT_MAXRECS(sz))) 227 (XFS_BTREE_REC_ADDR(xfs_bmbt,bb,i))
252#define XFS_BMAP_BROOT_KEY_ADDR(bb,i,sz) \ 228#define XFS_BMAP_BROOT_KEY_ADDR(bb,i,sz) \
253 (XFS_BTREE_KEY_ADDR(sz,xfs_bmbt,bb,i,XFS_BMAP_BROOT_MAXRECS(sz))) 229 (XFS_BTREE_KEY_ADDR(xfs_bmbt,bb,i))
254#define XFS_BMAP_BROOT_PTR_ADDR(bb,i,sz) \ 230#define XFS_BMAP_BROOT_PTR_ADDR(bb,i,sz) \
255 (XFS_BTREE_PTR_ADDR(sz,xfs_bmbt,bb,i,XFS_BMAP_BROOT_MAXRECS(sz))) 231 (XFS_BTREE_PTR_ADDR(xfs_bmbt,bb,i,XFS_BMAP_BROOT_MAXRECS(sz)))
256 232
257#define XFS_BMAP_BROOT_NUMRECS(bb) be16_to_cpu((bb)->bb_numrecs) 233#define XFS_BMAP_BROOT_NUMRECS(bb) be16_to_cpu((bb)->bb_numrecs)
258#define XFS_BMAP_BROOT_MAXRECS(sz) XFS_BTREE_BLOCK_MAXRECS(sz,xfs_bmbt,0) 234#define XFS_BMAP_BROOT_MAXRECS(sz) XFS_BTREE_BLOCK_MAXRECS(sz,xfs_bmbt,0)