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.h59
1 files changed, 11 insertions, 48 deletions
diff --git a/fs/xfs/xfs_bmap_btree.h b/fs/xfs/xfs_bmap_btree.h
index 49539de9525b..a77b1b753d0c 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)
@@ -315,15 +291,11 @@ extern xfs_exntst_t xfs_bmbt_get_state(xfs_bmbt_rec_t *r);
315 291
316#ifndef XFS_NATIVE_HOST 292#ifndef XFS_NATIVE_HOST
317extern void xfs_bmbt_disk_get_all(xfs_bmbt_rec_t *r, xfs_bmbt_irec_t *s); 293extern void xfs_bmbt_disk_get_all(xfs_bmbt_rec_t *r, xfs_bmbt_irec_t *s);
318extern xfs_exntst_t xfs_bmbt_disk_get_state(xfs_bmbt_rec_t *r);
319extern xfs_filblks_t xfs_bmbt_disk_get_blockcount(xfs_bmbt_rec_t *r); 294extern xfs_filblks_t xfs_bmbt_disk_get_blockcount(xfs_bmbt_rec_t *r);
320extern xfs_fsblock_t xfs_bmbt_disk_get_startblock(xfs_bmbt_rec_t *r);
321extern xfs_fileoff_t xfs_bmbt_disk_get_startoff(xfs_bmbt_rec_t *r); 295extern xfs_fileoff_t xfs_bmbt_disk_get_startoff(xfs_bmbt_rec_t *r);
322#else 296#else
323#define xfs_bmbt_disk_get_all(r, s) xfs_bmbt_get_all(r, s) 297#define xfs_bmbt_disk_get_all(r, s) xfs_bmbt_get_all(r, s)
324#define xfs_bmbt_disk_get_state(r) xfs_bmbt_get_state(r)
325#define xfs_bmbt_disk_get_blockcount(r) xfs_bmbt_get_blockcount(r) 298#define xfs_bmbt_disk_get_blockcount(r) xfs_bmbt_get_blockcount(r)
326#define xfs_bmbt_disk_get_startblock(r) xfs_bmbt_get_blockcount(r)
327#define xfs_bmbt_disk_get_startoff(r) xfs_bmbt_get_startoff(r) 299#define xfs_bmbt_disk_get_startoff(r) xfs_bmbt_get_startoff(r)
328#endif /* XFS_NATIVE_HOST */ 300#endif /* XFS_NATIVE_HOST */
329 301
@@ -364,15 +336,6 @@ extern void xfs_bmbt_to_bmdr(xfs_bmbt_block_t *, int, xfs_bmdr_block_t *, int);
364extern int xfs_bmbt_update(struct xfs_btree_cur *, xfs_fileoff_t, 336extern int xfs_bmbt_update(struct xfs_btree_cur *, xfs_fileoff_t,
365 xfs_fsblock_t, xfs_filblks_t, xfs_exntst_t); 337 xfs_fsblock_t, xfs_filblks_t, xfs_exntst_t);
366 338
367#ifdef DEBUG
368/*
369 * Get the data from the pointed-to record.
370 */
371extern int xfs_bmbt_get_rec(struct xfs_btree_cur *, xfs_fileoff_t *,
372 xfs_fsblock_t *, xfs_filblks_t *,
373 xfs_exntst_t *, int *);
374#endif
375
376#endif /* __KERNEL__ */ 339#endif /* __KERNEL__ */
377 340
378#endif /* __XFS_BMAP_BTREE_H__ */ 341#endif /* __XFS_BMAP_BTREE_H__ */