1 // SPDX-License-Identifier: GPL-2.0
3 * Copyright (c) 2000,2005 Silicon Graphics, Inc.
6 #ifndef __XFS_IALLOC_BTREE_H__
7 #define __XFS_IALLOC_BTREE_H__
10 * Inode map on-disk structures
18 * Btree block header size depends on a superblock flag.
20 #define XFS_INOBT_BLOCK_LEN(mp) \
21 (xfs_sb_version_hascrc(&((mp)->m_sb)) ? \
22 XFS_BTREE_SBLOCK_CRC_LEN : XFS_BTREE_SBLOCK_LEN)
25 * Record, key, and pointer address macros for btree blocks.
27 * (note that some of these may appear unused, but they are used in userspace)
29 #define XFS_INOBT_REC_ADDR(mp, block, index) \
30 ((xfs_inobt_rec_t *) \
32 XFS_INOBT_BLOCK_LEN(mp) + \
33 (((index) - 1) * sizeof(xfs_inobt_rec_t))))
35 #define XFS_INOBT_KEY_ADDR(mp, block, index) \
36 ((xfs_inobt_key_t *) \
38 XFS_INOBT_BLOCK_LEN(mp) + \
39 ((index) - 1) * sizeof(xfs_inobt_key_t)))
41 #define XFS_INOBT_PTR_ADDR(mp, block, index, maxrecs) \
42 ((xfs_inobt_ptr_t *) \
44 XFS_INOBT_BLOCK_LEN(mp) + \
45 (maxrecs) * sizeof(xfs_inobt_key_t) + \
46 ((index) - 1) * sizeof(xfs_inobt_ptr_t)))
48 extern struct xfs_btree_cur
*xfs_inobt_init_cursor(struct xfs_mount
*,
49 struct xfs_trans
*, struct xfs_buf
*, xfs_agnumber_t
,
51 extern int xfs_inobt_maxrecs(struct xfs_mount
*, int, int);
53 /* ir_holemask to inode allocation bitmap conversion */
54 uint64_t xfs_inobt_irec_to_allocmask(struct xfs_inobt_rec_incore
*);
56 #if defined(DEBUG) || defined(XFS_WARN)
57 int xfs_inobt_rec_check_count(struct xfs_mount
*,
58 struct xfs_inobt_rec_incore
*);
60 #define xfs_inobt_rec_check_count(mp, rec) 0
63 int xfs_finobt_calc_reserves(struct xfs_mount
*mp
, struct xfs_trans
*tp
,
64 xfs_agnumber_t agno
, xfs_extlen_t
*ask
, xfs_extlen_t
*used
);
65 extern xfs_extlen_t
xfs_iallocbt_calc_size(struct xfs_mount
*mp
,
66 unsigned long long len
);
68 #endif /* __XFS_IALLOC_BTREE_H__ */