aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs/linux-2.6/xfs_vnode.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/xfs/linux-2.6/xfs_vnode.c')
-rw-r--r--fs/xfs/linux-2.6/xfs_vnode.c117
1 files changed, 44 insertions, 73 deletions
diff --git a/fs/xfs/linux-2.6/xfs_vnode.c b/fs/xfs/linux-2.6/xfs_vnode.c
index 814169fd7e1e..bc7afe007338 100644
--- a/fs/xfs/linux-2.6/xfs_vnode.c
+++ b/fs/xfs/linux-2.6/xfs_vnode.c
@@ -40,7 +40,7 @@
40#define vptosync(v) (&vsync[((unsigned long)v) % NVSYNC]) 40#define vptosync(v) (&vsync[((unsigned long)v) % NVSYNC])
41static wait_queue_head_t vsync[NVSYNC]; 41static wait_queue_head_t vsync[NVSYNC];
42 42
43void 43void __init
44vn_init(void) 44vn_init(void)
45{ 45{
46 int i; 46 int i;
@@ -82,84 +82,55 @@ vn_ioerror(
82 xfs_do_force_shutdown(ip->i_mount, SHUTDOWN_DEVICE_REQ, f, l); 82 xfs_do_force_shutdown(ip->i_mount, SHUTDOWN_DEVICE_REQ, f, l);
83} 83}
84 84
85bhv_vnode_t *
86vn_initialize(
87 struct inode *inode)
88{
89 bhv_vnode_t *vp = vn_from_inode(inode);
90
91 XFS_STATS_INC(vn_active);
92 XFS_STATS_INC(vn_alloc);
93
94 ASSERT(VN_CACHED(vp) == 0);
95
96 return vp;
97}
98
99/* 85/*
100 * Revalidate the Linux inode from the vattr. 86 * Revalidate the Linux inode from the XFS inode.
101 * Note: i_size _not_ updated; we must hold the inode 87 * Note: i_size _not_ updated; we must hold the inode
102 * semaphore when doing that - callers responsibility. 88 * semaphore when doing that - callers responsibility.
103 */ 89 */
104void 90int
105vn_revalidate_core( 91vn_revalidate(
106 bhv_vnode_t *vp, 92 bhv_vnode_t *vp)
107 bhv_vattr_t *vap)
108{ 93{
109 struct inode *inode = vn_to_inode(vp); 94 struct inode *inode = vn_to_inode(vp);
110 95 struct xfs_inode *ip = XFS_I(inode);
111 inode->i_mode = vap->va_mode; 96 struct xfs_mount *mp = ip->i_mount;
112 inode->i_nlink = vap->va_nlink; 97 unsigned long xflags;
113 inode->i_uid = vap->va_uid; 98
114 inode->i_gid = vap->va_gid; 99 xfs_itrace_entry(ip);
115 inode->i_blocks = vap->va_nblocks; 100
116 inode->i_mtime = vap->va_mtime; 101 if (XFS_FORCED_SHUTDOWN(mp))
117 inode->i_ctime = vap->va_ctime; 102 return -EIO;
118 if (vap->va_xflags & XFS_XFLAG_IMMUTABLE) 103
104 xfs_ilock(ip, XFS_ILOCK_SHARED);
105 inode->i_mode = ip->i_d.di_mode;
106 inode->i_uid = ip->i_d.di_uid;
107 inode->i_gid = ip->i_d.di_gid;
108 inode->i_mtime.tv_sec = ip->i_d.di_mtime.t_sec;
109 inode->i_mtime.tv_nsec = ip->i_d.di_mtime.t_nsec;
110 inode->i_ctime.tv_sec = ip->i_d.di_ctime.t_sec;
111 inode->i_ctime.tv_nsec = ip->i_d.di_ctime.t_nsec;
112
113 xflags = xfs_ip2xflags(ip);
114 if (xflags & XFS_XFLAG_IMMUTABLE)
119 inode->i_flags |= S_IMMUTABLE; 115 inode->i_flags |= S_IMMUTABLE;
120 else 116 else
121 inode->i_flags &= ~S_IMMUTABLE; 117 inode->i_flags &= ~S_IMMUTABLE;
122 if (vap->va_xflags & XFS_XFLAG_APPEND) 118 if (xflags & XFS_XFLAG_APPEND)
123 inode->i_flags |= S_APPEND; 119 inode->i_flags |= S_APPEND;
124 else 120 else
125 inode->i_flags &= ~S_APPEND; 121 inode->i_flags &= ~S_APPEND;
126 if (vap->va_xflags & XFS_XFLAG_SYNC) 122 if (xflags & XFS_XFLAG_SYNC)
127 inode->i_flags |= S_SYNC; 123 inode->i_flags |= S_SYNC;
128 else 124 else
129 inode->i_flags &= ~S_SYNC; 125 inode->i_flags &= ~S_SYNC;
130 if (vap->va_xflags & XFS_XFLAG_NOATIME) 126 if (xflags & XFS_XFLAG_NOATIME)
131 inode->i_flags |= S_NOATIME; 127 inode->i_flags |= S_NOATIME;
132 else 128 else
133 inode->i_flags &= ~S_NOATIME; 129 inode->i_flags &= ~S_NOATIME;
134} 130 xfs_iunlock(ip, XFS_ILOCK_SHARED);
135
136/*
137 * Revalidate the Linux inode from the vnode.
138 */
139int
140__vn_revalidate(
141 bhv_vnode_t *vp,
142 bhv_vattr_t *vattr)
143{
144 int error;
145
146 vn_trace_entry(xfs_vtoi(vp), __FUNCTION__, (inst_t *)__return_address);
147 vattr->va_mask = XFS_AT_STAT | XFS_AT_XFLAGS;
148 error = xfs_getattr(xfs_vtoi(vp), vattr, 0);
149 if (likely(!error)) {
150 vn_revalidate_core(vp, vattr);
151 xfs_iflags_clear(xfs_vtoi(vp), XFS_IMODIFIED);
152 }
153 return -error;
154}
155
156int
157vn_revalidate(
158 bhv_vnode_t *vp)
159{
160 bhv_vattr_t vattr;
161 131
162 return __vn_revalidate(vp, &vattr); 132 xfs_iflags_clear(ip, XFS_IMODIFIED);
133 return 0;
163} 134}
164 135
165/* 136/*
@@ -179,7 +150,7 @@ vn_hold(
179 return vp; 150 return vp;
180} 151}
181 152
182#ifdef XFS_VNODE_TRACE 153#ifdef XFS_INODE_TRACE
183 154
184/* 155/*
185 * Reference count of Linux inode if present, -1 if the xfs_inode 156 * Reference count of Linux inode if present, -1 if the xfs_inode
@@ -211,32 +182,32 @@ static inline int xfs_icount(struct xfs_inode *ip)
211 * Vnode tracing code. 182 * Vnode tracing code.
212 */ 183 */
213void 184void
214vn_trace_entry(xfs_inode_t *ip, const char *func, inst_t *ra) 185_xfs_itrace_entry(xfs_inode_t *ip, const char *func, inst_t *ra)
215{ 186{
216 KTRACE_ENTER(ip, VNODE_KTRACE_ENTRY, func, 0, ra); 187 KTRACE_ENTER(ip, INODE_KTRACE_ENTRY, func, 0, ra);
217} 188}
218 189
219void 190void
220vn_trace_exit(xfs_inode_t *ip, const char *func, inst_t *ra) 191_xfs_itrace_exit(xfs_inode_t *ip, const char *func, inst_t *ra)
221{ 192{
222 KTRACE_ENTER(ip, VNODE_KTRACE_EXIT, func, 0, ra); 193 KTRACE_ENTER(ip, INODE_KTRACE_EXIT, func, 0, ra);
223} 194}
224 195
225void 196void
226vn_trace_hold(xfs_inode_t *ip, char *file, int line, inst_t *ra) 197xfs_itrace_hold(xfs_inode_t *ip, char *file, int line, inst_t *ra)
227{ 198{
228 KTRACE_ENTER(ip, VNODE_KTRACE_HOLD, file, line, ra); 199 KTRACE_ENTER(ip, INODE_KTRACE_HOLD, file, line, ra);
229} 200}
230 201
231void 202void
232vn_trace_ref(xfs_inode_t *ip, char *file, int line, inst_t *ra) 203_xfs_itrace_ref(xfs_inode_t *ip, char *file, int line, inst_t *ra)
233{ 204{
234 KTRACE_ENTER(ip, VNODE_KTRACE_REF, file, line, ra); 205 KTRACE_ENTER(ip, INODE_KTRACE_REF, file, line, ra);
235} 206}
236 207
237void 208void
238vn_trace_rele(xfs_inode_t *ip, char *file, int line, inst_t *ra) 209xfs_itrace_rele(xfs_inode_t *ip, char *file, int line, inst_t *ra)
239{ 210{
240 KTRACE_ENTER(ip, VNODE_KTRACE_RELE, file, line, ra); 211 KTRACE_ENTER(ip, INODE_KTRACE_RELE, file, line, ra);
241} 212}
242#endif /* XFS_VNODE_TRACE */ 213#endif /* XFS_INODE_TRACE */