Linux Audio

Check our new training course

Loading...
v6.9.4
 1// SPDX-License-Identifier: GPL-2.0
 2/*
 3 * Copyright (c) 2000,2005 Silicon Graphics, Inc.
 4 * All Rights Reserved.
 5 */
 6#ifndef __XFS_IALLOC_BTREE_H__
 7#define	__XFS_IALLOC_BTREE_H__
 8
 9/*
10 * Inode map on-disk structures
11 */
12
13struct xfs_buf;
14struct xfs_btree_cur;
15struct xfs_mount;
16struct xfs_perag;
17
18/*
19 * Btree block header size depends on a superblock flag.
20 */
21#define XFS_INOBT_BLOCK_LEN(mp) \
22	(xfs_has_crc(((mp))) ? \
23		XFS_BTREE_SBLOCK_CRC_LEN : XFS_BTREE_SBLOCK_LEN)
24
25/*
26 * Record, key, and pointer address macros for btree blocks.
27 *
28 * (note that some of these may appear unused, but they are used in userspace)
29 */
30#define XFS_INOBT_REC_ADDR(mp, block, index) \
31	((xfs_inobt_rec_t *) \
32		((char *)(block) + \
33		 XFS_INOBT_BLOCK_LEN(mp) + \
34		 (((index) - 1) * sizeof(xfs_inobt_rec_t))))
35
36#define XFS_INOBT_KEY_ADDR(mp, block, index) \
37	((xfs_inobt_key_t *) \
38		((char *)(block) + \
39		 XFS_INOBT_BLOCK_LEN(mp) + \
40		 ((index) - 1) * sizeof(xfs_inobt_key_t)))
41
42#define XFS_INOBT_PTR_ADDR(mp, block, index, maxrecs) \
43	((xfs_inobt_ptr_t *) \
44		((char *)(block) + \
45		 XFS_INOBT_BLOCK_LEN(mp) + \
46		 (maxrecs) * sizeof(xfs_inobt_key_t) + \
47		 ((index) - 1) * sizeof(xfs_inobt_ptr_t)))
48
49struct xfs_btree_cur *xfs_inobt_init_cursor(struct xfs_perag *pag,
50		struct xfs_trans *tp, struct xfs_buf *agbp);
51struct xfs_btree_cur *xfs_finobt_init_cursor(struct xfs_perag *pag,
52		struct xfs_trans *tp, struct xfs_buf *agbp);
 
 
53extern int xfs_inobt_maxrecs(struct xfs_mount *, int, int);
54
55/* ir_holemask to inode allocation bitmap conversion */
56uint64_t xfs_inobt_irec_to_allocmask(const struct xfs_inobt_rec_incore *irec);
57
58#if defined(DEBUG) || defined(XFS_WARN)
59int xfs_inobt_rec_check_count(struct xfs_mount *,
60			      struct xfs_inobt_rec_incore *);
61#else
62#define xfs_inobt_rec_check_count(mp, rec)	0
63#endif	/* DEBUG */
64
65int xfs_finobt_calc_reserves(struct xfs_perag *perag, struct xfs_trans *tp,
66		xfs_extlen_t *ask, xfs_extlen_t *used);
67extern xfs_extlen_t xfs_iallocbt_calc_size(struct xfs_mount *mp,
68		unsigned long long len);
 
 
 
69
70void xfs_inobt_commit_staged_btree(struct xfs_btree_cur *cur,
71		struct xfs_trans *tp, struct xfs_buf *agbp);
72
73unsigned int xfs_iallocbt_maxlevels_ondisk(void);
74
75int __init xfs_inobt_init_cur_cache(void);
76void xfs_inobt_destroy_cur_cache(void);
77
78#endif	/* __XFS_IALLOC_BTREE_H__ */
v5.9
 1// SPDX-License-Identifier: GPL-2.0
 2/*
 3 * Copyright (c) 2000,2005 Silicon Graphics, Inc.
 4 * All Rights Reserved.
 5 */
 6#ifndef __XFS_IALLOC_BTREE_H__
 7#define	__XFS_IALLOC_BTREE_H__
 8
 9/*
10 * Inode map on-disk structures
11 */
12
13struct xfs_buf;
14struct xfs_btree_cur;
15struct xfs_mount;
 
16
17/*
18 * Btree block header size depends on a superblock flag.
19 */
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)
23
24/*
25 * Record, key, and pointer address macros for btree blocks.
26 *
27 * (note that some of these may appear unused, but they are used in userspace)
28 */
29#define XFS_INOBT_REC_ADDR(mp, block, index) \
30	((xfs_inobt_rec_t *) \
31		((char *)(block) + \
32		 XFS_INOBT_BLOCK_LEN(mp) + \
33		 (((index) - 1) * sizeof(xfs_inobt_rec_t))))
34
35#define XFS_INOBT_KEY_ADDR(mp, block, index) \
36	((xfs_inobt_key_t *) \
37		((char *)(block) + \
38		 XFS_INOBT_BLOCK_LEN(mp) + \
39		 ((index) - 1) * sizeof(xfs_inobt_key_t)))
40
41#define XFS_INOBT_PTR_ADDR(mp, block, index, maxrecs) \
42	((xfs_inobt_ptr_t *) \
43		((char *)(block) + \
44		 XFS_INOBT_BLOCK_LEN(mp) + \
45		 (maxrecs) * sizeof(xfs_inobt_key_t) + \
46		 ((index) - 1) * sizeof(xfs_inobt_ptr_t)))
47
48extern struct xfs_btree_cur *xfs_inobt_init_cursor(struct xfs_mount *,
49		struct xfs_trans *, struct xfs_buf *, xfs_agnumber_t,
50		xfs_btnum_t);
51struct xfs_btree_cur *xfs_inobt_stage_cursor(struct xfs_mount *mp,
52		struct xbtree_afakeroot *afake, xfs_agnumber_t agno,
53		xfs_btnum_t btnum);
54extern int xfs_inobt_maxrecs(struct xfs_mount *, int, int);
55
56/* ir_holemask to inode allocation bitmap conversion */
57uint64_t xfs_inobt_irec_to_allocmask(struct xfs_inobt_rec_incore *);
58
59#if defined(DEBUG) || defined(XFS_WARN)
60int xfs_inobt_rec_check_count(struct xfs_mount *,
61			      struct xfs_inobt_rec_incore *);
62#else
63#define xfs_inobt_rec_check_count(mp, rec)	0
64#endif	/* DEBUG */
65
66int xfs_finobt_calc_reserves(struct xfs_mount *mp, struct xfs_trans *tp,
67		xfs_agnumber_t agno, xfs_extlen_t *ask, xfs_extlen_t *used);
68extern xfs_extlen_t xfs_iallocbt_calc_size(struct xfs_mount *mp,
69		unsigned long long len);
70int xfs_inobt_cur(struct xfs_mount *mp, struct xfs_trans *tp,
71		xfs_agnumber_t agno, xfs_btnum_t btnum,
72		struct xfs_btree_cur **curpp, struct xfs_buf **agi_bpp);
73
74void xfs_inobt_commit_staged_btree(struct xfs_btree_cur *cur,
75		struct xfs_trans *tp, struct xfs_buf *agbp);
 
 
 
 
 
76
77#endif	/* __XFS_IALLOC_BTREE_H__ */