aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChuck Lever <cel@citi.umich.edu>2005-08-18 14:24:09 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2005-08-18 15:53:56 -0400
commit5529680981807b44abf3be30fb6d612ff04f68ff (patch)
tree57da4e9135c0a85c1f8c6bc797250c0209420b51
parent3c7bf1eaee1255315fc7c2c4c300295e556ef768 (diff)
[PATCH] NFS: split nfsi->flags into two fields
Certain bits in nfsi->flags can be manipulated with atomic bitops, and some are better manipulated via logical bitmask operations. This patch splits the flags field into two. The next patch introduces atomic bitops for one of the fields. Test plan: Millions of fsx ops on SMP clients. Signed-off-by: Chuck Lever <cel@netapp.com> Cc: Trond Myklebust <trond.myklebust@fys.uio.no> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
-rw-r--r--fs/nfs/dir.c16
-rw-r--r--fs/nfs/file.c5
-rw-r--r--fs/nfs/inode.c61
-rw-r--r--fs/nfs/nfs3acl.c2
-rw-r--r--fs/nfs/read.c4
-rw-r--r--include/linux/nfs_fs.h27
6 files changed, 63 insertions, 52 deletions
diff --git a/fs/nfs/dir.c b/fs/nfs/dir.c
index b38a57e78a63..5732e13cd0da 100644
--- a/fs/nfs/dir.c
+++ b/fs/nfs/dir.c
@@ -189,7 +189,7 @@ int nfs_readdir_filler(nfs_readdir_descriptor_t *desc, struct page *page)
189 goto error; 189 goto error;
190 } 190 }
191 SetPageUptodate(page); 191 SetPageUptodate(page);
192 NFS_FLAGS(inode) |= NFS_INO_INVALID_ATIME; 192 NFS_I(inode)->cache_validity |= NFS_INO_INVALID_ATIME;
193 /* Ensure consistent page alignment of the data. 193 /* Ensure consistent page alignment of the data.
194 * Note: assumes we have exclusive access to this mapping either 194 * Note: assumes we have exclusive access to this mapping either
195 * through inode->i_sem or some other mechanism. 195 * through inode->i_sem or some other mechanism.
@@ -462,7 +462,7 @@ int uncached_readdir(nfs_readdir_descriptor_t *desc, void *dirent,
462 page, 462 page,
463 NFS_SERVER(inode)->dtsize, 463 NFS_SERVER(inode)->dtsize,
464 desc->plus); 464 desc->plus);
465 NFS_FLAGS(inode) |= NFS_INO_INVALID_ATIME; 465 NFS_I(inode)->cache_validity |= NFS_INO_INVALID_ATIME;
466 desc->page = page; 466 desc->page = page;
467 desc->ptr = kmap(page); /* matching kunmap in nfs_do_filldir */ 467 desc->ptr = kmap(page); /* matching kunmap in nfs_do_filldir */
468 if (desc->error >= 0) { 468 if (desc->error >= 0) {
@@ -608,7 +608,7 @@ static inline int nfs_check_verifier(struct inode *dir, struct dentry *dentry)
608{ 608{
609 if (IS_ROOT(dentry)) 609 if (IS_ROOT(dentry))
610 return 1; 610 return 1;
611 if ((NFS_FLAGS(dir) & NFS_INO_INVALID_ATTR) != 0 611 if ((NFS_I(dir)->cache_validity & NFS_INO_INVALID_ATTR) != 0
612 || nfs_attribute_timeout(dir)) 612 || nfs_attribute_timeout(dir))
613 return 0; 613 return 0;
614 return nfs_verify_change_attribute(dir, (unsigned long)dentry->d_fsdata); 614 return nfs_verify_change_attribute(dir, (unsigned long)dentry->d_fsdata);
@@ -1575,11 +1575,12 @@ out:
1575 1575
1576int nfs_access_get_cached(struct inode *inode, struct rpc_cred *cred, struct nfs_access_entry *res) 1576int nfs_access_get_cached(struct inode *inode, struct rpc_cred *cred, struct nfs_access_entry *res)
1577{ 1577{
1578 struct nfs_access_entry *cache = &NFS_I(inode)->cache_access; 1578 struct nfs_inode *nfsi = NFS_I(inode);
1579 struct nfs_access_entry *cache = &nfsi->cache_access;
1579 1580
1580 if (cache->cred != cred 1581 if (cache->cred != cred
1581 || time_after(jiffies, cache->jiffies + NFS_ATTRTIMEO(inode)) 1582 || time_after(jiffies, cache->jiffies + NFS_ATTRTIMEO(inode))
1582 || (NFS_FLAGS(inode) & NFS_INO_INVALID_ACCESS)) 1583 || (nfsi->cache_validity & NFS_INO_INVALID_ACCESS))
1583 return -ENOENT; 1584 return -ENOENT;
1584 memcpy(res, cache, sizeof(*res)); 1585 memcpy(res, cache, sizeof(*res));
1585 return 0; 1586 return 0;
@@ -1587,14 +1588,15 @@ int nfs_access_get_cached(struct inode *inode, struct rpc_cred *cred, struct nfs
1587 1588
1588void nfs_access_add_cache(struct inode *inode, struct nfs_access_entry *set) 1589void nfs_access_add_cache(struct inode *inode, struct nfs_access_entry *set)
1589{ 1590{
1590 struct nfs_access_entry *cache = &NFS_I(inode)->cache_access; 1591 struct nfs_inode *nfsi = NFS_I(inode);
1592 struct nfs_access_entry *cache = &nfsi->cache_access;
1591 1593
1592 if (cache->cred != set->cred) { 1594 if (cache->cred != set->cred) {
1593 if (cache->cred) 1595 if (cache->cred)
1594 put_rpccred(cache->cred); 1596 put_rpccred(cache->cred);
1595 cache->cred = get_rpccred(set->cred); 1597 cache->cred = get_rpccred(set->cred);
1596 } 1598 }
1597 NFS_FLAGS(inode) &= ~NFS_INO_INVALID_ACCESS; 1599 nfsi->cache_validity &= ~NFS_INO_INVALID_ACCESS;
1598 cache->jiffies = set->jiffies; 1600 cache->jiffies = set->jiffies;
1599 cache->mask = set->mask; 1601 cache->mask = set->mask;
1600} 1602}
diff --git a/fs/nfs/file.c b/fs/nfs/file.c
index 5621ba9885f4..f6b9eda925c5 100644
--- a/fs/nfs/file.c
+++ b/fs/nfs/file.c
@@ -134,9 +134,10 @@ nfs_file_release(struct inode *inode, struct file *filp)
134 */ 134 */
135static int nfs_revalidate_file(struct inode *inode, struct file *filp) 135static int nfs_revalidate_file(struct inode *inode, struct file *filp)
136{ 136{
137 struct nfs_inode *nfsi = NFS_I(inode);
137 int retval = 0; 138 int retval = 0;
138 139
139 if ((NFS_FLAGS(inode) & NFS_INO_REVAL_PAGECACHE) || nfs_attribute_timeout(inode)) 140 if ((nfsi->cache_validity & NFS_INO_REVAL_PAGECACHE) || nfs_attribute_timeout(inode))
140 retval = __nfs_revalidate_inode(NFS_SERVER(inode), inode); 141 retval = __nfs_revalidate_inode(NFS_SERVER(inode), inode);
141 nfs_revalidate_mapping(inode, filp->f_mapping); 142 nfs_revalidate_mapping(inode, filp->f_mapping);
142 return 0; 143 return 0;
@@ -164,7 +165,7 @@ static int nfs_revalidate_file_size(struct inode *inode, struct file *filp)
164 goto force_reval; 165 goto force_reval;
165 if (nfsi->npages != 0) 166 if (nfsi->npages != 0)
166 return 0; 167 return 0;
167 if (!(NFS_FLAGS(inode) & NFS_INO_REVAL_PAGECACHE) && !nfs_attribute_timeout(inode)) 168 if (!(nfsi->cache_validity & NFS_INO_REVAL_PAGECACHE) && !nfs_attribute_timeout(inode))
168 return 0; 169 return 0;
169force_reval: 170force_reval:
170 return __nfs_revalidate_inode(server, inode); 171 return __nfs_revalidate_inode(server, inode);
diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c
index bb7ca022bcb2..622184553516 100644
--- a/fs/nfs/inode.c
+++ b/fs/nfs/inode.c
@@ -620,9 +620,9 @@ nfs_zap_caches(struct inode *inode)
620 620
621 memset(NFS_COOKIEVERF(inode), 0, sizeof(NFS_COOKIEVERF(inode))); 621 memset(NFS_COOKIEVERF(inode), 0, sizeof(NFS_COOKIEVERF(inode)));
622 if (S_ISREG(mode) || S_ISDIR(mode) || S_ISLNK(mode)) 622 if (S_ISREG(mode) || S_ISDIR(mode) || S_ISLNK(mode))
623 nfsi->flags |= NFS_INO_INVALID_ATTR|NFS_INO_INVALID_DATA|NFS_INO_INVALID_ACCESS|NFS_INO_INVALID_ACL|NFS_INO_REVAL_PAGECACHE; 623 nfsi->cache_validity |= NFS_INO_INVALID_ATTR|NFS_INO_INVALID_DATA|NFS_INO_INVALID_ACCESS|NFS_INO_INVALID_ACL|NFS_INO_REVAL_PAGECACHE;
624 else 624 else
625 nfsi->flags |= NFS_INO_INVALID_ATTR|NFS_INO_INVALID_ACCESS|NFS_INO_INVALID_ACL|NFS_INO_REVAL_PAGECACHE; 625 nfsi->cache_validity |= NFS_INO_INVALID_ATTR|NFS_INO_INVALID_ACCESS|NFS_INO_INVALID_ACL|NFS_INO_REVAL_PAGECACHE;
626} 626}
627 627
628static void nfs_zap_acl_cache(struct inode *inode) 628static void nfs_zap_acl_cache(struct inode *inode)
@@ -632,7 +632,7 @@ static void nfs_zap_acl_cache(struct inode *inode)
632 clear_acl_cache = NFS_PROTO(inode)->clear_acl_cache; 632 clear_acl_cache = NFS_PROTO(inode)->clear_acl_cache;
633 if (clear_acl_cache != NULL) 633 if (clear_acl_cache != NULL)
634 clear_acl_cache(inode); 634 clear_acl_cache(inode);
635 NFS_I(inode)->flags &= ~NFS_INO_INVALID_ACL; 635 NFS_I(inode)->cache_validity &= ~NFS_INO_INVALID_ACL;
636} 636}
637 637
638/* 638/*
@@ -841,7 +841,7 @@ void nfs_setattr_update_inode(struct inode *inode, struct iattr *attr)
841 inode->i_uid = attr->ia_uid; 841 inode->i_uid = attr->ia_uid;
842 if ((attr->ia_valid & ATTR_GID) != 0) 842 if ((attr->ia_valid & ATTR_GID) != 0)
843 inode->i_gid = attr->ia_gid; 843 inode->i_gid = attr->ia_gid;
844 NFS_FLAGS(inode) |= NFS_INO_INVALID_ACCESS|NFS_INO_INVALID_ACL; 844 NFS_I(inode)->cache_validity |= NFS_INO_INVALID_ACCESS|NFS_INO_INVALID_ACL;
845 } 845 }
846 if ((attr->ia_valid & ATTR_SIZE) != 0) { 846 if ((attr->ia_valid & ATTR_SIZE) != 0) {
847 inode->i_size = attr->ia_size; 847 inode->i_size = attr->ia_size;
@@ -872,8 +872,7 @@ nfs_wait_on_inode(struct inode *inode, int flag)
872int nfs_getattr(struct vfsmount *mnt, struct dentry *dentry, struct kstat *stat) 872int nfs_getattr(struct vfsmount *mnt, struct dentry *dentry, struct kstat *stat)
873{ 873{
874 struct inode *inode = dentry->d_inode; 874 struct inode *inode = dentry->d_inode;
875 struct nfs_inode *nfsi = NFS_I(inode); 875 int need_atime = NFS_I(inode)->cache_validity & NFS_INO_INVALID_ATIME;
876 int need_atime = nfsi->flags & NFS_INO_INVALID_ATIME;
877 int err; 876 int err;
878 877
879 if (__IS_FLG(inode, MS_NOATIME)) 878 if (__IS_FLG(inode, MS_NOATIME))
@@ -1019,7 +1018,7 @@ __nfs_revalidate_inode(struct nfs_server *server, struct inode *inode)
1019 struct nfs_fattr fattr; 1018 struct nfs_fattr fattr;
1020 struct nfs_inode *nfsi = NFS_I(inode); 1019 struct nfs_inode *nfsi = NFS_I(inode);
1021 unsigned long verifier; 1020 unsigned long verifier;
1022 unsigned int flags; 1021 unsigned long cache_validity;
1023 1022
1024 dfprintk(PAGECACHE, "NFS: revalidating (%s/%Ld)\n", 1023 dfprintk(PAGECACHE, "NFS: revalidating (%s/%Ld)\n",
1025 inode->i_sb->s_id, (long long)NFS_FILEID(inode)); 1024 inode->i_sb->s_id, (long long)NFS_FILEID(inode));
@@ -1036,7 +1035,7 @@ __nfs_revalidate_inode(struct nfs_server *server, struct inode *inode)
1036 goto out_nowait; 1035 goto out_nowait;
1037 if (NFS_ATTRTIMEO(inode) == 0) 1036 if (NFS_ATTRTIMEO(inode) == 0)
1038 continue; 1037 continue;
1039 if (NFS_FLAGS(inode) & (NFS_INO_INVALID_ATTR|NFS_INO_INVALID_DATA|NFS_INO_INVALID_ATIME)) 1038 if (nfsi->cache_validity & (NFS_INO_INVALID_ATTR|NFS_INO_INVALID_DATA|NFS_INO_INVALID_ATIME))
1040 continue; 1039 continue;
1041 status = NFS_STALE(inode) ? -ESTALE : 0; 1040 status = NFS_STALE(inode) ? -ESTALE : 0;
1042 goto out_nowait; 1041 goto out_nowait;
@@ -1065,18 +1064,21 @@ __nfs_revalidate_inode(struct nfs_server *server, struct inode *inode)
1065 (long long)NFS_FILEID(inode), status); 1064 (long long)NFS_FILEID(inode), status);
1066 goto out; 1065 goto out;
1067 } 1066 }
1068 flags = nfsi->flags; 1067 cache_validity = nfsi->cache_validity;
1069 nfsi->flags &= ~NFS_INO_REVAL_PAGECACHE; 1068 nfsi->cache_validity &= ~NFS_INO_REVAL_PAGECACHE;
1069
1070 /* 1070 /*
1071 * We may need to keep the attributes marked as invalid if 1071 * We may need to keep the attributes marked as invalid if
1072 * we raced with nfs_end_attr_update(). 1072 * we raced with nfs_end_attr_update().
1073 */ 1073 */
1074 if (verifier == nfsi->cache_change_attribute) 1074 if (verifier == nfsi->cache_change_attribute)
1075 nfsi->flags &= ~(NFS_INO_INVALID_ATTR|NFS_INO_INVALID_ATIME); 1075 nfsi->cache_validity &= ~(NFS_INO_INVALID_ATTR|NFS_INO_INVALID_ATIME);
1076 /* Do the page cache invalidation */ 1076
1077 nfs_revalidate_mapping(inode, inode->i_mapping); 1077 nfs_revalidate_mapping(inode, inode->i_mapping);
1078 if (flags & NFS_INO_INVALID_ACL) 1078
1079 if (cache_validity & NFS_INO_INVALID_ACL)
1079 nfs_zap_acl_cache(inode); 1080 nfs_zap_acl_cache(inode);
1081
1080 dfprintk(PAGECACHE, "NFS: (%s/%Ld) revalidation complete\n", 1082 dfprintk(PAGECACHE, "NFS: (%s/%Ld) revalidation complete\n",
1081 inode->i_sb->s_id, 1083 inode->i_sb->s_id,
1082 (long long)NFS_FILEID(inode)); 1084 (long long)NFS_FILEID(inode));
@@ -1107,7 +1109,7 @@ int nfs_attribute_timeout(struct inode *inode)
1107 */ 1109 */
1108int nfs_revalidate_inode(struct nfs_server *server, struct inode *inode) 1110int nfs_revalidate_inode(struct nfs_server *server, struct inode *inode)
1109{ 1111{
1110 if (!(NFS_FLAGS(inode) & (NFS_INO_INVALID_ATTR|NFS_INO_INVALID_DATA)) 1112 if (!(NFS_I(inode)->cache_validity & (NFS_INO_INVALID_ATTR|NFS_INO_INVALID_DATA))
1111 && !nfs_attribute_timeout(inode)) 1113 && !nfs_attribute_timeout(inode))
1112 return NFS_STALE(inode) ? -ESTALE : 0; 1114 return NFS_STALE(inode) ? -ESTALE : 0;
1113 return __nfs_revalidate_inode(server, inode); 1115 return __nfs_revalidate_inode(server, inode);
@@ -1122,14 +1124,14 @@ void nfs_revalidate_mapping(struct inode *inode, struct address_space *mapping)
1122{ 1124{
1123 struct nfs_inode *nfsi = NFS_I(inode); 1125 struct nfs_inode *nfsi = NFS_I(inode);
1124 1126
1125 if (nfsi->flags & NFS_INO_INVALID_DATA) { 1127 if (nfsi->cache_validity & NFS_INO_INVALID_DATA) {
1126 if (S_ISREG(inode->i_mode)) { 1128 if (S_ISREG(inode->i_mode)) {
1127 if (filemap_fdatawrite(mapping) == 0) 1129 if (filemap_fdatawrite(mapping) == 0)
1128 filemap_fdatawait(mapping); 1130 filemap_fdatawait(mapping);
1129 nfs_wb_all(inode); 1131 nfs_wb_all(inode);
1130 } 1132 }
1131 invalidate_inode_pages2(mapping); 1133 invalidate_inode_pages2(mapping);
1132 nfsi->flags &= ~NFS_INO_INVALID_DATA; 1134 nfsi->cache_validity &= ~NFS_INO_INVALID_DATA;
1133 if (S_ISDIR(inode->i_mode)) { 1135 if (S_ISDIR(inode->i_mode)) {
1134 memset(nfsi->cookieverf, 0, sizeof(nfsi->cookieverf)); 1136 memset(nfsi->cookieverf, 0, sizeof(nfsi->cookieverf));
1135 /* This ensures we revalidate child dentries */ 1137 /* This ensures we revalidate child dentries */
@@ -1164,10 +1166,10 @@ void nfs_end_data_update(struct inode *inode)
1164 1166
1165 if (!nfs_have_delegation(inode, FMODE_READ)) { 1167 if (!nfs_have_delegation(inode, FMODE_READ)) {
1166 /* Mark the attribute cache for revalidation */ 1168 /* Mark the attribute cache for revalidation */
1167 nfsi->flags |= NFS_INO_INVALID_ATTR; 1169 nfsi->cache_validity |= NFS_INO_INVALID_ATTR;
1168 /* Directories and symlinks: invalidate page cache too */ 1170 /* Directories and symlinks: invalidate page cache too */
1169 if (S_ISDIR(inode->i_mode) || S_ISLNK(inode->i_mode)) 1171 if (S_ISDIR(inode->i_mode) || S_ISLNK(inode->i_mode))
1170 nfsi->flags |= NFS_INO_INVALID_DATA; 1172 nfsi->cache_validity |= NFS_INO_INVALID_DATA;
1171 } 1173 }
1172 nfsi->cache_change_attribute ++; 1174 nfsi->cache_change_attribute ++;
1173 atomic_dec(&nfsi->data_updates); 1175 atomic_dec(&nfsi->data_updates);
@@ -1200,9 +1202,9 @@ int nfs_refresh_inode(struct inode *inode, struct nfs_fattr *fattr)
1200 && nfsi->change_attr == fattr->pre_change_attr) 1202 && nfsi->change_attr == fattr->pre_change_attr)
1201 nfsi->change_attr = fattr->change_attr; 1203 nfsi->change_attr = fattr->change_attr;
1202 if (nfsi->change_attr != fattr->change_attr) { 1204 if (nfsi->change_attr != fattr->change_attr) {
1203 nfsi->flags |= NFS_INO_INVALID_ATTR; 1205 nfsi->cache_validity |= NFS_INO_INVALID_ATTR;
1204 if (!data_unstable) 1206 if (!data_unstable)
1205 nfsi->flags |= NFS_INO_REVAL_PAGECACHE; 1207 nfsi->cache_validity |= NFS_INO_REVAL_PAGECACHE;
1206 } 1208 }
1207 } 1209 }
1208 1210
@@ -1227,28 +1229,28 @@ int nfs_refresh_inode(struct inode *inode, struct nfs_fattr *fattr)
1227 1229
1228 /* Verify a few of the more important attributes */ 1230 /* Verify a few of the more important attributes */
1229 if (!timespec_equal(&inode->i_mtime, &fattr->mtime)) { 1231 if (!timespec_equal(&inode->i_mtime, &fattr->mtime)) {
1230 nfsi->flags |= NFS_INO_INVALID_ATTR; 1232 nfsi->cache_validity |= NFS_INO_INVALID_ATTR;
1231 if (!data_unstable) 1233 if (!data_unstable)
1232 nfsi->flags |= NFS_INO_REVAL_PAGECACHE; 1234 nfsi->cache_validity |= NFS_INO_REVAL_PAGECACHE;
1233 } 1235 }
1234 if (cur_size != new_isize) { 1236 if (cur_size != new_isize) {
1235 nfsi->flags |= NFS_INO_INVALID_ATTR; 1237 nfsi->cache_validity |= NFS_INO_INVALID_ATTR;
1236 if (nfsi->npages == 0) 1238 if (nfsi->npages == 0)
1237 nfsi->flags |= NFS_INO_REVAL_PAGECACHE; 1239 nfsi->cache_validity |= NFS_INO_REVAL_PAGECACHE;
1238 } 1240 }
1239 1241
1240 /* Have any file permissions changed? */ 1242 /* Have any file permissions changed? */
1241 if ((inode->i_mode & S_IALLUGO) != (fattr->mode & S_IALLUGO) 1243 if ((inode->i_mode & S_IALLUGO) != (fattr->mode & S_IALLUGO)
1242 || inode->i_uid != fattr->uid 1244 || inode->i_uid != fattr->uid
1243 || inode->i_gid != fattr->gid) 1245 || inode->i_gid != fattr->gid)
1244 nfsi->flags |= NFS_INO_INVALID_ATTR | NFS_INO_INVALID_ACCESS | NFS_INO_INVALID_ACL; 1246 nfsi->cache_validity |= NFS_INO_INVALID_ATTR | NFS_INO_INVALID_ACCESS | NFS_INO_INVALID_ACL;
1245 1247
1246 /* Has the link count changed? */ 1248 /* Has the link count changed? */
1247 if (inode->i_nlink != fattr->nlink) 1249 if (inode->i_nlink != fattr->nlink)
1248 nfsi->flags |= NFS_INO_INVALID_ATTR; 1250 nfsi->cache_validity |= NFS_INO_INVALID_ATTR;
1249 1251
1250 if (!timespec_equal(&inode->i_atime, &fattr->atime)) 1252 if (!timespec_equal(&inode->i_atime, &fattr->atime))
1251 nfsi->flags |= NFS_INO_INVALID_ATIME; 1253 nfsi->cache_validity |= NFS_INO_INVALID_ATIME;
1252 1254
1253 nfsi->read_cache_jiffies = fattr->timestamp; 1255 nfsi->read_cache_jiffies = fattr->timestamp;
1254 return 0; 1256 return 0;
@@ -1384,7 +1386,7 @@ static int nfs_update_inode(struct inode *inode, struct nfs_fattr *fattr, unsign
1384 || S_ISLNK(inode->i_mode))) 1386 || S_ISLNK(inode->i_mode)))
1385 invalid &= ~NFS_INO_INVALID_DATA; 1387 invalid &= ~NFS_INO_INVALID_DATA;
1386 if (!nfs_have_delegation(inode, FMODE_READ)) 1388 if (!nfs_have_delegation(inode, FMODE_READ))
1387 nfsi->flags |= invalid; 1389 nfsi->cache_validity |= invalid;
1388 1390
1389 return 0; 1391 return 0;
1390 out_changed: 1392 out_changed:
@@ -1961,7 +1963,8 @@ static struct inode *nfs_alloc_inode(struct super_block *sb)
1961 nfsi = (struct nfs_inode *)kmem_cache_alloc(nfs_inode_cachep, SLAB_KERNEL); 1963 nfsi = (struct nfs_inode *)kmem_cache_alloc(nfs_inode_cachep, SLAB_KERNEL);
1962 if (!nfsi) 1964 if (!nfsi)
1963 return NULL; 1965 return NULL;
1964 nfsi->flags = 0; 1966 nfsi->flags = 0UL;
1967 nfsi->cache_validity = 0UL;
1965#ifdef CONFIG_NFS_V3_ACL 1968#ifdef CONFIG_NFS_V3_ACL
1966 nfsi->acl_access = ERR_PTR(-EAGAIN); 1969 nfsi->acl_access = ERR_PTR(-EAGAIN);
1967 nfsi->acl_default = ERR_PTR(-EAGAIN); 1970 nfsi->acl_default = ERR_PTR(-EAGAIN);
diff --git a/fs/nfs/nfs3acl.c b/fs/nfs/nfs3acl.c
index 1b7a3ef2f813..a020e650ffc2 100644
--- a/fs/nfs/nfs3acl.c
+++ b/fs/nfs/nfs3acl.c
@@ -308,7 +308,7 @@ static int nfs3_proc_setacls(struct inode *inode, struct posix_acl *acl,
308 nfs_begin_data_update(inode); 308 nfs_begin_data_update(inode);
309 status = rpc_call(server->client_acl, ACLPROC3_SETACL, 309 status = rpc_call(server->client_acl, ACLPROC3_SETACL,
310 &args, &fattr, 0); 310 &args, &fattr, 0);
311 NFS_FLAGS(inode) |= NFS_INO_INVALID_ACCESS; 311 NFS_I(inode)->cache_validity |= NFS_INO_INVALID_ACCESS;
312 nfs_end_data_update(inode); 312 nfs_end_data_update(inode);
313 dprintk("NFS reply setacl: %d\n", status); 313 dprintk("NFS reply setacl: %d\n", status);
314 314
diff --git a/fs/nfs/read.c b/fs/nfs/read.c
index 6f866b8aa2d5..90df0500ca1b 100644
--- a/fs/nfs/read.c
+++ b/fs/nfs/read.c
@@ -140,7 +140,7 @@ static int nfs_readpage_sync(struct nfs_open_context *ctx, struct inode *inode,
140 if (rdata->res.eof != 0 || result == 0) 140 if (rdata->res.eof != 0 || result == 0)
141 break; 141 break;
142 } while (count); 142 } while (count);
143 NFS_FLAGS(inode) |= NFS_INO_INVALID_ATIME; 143 NFS_I(inode)->cache_validity |= NFS_INO_INVALID_ATIME;
144 144
145 if (count) 145 if (count)
146 memclear_highpage_flush(page, rdata->args.pgbase, count); 146 memclear_highpage_flush(page, rdata->args.pgbase, count);
@@ -473,7 +473,7 @@ void nfs_readpage_result(struct rpc_task *task)
473 } 473 }
474 task->tk_status = -EIO; 474 task->tk_status = -EIO;
475 } 475 }
476 NFS_FLAGS(data->inode) |= NFS_INO_INVALID_ATIME; 476 NFS_I(data->inode)->cache_validity |= NFS_INO_INVALID_ATIME;
477 data->complete(data, status); 477 data->complete(data, status);
478} 478}
479 479
diff --git a/include/linux/nfs_fs.h b/include/linux/nfs_fs.h
index 7d78a783c64a..229a1755842a 100644
--- a/include/linux/nfs_fs.h
+++ b/include/linux/nfs_fs.h
@@ -113,6 +113,7 @@ struct nfs_inode {
113 * Various flags 113 * Various flags
114 */ 114 */
115 unsigned int flags; 115 unsigned int flags;
116 unsigned long cache_validity;
116 117
117 /* 118 /*
118 * read_cache_jiffies is when we started read-caching this inode, 119 * read_cache_jiffies is when we started read-caching this inode,
@@ -188,17 +189,21 @@ struct nfs_inode {
188}; 189};
189 190
190/* 191/*
191 * Legal inode flag values 192 * Cache validity bit flags
192 */ 193 */
193#define NFS_INO_STALE 0x0001 /* possible stale inode */ 194#define NFS_INO_INVALID_ATTR 0x0001 /* cached attrs are invalid */
194#define NFS_INO_ADVISE_RDPLUS 0x0002 /* advise readdirplus */ 195#define NFS_INO_INVALID_DATA 0x0002 /* cached data is invalid */
195#define NFS_INO_REVALIDATING 0x0004 /* revalidating attrs */ 196#define NFS_INO_INVALID_ATIME 0x0004 /* cached atime is invalid */
196#define NFS_INO_INVALID_ATTR 0x0008 /* cached attrs are invalid */ 197#define NFS_INO_INVALID_ACCESS 0x0008 /* cached access cred invalid */
197#define NFS_INO_INVALID_DATA 0x0010 /* cached data is invalid */ 198#define NFS_INO_INVALID_ACL 0x0010 /* cached acls are invalid */
198#define NFS_INO_INVALID_ATIME 0x0020 /* cached atime is invalid */ 199#define NFS_INO_REVAL_PAGECACHE 0x0020 /* must revalidate pagecache */
199#define NFS_INO_INVALID_ACCESS 0x0040 /* cached access cred invalid */ 200
200#define NFS_INO_INVALID_ACL 0x0080 /* cached acls are invalid */ 201/*
201#define NFS_INO_REVAL_PAGECACHE 0x1000 /* must revalidate pagecache */ 202 * Legal values of flags field
203 */
204#define NFS_INO_REVALIDATING 0x0001 /* revalidating attrs */
205#define NFS_INO_ADVISE_RDPLUS 0x0002 /* advise readdirplus */
206#define NFS_INO_STALE 0x0004 /* possible stale inode */
202 207
203static inline struct nfs_inode *NFS_I(struct inode *inode) 208static inline struct nfs_inode *NFS_I(struct inode *inode)
204{ 209{
@@ -237,7 +242,7 @@ static inline int nfs_caches_unstable(struct inode *inode)
237static inline void NFS_CACHEINV(struct inode *inode) 242static inline void NFS_CACHEINV(struct inode *inode)
238{ 243{
239 if (!nfs_caches_unstable(inode)) 244 if (!nfs_caches_unstable(inode))
240 NFS_FLAGS(inode) |= NFS_INO_INVALID_ATTR | NFS_INO_INVALID_ACCESS; 245 NFS_I(inode)->cache_validity |= NFS_INO_INVALID_ATTR | NFS_INO_INVALID_ACCESS;
241} 246}
242 247
243static inline int nfs_server_capable(struct inode *inode, int cap) 248static inline int nfs_server_capable(struct inode *inode, int cap)