]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/blob - include/xfs_inode.h
move to version 1.2.0 for group quota changes.
[thirdparty/xfsprogs-dev.git] / include / xfs_inode.h
1 /*
2 * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved.
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of version 2 of the GNU General Public License as
6 * published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it would be useful, but
9 * WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
11 *
12 * Further, this software is distributed without any warranty that it is
13 * free of the rightful claim of any third person regarding infringement
14 * or the like. Any license provided herein, whether implied or
15 * otherwise, applies only to this software file. Patent licenses, if
16 * any, provided herein do not apply to combinations of this program with
17 * other software, or any other product whatsoever.
18 *
19 * You should have received a copy of the GNU General Public License along
20 * with this program; if not, write the Free Software Foundation, Inc., 59
21 * Temple Place - Suite 330, Boston MA 02111-1307, USA.
22 *
23 * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
24 * Mountain View, CA 94043, or:
25 *
26 * http://www.sgi.com
27 *
28 * For further information regarding this notice, see:
29 *
30 * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
31 */
32 #ifndef __XFS_INODE_H__
33 #define __XFS_INODE_H__
34
35 /*
36 * File incore extent information, present for each of data & attr forks.
37 */
38 #define XFS_INLINE_EXTS 2
39 #define XFS_INLINE_DATA 32
40 typedef struct xfs_ifork {
41 int if_bytes; /* bytes in if_u1 */
42 int if_real_bytes; /* bytes allocated in if_u1 */
43 xfs_bmbt_block_t *if_broot; /* file's incore btree root */
44 short if_broot_bytes; /* bytes allocated for root */
45 unsigned char if_flags; /* per-fork flags */
46 unsigned char if_ext_max; /* max # of extent records */
47 xfs_extnum_t if_lastex; /* last if_extents used */
48 union {
49 xfs_bmbt_rec_t *if_extents; /* linear map file exts */
50 char *if_data; /* inline file data */
51 } if_u1;
52 union {
53 xfs_bmbt_rec_t if_inline_ext[XFS_INLINE_EXTS];
54 /* very small file extents */
55 char if_inline_data[XFS_INLINE_DATA];
56 /* very small file data */
57 xfs_dev_t if_rdev; /* dev number if special */
58 uuid_t if_uuid; /* mount point value */
59 } if_u2;
60 } xfs_ifork_t;
61
62 /*
63 * Flags for xfs_ichgtime().
64 */
65 #define XFS_ICHGTIME_MOD 0x1 /* data fork modification timestamp */
66 #define XFS_ICHGTIME_ACC 0x2 /* data fork access timestamp */
67 #define XFS_ICHGTIME_CHG 0x4 /* inode field change timestamp */
68
69 /*
70 * Per-fork incore inode flags.
71 */
72 #define XFS_IFINLINE 0x0001 /* Inline data is read in */
73 #define XFS_IFEXTENTS 0x0002 /* All extent pointers are read in */
74 #define XFS_IFBROOT 0x0004 /* i_broot points to the bmap b-tree root */
75
76 /*
77 * Flags for xfs_imap() and xfs_dilocate().
78 */
79 #define XFS_IMAP_LOOKUP 0x1
80
81 /*
82 * Maximum number of extent pointers in if_u1.if_extents.
83 */
84 #define XFS_MAX_INCORE_EXTENTS 32768
85
86
87 #ifdef __KERNEL__
88 struct bhv_desc;
89 struct cred;
90 struct ktrace;
91 struct vnode;
92 struct xfs_buf;
93 struct xfs_bmap_free;
94 struct xfs_bmbt_irec;
95 struct xfs_bmbt_block;
96 struct xfs_ext_attr;
97 struct xfs_inode;
98 struct xfs_inode_log_item;
99 struct xfs_mount;
100 struct xfs_trans;
101 struct xfs_dquot;
102 struct pm;
103
104
105 /*
106 * This structure is used to communicate which extents of a file
107 * were holes when a write started from xfs_write_file() to
108 * xfs_strat_read(). This is necessary so that we can know which
109 * blocks need to be zeroed when they are read in in xfs_strat_read()
110 * if they weren\'t allocated when the buffer given to xfs_strat_read()
111 * was mapped.
112 *
113 * We keep a list of these attached to the inode. The list is
114 * protected by the inode lock and the fact that the io lock is
115 * held exclusively by writers.
116 */
117 typedef struct xfs_gap {
118 struct xfs_gap *xg_next;
119 xfs_fileoff_t xg_offset_fsb;
120 xfs_extlen_t xg_count_fsb;
121 } xfs_gap_t;
122
123 /*
124 * This structure is used to hold common pieces of the buffer
125 * and file for xfs_dio_write and xfs_dio_read.
126 */
127 typedef struct xfs_dio {
128 struct xfs_buf *xd_bp;
129 bhv_desc_t *xd_bdp;
130 struct xfs_inode *xd_ip;
131 struct xfs_iocore *xd_io;
132 struct cred *xd_cr;
133 struct pm *xd_pmp;
134 int xd_blkalgn;
135 int xd_ioflag;
136 xfs_off_t xd_start;
137 size_t xd_length;
138 } xfs_dio_t;
139
140
141 typedef struct xfs_iocore {
142 void *io_obj; /* pointer to container
143 * inode or dcxvn structure */
144 struct xfs_mount *io_mount; /* fs mount struct ptr */
145 mrlock_t *io_lock; /* inode lock */
146 mrlock_t *io_iolock; /* inode IO lock */
147 sema_t *io_flock; /* inode flush lock */
148 mutex_t io_rlock; /* inode readahead mutex */
149
150 /* I/O state */
151 xfs_off_t io_offset; /* last buf offset */
152 xfs_off_t io_next_offset; /* seq read detector */
153 unsigned int io_last_req_sz; /* last read size */
154 unsigned int io_size; /* file io buffer len */
155 xfs_fsize_t io_new_size; /* sz when write completes */
156 xfs_off_t io_write_offset;
157 /* start off of curr write */
158 xfs_fileoff_t io_reada_blkno; /* next blk to start ra */
159 xfs_gap_t *io_gap_list; /* hole list in write range */
160 unsigned int io_readio_blocks; /* read buffer size */
161 unsigned int io_writeio_blocks; /* write buffer size */
162 uchar_t io_readio_log; /* log2 of read buffer size */
163 uchar_t io_writeio_log; /* log2 of write buffer size */
164 uchar_t io_max_io_log; /* max r/w io value */
165 int io_queued_bufs; /* count of xfsd queued bufs*/
166
167 /* Miscellaneous state. */
168 unsigned int io_flags; /* IO related flags */
169
170 /* DMAPI state */
171 __uint32_t io_dmevmask; /* DMIG event mask */
172 __uint16_t io_dmstate; /* DMIG state info */
173 } xfs_iocore_t;
174
175 #define XFS_IO_INODE(io) ((xfs_inode_t *) ((io)->io_obj))
176 #define XFS_IO_DCXVN(io) ((dcxvn_t *) ((io)->io_obj))
177
178 /*
179 * Flags in the flags field
180 */
181
182 #define XFS_IOCORE_ISXFS 0x01
183 #define XFS_IOCORE_ISCXFS 0x02
184 #define XFS_IOCORE_RT 0x04
185 #define XFS_IOCORE_UIOSZ 0x08
186
187 #define IO_IS_XFS(io) ((io)->io_flags & XFS_IOCORE_ISXFS)
188
189 /*
190 * Clear out the read-ahead state in the in-core inode.
191 * We actually only need to clear i_next_offset and
192 * i_last_req_sz to get the effect of making all the
193 * read ahead state unusable.
194 */
195 #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_INODE_CLEAR_READ_AHEAD)
196 void xfs_inode_clear_read_ahead(xfs_iocore_t *io);
197 #define XFS_INODE_CLEAR_READ_AHEAD(io) xfs_inode_clear_read_ahead(io)
198 #else
199 #define XFS_INODE_CLEAR_READ_AHEAD(io) { \
200 mutex_lock(&((io)->io_rlock), PINOD); \
201 (io)->io_next_offset = 0; \
202 (io)->io_last_req_sz = 0; \
203 mutex_unlock(&((io)->io_rlock)); }
204 #endif
205
206
207 /*
208 * xfs_iocore prototypes
209 */
210
211 extern void xfs_iocore_inode_init(struct xfs_inode *);
212 extern void xfs_iocore_inode_reinit(struct xfs_inode *);
213 extern void xfs_iocore_reset(xfs_iocore_t *);
214 extern void xfs_iocore_destroy(xfs_iocore_t *);
215
216
217 /*
218 * This is the type used in the xfs inode hash table.
219 * An array of these is allocated for each mounted
220 * file system to hash the inodes for that file system.
221 */
222 typedef struct xfs_ihash {
223 struct xfs_inode *ih_next;
224 mrlock_t ih_lock;
225 uint ih_version;
226 } xfs_ihash_t;
227 #if defined(MP)
228 #pragma set type attribute xfs_ihash align=128
229 #endif
230
231 /*
232 * Inode hashing and hash bucket locking.
233 */
234 #define XFS_BUCKETS(mp) (37*(mp)->m_sb.sb_agcount-1)
235 #define XFS_IHASH(mp,ino) ((mp)->m_ihash + (((uint)ino) % (mp)->m_ihsize))
236
237 /*
238 * This is the xfs inode cluster hash. This hash is used by xfs_iflush to
239 * find inodes that share a cluster and can be flushed to disk at the same
240 * time.
241 */
242
243 typedef struct xfs_chashlist {
244 struct xfs_chashlist *chl_next;
245 struct xfs_inode *chl_ip;
246 xfs_daddr_t chl_blkno; /* starting block number of
247 * the cluster */
248 #ifdef DEBUG
249 struct xfs_buf *chl_buf; /* debug: the inode buffer */
250 #endif
251 } xfs_chashlist_t;
252
253 typedef struct xfs_chash {
254 xfs_chashlist_t *ch_list;
255 lock_t ch_lock;
256 } xfs_chash_t;
257
258
259 /*
260 * This is the xfs in-core inode structure.
261 * Most of the on-disk inode is embedded in the i_d field.
262 *
263 * The extent pointers/inline file space, however, are managed
264 * separately. The memory for this information is pointed to by
265 * the if_u1 unions depending on the type of the data.
266 * This is used to linearize the array of extents for fast in-core
267 * access. This is used until the file's number of extents
268 * surpasses XFS_MAX_INCORE_EXTENTS, at which point all extent pointers
269 * are accessed through the buffer cache.
270 *
271 * Other state kept in the in-core inode is used for identification,
272 * locking, transactional updating, etc of the inode.
273 *
274 * Generally, we do not want to hold the i_rlock while holding the
275 * i_ilock. Hierarchy is i_iolock followed by i_rlock.
276 *
277 * xfs_iptr_t contains all the inode fields upto and including the
278 * i_mnext and i_mprev fields, it is used as a marker in the inode
279 * chain off the mount structure by xfs_sync calls.
280 */
281
282 typedef struct {
283 struct xfs_ihash *ip_hash; /* pointer to hash header */
284 struct xfs_inode *ip_next; /* inode hash link forw */
285 struct xfs_inode *ip_mnext; /* next inode in mount list */
286 struct xfs_inode *ip_mprev; /* ptr to prev inode */
287 struct xfs_inode **ip_prevp; /* ptr to prev i_next */
288 struct xfs_mount *ip_mount; /* fs mount struct ptr */
289 } xfs_iptr_t;
290
291 typedef struct xfs_inode {
292 /* Inode linking and identification information. */
293 struct xfs_ihash *i_hash; /* pointer to hash header */
294 struct xfs_inode *i_next; /* inode hash link forw */
295 struct xfs_inode *i_mnext; /* next inode in mount list */
296 struct xfs_inode *i_mprev; /* ptr to prev inode */
297 struct xfs_inode **i_prevp; /* ptr to prev i_next */
298 struct xfs_mount *i_mount; /* fs mount struct ptr */
299 struct bhv_desc i_bhv_desc; /* inode behavior descriptor*/
300 struct xfs_dquot *i_udquot; /* user dquot */
301 struct xfs_dquot *i_gdquot; /* group dquot */
302
303 /* Inode location stuff */
304 xfs_ino_t i_ino; /* inode number (agno/agino)*/
305 xfs_daddr_t i_blkno; /* blkno of inode buffer */
306 dev_t i_dev; /* dev for this inode */
307 ushort i_len; /* len of inode buffer */
308 ushort i_boffset; /* off of inode in buffer */
309
310 /* Extent information. */
311 xfs_ifork_t *i_afp; /* attribute fork pointer */
312 xfs_ifork_t i_df; /* data fork */
313
314 /* Transaction and locking information. */
315 struct xfs_trans *i_transp; /* ptr to owning transaction*/
316 struct xfs_inode_log_item *i_itemp; /* logging information */
317 mrlock_t i_lock; /* inode lock */
318 mrlock_t i_iolock; /* inode IO lock */
319 sema_t i_flock; /* inode flush lock */
320 unsigned int i_pincount; /* inode pin count */
321 sv_t i_pinsema; /* inode pin sema */
322 lock_t i_ipinlock; /* inode pinning mutex */
323 struct xfs_inode **i_refcache; /* ptr to entry in ref cache */
324 struct xfs_inode *i_release; /* inode to unref */
325
326 /* I/O state */
327 xfs_iocore_t i_iocore; /* I/O core */
328
329 /* Miscellaneous state. */
330 unsigned short i_flags; /* see defined flags below */
331 unsigned short i_update_core; /* timestamps/size is dirty */
332 unsigned short i_update_size; /* di_size field is dirty */
333 unsigned int i_gen; /* generation count */
334 unsigned int i_delayed_blks; /* count of delay alloc blks */
335 struct xfs_ext_attr *i_ext_attr; /* Critical ext attributes */
336 void *i_ilock_ra; /* current ilock ret addr */
337
338 xfs_dinode_core_t i_d; /* most of ondisk inode */
339 xfs_chashlist_t *i_chash; /* cluster hash list header */
340 struct xfs_inode *i_cnext; /* cluster hash link forward */
341 struct xfs_inode *i_cprev; /* cluster hash link backward */
342
343 #ifdef DEBUG
344 /* Trace buffers per inode. */
345 struct ktrace *i_xtrace; /* inode extent list trace */
346 struct ktrace *i_btrace; /* inode bmap btree trace */
347 struct ktrace *i_rwtrace; /* inode read/write trace */
348 struct ktrace *i_strat_trace; /* inode strat_write trace */
349 struct ktrace *i_lock_trace; /* inode lock/unlock trace */
350 struct ktrace *i_dir_trace; /* inode directory trace */
351 #endif /* DEBUG */
352 } xfs_inode_t;
353
354 #endif /* __KERNEL__ */
355
356
357 /*
358 * Fork handling.
359 */
360 #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_IFORK_PTR)
361 xfs_ifork_t *xfs_ifork_ptr(xfs_inode_t *ip, int w);
362 #define XFS_IFORK_PTR(ip,w) xfs_ifork_ptr(ip,w)
363 #else
364 #define XFS_IFORK_PTR(ip,w) ((w) == XFS_DATA_FORK ? &(ip)->i_df : (ip)->i_afp)
365 #endif
366 #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_IFORK_Q)
367 int xfs_ifork_q(xfs_inode_t *ip);
368 #define XFS_IFORK_Q(ip) xfs_ifork_q(ip)
369 #else
370 #define XFS_IFORK_Q(ip) XFS_CFORK_Q(&(ip)->i_d)
371 #endif
372 #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_IFORK_DSIZE)
373 int xfs_ifork_dsize(xfs_inode_t *ip);
374 #define XFS_IFORK_DSIZE(ip) xfs_ifork_dsize(ip)
375 #else
376 #define XFS_IFORK_DSIZE(ip) XFS_CFORK_DSIZE(&ip->i_d, ip->i_mount)
377 #endif
378 #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_IFORK_ASIZE)
379 int xfs_ifork_asize(xfs_inode_t *ip);
380 #define XFS_IFORK_ASIZE(ip) xfs_ifork_asize(ip)
381 #else
382 #define XFS_IFORK_ASIZE(ip) XFS_CFORK_ASIZE(&ip->i_d, ip->i_mount)
383 #endif
384 #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_IFORK_SIZE)
385 int xfs_ifork_size(xfs_inode_t *ip, int w);
386 #define XFS_IFORK_SIZE(ip,w) xfs_ifork_size(ip,w)
387 #else
388 #define XFS_IFORK_SIZE(ip,w) XFS_CFORK_SIZE(&ip->i_d, ip->i_mount, w)
389 #endif
390 #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_IFORK_FORMAT)
391 int xfs_ifork_format(xfs_inode_t *ip, int w);
392 #define XFS_IFORK_FORMAT(ip,w) xfs_ifork_format(ip,w)
393 #else
394 #define XFS_IFORK_FORMAT(ip,w) XFS_CFORK_FORMAT(&ip->i_d, w)
395 #endif
396 #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_IFORK_FMT_SET)
397 void xfs_ifork_fmt_set(xfs_inode_t *ip, int w, int n);
398 #define XFS_IFORK_FMT_SET(ip,w,n) xfs_ifork_fmt_set(ip,w,n)
399 #else
400 #define XFS_IFORK_FMT_SET(ip,w,n) XFS_CFORK_FMT_SET(&ip->i_d, w, n)
401 #endif
402 #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_IFORK_NEXTENTS)
403 int xfs_ifork_nextents(xfs_inode_t *ip, int w);
404 #define XFS_IFORK_NEXTENTS(ip,w) xfs_ifork_nextents(ip,w)
405 #else
406 #define XFS_IFORK_NEXTENTS(ip,w) XFS_CFORK_NEXTENTS(&ip->i_d, w)
407 #endif
408 #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_IFORK_NEXT_SET)
409 void xfs_ifork_next_set(xfs_inode_t *ip, int w, int n);
410 #define XFS_IFORK_NEXT_SET(ip,w,n) xfs_ifork_next_set(ip,w,n)
411 #else
412 #define XFS_IFORK_NEXT_SET(ip,w,n) XFS_CFORK_NEXT_SET(&ip->i_d, w, n)
413 #endif
414
415
416 #ifdef __KERNEL__
417
418 /*
419 * In-core inode flags.
420 */
421 #define XFS_IGRIO 0x0001 /* inode used for guaranteed rate i/o */
422 #define XFS_IUIOSZ 0x0002 /* inode i/o sizes have been explicitly set */
423 #define XFS_IQUIESCE 0x0004 /* we have started quiescing for this inode */
424 #define XFS_IRECLAIM 0x0008 /* we have started reclaiming this inode */
425
426 /*
427 * Flags for inode locking.
428 */
429 #define XFS_IOLOCK_EXCL 0x001
430 #define XFS_IOLOCK_SHARED 0x002
431 #define XFS_ILOCK_EXCL 0x004
432 #define XFS_ILOCK_SHARED 0x008
433 #define XFS_IUNLOCK_NONOTIFY 0x010
434 #define XFS_IOLOCK_NESTED 0x020
435 #define XFS_EXTENT_TOKEN_RD 0x040
436 #define XFS_SIZE_TOKEN_RD 0x080
437 #define XFS_EXTSIZE_RD (XFS_EXTENT_TOKEN_RD|XFS_SIZE_TOKEN_RD)
438 #define XFS_WILLLEND 0x100 /* Always acquire tokens for lending */
439 #define XFS_EXTENT_TOKEN_WR (XFS_EXTENT_TOKEN_RD | XFS_WILLLEND)
440 #define XFS_SIZE_TOKEN_WR (XFS_SIZE_TOKEN_RD | XFS_WILLLEND)
441 #define XFS_EXTSIZE_WR (XFS_EXTSIZE_RD | XFS_WILLLEND)
442
443
444 #define XFS_LOCK_MASK \
445 (XFS_IOLOCK_EXCL | XFS_IOLOCK_SHARED | XFS_ILOCK_EXCL | \
446 XFS_IOLOCK_NESTED | \
447 XFS_ILOCK_SHARED | XFS_EXTENT_TOKEN_RD | XFS_SIZE_TOKEN_RD | \
448 XFS_WILLLEND)
449
450 /*
451 * Flags for xfs_iflush()
452 */
453 #define XFS_IFLUSH_DELWRI_ELSE_SYNC 1
454 #define XFS_IFLUSH_DELWRI_ELSE_ASYNC 2
455 #define XFS_IFLUSH_SYNC 3
456 #define XFS_IFLUSH_ASYNC 4
457 #define XFS_IFLUSH_DELWRI 5
458
459 /*
460 * Flags for xfs_iflush_all.
461 */
462 #define XFS_FLUSH_ALL 0x1
463
464 /*
465 * Flags for xfs_itruncate_start().
466 */
467 #define XFS_ITRUNC_DEFINITE 0x1
468 #define XFS_ITRUNC_MAYBE 0x2
469
470 /*
471 * Maximum file size.
472 * if XFS_BIG_FILES 2^63 - 1 (largest positive value of xfs_fsize_t)
473 * else 2^40 - 1 (40=31+9) (might be an int holding a block #)
474 * Note, we allow seeks to this offset, although you can't read or write.
475 * For the not XFS_BIG_FILES case, the value could be 1 higher but we don't
476 * do that, for symmetry.
477 */
478 #if XFS_BIG_FILES
479 #define XFS_MAX_FILE_OFFSET ((long long)((1ULL<<63)-1ULL))
480 #else
481 #define XFS_MAX_FILE_OFFSET ((1LL<<40)-1LL)
482 #endif
483
484 #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_ITOV)
485 struct vnode *xfs_itov(xfs_inode_t *ip);
486 #define XFS_ITOV(ip) xfs_itov(ip)
487 #else
488 #define XFS_ITOV(ip) BHV_TO_VNODE(XFS_ITOBHV(ip))
489 #endif
490 #define XFS_ITOV_NULL(ip) BHV_TO_VNODE_NULL(XFS_ITOBHV(ip))
491 #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_ITOBHV)
492 struct bhv_desc *xfs_itobhv(xfs_inode_t *ip);
493 #define XFS_ITOBHV(ip) xfs_itobhv(ip)
494 #else
495 #define XFS_ITOBHV(ip) ((struct bhv_desc *)(&((ip)->i_bhv_desc)))
496 #endif
497 #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_BHVTOI)
498 xfs_inode_t *xfs_bhvtoi(struct bhv_desc *bhvp);
499 #define XFS_BHVTOI(bhvp) xfs_bhvtoi(bhvp)
500 #else
501 #define XFS_BHVTOI(bhvp) \
502 ((xfs_inode_t *)((char *)(bhvp) - \
503 (char *)&(((xfs_inode_t *)0)->i_bhv_desc)))
504 #endif
505
506 #define BHV_IS_XFS(bdp) (BHV_OPS(bdp) == &xfs_vnodeops)
507
508 /*
509 * Pick the inode cluster hash bucket
510 * (m_chash is the same size as m_ihash)
511 */
512 #define XFS_CHASH(mp,blk) ((mp)->m_chash + (((uint)blk) % (mp)->m_chsize))
513
514
515 /*
516 * xfs_iget.c prototypes.
517 */
518 void xfs_ihash_init(struct xfs_mount *);
519 void xfs_ihash_free(struct xfs_mount *);
520 void xfs_chash_init(struct xfs_mount *);
521 void xfs_chash_free(struct xfs_mount *);
522 xfs_inode_t *xfs_inode_incore(struct xfs_mount *, xfs_ino_t,
523 struct xfs_trans *);
524 void xfs_inode_lock_init(xfs_inode_t *, struct vnode *);
525 int xfs_iget(struct xfs_mount *, struct xfs_trans *, xfs_ino_t,
526 uint, xfs_inode_t **, xfs_daddr_t);
527 int xfs_vn_iget(struct vnode *, struct xfs_mount *,
528 struct xfs_trans *, xfs_ino_t,
529 uint, xfs_inode_t **, xfs_daddr_t);
530 void xfs_iput(xfs_inode_t *, uint);
531 void xfs_ilock(xfs_inode_t *, uint);
532 int xfs_ilock_nowait(xfs_inode_t *, uint);
533 void xfs_iunlock(xfs_inode_t *, uint);
534 void xfs_ilock_demote(xfs_inode_t *, uint);
535 void xfs_iflock(xfs_inode_t *);
536 int xfs_iflock_nowait(xfs_inode_t *);
537 uint xfs_ilock_map_shared(xfs_inode_t *);
538 void xfs_iunlock_map_shared(xfs_inode_t *, uint);
539 void xfs_ifunlock(xfs_inode_t *);
540 void xfs_ireclaim(xfs_inode_t *);
541 int xfs_finish_reclaim(xfs_inode_t *, int);
542
543 /*
544 * xfs_inode.c prototypes.
545 */
546 int xfs_inotobp(struct xfs_mount *, struct xfs_trans *, xfs_ino_t,
547 xfs_dinode_t **, struct xfs_buf **, int *);
548 int xfs_itobp(struct xfs_mount *, struct xfs_trans *,
549 xfs_inode_t *, xfs_dinode_t **, struct xfs_buf **,
550 xfs_daddr_t);
551 int xfs_iread(struct xfs_mount *, struct xfs_trans *, xfs_ino_t,
552 xfs_inode_t **, xfs_daddr_t);
553 int xfs_iread_extents(struct xfs_trans *, xfs_inode_t *, int);
554 int xfs_ialloc(struct xfs_trans *, xfs_inode_t *, mode_t, nlink_t,
555 dev_t, struct cred *, xfs_prid_t, int,
556 struct xfs_buf **, boolean_t *, xfs_inode_t **);
557 void xfs_xlate_dinode_core(xfs_caddr_t, struct xfs_dinode_core *, int,
558 xfs_arch_t);
559 int xfs_ifree(struct xfs_trans *, xfs_inode_t *);
560 int xfs_atruncate_start(xfs_inode_t *);
561 void xfs_itruncate_start(xfs_inode_t *, uint, xfs_fsize_t);
562 int xfs_itruncate_finish(struct xfs_trans **, xfs_inode_t *,
563 xfs_fsize_t, int, int);
564 int xfs_iunlink(struct xfs_trans *, xfs_inode_t *);
565 int xfs_igrow_start(xfs_inode_t *, xfs_fsize_t, struct cred *);
566 void xfs_igrow_finish(struct xfs_trans *, xfs_inode_t *,
567 xfs_fsize_t, int);
568
569 void xfs_idestroy_fork(xfs_inode_t *, int);
570 void xfs_idestroy(xfs_inode_t *);
571 void xfs_idata_realloc(xfs_inode_t *, int, int);
572 void xfs_iextract(xfs_inode_t *);
573 void xfs_iext_realloc(xfs_inode_t *, int, int);
574 void xfs_iroot_realloc(xfs_inode_t *, int, int);
575 void xfs_ipin(xfs_inode_t *);
576 void xfs_iunpin(xfs_inode_t *);
577 unsigned int xfs_ipincount(xfs_inode_t *);
578 int xfs_iextents_copy(xfs_inode_t *, xfs_bmbt_rec_32_t *, int);
579 int xfs_iflush(xfs_inode_t *, uint);
580 int xfs_iflush_all(struct xfs_mount *, int);
581 int xfs_ibusy_check(xfs_inode_t *, int);
582 int xfs_iaccess(xfs_inode_t *, mode_t, cred_t *);
583 uint xfs_iroundup(uint);
584 void xfs_ichgtime(xfs_inode_t *, int);
585 xfs_fsize_t xfs_file_last_byte(xfs_inode_t *);
586 xfs_inode_t *xfs_get_inode(dev_t, xfs_ino_t);
587 void xfs_lock_inodes(xfs_inode_t **, int, int, uint);
588
589
590 #ifdef DEBUG
591 void xfs_isize_check(struct xfs_mount *, xfs_inode_t *, xfs_fsize_t);
592 #else /* DEBUG */
593 #define xfs_isize_check(mp, ip, isize)
594 #endif /* DEBUG */
595
596 #if defined(DEBUG)
597 void xfs_inobp_check(struct xfs_mount *, struct xfs_buf *);
598 #else
599 #define xfs_inobp_check(mp, bp)
600 #endif /* DEBUG */
601
602 extern struct xfs_zone *xfs_chashlist_zone;
603 extern struct xfs_zone *xfs_ifork_zone;
604 extern struct xfs_zone *xfs_inode_zone;
605 extern struct xfs_zone *xfs_ili_zone;
606 extern struct vnodeops xfs_vnodeops;
607
608 #ifdef XFS_ILOCK_TRACE
609 #define XFS_ILOCK_KTRACE_SIZE 32
610 void xfs_ilock_trace(xfs_inode_t *ip, int lock, unsigned int lockflags,
611 inst_t *ra);
612 #endif
613
614 #endif /* __KERNEL__ */
615
616 #endif /* __XFS_INODE_H__ */