blob: 006396764cbc1a2e9d85f53e07713a7390e4ac1f [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
Nathan Scott7b718762005-11-02 14:58:39 +11002 * Copyright (c) 2000-2003,2005 Silicon Graphics, Inc.
3 * All Rights Reserved.
Linus Torvalds1da177e2005-04-16 15:20:36 -07004 *
Nathan Scott7b718762005-11-02 14:58:39 +11005 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License as
Linus Torvalds1da177e2005-04-16 15:20:36 -07007 * published by the Free Software Foundation.
8 *
Nathan Scott7b718762005-11-02 14:58:39 +11009 * This program is distributed in the hope that it would be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
Linus Torvalds1da177e2005-04-16 15:20:36 -070013 *
Nathan Scott7b718762005-11-02 14:58:39 +110014 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write the Free Software Foundation,
16 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Linus Torvalds1da177e2005-04-16 15:20:36 -070017 */
18#ifndef __XFS_INODE_H__
19#define __XFS_INODE_H__
20
21/*
Nathan Scotta844f452005-11-02 14:38:42 +110022 * Fork identifiers.
23 */
24#define XFS_DATA_FORK 0
25#define XFS_ATTR_FORK 1
26
27/*
Mandy Kirkconnell0293ce32006-03-14 13:30:23 +110028 * The following xfs_ext_irec_t struct introduces a second (top) level
29 * to the in-core extent allocation scheme. These structs are allocated
30 * in a contiguous block, creating an indirection array where each entry
31 * (irec) contains a pointer to a buffer of in-core extent records which
32 * it manages. Each extent buffer is 4k in size, since 4k is the system
33 * page size on Linux i386 and systems with larger page sizes don't seem
34 * to gain much, if anything, by using their native page size as the
35 * extent buffer size. Also, using 4k extent buffers everywhere provides
36 * a consistent interface for CXFS across different platforms.
37 *
38 * There is currently no limit on the number of irec's (extent lists)
39 * allowed, so heavily fragmented files may require an indirection array
40 * which spans multiple system pages of memory. The number of extents
41 * which would require this amount of contiguous memory is very large
42 * and should not cause problems in the foreseeable future. However,
43 * if the memory needed for the contiguous array ever becomes a problem,
44 * it is possible that a third level of indirection may be required.
45 */
46typedef struct xfs_ext_irec {
47 xfs_bmbt_rec_t *er_extbuf; /* block of extent records */
48 xfs_extnum_t er_extoff; /* extent offset in file */
49 xfs_extnum_t er_extcount; /* number of extents in page/block */
50} xfs_ext_irec_t;
51
52/*
Linus Torvalds1da177e2005-04-16 15:20:36 -070053 * File incore extent information, present for each of data & attr forks.
54 */
Mandy Kirkconnell0293ce32006-03-14 13:30:23 +110055#define XFS_IEXT_BUFSZ 4096
56#define XFS_LINEAR_EXTS (XFS_IEXT_BUFSZ / (uint)sizeof(xfs_bmbt_rec_t))
57#define XFS_INLINE_EXTS 2
58#define XFS_INLINE_DATA 32
Linus Torvalds1da177e2005-04-16 15:20:36 -070059typedef struct xfs_ifork {
60 int if_bytes; /* bytes in if_u1 */
61 int if_real_bytes; /* bytes allocated in if_u1 */
62 xfs_bmbt_block_t *if_broot; /* file's incore btree root */
63 short if_broot_bytes; /* bytes allocated for root */
64 unsigned char if_flags; /* per-fork flags */
65 unsigned char if_ext_max; /* max # of extent records */
66 xfs_extnum_t if_lastex; /* last if_extents used */
67 union {
68 xfs_bmbt_rec_t *if_extents; /* linear map file exts */
Mandy Kirkconnell0293ce32006-03-14 13:30:23 +110069 xfs_ext_irec_t *if_ext_irec; /* irec map file exts */
Linus Torvalds1da177e2005-04-16 15:20:36 -070070 char *if_data; /* inline file data */
71 } if_u1;
72 union {
73 xfs_bmbt_rec_t if_inline_ext[XFS_INLINE_EXTS];
74 /* very small file extents */
75 char if_inline_data[XFS_INLINE_DATA];
76 /* very small file data */
77 xfs_dev_t if_rdev; /* dev number if special */
78 uuid_t if_uuid; /* mount point value */
79 } if_u2;
80} xfs_ifork_t;
81
82/*
83 * Flags for xfs_ichgtime().
84 */
85#define XFS_ICHGTIME_MOD 0x1 /* data fork modification timestamp */
86#define XFS_ICHGTIME_ACC 0x2 /* data fork access timestamp */
87#define XFS_ICHGTIME_CHG 0x4 /* inode field change timestamp */
88
89/*
90 * Per-fork incore inode flags.
91 */
Mandy Kirkconnell0293ce32006-03-14 13:30:23 +110092#define XFS_IFINLINE 0x01 /* Inline data is read in */
93#define XFS_IFEXTENTS 0x02 /* All extent pointers are read in */
94#define XFS_IFBROOT 0x04 /* i_broot points to the bmap b-tree root */
95#define XFS_IFEXTIREC 0x08 /* Indirection array of extent blocks */
Linus Torvalds1da177e2005-04-16 15:20:36 -070096
97/*
98 * Flags for xfs_imap() and xfs_dilocate().
99 */
100#define XFS_IMAP_LOOKUP 0x1
101
Linus Torvalds1da177e2005-04-16 15:20:36 -0700102#ifdef __KERNEL__
103struct bhv_desc;
104struct cred;
105struct ktrace;
106struct vnode;
107struct xfs_buf;
108struct xfs_bmap_free;
109struct xfs_bmbt_irec;
110struct xfs_bmbt_block;
111struct xfs_inode;
112struct xfs_inode_log_item;
113struct xfs_mount;
114struct xfs_trans;
115struct xfs_dquot;
116
117#if defined(XFS_ILOCK_TRACE)
118#define XFS_ILOCK_KTRACE_SIZE 32
119extern ktrace_t *xfs_ilock_trace_buf;
120extern void xfs_ilock_trace(struct xfs_inode *, int, unsigned int, inst_t *);
121#else
122#define xfs_ilock_trace(i,n,f,ra)
123#endif
124
Linus Torvalds1da177e2005-04-16 15:20:36 -0700125typedef struct dm_attrs_s {
126 __uint32_t da_dmevmask; /* DMIG event mask */
127 __uint16_t da_dmstate; /* DMIG state info */
128 __uint16_t da_pad; /* DMIG extra padding */
129} dm_attrs_t;
130
131typedef struct xfs_iocore {
132 void *io_obj; /* pointer to container
133 * inode or dcxvn structure */
134 struct xfs_mount *io_mount; /* fs mount struct ptr */
135#ifdef DEBUG
136 mrlock_t *io_lock; /* inode IO lock */
137 mrlock_t *io_iolock; /* inode IO lock */
138#endif
139
140 /* I/O state */
141 xfs_fsize_t io_new_size; /* sz when write completes */
142
143 /* Miscellaneous state. */
144 unsigned int io_flags; /* IO related flags */
145
146 /* DMAPI state */
147 dm_attrs_t io_dmattrs;
148
149} xfs_iocore_t;
150
151#define io_dmevmask io_dmattrs.da_dmevmask
152#define io_dmstate io_dmattrs.da_dmstate
153
154#define XFS_IO_INODE(io) ((xfs_inode_t *) ((io)->io_obj))
155#define XFS_IO_DCXVN(io) ((dcxvn_t *) ((io)->io_obj))
156
157/*
158 * Flags in the flags field
159 */
160
161#define XFS_IOCORE_RT 0x1
162
163/*
164 * xfs_iocore prototypes
165 */
166
167extern void xfs_iocore_inode_init(struct xfs_inode *);
168extern void xfs_iocore_inode_reinit(struct xfs_inode *);
169
170
171/*
172 * This is the type used in the xfs inode hash table.
173 * An array of these is allocated for each mounted
174 * file system to hash the inodes for that file system.
175 */
176typedef struct xfs_ihash {
177 struct xfs_inode *ih_next;
178 rwlock_t ih_lock;
179 uint ih_version;
180} xfs_ihash_t;
181
182#define XFS_IHASH(mp,ino) ((mp)->m_ihash + (((uint)(ino)) % (mp)->m_ihsize))
183
184/*
185 * This is the xfs inode cluster hash. This hash is used by xfs_iflush to
186 * find inodes that share a cluster and can be flushed to disk at the same
187 * time.
188 */
189typedef struct xfs_chashlist {
190 struct xfs_chashlist *chl_next;
191 struct xfs_inode *chl_ip;
192 xfs_daddr_t chl_blkno; /* starting block number of
193 * the cluster */
194 struct xfs_buf *chl_buf; /* the inode buffer */
195} xfs_chashlist_t;
196
197typedef struct xfs_chash {
198 xfs_chashlist_t *ch_list;
199 lock_t ch_lock;
200} xfs_chash_t;
201
202#define XFS_CHASH(mp,blk) ((mp)->m_chash + (((uint)blk) % (mp)->m_chsize))
203
204
205/*
206 * This is the xfs in-core inode structure.
207 * Most of the on-disk inode is embedded in the i_d field.
208 *
209 * The extent pointers/inline file space, however, are managed
210 * separately. The memory for this information is pointed to by
211 * the if_u1 unions depending on the type of the data.
212 * This is used to linearize the array of extents for fast in-core
213 * access. This is used until the file's number of extents
214 * surpasses XFS_MAX_INCORE_EXTENTS, at which point all extent pointers
215 * are accessed through the buffer cache.
216 *
217 * Other state kept in the in-core inode is used for identification,
218 * locking, transactional updating, etc of the inode.
219 *
220 * Generally, we do not want to hold the i_rlock while holding the
221 * i_ilock. Hierarchy is i_iolock followed by i_rlock.
222 *
223 * xfs_iptr_t contains all the inode fields upto and including the
224 * i_mnext and i_mprev fields, it is used as a marker in the inode
225 * chain off the mount structure by xfs_sync calls.
226 */
227
228typedef struct {
229 struct xfs_ihash *ip_hash; /* pointer to hash header */
230 struct xfs_inode *ip_next; /* inode hash link forw */
231 struct xfs_inode *ip_mnext; /* next inode in mount list */
232 struct xfs_inode *ip_mprev; /* ptr to prev inode */
233 struct xfs_inode **ip_prevp; /* ptr to prev i_next */
234 struct xfs_mount *ip_mount; /* fs mount struct ptr */
235} xfs_iptr_t;
236
237typedef struct xfs_inode {
238 /* Inode linking and identification information. */
239 struct xfs_ihash *i_hash; /* pointer to hash header */
240 struct xfs_inode *i_next; /* inode hash link forw */
241 struct xfs_inode *i_mnext; /* next inode in mount list */
242 struct xfs_inode *i_mprev; /* ptr to prev inode */
243 struct xfs_inode **i_prevp; /* ptr to prev i_next */
244 struct xfs_mount *i_mount; /* fs mount struct ptr */
245 struct list_head i_reclaim; /* reclaim list */
246 struct bhv_desc i_bhv_desc; /* inode behavior descriptor*/
247 struct xfs_dquot *i_udquot; /* user dquot */
248 struct xfs_dquot *i_gdquot; /* group dquot */
249
250 /* Inode location stuff */
251 xfs_ino_t i_ino; /* inode number (agno/agino)*/
252 xfs_daddr_t i_blkno; /* blkno of inode buffer */
253 ushort i_len; /* len of inode buffer */
254 ushort i_boffset; /* off of inode in buffer */
255
256 /* Extent information. */
257 xfs_ifork_t *i_afp; /* attribute fork pointer */
258 xfs_ifork_t i_df; /* data fork */
259
260 /* Transaction and locking information. */
261 struct xfs_trans *i_transp; /* ptr to owning transaction*/
262 struct xfs_inode_log_item *i_itemp; /* logging information */
263 mrlock_t i_lock; /* inode lock */
264 mrlock_t i_iolock; /* inode IO lock */
265 sema_t i_flock; /* inode flush lock */
266 atomic_t i_pincount; /* inode pin count */
267 wait_queue_head_t i_ipin_wait; /* inode pinning wait queue */
268#ifdef HAVE_REFCACHE
269 struct xfs_inode **i_refcache; /* ptr to entry in ref cache */
270 struct xfs_inode *i_release; /* inode to unref */
271#endif
272 /* I/O state */
273 xfs_iocore_t i_iocore; /* I/O core */
274
275 /* Miscellaneous state. */
276 unsigned short i_flags; /* see defined flags below */
277 unsigned char i_update_core; /* timestamps/size is dirty */
278 unsigned char i_update_size; /* di_size field is dirty */
279 unsigned int i_gen; /* generation count */
280 unsigned int i_delayed_blks; /* count of delay alloc blks */
281
282 xfs_dinode_core_t i_d; /* most of ondisk inode */
283 xfs_chashlist_t *i_chash; /* cluster hash list header */
284 struct xfs_inode *i_cnext; /* cluster hash link forward */
285 struct xfs_inode *i_cprev; /* cluster hash link backward */
286
287 /* Trace buffers per inode. */
288#ifdef XFS_BMAP_TRACE
289 struct ktrace *i_xtrace; /* inode extent list trace */
290#endif
291#ifdef XFS_BMBT_TRACE
292 struct ktrace *i_btrace; /* inode bmap btree trace */
293#endif
294#ifdef XFS_RW_TRACE
295 struct ktrace *i_rwtrace; /* inode read/write trace */
296#endif
297#ifdef XFS_ILOCK_TRACE
298 struct ktrace *i_lock_trace; /* inode lock/unlock trace */
299#endif
300#ifdef XFS_DIR2_TRACE
301 struct ktrace *i_dir_trace; /* inode directory trace */
302#endif
303} xfs_inode_t;
304
305#endif /* __KERNEL__ */
306
307
308/*
309 * Fork handling.
310 */
Nathan Scotta844f452005-11-02 14:38:42 +1100311#define XFS_IFORK_PTR(ip,w) \
312 ((w) == XFS_DATA_FORK ? &(ip)->i_df : (ip)->i_afp)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700313#define XFS_IFORK_Q(ip) XFS_CFORK_Q(&(ip)->i_d)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700314#define XFS_IFORK_DSIZE(ip) XFS_CFORK_DSIZE(&ip->i_d, ip->i_mount)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700315#define XFS_IFORK_ASIZE(ip) XFS_CFORK_ASIZE(&ip->i_d, ip->i_mount)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700316#define XFS_IFORK_SIZE(ip,w) XFS_CFORK_SIZE(&ip->i_d, ip->i_mount, w)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700317#define XFS_IFORK_FORMAT(ip,w) XFS_CFORK_FORMAT(&ip->i_d, w)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700318#define XFS_IFORK_FMT_SET(ip,w,n) XFS_CFORK_FMT_SET(&ip->i_d, w, n)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700319#define XFS_IFORK_NEXTENTS(ip,w) XFS_CFORK_NEXTENTS(&ip->i_d, w)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700320#define XFS_IFORK_NEXT_SET(ip,w,n) XFS_CFORK_NEXT_SET(&ip->i_d, w, n)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700321
322
323#ifdef __KERNEL__
324
325/*
326 * In-core inode flags.
327 */
328#define XFS_IGRIO 0x0001 /* inode used for guaranteed rate i/o */
329#define XFS_IUIOSZ 0x0002 /* inode i/o sizes have been explicitly set */
330#define XFS_IQUIESCE 0x0004 /* we have started quiescing for this inode */
331#define XFS_IRECLAIM 0x0008 /* we have started reclaiming this inode */
332#define XFS_ISTALE 0x0010 /* inode has been staled */
333#define XFS_IRECLAIMABLE 0x0020 /* inode can be reclaimed */
334#define XFS_INEW 0x0040
335
336/*
337 * Flags for inode locking.
338 */
339#define XFS_IOLOCK_EXCL 0x001
340#define XFS_IOLOCK_SHARED 0x002
341#define XFS_ILOCK_EXCL 0x004
342#define XFS_ILOCK_SHARED 0x008
343#define XFS_IUNLOCK_NONOTIFY 0x010
Nathan Scott30dab212005-11-02 10:31:13 +1100344/* XFS_IOLOCK_NESTED 0x020 */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700345#define XFS_EXTENT_TOKEN_RD 0x040
346#define XFS_SIZE_TOKEN_RD 0x080
347#define XFS_EXTSIZE_RD (XFS_EXTENT_TOKEN_RD|XFS_SIZE_TOKEN_RD)
348#define XFS_WILLLEND 0x100 /* Always acquire tokens for lending */
349#define XFS_EXTENT_TOKEN_WR (XFS_EXTENT_TOKEN_RD | XFS_WILLLEND)
350#define XFS_SIZE_TOKEN_WR (XFS_SIZE_TOKEN_RD | XFS_WILLLEND)
351#define XFS_EXTSIZE_WR (XFS_EXTSIZE_RD | XFS_WILLLEND)
Nathan Scott30dab212005-11-02 10:31:13 +1100352/* XFS_SIZE_TOKEN_WANT 0x200 */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700353
354#define XFS_LOCK_MASK \
355 (XFS_IOLOCK_EXCL | XFS_IOLOCK_SHARED | XFS_ILOCK_EXCL | \
356 XFS_ILOCK_SHARED | XFS_EXTENT_TOKEN_RD | XFS_SIZE_TOKEN_RD | \
357 XFS_WILLLEND)
358
359/*
360 * Flags for xfs_iflush()
361 */
362#define XFS_IFLUSH_DELWRI_ELSE_SYNC 1
363#define XFS_IFLUSH_DELWRI_ELSE_ASYNC 2
364#define XFS_IFLUSH_SYNC 3
365#define XFS_IFLUSH_ASYNC 4
366#define XFS_IFLUSH_DELWRI 5
367
368/*
Linus Torvalds1da177e2005-04-16 15:20:36 -0700369 * Flags for xfs_itruncate_start().
370 */
371#define XFS_ITRUNC_DEFINITE 0x1
372#define XFS_ITRUNC_MAYBE 0x2
373
Linus Torvalds1da177e2005-04-16 15:20:36 -0700374#define XFS_ITOV(ip) BHV_TO_VNODE(XFS_ITOBHV(ip))
Linus Torvalds1da177e2005-04-16 15:20:36 -0700375#define XFS_ITOV_NULL(ip) BHV_TO_VNODE_NULL(XFS_ITOBHV(ip))
Linus Torvalds1da177e2005-04-16 15:20:36 -0700376#define XFS_ITOBHV(ip) ((struct bhv_desc *)(&((ip)->i_bhv_desc)))
Nathan Scotta844f452005-11-02 14:38:42 +1100377#define XFS_BHVTOI(bhvp) ((xfs_inode_t *)((char *)(bhvp) - \
378 (char *)&(((xfs_inode_t *)0)->i_bhv_desc)))
Linus Torvalds1da177e2005-04-16 15:20:36 -0700379#define BHV_IS_XFS(bdp) (BHV_OPS(bdp) == &xfs_vnodeops)
380
381/*
382 * For multiple groups support: if S_ISGID bit is set in the parent
383 * directory, group of new file is set to that of the parent, and
384 * new subdirectory gets S_ISGID bit from parent.
385 */
386#define XFS_INHERIT_GID(pip, vfsp) \
387 (((vfsp)->vfs_flag & VFS_GRPID) || ((pip)->i_d.di_mode & S_ISGID))
388
389/*
390 * xfs_iget.c prototypes.
391 */
392
393#define IGET_CREATE 1
394
395void xfs_ihash_init(struct xfs_mount *);
396void xfs_ihash_free(struct xfs_mount *);
397void xfs_chash_init(struct xfs_mount *);
398void xfs_chash_free(struct xfs_mount *);
399xfs_inode_t *xfs_inode_incore(struct xfs_mount *, xfs_ino_t,
400 struct xfs_trans *);
401void xfs_inode_lock_init(xfs_inode_t *, struct vnode *);
402int xfs_iget(struct xfs_mount *, struct xfs_trans *, xfs_ino_t,
403 uint, uint, xfs_inode_t **, xfs_daddr_t);
404void xfs_iput(xfs_inode_t *, uint);
405void xfs_iput_new(xfs_inode_t *, uint);
406void xfs_ilock(xfs_inode_t *, uint);
407int xfs_ilock_nowait(xfs_inode_t *, uint);
408void xfs_iunlock(xfs_inode_t *, uint);
409void xfs_ilock_demote(xfs_inode_t *, uint);
410void xfs_iflock(xfs_inode_t *);
411int xfs_iflock_nowait(xfs_inode_t *);
412uint xfs_ilock_map_shared(xfs_inode_t *);
413void xfs_iunlock_map_shared(xfs_inode_t *, uint);
414void xfs_ifunlock(xfs_inode_t *);
415void xfs_ireclaim(xfs_inode_t *);
416int xfs_finish_reclaim(xfs_inode_t *, int, int);
417int xfs_finish_reclaim_all(struct xfs_mount *, int);
418
419/*
420 * xfs_inode.c prototypes.
421 */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700422int xfs_itobp(struct xfs_mount *, struct xfs_trans *,
423 xfs_inode_t *, xfs_dinode_t **, struct xfs_buf **,
424 xfs_daddr_t);
425int xfs_iread(struct xfs_mount *, struct xfs_trans *, xfs_ino_t,
426 xfs_inode_t **, xfs_daddr_t);
427int xfs_iread_extents(struct xfs_trans *, xfs_inode_t *, int);
Nathan Scott31b084a2005-05-05 13:25:00 -0700428int xfs_ialloc(struct xfs_trans *, xfs_inode_t *, mode_t,
429 xfs_nlink_t, xfs_dev_t, struct cred *, xfs_prid_t,
430 int, struct xfs_buf **, boolean_t *, xfs_inode_t **);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700431void xfs_xlate_dinode_core(xfs_caddr_t, struct xfs_dinode_core *,
432 int);
433uint xfs_ip2xflags(struct xfs_inode *);
434uint xfs_dic2xflags(struct xfs_dinode_core *);
435int xfs_ifree(struct xfs_trans *, xfs_inode_t *,
436 struct xfs_bmap_free *);
437void xfs_itruncate_start(xfs_inode_t *, uint, xfs_fsize_t);
438int xfs_itruncate_finish(struct xfs_trans **, xfs_inode_t *,
439 xfs_fsize_t, int, int);
440int xfs_iunlink(struct xfs_trans *, xfs_inode_t *);
441int xfs_igrow_start(xfs_inode_t *, xfs_fsize_t, struct cred *);
442void xfs_igrow_finish(struct xfs_trans *, xfs_inode_t *,
443 xfs_fsize_t, int);
444
445void xfs_idestroy_fork(xfs_inode_t *, int);
446void xfs_idestroy(xfs_inode_t *);
447void xfs_idata_realloc(xfs_inode_t *, int, int);
448void xfs_iextract(xfs_inode_t *);
449void xfs_iext_realloc(xfs_inode_t *, int, int);
450void xfs_iroot_realloc(xfs_inode_t *, int, int);
451void xfs_ipin(xfs_inode_t *);
452void xfs_iunpin(xfs_inode_t *);
453int xfs_iextents_copy(xfs_inode_t *, xfs_bmbt_rec_t *, int);
454int xfs_iflush(xfs_inode_t *, uint);
Christoph Hellwigefa80272005-06-21 15:37:17 +1000455void xfs_iflush_all(struct xfs_mount *);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700456int xfs_iaccess(xfs_inode_t *, mode_t, cred_t *);
457uint xfs_iroundup(uint);
458void xfs_ichgtime(xfs_inode_t *, int);
459xfs_fsize_t xfs_file_last_byte(xfs_inode_t *);
460void xfs_lock_inodes(xfs_inode_t **, int, int, uint);
461
Christoph Hellwig75e17b32006-01-11 20:58:44 +1100462xfs_inode_t *xfs_vtoi(struct vnode *vp);
463
Christoph Hellwig42fe2b12006-01-11 15:35:17 +1100464void xfs_synchronize_atime(xfs_inode_t *);
465
Mandy Kirkconnell4eea22f2006-03-14 13:29:52 +1100466xfs_bmbt_rec_t *xfs_iext_get_ext(xfs_ifork_t *, xfs_extnum_t);
467void xfs_iext_insert(xfs_ifork_t *, xfs_extnum_t, xfs_extnum_t,
468 xfs_bmbt_irec_t *);
469void xfs_iext_add(xfs_ifork_t *, xfs_extnum_t, int);
Mandy Kirkconnell0293ce32006-03-14 13:30:23 +1100470void xfs_iext_add_indirect_multi(xfs_ifork_t *, int, xfs_extnum_t, int);
Mandy Kirkconnell4eea22f2006-03-14 13:29:52 +1100471void xfs_iext_remove(xfs_ifork_t *, xfs_extnum_t, int);
472void xfs_iext_remove_inline(xfs_ifork_t *, xfs_extnum_t, int);
473void xfs_iext_remove_direct(xfs_ifork_t *, xfs_extnum_t, int);
Mandy Kirkconnell0293ce32006-03-14 13:30:23 +1100474void xfs_iext_remove_indirect(xfs_ifork_t *, xfs_extnum_t, int);
Mandy Kirkconnell4eea22f2006-03-14 13:29:52 +1100475void xfs_iext_realloc_direct(xfs_ifork_t *, int);
Mandy Kirkconnell0293ce32006-03-14 13:30:23 +1100476void xfs_iext_realloc_indirect(xfs_ifork_t *, int);
477void xfs_iext_indirect_to_direct(xfs_ifork_t *);
Mandy Kirkconnell4eea22f2006-03-14 13:29:52 +1100478void xfs_iext_direct_to_inline(xfs_ifork_t *, xfs_extnum_t);
479void xfs_iext_inline_to_direct(xfs_ifork_t *, int);
480void xfs_iext_destroy(xfs_ifork_t *);
Mandy Kirkconnell8867bc92006-03-17 17:25:04 +1100481xfs_bmbt_rec_t *xfs_iext_bno_to_ext(xfs_ifork_t *, xfs_fileoff_t, int *);
Mandy Kirkconnell0293ce32006-03-14 13:30:23 +1100482xfs_ext_irec_t *xfs_iext_bno_to_irec(xfs_ifork_t *, xfs_fileoff_t, int *);
483xfs_ext_irec_t *xfs_iext_idx_to_irec(xfs_ifork_t *, xfs_extnum_t *, int *, int);
484void xfs_iext_irec_init(xfs_ifork_t *);
485xfs_ext_irec_t *xfs_iext_irec_new(xfs_ifork_t *, int);
486void xfs_iext_irec_remove(xfs_ifork_t *, int);
487void xfs_iext_irec_compact(xfs_ifork_t *);
488void xfs_iext_irec_compact_pages(xfs_ifork_t *);
489void xfs_iext_irec_compact_full(xfs_ifork_t *);
490void xfs_iext_irec_update_extoffs(xfs_ifork_t *, int, int);
Mandy Kirkconnell4eea22f2006-03-14 13:29:52 +1100491
Linus Torvalds1da177e2005-04-16 15:20:36 -0700492#define xfs_ipincount(ip) ((unsigned int) atomic_read(&ip->i_pincount))
493
494#ifdef DEBUG
495void xfs_isize_check(struct xfs_mount *, xfs_inode_t *, xfs_fsize_t);
496#else /* DEBUG */
497#define xfs_isize_check(mp, ip, isize)
498#endif /* DEBUG */
499
500#if defined(DEBUG)
501void xfs_inobp_check(struct xfs_mount *, struct xfs_buf *);
502#else
503#define xfs_inobp_check(mp, bp)
504#endif /* DEBUG */
505
506extern struct kmem_zone *xfs_chashlist_zone;
507extern struct kmem_zone *xfs_ifork_zone;
508extern struct kmem_zone *xfs_inode_zone;
509extern struct kmem_zone *xfs_ili_zone;
510extern struct vnodeops xfs_vnodeops;
511
512#endif /* __KERNEL__ */
513
514#endif /* __XFS_INODE_H__ */