1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20#ifndef __XFS_REFCOUNT_BTREE_H__
21#define __XFS_REFCOUNT_BTREE_H__
22
23
24
25
26
27struct xfs_buf;
28struct xfs_btree_cur;
29struct xfs_mount;
30
31
32
33
34#define XFS_REFCOUNT_BLOCK_LEN XFS_BTREE_SBLOCK_CRC_LEN
35
36
37
38
39
40
41#define XFS_REFCOUNT_REC_ADDR(block, index) \
42 ((struct xfs_refcount_rec *) \
43 ((char *)(block) + \
44 XFS_REFCOUNT_BLOCK_LEN + \
45 (((index) - 1) * sizeof(struct xfs_refcount_rec))))
46
47#define XFS_REFCOUNT_KEY_ADDR(block, index) \
48 ((struct xfs_refcount_key *) \
49 ((char *)(block) + \
50 XFS_REFCOUNT_BLOCK_LEN + \
51 ((index) - 1) * sizeof(struct xfs_refcount_key)))
52
53#define XFS_REFCOUNT_PTR_ADDR(block, index, maxrecs) \
54 ((xfs_refcount_ptr_t *) \
55 ((char *)(block) + \
56 XFS_REFCOUNT_BLOCK_LEN + \
57 (maxrecs) * sizeof(struct xfs_refcount_key) + \
58 ((index) - 1) * sizeof(xfs_refcount_ptr_t)))
59
60extern struct xfs_btree_cur *xfs_refcountbt_init_cursor(struct xfs_mount *mp,
61 struct xfs_trans *tp, struct xfs_buf *agbp, xfs_agnumber_t agno,
62 struct xfs_defer_ops *dfops);
63extern int xfs_refcountbt_maxrecs(struct xfs_mount *mp, int blocklen,
64 bool leaf);
65extern void xfs_refcountbt_compute_maxlevels(struct xfs_mount *mp);
66
67extern xfs_extlen_t xfs_refcountbt_calc_size(struct xfs_mount *mp,
68 unsigned long long len);
69extern xfs_extlen_t xfs_refcountbt_max_size(struct xfs_mount *mp,
70 xfs_agblock_t agblocks);
71
72extern int xfs_refcountbt_calc_reserves(struct xfs_mount *mp,
73 xfs_agnumber_t agno, xfs_extlen_t *ask, xfs_extlen_t *used);
74
75#endif
76