aboutsummaryrefslogtreecommitdiffstats
path: root/fs
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
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')
-rw-r--r--fs/xfs/linux-2.6/xfs_ioctl.c4
-rw-r--r--fs/xfs/linux-2.6/xfs_iops.c2
-rw-r--r--fs/xfs/linux-2.6/xfs_vnode.c80
-rw-r--r--fs/xfs/linux-2.6/xfs_vnode.h2
4 files changed, 37 insertions, 51 deletions
diff --git a/fs/xfs/linux-2.6/xfs_ioctl.c b/fs/xfs/linux-2.6/xfs_ioctl.c
index 30bb994d2899..90b10d181db2 100644
--- a/fs/xfs/linux-2.6/xfs_ioctl.c
+++ b/fs/xfs/linux-2.6/xfs_ioctl.c
@@ -1236,7 +1236,7 @@ xfs_ioc_xattr(
1236 1236
1237 error = xfs_setattr(ip, vattr, attr_flags, NULL); 1237 error = xfs_setattr(ip, vattr, attr_flags, NULL);
1238 if (likely(!error)) 1238 if (likely(!error))
1239 __vn_revalidate(vp, vattr); /* update flags */ 1239 vn_revalidate(vp); /* update flags */
1240 error = -error; 1240 error = -error;
1241 break; 1241 break;
1242 } 1242 }
@@ -1271,7 +1271,7 @@ xfs_ioc_xattr(
1271 1271
1272 error = xfs_setattr(ip, vattr, attr_flags, NULL); 1272 error = xfs_setattr(ip, vattr, attr_flags, NULL);
1273 if (likely(!error)) 1273 if (likely(!error))
1274 __vn_revalidate(vp, vattr); /* update flags */ 1274 vn_revalidate(vp); /* update flags */
1275 error = -error; 1275 error = -error;
1276 break; 1276 break;
1277 } 1277 }
diff --git a/fs/xfs/linux-2.6/xfs_iops.c b/fs/xfs/linux-2.6/xfs_iops.c
index 5e8bb7f71b5a..204ad238ce4a 100644
--- a/fs/xfs/linux-2.6/xfs_iops.c
+++ b/fs/xfs/linux-2.6/xfs_iops.c
@@ -636,7 +636,7 @@ xfs_vn_setattr(
636 636
637 error = xfs_setattr(XFS_I(inode), &vattr, flags, NULL); 637 error = xfs_setattr(XFS_I(inode), &vattr, flags, NULL);
638 if (likely(!error)) 638 if (likely(!error))
639 __vn_revalidate(vn_from_inode(inode), &vattr); 639 vn_revalidate(vn_from_inode(inode));
640 return -error; 640 return -error;
641} 641}
642 642
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/*
diff --git a/fs/xfs/linux-2.6/xfs_vnode.h b/fs/xfs/linux-2.6/xfs_vnode.h
index bb3983a1bbbd..59cbe4035d47 100644
--- a/fs/xfs/linux-2.6/xfs_vnode.h
+++ b/fs/xfs/linux-2.6/xfs_vnode.h
@@ -189,8 +189,6 @@ typedef struct bhv_vattr {
189extern void vn_init(void); 189extern void vn_init(void);
190extern bhv_vnode_t *vn_initialize(struct inode *); 190extern bhv_vnode_t *vn_initialize(struct inode *);
191extern int vn_revalidate(bhv_vnode_t *); 191extern int vn_revalidate(bhv_vnode_t *);
192extern int __vn_revalidate(bhv_vnode_t *, bhv_vattr_t *);
193extern void vn_revalidate_core(bhv_vnode_t *, bhv_vattr_t *);
194 192
195/* 193/*
196 * Yeah, these don't take vnode anymore at all, all this should be 194 * Yeah, these don't take vnode anymore at all, all this should be