0001
0002
0003
0004
0005
0006 #ifndef __XFS_IALLOC_BTREE_H__
0007 #define __XFS_IALLOC_BTREE_H__
0008
0009
0010
0011
0012
0013 struct xfs_buf;
0014 struct xfs_btree_cur;
0015 struct xfs_mount;
0016 struct xfs_perag;
0017
0018
0019
0020
0021 #define XFS_INOBT_BLOCK_LEN(mp) \
0022 (xfs_has_crc(((mp))) ? \
0023 XFS_BTREE_SBLOCK_CRC_LEN : XFS_BTREE_SBLOCK_LEN)
0024
0025
0026
0027
0028
0029
0030 #define XFS_INOBT_REC_ADDR(mp, block, index) \
0031 ((xfs_inobt_rec_t *) \
0032 ((char *)(block) + \
0033 XFS_INOBT_BLOCK_LEN(mp) + \
0034 (((index) - 1) * sizeof(xfs_inobt_rec_t))))
0035
0036 #define XFS_INOBT_KEY_ADDR(mp, block, index) \
0037 ((xfs_inobt_key_t *) \
0038 ((char *)(block) + \
0039 XFS_INOBT_BLOCK_LEN(mp) + \
0040 ((index) - 1) * sizeof(xfs_inobt_key_t)))
0041
0042 #define XFS_INOBT_PTR_ADDR(mp, block, index, maxrecs) \
0043 ((xfs_inobt_ptr_t *) \
0044 ((char *)(block) + \
0045 XFS_INOBT_BLOCK_LEN(mp) + \
0046 (maxrecs) * sizeof(xfs_inobt_key_t) + \
0047 ((index) - 1) * sizeof(xfs_inobt_ptr_t)))
0048
0049 extern struct xfs_btree_cur *xfs_inobt_init_cursor(struct xfs_mount *mp,
0050 struct xfs_trans *tp, struct xfs_buf *agbp,
0051 struct xfs_perag *pag, xfs_btnum_t btnum);
0052 struct xfs_btree_cur *xfs_inobt_stage_cursor(struct xfs_mount *mp,
0053 struct xbtree_afakeroot *afake, struct xfs_perag *pag,
0054 xfs_btnum_t btnum);
0055 extern int xfs_inobt_maxrecs(struct xfs_mount *, int, int);
0056
0057
0058 uint64_t xfs_inobt_irec_to_allocmask(struct xfs_inobt_rec_incore *);
0059
0060 #if defined(DEBUG) || defined(XFS_WARN)
0061 int xfs_inobt_rec_check_count(struct xfs_mount *,
0062 struct xfs_inobt_rec_incore *);
0063 #else
0064 #define xfs_inobt_rec_check_count(mp, rec) 0
0065 #endif
0066
0067 int xfs_finobt_calc_reserves(struct xfs_mount *mp, struct xfs_trans *tp,
0068 struct xfs_perag *pag, xfs_extlen_t *ask, xfs_extlen_t *used);
0069 extern xfs_extlen_t xfs_iallocbt_calc_size(struct xfs_mount *mp,
0070 unsigned long long len);
0071 int xfs_inobt_cur(struct xfs_mount *mp, struct xfs_trans *tp,
0072 struct xfs_perag *pag, xfs_btnum_t btnum,
0073 struct xfs_btree_cur **curpp, struct xfs_buf **agi_bpp);
0074
0075 void xfs_inobt_commit_staged_btree(struct xfs_btree_cur *cur,
0076 struct xfs_trans *tp, struct xfs_buf *agbp);
0077
0078 unsigned int xfs_iallocbt_maxlevels_ondisk(void);
0079
0080 int __init xfs_inobt_init_cur_cache(void);
0081 void xfs_inobt_destroy_cur_cache(void);
0082
0083 #endif