aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs/xfs_inode.h
diff options
context:
space:
mode:
Diffstat (limited to 'fs/xfs/xfs_inode.h')
-rw-r--r--fs/xfs/xfs_inode.h375
1 files changed, 210 insertions, 165 deletions
diff --git a/fs/xfs/xfs_inode.h b/fs/xfs/xfs_inode.h
index 6be310d41daf..1f175fa34b22 100644
--- a/fs/xfs/xfs_inode.h
+++ b/fs/xfs/xfs_inode.h
@@ -19,8 +19,7 @@
19#define __XFS_INODE_H__ 19#define __XFS_INODE_H__
20 20
21struct xfs_dinode; 21struct xfs_dinode;
22struct xfs_dinode_core; 22struct xfs_inode;
23
24 23
25/* 24/*
26 * Fork identifiers. 25 * Fork identifiers.
@@ -63,7 +62,7 @@ typedef struct xfs_ext_irec {
63typedef struct xfs_ifork { 62typedef struct xfs_ifork {
64 int if_bytes; /* bytes in if_u1 */ 63 int if_bytes; /* bytes in if_u1 */
65 int if_real_bytes; /* bytes allocated in if_u1 */ 64 int if_real_bytes; /* bytes allocated in if_u1 */
66 xfs_bmbt_block_t *if_broot; /* file's incore btree root */ 65 struct xfs_btree_block *if_broot; /* file's incore btree root */
67 short if_broot_bytes; /* bytes allocated for root */ 66 short if_broot_bytes; /* bytes allocated for root */
68 unsigned char if_flags; /* per-fork flags */ 67 unsigned char if_flags; /* per-fork flags */
69 unsigned char if_ext_max; /* max # of extent records */ 68 unsigned char if_ext_max; /* max # of extent records */
@@ -84,52 +83,14 @@ typedef struct xfs_ifork {
84} xfs_ifork_t; 83} xfs_ifork_t;
85 84
86/* 85/*
87 * Flags for xfs_ichgtime(). 86 * Inode location information. Stored in the inode and passed to
87 * xfs_imap_to_bp() to get a buffer and dinode for a given inode.
88 */ 88 */
89#define XFS_ICHGTIME_MOD 0x1 /* data fork modification timestamp */ 89struct xfs_imap {
90#define XFS_ICHGTIME_CHG 0x2 /* inode field change timestamp */ 90 xfs_daddr_t im_blkno; /* starting BB of inode chunk */
91 91 ushort im_len; /* length in BBs of inode chunk */
92/* 92 ushort im_boffset; /* inode offset in block in bytes */
93 * Per-fork incore inode flags. 93};
94 */
95#define XFS_IFINLINE 0x01 /* Inline data is read in */
96#define XFS_IFEXTENTS 0x02 /* All extent pointers are read in */
97#define XFS_IFBROOT 0x04 /* i_broot points to the bmap b-tree root */
98#define XFS_IFEXTIREC 0x08 /* Indirection array of extent blocks */
99
100/*
101 * Flags for xfs_itobp(), xfs_imap() and xfs_dilocate().
102 */
103#define XFS_IMAP_LOOKUP 0x1
104#define XFS_IMAP_BULKSTAT 0x2
105
106#ifdef __KERNEL__
107struct bhv_desc;
108struct cred;
109struct ktrace;
110struct xfs_buf;
111struct xfs_bmap_free;
112struct xfs_bmbt_irec;
113struct xfs_bmbt_block;
114struct xfs_inode;
115struct xfs_inode_log_item;
116struct xfs_mount;
117struct xfs_trans;
118struct xfs_dquot;
119
120#if defined(XFS_ILOCK_TRACE)
121#define XFS_ILOCK_KTRACE_SIZE 32
122extern ktrace_t *xfs_ilock_trace_buf;
123extern void xfs_ilock_trace(struct xfs_inode *, int, unsigned int, inst_t *);
124#else
125#define xfs_ilock_trace(i,n,f,ra)
126#endif
127
128typedef struct dm_attrs_s {
129 __uint32_t da_dmevmask; /* DMIG event mask */
130 __uint16_t da_dmstate; /* DMIG state info */
131 __uint16_t da_pad; /* DMIG extra padding */
132} dm_attrs_t;
133 94
134/* 95/*
135 * This is the xfs in-core inode structure. 96 * This is the xfs in-core inode structure.
@@ -160,7 +121,7 @@ typedef struct xfs_ictimestamp {
160} xfs_ictimestamp_t; 121} xfs_ictimestamp_t;
161 122
162/* 123/*
163 * NOTE: This structure must be kept identical to struct xfs_dinode_core 124 * NOTE: This structure must be kept identical to struct xfs_dinode
164 * in xfs_dinode.h except for the endianess annotations. 125 * in xfs_dinode.h except for the endianess annotations.
165 */ 126 */
166typedef struct xfs_icdinode { 127typedef struct xfs_icdinode {
@@ -191,27 +152,97 @@ typedef struct xfs_icdinode {
191 __uint32_t di_gen; /* generation number */ 152 __uint32_t di_gen; /* generation number */
192} xfs_icdinode_t; 153} xfs_icdinode_t;
193 154
194typedef struct { 155/*
195 struct xfs_inode *ip_mnext; /* next inode in mount list */ 156 * Flags for xfs_ichgtime().
196 struct xfs_inode *ip_mprev; /* ptr to prev inode */ 157 */
197 struct xfs_mount *ip_mount; /* fs mount struct ptr */ 158#define XFS_ICHGTIME_MOD 0x1 /* data fork modification timestamp */
198} xfs_iptr_t; 159#define XFS_ICHGTIME_CHG 0x2 /* inode field change timestamp */
160
161/*
162 * Per-fork incore inode flags.
163 */
164#define XFS_IFINLINE 0x01 /* Inline data is read in */
165#define XFS_IFEXTENTS 0x02 /* All extent pointers are read in */
166#define XFS_IFBROOT 0x04 /* i_broot points to the bmap b-tree root */
167#define XFS_IFEXTIREC 0x08 /* Indirection array of extent blocks */
168
169/*
170 * Fork handling.
171 */
172
173#define XFS_IFORK_Q(ip) ((ip)->i_d.di_forkoff != 0)
174#define XFS_IFORK_BOFF(ip) ((int)((ip)->i_d.di_forkoff << 3))
175
176#define XFS_IFORK_PTR(ip,w) \
177 ((w) == XFS_DATA_FORK ? \
178 &(ip)->i_df : \
179 (ip)->i_afp)
180#define XFS_IFORK_DSIZE(ip) \
181 (XFS_IFORK_Q(ip) ? \
182 XFS_IFORK_BOFF(ip) : \
183 XFS_LITINO((ip)->i_mount))
184#define XFS_IFORK_ASIZE(ip) \
185 (XFS_IFORK_Q(ip) ? \
186 XFS_LITINO((ip)->i_mount) - XFS_IFORK_BOFF(ip) : \
187 0)
188#define XFS_IFORK_SIZE(ip,w) \
189 ((w) == XFS_DATA_FORK ? \
190 XFS_IFORK_DSIZE(ip) : \
191 XFS_IFORK_ASIZE(ip))
192#define XFS_IFORK_FORMAT(ip,w) \
193 ((w) == XFS_DATA_FORK ? \
194 (ip)->i_d.di_format : \
195 (ip)->i_d.di_aformat)
196#define XFS_IFORK_FMT_SET(ip,w,n) \
197 ((w) == XFS_DATA_FORK ? \
198 ((ip)->i_d.di_format = (n)) : \
199 ((ip)->i_d.di_aformat = (n)))
200#define XFS_IFORK_NEXTENTS(ip,w) \
201 ((w) == XFS_DATA_FORK ? \
202 (ip)->i_d.di_nextents : \
203 (ip)->i_d.di_anextents)
204#define XFS_IFORK_NEXT_SET(ip,w,n) \
205 ((w) == XFS_DATA_FORK ? \
206 ((ip)->i_d.di_nextents = (n)) : \
207 ((ip)->i_d.di_anextents = (n)))
208
209
210
211#ifdef __KERNEL__
212
213struct bhv_desc;
214struct cred;
215struct ktrace;
216struct xfs_buf;
217struct xfs_bmap_free;
218struct xfs_bmbt_irec;
219struct xfs_inode_log_item;
220struct xfs_mount;
221struct xfs_trans;
222struct xfs_dquot;
223
224#if defined(XFS_ILOCK_TRACE)
225#define XFS_ILOCK_KTRACE_SIZE 32
226extern void xfs_ilock_trace(struct xfs_inode *, int, unsigned int, inst_t *);
227#else
228#define xfs_ilock_trace(i,n,f,ra)
229#endif
230
231typedef struct dm_attrs_s {
232 __uint32_t da_dmevmask; /* DMIG event mask */
233 __uint16_t da_dmstate; /* DMIG state info */
234 __uint16_t da_pad; /* DMIG extra padding */
235} dm_attrs_t;
199 236
200typedef struct xfs_inode { 237typedef struct xfs_inode {
201 /* Inode linking and identification information. */ 238 /* Inode linking and identification information. */
202 struct xfs_inode *i_mnext; /* next inode in mount list */
203 struct xfs_inode *i_mprev; /* ptr to prev inode */
204 struct xfs_mount *i_mount; /* fs mount struct ptr */ 239 struct xfs_mount *i_mount; /* fs mount struct ptr */
205 struct list_head i_reclaim; /* reclaim list */
206 struct inode *i_vnode; /* vnode backpointer */
207 struct xfs_dquot *i_udquot; /* user dquot */ 240 struct xfs_dquot *i_udquot; /* user dquot */
208 struct xfs_dquot *i_gdquot; /* group dquot */ 241 struct xfs_dquot *i_gdquot; /* group dquot */
209 242
210 /* Inode location stuff */ 243 /* Inode location stuff */
211 xfs_ino_t i_ino; /* inode number (agno/agino)*/ 244 xfs_ino_t i_ino; /* inode number (agno/agino)*/
212 xfs_daddr_t i_blkno; /* blkno of inode buffer */ 245 struct xfs_imap i_imap; /* location for xfs_imap() */
213 ushort i_len; /* len of inode buffer */
214 ushort i_boffset; /* off of inode in buffer */
215 246
216 /* Extent information. */ 247 /* Extent information. */
217 xfs_ifork_t *i_afp; /* attribute fork pointer */ 248 xfs_ifork_t *i_afp; /* attribute fork pointer */
@@ -230,7 +261,6 @@ typedef struct xfs_inode {
230 unsigned short i_flags; /* see defined flags below */ 261 unsigned short i_flags; /* see defined flags below */
231 unsigned char i_update_core; /* timestamps/size is dirty */ 262 unsigned char i_update_core; /* timestamps/size is dirty */
232 unsigned char i_update_size; /* di_size field is dirty */ 263 unsigned char i_update_size; /* di_size field is dirty */
233 unsigned int i_gen; /* generation count */
234 unsigned int i_delayed_blks; /* count of delay alloc blks */ 264 unsigned int i_delayed_blks; /* count of delay alloc blks */
235 265
236 xfs_icdinode_t i_d; /* most of ondisk inode */ 266 xfs_icdinode_t i_d; /* most of ondisk inode */
@@ -238,6 +268,10 @@ typedef struct xfs_inode {
238 xfs_fsize_t i_size; /* in-memory size */ 268 xfs_fsize_t i_size; /* in-memory size */
239 xfs_fsize_t i_new_size; /* size when write completes */ 269 xfs_fsize_t i_new_size; /* size when write completes */
240 atomic_t i_iocount; /* outstanding I/O count */ 270 atomic_t i_iocount; /* outstanding I/O count */
271
272 /* VFS inode */
273 struct inode i_vnode; /* embedded VFS inode */
274
241 /* Trace buffers per inode. */ 275 /* Trace buffers per inode. */
242#ifdef XFS_INODE_TRACE 276#ifdef XFS_INODE_TRACE
243 struct ktrace *i_trace; /* general inode trace */ 277 struct ktrace *i_trace; /* general inode trace */
@@ -245,7 +279,7 @@ typedef struct xfs_inode {
245#ifdef XFS_BMAP_TRACE 279#ifdef XFS_BMAP_TRACE
246 struct ktrace *i_xtrace; /* inode extent list trace */ 280 struct ktrace *i_xtrace; /* inode extent list trace */
247#endif 281#endif
248#ifdef XFS_BMBT_TRACE 282#ifdef XFS_BTREE_TRACE
249 struct ktrace *i_btrace; /* inode bmap btree trace */ 283 struct ktrace *i_btrace; /* inode bmap btree trace */
250#endif 284#endif
251#ifdef XFS_RW_TRACE 285#ifdef XFS_RW_TRACE
@@ -265,13 +299,30 @@ typedef struct xfs_inode {
265/* Convert from vfs inode to xfs inode */ 299/* Convert from vfs inode to xfs inode */
266static inline struct xfs_inode *XFS_I(struct inode *inode) 300static inline struct xfs_inode *XFS_I(struct inode *inode)
267{ 301{
268 return (struct xfs_inode *)inode->i_private; 302 return container_of(inode, struct xfs_inode, i_vnode);
269} 303}
270 304
271/* convert from xfs inode to vfs inode */ 305/* convert from xfs inode to vfs inode */
272static inline struct inode *VFS_I(struct xfs_inode *ip) 306static inline struct inode *VFS_I(struct xfs_inode *ip)
273{ 307{
274 return (struct inode *)ip->i_vnode; 308 return &ip->i_vnode;
309}
310
311/*
312 * Get rid of a partially initialized inode.
313 *
314 * We have to go through destroy_inode to make sure allocations
315 * from init_inode_always like the security data are undone.
316 *
317 * We mark the inode bad so that it takes the short cut in
318 * the reclaim path instead of going through the flush path
319 * which doesn't make sense for an inode that has never seen the
320 * light of day.
321 */
322static inline void xfs_destroy_inode(struct xfs_inode *ip)
323{
324 make_bad_inode(VFS_I(ip));
325 return destroy_inode(VFS_I(ip));
275} 326}
276 327
277/* 328/*
@@ -327,65 +378,36 @@ xfs_iflags_test_and_clear(xfs_inode_t *ip, unsigned short flags)
327 spin_unlock(&ip->i_flags_lock); 378 spin_unlock(&ip->i_flags_lock);
328 return ret; 379 return ret;
329} 380}
330#endif /* __KERNEL__ */
331
332 381
333/* 382/*
334 * Fork handling. 383 * Manage the i_flush queue embedded in the inode. This completion
384 * queue synchronizes processes attempting to flush the in-core
385 * inode back to disk.
335 */ 386 */
387static inline void xfs_iflock(xfs_inode_t *ip)
388{
389 wait_for_completion(&ip->i_flush);
390}
336 391
337#define XFS_IFORK_Q(ip) ((ip)->i_d.di_forkoff != 0) 392static inline int xfs_iflock_nowait(xfs_inode_t *ip)
338#define XFS_IFORK_BOFF(ip) ((int)((ip)->i_d.di_forkoff << 3)) 393{
339 394 return try_wait_for_completion(&ip->i_flush);
340#define XFS_IFORK_PTR(ip,w) \ 395}
341 ((w) == XFS_DATA_FORK ? \
342 &(ip)->i_df : \
343 (ip)->i_afp)
344#define XFS_IFORK_DSIZE(ip) \
345 (XFS_IFORK_Q(ip) ? \
346 XFS_IFORK_BOFF(ip) : \
347 XFS_LITINO((ip)->i_mount))
348#define XFS_IFORK_ASIZE(ip) \
349 (XFS_IFORK_Q(ip) ? \
350 XFS_LITINO((ip)->i_mount) - XFS_IFORK_BOFF(ip) : \
351 0)
352#define XFS_IFORK_SIZE(ip,w) \
353 ((w) == XFS_DATA_FORK ? \
354 XFS_IFORK_DSIZE(ip) : \
355 XFS_IFORK_ASIZE(ip))
356#define XFS_IFORK_FORMAT(ip,w) \
357 ((w) == XFS_DATA_FORK ? \
358 (ip)->i_d.di_format : \
359 (ip)->i_d.di_aformat)
360#define XFS_IFORK_FMT_SET(ip,w,n) \
361 ((w) == XFS_DATA_FORK ? \
362 ((ip)->i_d.di_format = (n)) : \
363 ((ip)->i_d.di_aformat = (n)))
364#define XFS_IFORK_NEXTENTS(ip,w) \
365 ((w) == XFS_DATA_FORK ? \
366 (ip)->i_d.di_nextents : \
367 (ip)->i_d.di_anextents)
368#define XFS_IFORK_NEXT_SET(ip,w,n) \
369 ((w) == XFS_DATA_FORK ? \
370 ((ip)->i_d.di_nextents = (n)) : \
371 ((ip)->i_d.di_anextents = (n)))
372 396
373#ifdef __KERNEL__ 397static inline void xfs_ifunlock(xfs_inode_t *ip)
398{
399 complete(&ip->i_flush);
400}
374 401
375/* 402/*
376 * In-core inode flags. 403 * In-core inode flags.
377 */ 404 */
378#define XFS_IGRIO 0x0001 /* inode used for guaranteed rate i/o */ 405#define XFS_IRECLAIM 0x0001 /* we have started reclaiming this inode */
379#define XFS_IUIOSZ 0x0002 /* inode i/o sizes have been explicitly set */ 406#define XFS_ISTALE 0x0002 /* inode has been staled */
380#define XFS_IQUIESCE 0x0004 /* we have started quiescing for this inode */ 407#define XFS_IRECLAIMABLE 0x0004 /* inode can be reclaimed */
381#define XFS_IRECLAIM 0x0008 /* we have started reclaiming this inode */ 408#define XFS_INEW 0x0008 /* inode has just been allocated */
382#define XFS_ISTALE 0x0010 /* inode has been staled */ 409#define XFS_IFILESTREAM 0x0010 /* inode is in a filestream directory */
383#define XFS_IRECLAIMABLE 0x0020 /* inode can be reclaimed */ 410#define XFS_ITRUNCATED 0x0020 /* truncated down so flush-on-close */
384#define XFS_INEW 0x0040
385#define XFS_IFILESTREAM 0x0080 /* inode is in a filestream directory */
386#define XFS_IMODIFIED 0x0100 /* XFS inode state possibly differs */
387 /* to the Linux inode state. */
388#define XFS_ITRUNCATED 0x0200 /* truncated down so flush-on-close */
389 411
390/* 412/*
391 * Flags for inode locking. 413 * Flags for inode locking.
@@ -460,16 +482,8 @@ xfs_iflags_test_and_clear(xfs_inode_t *ip, unsigned short flags)
460 ((pip)->i_d.di_mode & S_ISGID)) 482 ((pip)->i_d.di_mode & S_ISGID))
461 483
462/* 484/*
463 * Flags for xfs_iget()
464 */
465#define XFS_IGET_CREATE 0x1
466#define XFS_IGET_BULKSTAT 0x2
467
468/*
469 * xfs_iget.c prototypes. 485 * xfs_iget.c prototypes.
470 */ 486 */
471void xfs_ihash_init(struct xfs_mount *);
472void xfs_ihash_free(struct xfs_mount *);
473xfs_inode_t *xfs_inode_incore(struct xfs_mount *, xfs_ino_t, 487xfs_inode_t *xfs_inode_incore(struct xfs_mount *, xfs_ino_t,
474 struct xfs_trans *); 488 struct xfs_trans *);
475int xfs_iget(struct xfs_mount *, struct xfs_trans *, xfs_ino_t, 489int xfs_iget(struct xfs_mount *, struct xfs_trans *, xfs_ino_t,
@@ -484,25 +498,13 @@ int xfs_isilocked(xfs_inode_t *, uint);
484uint xfs_ilock_map_shared(xfs_inode_t *); 498uint xfs_ilock_map_shared(xfs_inode_t *);
485void xfs_iunlock_map_shared(xfs_inode_t *, uint); 499void xfs_iunlock_map_shared(xfs_inode_t *, uint);
486void xfs_ireclaim(xfs_inode_t *); 500void xfs_ireclaim(xfs_inode_t *);
487int xfs_finish_reclaim(xfs_inode_t *, int, int);
488int xfs_finish_reclaim_all(struct xfs_mount *, int);
489 501
490/* 502/*
491 * xfs_inode.c prototypes. 503 * xfs_inode.c prototypes.
492 */ 504 */
493int xfs_itobp(struct xfs_mount *, struct xfs_trans *,
494 xfs_inode_t *, struct xfs_dinode **, struct xfs_buf **,
495 xfs_daddr_t, uint, uint);
496int xfs_iread(struct xfs_mount *, struct xfs_trans *, xfs_ino_t,
497 xfs_inode_t **, xfs_daddr_t, uint);
498int xfs_iread_extents(struct xfs_trans *, xfs_inode_t *, int);
499int xfs_ialloc(struct xfs_trans *, xfs_inode_t *, mode_t, 505int xfs_ialloc(struct xfs_trans *, xfs_inode_t *, mode_t,
500 xfs_nlink_t, xfs_dev_t, cred_t *, xfs_prid_t, 506 xfs_nlink_t, xfs_dev_t, cred_t *, xfs_prid_t,
501 int, struct xfs_buf **, boolean_t *, xfs_inode_t **); 507 int, struct xfs_buf **, boolean_t *, xfs_inode_t **);
502void xfs_dinode_from_disk(struct xfs_icdinode *,
503 struct xfs_dinode_core *);
504void xfs_dinode_to_disk(struct xfs_dinode_core *,
505 struct xfs_icdinode *);
506 508
507uint xfs_ip2xflags(struct xfs_inode *); 509uint xfs_ip2xflags(struct xfs_inode *);
508uint xfs_dic2xflags(struct xfs_dinode *); 510uint xfs_dic2xflags(struct xfs_dinode *);
@@ -513,17 +515,10 @@ int xfs_itruncate_finish(struct xfs_trans **, xfs_inode_t *,
513 xfs_fsize_t, int, int); 515 xfs_fsize_t, int, int);
514int xfs_iunlink(struct xfs_trans *, xfs_inode_t *); 516int xfs_iunlink(struct xfs_trans *, xfs_inode_t *);
515 517
516void xfs_idestroy_fork(xfs_inode_t *, int);
517void xfs_idestroy(xfs_inode_t *);
518void xfs_idata_realloc(xfs_inode_t *, int, int);
519void xfs_iextract(xfs_inode_t *);
520void xfs_iext_realloc(xfs_inode_t *, int, int); 518void xfs_iext_realloc(xfs_inode_t *, int, int);
521void xfs_iroot_realloc(xfs_inode_t *, int, int);
522void xfs_ipin(xfs_inode_t *); 519void xfs_ipin(xfs_inode_t *);
523void xfs_iunpin(xfs_inode_t *); 520void xfs_iunpin(xfs_inode_t *);
524int xfs_iextents_copy(xfs_inode_t *, xfs_bmbt_rec_t *, int);
525int xfs_iflush(xfs_inode_t *, uint); 521int xfs_iflush(xfs_inode_t *, uint);
526void xfs_iflush_all(struct xfs_mount *);
527void xfs_ichgtime(xfs_inode_t *, int); 522void xfs_ichgtime(xfs_inode_t *, int);
528xfs_fsize_t xfs_file_last_byte(xfs_inode_t *); 523xfs_fsize_t xfs_file_last_byte(xfs_inode_t *);
529void xfs_lock_inodes(xfs_inode_t **, int, uint); 524void xfs_lock_inodes(xfs_inode_t **, int, uint);
@@ -532,6 +527,77 @@ void xfs_lock_two_inodes(xfs_inode_t *, xfs_inode_t *, uint);
532void xfs_synchronize_atime(xfs_inode_t *); 527void xfs_synchronize_atime(xfs_inode_t *);
533void xfs_mark_inode_dirty_sync(xfs_inode_t *); 528void xfs_mark_inode_dirty_sync(xfs_inode_t *);
534 529
530#if defined(XFS_INODE_TRACE)
531
532#define INODE_TRACE_SIZE 16 /* number of trace entries */
533#define INODE_KTRACE_ENTRY 1
534#define INODE_KTRACE_EXIT 2
535#define INODE_KTRACE_HOLD 3
536#define INODE_KTRACE_REF 4
537#define INODE_KTRACE_RELE 5
538
539extern void _xfs_itrace_entry(struct xfs_inode *, const char *, inst_t *);
540extern void _xfs_itrace_exit(struct xfs_inode *, const char *, inst_t *);
541extern void xfs_itrace_hold(struct xfs_inode *, char *, int, inst_t *);
542extern void _xfs_itrace_ref(struct xfs_inode *, char *, int, inst_t *);
543extern void xfs_itrace_rele(struct xfs_inode *, char *, int, inst_t *);
544#define xfs_itrace_entry(ip) \
545 _xfs_itrace_entry(ip, __func__, (inst_t *)__return_address)
546#define xfs_itrace_exit(ip) \
547 _xfs_itrace_exit(ip, __func__, (inst_t *)__return_address)
548#define xfs_itrace_exit_tag(ip, tag) \
549 _xfs_itrace_exit(ip, tag, (inst_t *)__return_address)
550#define xfs_itrace_ref(ip) \
551 _xfs_itrace_ref(ip, __FILE__, __LINE__, (inst_t *)__return_address)
552
553#else
554#define xfs_itrace_entry(a)
555#define xfs_itrace_exit(a)
556#define xfs_itrace_exit_tag(a, b)
557#define xfs_itrace_hold(a, b, c, d)
558#define xfs_itrace_ref(a)
559#define xfs_itrace_rele(a, b, c, d)
560#endif
561
562#define IHOLD(ip) \
563do { \
564 ASSERT(atomic_read(&VFS_I(ip)->i_count) > 0) ; \
565 atomic_inc(&(VFS_I(ip)->i_count)); \
566 xfs_itrace_hold((ip), __FILE__, __LINE__, (inst_t *)__return_address); \
567} while (0)
568
569#define IRELE(ip) \
570do { \
571 xfs_itrace_rele((ip), __FILE__, __LINE__, (inst_t *)__return_address); \
572 iput(VFS_I(ip)); \
573} while (0)
574
575#endif /* __KERNEL__ */
576
577/*
578 * Flags for xfs_iget()
579 */
580#define XFS_IGET_CREATE 0x1
581#define XFS_IGET_BULKSTAT 0x2
582
583int xfs_inotobp(struct xfs_mount *, struct xfs_trans *,
584 xfs_ino_t, struct xfs_dinode **,
585 struct xfs_buf **, int *, uint);
586int xfs_itobp(struct xfs_mount *, struct xfs_trans *,
587 struct xfs_inode *, struct xfs_dinode **,
588 struct xfs_buf **, uint);
589int xfs_iread(struct xfs_mount *, struct xfs_trans *,
590 struct xfs_inode *, xfs_daddr_t, uint);
591void xfs_dinode_from_disk(struct xfs_icdinode *,
592 struct xfs_dinode *);
593void xfs_dinode_to_disk(struct xfs_dinode *,
594 struct xfs_icdinode *);
595void xfs_idestroy_fork(struct xfs_inode *, int);
596void xfs_idata_realloc(struct xfs_inode *, int, int);
597void xfs_iroot_realloc(struct xfs_inode *, int, int);
598int xfs_iread_extents(struct xfs_trans *, struct xfs_inode *, int);
599int xfs_iextents_copy(struct xfs_inode *, xfs_bmbt_rec_t *, int);
600
535xfs_bmbt_rec_host_t *xfs_iext_get_ext(xfs_ifork_t *, xfs_extnum_t); 601xfs_bmbt_rec_host_t *xfs_iext_get_ext(xfs_ifork_t *, xfs_extnum_t);
536void xfs_iext_insert(xfs_ifork_t *, xfs_extnum_t, xfs_extnum_t, 602void xfs_iext_insert(xfs_ifork_t *, xfs_extnum_t, xfs_extnum_t,
537 xfs_bmbt_irec_t *); 603 xfs_bmbt_irec_t *);
@@ -561,7 +627,8 @@ void xfs_iext_irec_update_extoffs(xfs_ifork_t *, int, int);
561#define xfs_ipincount(ip) ((unsigned int) atomic_read(&ip->i_pincount)) 627#define xfs_ipincount(ip) ((unsigned int) atomic_read(&ip->i_pincount))
562 628
563#ifdef DEBUG 629#ifdef DEBUG
564void xfs_isize_check(struct xfs_mount *, xfs_inode_t *, xfs_fsize_t); 630void xfs_isize_check(struct xfs_mount *, struct xfs_inode *,
631 xfs_fsize_t);
565#else /* DEBUG */ 632#else /* DEBUG */
566#define xfs_isize_check(mp, ip, isize) 633#define xfs_isize_check(mp, ip, isize)
567#endif /* DEBUG */ 634#endif /* DEBUG */
@@ -576,26 +643,4 @@ extern struct kmem_zone *xfs_ifork_zone;
576extern struct kmem_zone *xfs_inode_zone; 643extern struct kmem_zone *xfs_inode_zone;
577extern struct kmem_zone *xfs_ili_zone; 644extern struct kmem_zone *xfs_ili_zone;
578 645
579/*
580 * Manage the i_flush queue embedded in the inode. This completion
581 * queue synchronizes processes attempting to flush the in-core
582 * inode back to disk.
583 */
584static inline void xfs_iflock(xfs_inode_t *ip)
585{
586 wait_for_completion(&ip->i_flush);
587}
588
589static inline int xfs_iflock_nowait(xfs_inode_t *ip)
590{
591 return try_wait_for_completion(&ip->i_flush);
592}
593
594static inline void xfs_ifunlock(xfs_inode_t *ip)
595{
596 complete(&ip->i_flush);
597}
598
599#endif /* __KERNEL__ */
600
601#endif /* __XFS_INODE_H__ */ 646#endif /* __XFS_INODE_H__ */