1
2
3
4
5
6#ifndef __XFS_IALLOC_H__
7#define __XFS_IALLOC_H__
8
9struct xfs_buf;
10struct xfs_dinode;
11struct xfs_imap;
12struct xfs_mount;
13struct xfs_trans;
14struct xfs_btree_cur;
15
16
17#define XFS_INODE_BIG_CLUSTER_SIZE 8192
18
19struct xfs_icluster {
20 bool deleted;
21 xfs_ino_t first_ino;
22 uint64_t alloc;
23
24};
25
26
27static inline int
28xfs_icluster_size_fsb(
29 struct xfs_mount *mp)
30{
31 if (mp->m_sb.sb_blocksize >= mp->m_inode_cluster_size)
32 return 1;
33 return mp->m_inode_cluster_size >> mp->m_sb.sb_blocklog;
34}
35
36
37
38
39static inline struct xfs_dinode *
40xfs_make_iptr(struct xfs_mount *mp, struct xfs_buf *b, int o)
41{
42 return xfs_buf_offset(b, o << (mp)->m_sb.sb_inodelog);
43}
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67int
68xfs_dialloc(
69 struct xfs_trans *tp,
70 xfs_ino_t parent,
71 umode_t mode,
72 struct xfs_buf **agbp,
73 xfs_ino_t *inop);
74
75
76
77
78
79
80
81int
82xfs_difree(
83 struct xfs_trans *tp,
84 xfs_ino_t inode,
85 struct xfs_icluster *ifree);
86
87
88
89
90int
91xfs_imap(
92 struct xfs_mount *mp,
93 struct xfs_trans *tp,
94 xfs_ino_t ino,
95 struct xfs_imap *imap,
96 uint flags);
97
98
99
100
101void
102xfs_ialloc_compute_maxlevels(
103 struct xfs_mount *mp);
104
105
106
107
108void
109xfs_ialloc_log_agi(
110 struct xfs_trans *tp,
111 struct xfs_buf *bp,
112 int fields);
113
114
115
116
117int
118xfs_ialloc_read_agi(
119 struct xfs_mount *mp,
120 struct xfs_trans *tp,
121 xfs_agnumber_t agno,
122 struct xfs_buf **bpp);
123
124
125
126
127
128int
129xfs_ialloc_pagi_init(
130 struct xfs_mount *mp,
131 struct xfs_trans *tp,
132 xfs_agnumber_t agno);
133
134
135
136
137int xfs_inobt_lookup(struct xfs_btree_cur *cur, xfs_agino_t ino,
138 xfs_lookup_t dir, int *stat);
139
140
141
142
143int xfs_inobt_get_rec(struct xfs_btree_cur *cur,
144 xfs_inobt_rec_incore_t *rec, int *stat);
145
146
147
148
149int xfs_ialloc_inode_init(struct xfs_mount *mp, struct xfs_trans *tp,
150 struct list_head *buffer_list, int icount,
151 xfs_agnumber_t agno, xfs_agblock_t agbno,
152 xfs_agblock_t length, unsigned int gen);
153
154int xfs_read_agi(struct xfs_mount *mp, struct xfs_trans *tp,
155 xfs_agnumber_t agno, struct xfs_buf **bpp);
156
157union xfs_btree_rec;
158void xfs_inobt_btrec_to_irec(struct xfs_mount *mp, union xfs_btree_rec *rec,
159 struct xfs_inobt_rec_incore *irec);
160int xfs_ialloc_has_inodes_at_extent(struct xfs_btree_cur *cur,
161 xfs_agblock_t bno, xfs_extlen_t len, bool *exists);
162int xfs_ialloc_has_inode_record(struct xfs_btree_cur *cur, xfs_agino_t low,
163 xfs_agino_t high, bool *exists);
164int xfs_ialloc_count_inodes(struct xfs_btree_cur *cur, xfs_agino_t *count,
165 xfs_agino_t *freecount);
166int xfs_inobt_insert_rec(struct xfs_btree_cur *cur, uint16_t holemask,
167 uint8_t count, int32_t freecount, xfs_inofree_t free,
168 int *stat);
169
170int xfs_ialloc_cluster_alignment(struct xfs_mount *mp);
171
172#endif
173