aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@infradead.org>2008-07-21 02:16:15 -0400
committerNiv Sardi <xaiki@debian.org>2008-07-28 02:59:39 -0400
commitf13fae2d2a9372a5155d20bc9da4c14f02193277 (patch)
tree19bca1e8b3d5034ff84ad19e6a7640216ed3afaf /fs
parent0f285c8a1c4cacfd9f2aec077b06e2b537ee57ab (diff)
[XFS] Remove vn_revalidate calls in xfs.
These days most of the attributes in struct inode are properly kept in sync by XFS. This patch removes the need for vn_revalidate completely by: - keeping inode.i_flags uptodate after any flags are updated in xfs_ioctl_setattr - keeping i_mode, i_uid and i_gid uptodate in xfs_setattr SGI-PV: 984566 SGI-Modid: xfs-linux-melb:xfs-kern:31679a Signed-off-by: Christoph Hellwig <hch@infradead.org> Signed-off-by: Tim Shimmin <tes@sgi.com> Signed-off-by: Lachlan McIlroy <lachlan@sgi.com>
Diffstat (limited to 'fs')
-rw-r--r--fs/xfs/linux-2.6/xfs_ioctl.c29
-rw-r--r--fs/xfs/linux-2.6/xfs_iops.c16
-rw-r--r--fs/xfs/linux-2.6/xfs_vnode.c50
-rw-r--r--fs/xfs/linux-2.6/xfs_vnode.h1
-rw-r--r--fs/xfs/linux-2.6/xfs_xattr.c7
-rw-r--r--fs/xfs/xfs_vnodeops.c9
6 files changed, 39 insertions, 73 deletions
diff --git a/fs/xfs/linux-2.6/xfs_ioctl.c b/fs/xfs/linux-2.6/xfs_ioctl.c
index d1b0da6bcdca..acb978d9d085 100644
--- a/fs/xfs/linux-2.6/xfs_ioctl.c
+++ b/fs/xfs/linux-2.6/xfs_ioctl.c
@@ -923,6 +923,30 @@ xfs_set_diflags(
923 ip->i_d.di_flags = di_flags; 923 ip->i_d.di_flags = di_flags;
924} 924}
925 925
926STATIC void
927xfs_diflags_to_linux(
928 struct xfs_inode *ip)
929{
930 struct inode *inode = XFS_ITOV(ip);
931 unsigned int xflags = xfs_ip2xflags(ip);
932
933 if (xflags & XFS_XFLAG_IMMUTABLE)
934 inode->i_flags |= S_IMMUTABLE;
935 else
936 inode->i_flags &= ~S_IMMUTABLE;
937 if (xflags & XFS_XFLAG_APPEND)
938 inode->i_flags |= S_APPEND;
939 else
940 inode->i_flags &= ~S_APPEND;
941 if (xflags & XFS_XFLAG_SYNC)
942 inode->i_flags |= S_SYNC;
943 else
944 inode->i_flags &= ~S_SYNC;
945 if (xflags & XFS_XFLAG_NOATIME)
946 inode->i_flags |= S_NOATIME;
947 else
948 inode->i_flags &= ~S_NOATIME;
949}
926 950
927#define FSX_PROJID 1 951#define FSX_PROJID 1
928#define FSX_EXTSIZE 2 952#define FSX_EXTSIZE 2
@@ -1121,8 +1145,10 @@ xfs_ioctl_setattr(
1121 1145
1122 if (mask & FSX_EXTSIZE) 1146 if (mask & FSX_EXTSIZE)
1123 ip->i_d.di_extsize = fa->fsx_extsize >> mp->m_sb.sb_blocklog; 1147 ip->i_d.di_extsize = fa->fsx_extsize >> mp->m_sb.sb_blocklog;
1124 if (mask & FSX_XFLAGS) 1148 if (mask & FSX_XFLAGS) {
1125 xfs_set_diflags(ip, fa->fsx_xflags); 1149 xfs_set_diflags(ip, fa->fsx_xflags);
1150 xfs_diflags_to_linux(ip);
1151 }
1126 1152
1127 xfs_trans_log_inode(tp, ip, XFS_ILOG_CORE); 1153 xfs_trans_log_inode(tp, ip, XFS_ILOG_CORE);
1128 xfs_ichgtime(ip, XFS_ICHGTIME_CHG); 1154 xfs_ichgtime(ip, XFS_ICHGTIME_CHG);
@@ -1160,7 +1186,6 @@ xfs_ioctl_setattr(
1160 (mask & FSX_NONBLOCK) ? DM_FLAGS_NDELAY : 0); 1186 (mask & FSX_NONBLOCK) ? DM_FLAGS_NDELAY : 0);
1161 } 1187 }
1162 1188
1163 vn_revalidate(XFS_ITOV(ip)); /* update flags */
1164 return 0; 1189 return 0;
1165 1190
1166 error_return: 1191 error_return:
diff --git a/fs/xfs/linux-2.6/xfs_iops.c b/fs/xfs/linux-2.6/xfs_iops.c
index 669bbdc20857..e88f51028086 100644
--- a/fs/xfs/linux-2.6/xfs_iops.c
+++ b/fs/xfs/linux-2.6/xfs_iops.c
@@ -650,21 +650,7 @@ xfs_vn_setattr(
650 struct dentry *dentry, 650 struct dentry *dentry,
651 struct iattr *iattr) 651 struct iattr *iattr)
652{ 652{
653 struct inode *inode = dentry->d_inode; 653 return -xfs_setattr(XFS_I(dentry->d_inode), iattr, 0, NULL);
654 int error;
655
656 if (iattr->ia_valid & ATTR_ATIME)
657 inode->i_atime = iattr->ia_atime;
658
659 if (iattr->ia_valid & ATTR_MODE) {
660 if (!in_group_p(inode->i_gid) && !capable(CAP_FSETID))
661 inode->i_mode &= ~S_ISGID;
662 }
663
664 error = xfs_setattr(XFS_I(inode), iattr, 0, NULL);
665 if (likely(!error))
666 vn_revalidate(vn_from_inode(inode));
667 return -error;
668} 654}
669 655
670/* 656/*
diff --git a/fs/xfs/linux-2.6/xfs_vnode.c b/fs/xfs/linux-2.6/xfs_vnode.c
index bc7afe007338..25488b6d9881 100644
--- a/fs/xfs/linux-2.6/xfs_vnode.c
+++ b/fs/xfs/linux-2.6/xfs_vnode.c
@@ -82,56 +82,6 @@ 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
85/*
86 * Revalidate the Linux inode from the XFS inode.
87 * Note: i_size _not_ updated; we must hold the inode
88 * semaphore when doing that - callers responsibility.
89 */
90int
91vn_revalidate(
92 bhv_vnode_t *vp)
93{
94 struct inode *inode = vn_to_inode(vp);
95 struct xfs_inode *ip = XFS_I(inode);
96 struct xfs_mount *mp = ip->i_mount;
97 unsigned long xflags;
98
99 xfs_itrace_entry(ip);
100
101 if (XFS_FORCED_SHUTDOWN(mp))
102 return -EIO;
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)
115 inode->i_flags |= S_IMMUTABLE;
116 else
117 inode->i_flags &= ~S_IMMUTABLE;
118 if (xflags & XFS_XFLAG_APPEND)
119 inode->i_flags |= S_APPEND;
120 else
121 inode->i_flags &= ~S_APPEND;
122 if (xflags & XFS_XFLAG_SYNC)
123 inode->i_flags |= S_SYNC;
124 else
125 inode->i_flags &= ~S_SYNC;
126 if (xflags & XFS_XFLAG_NOATIME)
127 inode->i_flags |= S_NOATIME;
128 else
129 inode->i_flags &= ~S_NOATIME;
130 xfs_iunlock(ip, XFS_ILOCK_SHARED);
131
132 xfs_iflags_clear(ip, XFS_IMODIFIED);
133 return 0;
134}
135 85
136/* 86/*
137 * Add a reference to a referenced vnode. 87 * Add a reference to a referenced vnode.
diff --git a/fs/xfs/linux-2.6/xfs_vnode.h b/fs/xfs/linux-2.6/xfs_vnode.h
index 96e4a7b5391c..41ca2cec5d31 100644
--- a/fs/xfs/linux-2.6/xfs_vnode.h
+++ b/fs/xfs/linux-2.6/xfs_vnode.h
@@ -67,7 +67,6 @@ static inline struct inode *vn_to_inode(bhv_vnode_t *vnode)
67 67
68 68
69extern void vn_init(void); 69extern void vn_init(void);
70extern int vn_revalidate(bhv_vnode_t *);
71 70
72/* 71/*
73 * Yeah, these don't take vnode anymore at all, all this should be 72 * Yeah, these don't take vnode anymore at all, all this should be
diff --git a/fs/xfs/linux-2.6/xfs_xattr.c b/fs/xfs/linux-2.6/xfs_xattr.c
index b4acb68fc9f7..964621fde6ed 100644
--- a/fs/xfs/linux-2.6/xfs_xattr.c
+++ b/fs/xfs/linux-2.6/xfs_xattr.c
@@ -64,7 +64,7 @@ static int
64xfs_xattr_system_set(struct inode *inode, const char *name, 64xfs_xattr_system_set(struct inode *inode, const char *name,
65 const void *value, size_t size, int flags) 65 const void *value, size_t size, int flags)
66{ 66{
67 int error, acl; 67 int acl;
68 68
69 acl = xfs_decode_acl(name); 69 acl = xfs_decode_acl(name);
70 if (acl < 0) 70 if (acl < 0)
@@ -75,10 +75,7 @@ xfs_xattr_system_set(struct inode *inode, const char *name,
75 if (!value) 75 if (!value)
76 return xfs_acl_vremove(inode, acl); 76 return xfs_acl_vremove(inode, acl);
77 77
78 error = xfs_acl_vset(inode, (void *)value, size, acl); 78 return xfs_acl_vset(inode, (void *)value, size, acl);
79 if (!error)
80 vn_revalidate(inode);
81 return error;
82} 79}
83 80
84static struct xattr_handler xfs_xattr_system_handler = { 81static struct xattr_handler xfs_xattr_system_handler = {
diff --git a/fs/xfs/xfs_vnodeops.c b/fs/xfs/xfs_vnodeops.c
index b792a121b1a7..76a1166af822 100644
--- a/fs/xfs/xfs_vnodeops.c
+++ b/fs/xfs/xfs_vnodeops.c
@@ -83,6 +83,7 @@ xfs_setattr(
83 cred_t *credp) 83 cred_t *credp)
84{ 84{
85 xfs_mount_t *mp = ip->i_mount; 85 xfs_mount_t *mp = ip->i_mount;
86 struct inode *inode = XFS_ITOV(ip);
86 int mask = iattr->ia_valid; 87 int mask = iattr->ia_valid;
87 xfs_trans_t *tp; 88 xfs_trans_t *tp;
88 int code; 89 int code;
@@ -446,6 +447,9 @@ xfs_setattr(
446 ip->i_d.di_mode &= S_IFMT; 447 ip->i_d.di_mode &= S_IFMT;
447 ip->i_d.di_mode |= iattr->ia_mode & ~S_IFMT; 448 ip->i_d.di_mode |= iattr->ia_mode & ~S_IFMT;
448 449
450 inode->i_mode &= S_IFMT;
451 inode->i_mode |= iattr->ia_mode & ~S_IFMT;
452
449 xfs_trans_log_inode (tp, ip, XFS_ILOG_CORE); 453 xfs_trans_log_inode (tp, ip, XFS_ILOG_CORE);
450 timeflags |= XFS_ICHGTIME_CHG; 454 timeflags |= XFS_ICHGTIME_CHG;
451 } 455 }
@@ -481,6 +485,7 @@ xfs_setattr(
481 &ip->i_udquot, udqp); 485 &ip->i_udquot, udqp);
482 } 486 }
483 ip->i_d.di_uid = uid; 487 ip->i_d.di_uid = uid;
488 inode->i_uid = uid;
484 } 489 }
485 if (igid != gid) { 490 if (igid != gid) {
486 if (XFS_IS_GQUOTA_ON(mp)) { 491 if (XFS_IS_GQUOTA_ON(mp)) {
@@ -491,6 +496,7 @@ xfs_setattr(
491 &ip->i_gdquot, gdqp); 496 &ip->i_gdquot, gdqp);
492 } 497 }
493 ip->i_d.di_gid = gid; 498 ip->i_d.di_gid = gid;
499 inode->i_gid = gid;
494 } 500 }
495 501
496 xfs_trans_log_inode (tp, ip, XFS_ILOG_CORE); 502 xfs_trans_log_inode (tp, ip, XFS_ILOG_CORE);
@@ -503,12 +509,14 @@ xfs_setattr(
503 */ 509 */
504 if (mask & (ATTR_ATIME|ATTR_MTIME)) { 510 if (mask & (ATTR_ATIME|ATTR_MTIME)) {
505 if (mask & ATTR_ATIME) { 511 if (mask & ATTR_ATIME) {
512 inode->i_atime = iattr->ia_atime;
506 ip->i_d.di_atime.t_sec = iattr->ia_atime.tv_sec; 513 ip->i_d.di_atime.t_sec = iattr->ia_atime.tv_sec;
507 ip->i_d.di_atime.t_nsec = iattr->ia_atime.tv_nsec; 514 ip->i_d.di_atime.t_nsec = iattr->ia_atime.tv_nsec;
508 ip->i_update_core = 1; 515 ip->i_update_core = 1;
509 timeflags &= ~XFS_ICHGTIME_ACC; 516 timeflags &= ~XFS_ICHGTIME_ACC;
510 } 517 }
511 if (mask & ATTR_MTIME) { 518 if (mask & ATTR_MTIME) {
519 inode->i_mtime = iattr->ia_mtime;
512 ip->i_d.di_mtime.t_sec = iattr->ia_mtime.tv_sec; 520 ip->i_d.di_mtime.t_sec = iattr->ia_mtime.tv_sec;
513 ip->i_d.di_mtime.t_nsec = iattr->ia_mtime.tv_nsec; 521 ip->i_d.di_mtime.t_nsec = iattr->ia_mtime.tv_nsec;
514 timeflags &= ~XFS_ICHGTIME_MOD; 522 timeflags &= ~XFS_ICHGTIME_MOD;
@@ -524,6 +532,7 @@ xfs_setattr(
524 */ 532 */
525 533
526 if ((flags & XFS_ATTR_DMI) && (mask & ATTR_CTIME)) { 534 if ((flags & XFS_ATTR_DMI) && (mask & ATTR_CTIME)) {
535 inode->i_ctime = iattr->ia_ctime;
527 ip->i_d.di_ctime.t_sec = iattr->ia_ctime.tv_sec; 536 ip->i_d.di_ctime.t_sec = iattr->ia_ctime.tv_sec;
528 ip->i_d.di_ctime.t_nsec = iattr->ia_ctime.tv_nsec; 537 ip->i_d.di_ctime.t_nsec = iattr->ia_ctime.tv_nsec;
529 ip->i_update_core = 1; 538 ip->i_update_core = 1;