Go to the documentation of this file.
18 #ifndef __XFS_BTREE_H__
19 #define __XFS_BTREE_H__
32 #define XFS_LOOKUP_EQ ((xfs_lookup_t)XFS_LOOKUP_EQi)
33 #define XFS_LOOKUP_LE ((xfs_lookup_t)XFS_LOOKUP_LEi)
34 #define XFS_LOOKUP_GE ((xfs_lookup_t)XFS_LOOKUP_GEi)
36 #define XFS_BTNUM_BNO ((xfs_btnum_t)XFS_BTNUM_BNOi)
37 #define XFS_BTNUM_CNT ((xfs_btnum_t)XFS_BTNUM_CNTi)
38 #define XFS_BTNUM_BMAP ((xfs_btnum_t)XFS_BTNUM_BMAPi)
39 #define XFS_BTNUM_INO ((xfs_btnum_t)XFS_BTNUM_INOi)
67 #define XFS_BTREE_SBLOCK_LEN 16
68 #define XFS_BTREE_LBLOCK_LEN 24
99 #define XFS_BB_MAGIC 0x01
100 #define XFS_BB_LEVEL 0x02
101 #define XFS_BB_NUMRECS 0x04
102 #define XFS_BB_LEFTSIB 0x08
103 #define XFS_BB_RIGHTSIB 0x10
104 #define XFS_BB_NUM_BITS 5
105 #define XFS_BB_ALL_BITS ((1 << XFS_BB_NUM_BITS) - 1)
115 #define __XFS_BTREE_STATS_INC(type, stat) \
116 XFS_STATS_INC(xs_ ## type ## _2_ ## stat)
117 #define XFS_BTREE_STATS_INC(cur, stat) \
119 switch (cur->bc_btnum) { \
120 case XFS_BTNUM_BNO: __XFS_BTREE_STATS_INC(abtb, stat); break; \
121 case XFS_BTNUM_CNT: __XFS_BTREE_STATS_INC(abtc, stat); break; \
122 case XFS_BTNUM_BMAP: __XFS_BTREE_STATS_INC(bmbt, stat); break; \
123 case XFS_BTNUM_INO: __XFS_BTREE_STATS_INC(ibt, stat); break; \
124 case XFS_BTNUM_MAX: ASSERT(0); ; break; \
128 #define __XFS_BTREE_STATS_ADD(type, stat, val) \
129 XFS_STATS_ADD(xs_ ## type ## _2_ ## stat, val)
130 #define XFS_BTREE_STATS_ADD(cur, stat, val) \
132 switch (cur->bc_btnum) { \
133 case XFS_BTNUM_BNO: __XFS_BTREE_STATS_ADD(abtb, stat, val); break; \
134 case XFS_BTNUM_CNT: __XFS_BTREE_STATS_ADD(abtc, stat, val); break; \
135 case XFS_BTNUM_BMAP: __XFS_BTREE_STATS_ADD(bmbt, stat, val); break; \
136 case XFS_BTNUM_INO: __XFS_BTREE_STATS_ADD(ibt, stat, val); break; \
137 case XFS_BTNUM_MAX: ASSERT(0); ; break; \
141 #define XFS_BTREE_MAXLEVELS 8
207 #define LASTREC_UPDATE 0
208 #define LASTREC_INSREC 1
209 #define LASTREC_DELREC 2
230 #define XFS_BTCUR_LEFTRA 1
231 #define XFS_BTCUR_RIGHTRA 2
241 struct xfs_inode *
ip;
248 #define XFS_BTCUR_BPRV_WASDEL 1
254 #define XFS_BTREE_LONG_PTRS (1<<0)
255 #define XFS_BTREE_ROOT_IN_INODE (1<<1)
256 #define XFS_BTREE_LASTREC_UPDATE (1<<2)
259 #define XFS_BTREE_NOERROR 0
260 #define XFS_BTREE_ERROR 1
265 #define XFS_BUF_TO_BLOCK(bp) ((struct xfs_btree_block *)((bp)->b_addr))
310 struct xfs_mount *
mp,
311 struct xfs_trans *tp,
321 struct xfs_mount *
mp,
322 struct xfs_trans *tp,
342 const short *offsets,
353 struct xfs_mount *
mp,
354 struct xfs_trans *tp,
366 struct xfs_mount *
mp,
376 struct xfs_mount *
mp,
423 #define XFS_EXTLEN_MIN(a,b) min_t(xfs_extlen_t, (a), (b))
424 #define XFS_EXTLEN_MAX(a,b) max_t(xfs_extlen_t, (a), (b))
425 #define XFS_AGBLOCK_MIN(a,b) min_t(xfs_agblock_t, (a), (b))
426 #define XFS_AGBLOCK_MAX(a,b) max_t(xfs_agblock_t, (a), (b))
427 #define XFS_FILEOFF_MIN(a,b) min_t(xfs_fileoff_t, (a), (b))
428 #define XFS_FILEOFF_MAX(a,b) max_t(xfs_fileoff_t, (a), (b))
429 #define XFS_FILBLKS_MIN(a,b) min_t(xfs_filblks_t, (a), (b))
430 #define XFS_FILBLKS_MAX(a,b) max_t(xfs_filblks_t, (a), (b))
432 #define XFS_FSB_SANITY_CHECK(mp,fsb) \
433 (XFS_FSB_TO_AGNO(mp, fsb) < mp->m_sb.sb_agcount && \
434 XFS_FSB_TO_AGBNO(mp, fsb) < mp->m_sb.sb_agblocks)
446 #define XFS_BTREE_TRACE_ARGBI(c, b, i)
447 #define XFS_BTREE_TRACE_ARGBII(c, b, i, j)
448 #define XFS_BTREE_TRACE_ARGI(c, i)
449 #define XFS_BTREE_TRACE_ARGIPK(c, i, p, s)
450 #define XFS_BTREE_TRACE_ARGIPR(c, i, p, r)
451 #define XFS_BTREE_TRACE_ARGIK(c, i, k)
452 #define XFS_BTREE_TRACE_ARGR(c, r)
453 #define XFS_BTREE_TRACE_CURSOR(c, t)