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
27
28
29static inline struct xfs_dinode *
30xfs_make_iptr(struct xfs_mount *mp, struct xfs_buf *b, int o)
31{
32 return xfs_buf_offset(b, o << (mp)->m_sb.sb_inodelog);
33}
34
35
36
37
38
39
40
41
42
43
44
45
46
47int
48xfs_dialloc_select_ag(
49 struct xfs_trans **tpp,
50 xfs_ino_t parent,
51 umode_t mode,
52 struct xfs_buf **IO_agbp);
53
54int
55xfs_dialloc_ag(
56 struct xfs_trans *tp,
57 struct xfs_buf *agbp,
58 xfs_ino_t parent,
59 xfs_ino_t *inop);
60
61
62
63
64
65
66
67int
68xfs_difree(
69 struct xfs_trans *tp,
70 xfs_ino_t inode,
71 struct xfs_icluster *ifree);
72
73
74
75
76int
77xfs_imap(
78 struct xfs_mount *mp,
79 struct xfs_trans *tp,
80 xfs_ino_t ino,
81 struct xfs_imap *imap,
82 uint flags);
83
84
85
86
87void
88xfs_ialloc_log_agi(
89 struct xfs_trans *tp,
90 struct xfs_buf *bp,
91 int fields);
92
93
94
95
96int
97xfs_ialloc_read_agi(
98 struct xfs_mount *mp,
99 struct xfs_trans *tp,
100 xfs_agnumber_t agno,
101 struct xfs_buf **bpp);
102
103
104
105
106
107int
108xfs_ialloc_pagi_init(
109 struct xfs_mount *mp,
110 struct xfs_trans *tp,
111 xfs_agnumber_t agno);
112
113
114
115
116int xfs_inobt_lookup(struct xfs_btree_cur *cur, xfs_agino_t ino,
117 xfs_lookup_t dir, int *stat);
118
119
120
121
122int xfs_inobt_get_rec(struct xfs_btree_cur *cur,
123 xfs_inobt_rec_incore_t *rec, int *stat);
124
125
126
127
128int xfs_ialloc_inode_init(struct xfs_mount *mp, struct xfs_trans *tp,
129 struct list_head *buffer_list, int icount,
130 xfs_agnumber_t agno, xfs_agblock_t agbno,
131 xfs_agblock_t length, unsigned int gen);
132
133int xfs_read_agi(struct xfs_mount *mp, struct xfs_trans *tp,
134 xfs_agnumber_t agno, struct xfs_buf **bpp);
135
136union xfs_btree_rec;
137void xfs_inobt_btrec_to_irec(struct xfs_mount *mp, union xfs_btree_rec *rec,
138 struct xfs_inobt_rec_incore *irec);
139int xfs_ialloc_has_inodes_at_extent(struct xfs_btree_cur *cur,
140 xfs_agblock_t bno, xfs_extlen_t len, bool *exists);
141int xfs_ialloc_has_inode_record(struct xfs_btree_cur *cur, xfs_agino_t low,
142 xfs_agino_t high, bool *exists);
143int xfs_ialloc_count_inodes(struct xfs_btree_cur *cur, xfs_agino_t *count,
144 xfs_agino_t *freecount);
145int xfs_inobt_insert_rec(struct xfs_btree_cur *cur, uint16_t holemask,
146 uint8_t count, int32_t freecount, xfs_inofree_t free,
147 int *stat);
148
149int xfs_ialloc_cluster_alignment(struct xfs_mount *mp);
150void xfs_ialloc_setup_geometry(struct xfs_mount *mp);
151xfs_ino_t xfs_ialloc_calc_rootino(struct xfs_mount *mp, int sunit);
152
153#endif
154