aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs/linux-2.6/xfs_vnode.c
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@infradead.org>2007-09-19 01:27:49 -0400
committerLachlan McIlroy <lachlan@redback.melbourne.sgi.com>2008-02-07 00:44:04 -0500
commit21a62542b6d7f726d6c1d2cfbfa084f721ba4a26 (patch)
treedb0a080fd3550b12000d96513c5d92836e95ae5b /fs/xfs/linux-2.6/xfs_vnode.c
parent15947f2d4f747897f31cfaa36e98a93f80ca3d3f (diff)
[XFS] simplify vn_revalidate
No need to allocate a bhv_vattr_t on stack and call xfs_getattr to update a few fields in the Linux inode from the XFS inode, just do it directly. And yes, this function is in dire need of a better name and prototype, I'll do in a separate patch, though. SGI-PV: 970705 SGI-Modid: xfs-linux-melb:xfs-kern:29713a Signed-off-by: Christoph Hellwig <hch@infradead.org> Signed-off-by: Lachlan McIlroy <lachlan@sgi.com> Signed-off-by: Tim Shimmin <tes@sgi.com>
Diffstat (limited to 'fs/xfs/linux-2.6/xfs_vnode.c')
-rw-r--r--fs/xfs/linux-2.6/xfs_vnode.c80
1 files changed, 34 insertions, 46 deletions
diff --git a/fs/xfs/linux-2.6/xfs_vnode.c b/fs/xfs/linux-2.6/xfs_vnode.c
index e16b3e40015d..d42a33cd9d3d 100644
--- a/fs/xfs/linux-2.6/xfs_vnode.c
+++ b/fs/xfs/linux-2.6/xfs_vnode.c
@@ -97,69 +97,57 @@ vn_initialize(
97} 97}
98 98
99/* 99/*
100 * Revalidate the Linux inode from the vattr. 100 * Revalidate the Linux inode from the XFS inode.
101 * Note: i_size _not_ updated; we must hold the inode 101 * Note: i_size _not_ updated; we must hold the inode
102 * semaphore when doing that - callers responsibility. 102 * semaphore when doing that - callers responsibility.
103 */ 103 */
104void 104int
105vn_revalidate_core( 105vn_revalidate(
106 bhv_vnode_t *vp, 106 bhv_vnode_t *vp)
107 bhv_vattr_t *vap)
108{ 107{
109 struct inode *inode = vn_to_inode(vp); 108 struct inode *inode = vn_to_inode(vp);
110 109 struct xfs_inode *ip = XFS_I(inode);
111 inode->i_mode = vap->va_mode; 110 struct xfs_mount *mp = ip->i_mount;
112 inode->i_nlink = vap->va_nlink; 111 unsigned long xflags;
113 inode->i_uid = vap->va_uid; 112
114 inode->i_gid = vap->va_gid; 113 xfs_itrace_entry(ip);
115 inode->i_blocks = vap->va_nblocks; 114
116 inode->i_mtime = vap->va_mtime; 115 if (XFS_FORCED_SHUTDOWN(mp))
117 inode->i_ctime = vap->va_ctime; 116 return -EIO;
118 if (vap->va_xflags & XFS_XFLAG_IMMUTABLE) 117
118 xfs_ilock(ip, XFS_ILOCK_SHARED);
119 inode->i_mode = ip->i_d.di_mode;
120 inode->i_nlink = ip->i_d.di_nlink;
121 inode->i_uid = ip->i_d.di_uid;
122 inode->i_gid = ip->i_d.di_gid;
123 inode->i_blocks =
124 XFS_FSB_TO_BB(mp, ip->i_d.di_nblocks + ip->i_delayed_blks);
125 inode->i_mtime.tv_sec = ip->i_d.di_mtime.t_sec;
126 inode->i_mtime.tv_nsec = ip->i_d.di_mtime.t_nsec;
127 inode->i_ctime.tv_sec = ip->i_d.di_ctime.t_sec;
128 inode->i_ctime.tv_nsec = ip->i_d.di_ctime.t_nsec;
129
130 xflags = xfs_ip2xflags(ip);
131 if (xflags & XFS_XFLAG_IMMUTABLE)
119 inode->i_flags |= S_IMMUTABLE; 132 inode->i_flags |= S_IMMUTABLE;
120 else 133 else
121 inode->i_flags &= ~S_IMMUTABLE; 134 inode->i_flags &= ~S_IMMUTABLE;
122 if (vap->va_xflags & XFS_XFLAG_APPEND) 135 if (xflags & XFS_XFLAG_APPEND)
123 inode->i_flags |= S_APPEND; 136 inode->i_flags |= S_APPEND;
124 else 137 else
125 inode->i_flags &= ~S_APPEND; 138 inode->i_flags &= ~S_APPEND;
126 if (vap->va_xflags & XFS_XFLAG_SYNC) 139 if (xflags & XFS_XFLAG_SYNC)
127 inode->i_flags |= S_SYNC; 140 inode->i_flags |= S_SYNC;
128 else 141 else
129 inode->i_flags &= ~S_SYNC; 142 inode->i_flags &= ~S_SYNC;
130 if (vap->va_xflags & XFS_XFLAG_NOATIME) 143 if (xflags & XFS_XFLAG_NOATIME)
131 inode->i_flags |= S_NOATIME; 144 inode->i_flags |= S_NOATIME;
132 else 145 else
133 inode->i_flags &= ~S_NOATIME; 146 inode->i_flags &= ~S_NOATIME;
134} 147 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 xfs_itrace_entry(xfs_vtoi(vp));
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 148
162 return __vn_revalidate(vp, &vattr); 149 xfs_iflags_clear(ip, XFS_IMODIFIED);
150 return 0;
163} 151}
164 152
165/* 153/*