[XFS] Remove vn_revalidate calls in xfs.
[deliverable/linux.git] / fs / xfs / linux-2.6 / xfs_vnode.h
CommitLineData
1da177e4 1/*
7b718769
NS
2 * Copyright (c) 2000-2005 Silicon Graphics, Inc.
3 * All Rights Reserved.
1da177e4 4 *
7b718769
NS
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License as
1da177e4
LT
7 * published by the Free Software Foundation.
8 *
7b718769
NS
9 * 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.
1da177e4 13 *
7b718769
NS
14 * 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
1da177e4
LT
17 */
18#ifndef __XFS_VNODE_H__
19#define __XFS_VNODE_H__
20
1da177e4 21struct file;
1da177e4
LT
22struct xfs_iomap;
23struct attrlist_cursor_kern;
24
0a74cd19 25typedef struct inode bhv_vnode_t;
1da177e4 26
1da177e4
LT
27/*
28 * Vnode to Linux inode mapping.
29 */
0a74cd19 30static inline bhv_vnode_t *vn_from_inode(struct inode *inode)
ec86dc02 31{
0a74cd19 32 return inode;
ec86dc02 33}
0a74cd19 34static inline struct inode *vn_to_inode(bhv_vnode_t *vnode)
ec86dc02 35{
0a74cd19 36 return vnode;
ec86dc02 37}
1da177e4 38
1da177e4 39/*
739bfb2a 40 * Return values for xfs_inactive. A return value of
1da177e4
LT
41 * VN_INACTIVE_NOCACHE implies that the file system behavior
42 * has disassociated its state and bhv_desc_t from the vnode.
43 */
44#define VN_INACTIVE_CACHE 0
45#define VN_INACTIVE_NOCACHE 1
46
1da177e4
LT
47/*
48 * Flags for read/write calls - same values as IRIX
49 */
50#define IO_ISAIO 0x00001 /* don't wait for completion */
51#define IO_ISDIRECT 0x00004 /* bypass page cache */
52#define IO_INVIS 0x00020 /* don't update inode timestamps */
53
54/*
a3f74ffb 55 * Flags for xfs_inode_flush
1da177e4
LT
56 */
57#define FLUSH_SYNC 1 /* wait for flush to complete */
1da177e4
LT
58
59/*
67fcaa73 60 * Flush/Invalidate options for vop_toss/flush/flushinval_pages.
1da177e4
LT
61 */
62#define FI_NONE 0 /* none */
63#define FI_REMAPF 1 /* Do a remapf prior to the operation */
64#define FI_REMAPF_LOCKED 2 /* Do a remapf prior to the operation.
65 Prevent VM access to the pages until
66 the operation completes. */
67
1da177e4 68
1da177e4 69extern void vn_init(void);
1da177e4 70
b677c210
CH
71/*
72 * Yeah, these don't take vnode anymore at all, all this should be
73 * cleaned up at some point.
74 */
75extern void vn_iowait(struct xfs_inode *ip);
76extern void vn_iowake(struct xfs_inode *ip);
77extern void vn_ioerror(struct xfs_inode *ip, int error, char *f, int l);
7d04a335 78
0a74cd19 79static inline int vn_count(bhv_vnode_t *vp)
1da177e4 80{
ec86dc02 81 return atomic_read(&vn_to_inode(vp)->i_count);
1da177e4
LT
82}
83
84/*
85 * Vnode reference counting functions (and macros for compatibility).
86 */
0a74cd19 87extern bhv_vnode_t *vn_hold(bhv_vnode_t *);
1da177e4 88
cf441eeb 89#if defined(XFS_INODE_TRACE)
1da177e4
LT
90#define VN_HOLD(vp) \
91 ((void)vn_hold(vp), \
cf441eeb 92 xfs_itrace_hold(xfs_vtoi(vp), __FILE__, __LINE__, (inst_t *)__return_address))
1da177e4 93#define VN_RELE(vp) \
cf441eeb 94 (xfs_itrace_rele(xfs_vtoi(vp), __FILE__, __LINE__, (inst_t *)__return_address), \
ec86dc02 95 iput(vn_to_inode(vp)))
1da177e4
LT
96#else
97#define VN_HOLD(vp) ((void)vn_hold(vp))
ec86dc02 98#define VN_RELE(vp) (iput(vn_to_inode(vp)))
1da177e4
LT
99#endif
100
0a74cd19 101static inline bhv_vnode_t *vn_grab(bhv_vnode_t *vp)
cdb62687 102{
ec86dc02
NS
103 struct inode *inode = igrab(vn_to_inode(vp));
104 return inode ? vn_from_inode(inode) : NULL;
cdb62687
CH
105}
106
1da177e4
LT
107/*
108 * Dealing with bad inodes
109 */
0a74cd19 110static inline int VN_BAD(bhv_vnode_t *vp)
1da177e4 111{
ec86dc02 112 return is_bad_inode(vn_to_inode(vp));
1da177e4
LT
113}
114
ca5ccbf9
NS
115/*
116 * Extracting atime values in various formats
117 */
67fcaa73 118static inline void vn_atime_to_bstime(bhv_vnode_t *vp, xfs_bstime_t *bs_atime)
ca5ccbf9 119{
0a74cd19
CH
120 bs_atime->tv_sec = vp->i_atime.tv_sec;
121 bs_atime->tv_nsec = vp->i_atime.tv_nsec;
ca5ccbf9
NS
122}
123
67fcaa73 124static inline void vn_atime_to_timespec(bhv_vnode_t *vp, struct timespec *ts)
ca5ccbf9 125{
0a74cd19 126 *ts = vp->i_atime;
ca5ccbf9
NS
127}
128
67fcaa73 129static inline void vn_atime_to_time_t(bhv_vnode_t *vp, time_t *tt)
ca5ccbf9 130{
0a74cd19 131 *tt = vp->i_atime.tv_sec;
ca5ccbf9
NS
132}
133
1da177e4
LT
134/*
135 * Some useful predicates.
136 */
ec86dc02
NS
137#define VN_MAPPED(vp) mapping_mapped(vn_to_inode(vp)->i_mapping)
138#define VN_CACHED(vp) (vn_to_inode(vp)->i_mapping->nrpages)
139#define VN_DIRTY(vp) mapping_tagged(vn_to_inode(vp)->i_mapping, \
1da177e4 140 PAGECACHE_TAG_DIRTY)
1da177e4 141
1da177e4 142
1da177e4
LT
143/*
144 * Tracking vnode activity.
145 */
cf441eeb
LM
146#if defined(XFS_INODE_TRACE)
147
148#define INODE_TRACE_SIZE 16 /* number of trace entries */
149#define INODE_KTRACE_ENTRY 1
150#define INODE_KTRACE_EXIT 2
151#define INODE_KTRACE_HOLD 3
152#define INODE_KTRACE_REF 4
153#define INODE_KTRACE_RELE 5
154
155extern void _xfs_itrace_entry(struct xfs_inode *, const char *, inst_t *);
156extern void _xfs_itrace_exit(struct xfs_inode *, const char *, inst_t *);
157extern void xfs_itrace_hold(struct xfs_inode *, char *, int, inst_t *);
158extern void _xfs_itrace_ref(struct xfs_inode *, char *, int, inst_t *);
159extern void xfs_itrace_rele(struct xfs_inode *, char *, int, inst_t *);
160#define xfs_itrace_entry(ip) \
34a622b2 161 _xfs_itrace_entry(ip, __func__, (inst_t *)__return_address)
cf441eeb 162#define xfs_itrace_exit(ip) \
34a622b2 163 _xfs_itrace_exit(ip, __func__, (inst_t *)__return_address)
15947f2d
LM
164#define xfs_itrace_exit_tag(ip, tag) \
165 _xfs_itrace_exit(ip, tag, (inst_t *)__return_address)
cf441eeb
LM
166#define xfs_itrace_ref(ip) \
167 _xfs_itrace_ref(ip, __FILE__, __LINE__, (inst_t *)__return_address)
168
1da177e4 169#else
cf441eeb
LM
170#define xfs_itrace_entry(a)
171#define xfs_itrace_exit(a)
15947f2d 172#define xfs_itrace_exit_tag(a, b)
cf441eeb
LM
173#define xfs_itrace_hold(a, b, c, d)
174#define xfs_itrace_ref(a)
175#define xfs_itrace_rele(a, b, c, d)
1da177e4
LT
176#endif
177
178#endif /* __XFS_VNODE_H__ */
This page took 0.392628 seconds and 5 git commands to generate.