diff options
author | Trond Myklebust <Trond.Myklebust@netapp.com> | 2006-05-25 01:40:59 -0400 |
---|---|---|
committer | Trond Myklebust <Trond.Myklebust@netapp.com> | 2006-06-09 09:34:09 -0400 |
commit | 44b11874ff583b6e766a05856b04f3c492c32b84 (patch) | |
tree | b17effcaf70ed67f61b1ec2ed2dea1ea2f884d60 /fs/nfs/inode.c | |
parent | 38478b24e37587f1c4fedf8ac070ca54f052ed28 (diff) |
NFS: Separate metadata and page cache revalidation mechanisms
Separate out the function of revalidating the inode metadata, and
revalidating the mapping. The former may be called by lookup(),
and only really needs to check that permissions, ctime, etc haven't changed
whereas the latter needs only done when we want to read data from the page
cache, and may need to sync and then invalidate the mapping.
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs/nfs/inode.c')
-rw-r--r-- | fs/nfs/inode.c | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c index eddd0e982d23..69036ef39866 100644 --- a/fs/nfs/inode.c +++ b/fs/nfs/inode.c | |||
@@ -1220,7 +1220,7 @@ __nfs_revalidate_inode(struct nfs_server *server, struct inode *inode) | |||
1220 | status = -ESTALE; | 1220 | status = -ESTALE; |
1221 | /* Do we trust the cached ESTALE? */ | 1221 | /* Do we trust the cached ESTALE? */ |
1222 | if (NFS_ATTRTIMEO(inode) != 0) { | 1222 | if (NFS_ATTRTIMEO(inode) != 0) { |
1223 | if (nfsi->cache_validity & (NFS_INO_INVALID_ATTR|NFS_INO_INVALID_DATA|NFS_INO_INVALID_ATIME)) { | 1223 | if (nfsi->cache_validity & (NFS_INO_INVALID_ATTR|NFS_INO_INVALID_ATIME)) { |
1224 | /* no */ | 1224 | /* no */ |
1225 | } else | 1225 | } else |
1226 | goto out; | 1226 | goto out; |
@@ -1251,8 +1251,6 @@ __nfs_revalidate_inode(struct nfs_server *server, struct inode *inode) | |||
1251 | } | 1251 | } |
1252 | spin_unlock(&inode->i_lock); | 1252 | spin_unlock(&inode->i_lock); |
1253 | 1253 | ||
1254 | nfs_revalidate_mapping(inode, inode->i_mapping); | ||
1255 | |||
1256 | if (nfsi->cache_validity & NFS_INO_INVALID_ACL) | 1254 | if (nfsi->cache_validity & NFS_INO_INVALID_ACL) |
1257 | nfs_zap_acl_cache(inode); | 1255 | nfs_zap_acl_cache(inode); |
1258 | 1256 | ||
@@ -1287,7 +1285,7 @@ int nfs_attribute_timeout(struct inode *inode) | |||
1287 | int nfs_revalidate_inode(struct nfs_server *server, struct inode *inode) | 1285 | int nfs_revalidate_inode(struct nfs_server *server, struct inode *inode) |
1288 | { | 1286 | { |
1289 | nfs_inc_stats(inode, NFSIOS_INODEREVALIDATE); | 1287 | nfs_inc_stats(inode, NFSIOS_INODEREVALIDATE); |
1290 | if (!(NFS_I(inode)->cache_validity & (NFS_INO_INVALID_ATTR|NFS_INO_INVALID_DATA)) | 1288 | if (!(NFS_I(inode)->cache_validity & NFS_INO_INVALID_ATTR) |
1291 | && !nfs_attribute_timeout(inode)) | 1289 | && !nfs_attribute_timeout(inode)) |
1292 | return NFS_STALE(inode) ? -ESTALE : 0; | 1290 | return NFS_STALE(inode) ? -ESTALE : 0; |
1293 | return __nfs_revalidate_inode(server, inode); | 1291 | return __nfs_revalidate_inode(server, inode); |
@@ -1298,9 +1296,16 @@ int nfs_revalidate_inode(struct nfs_server *server, struct inode *inode) | |||
1298 | * @inode - pointer to host inode | 1296 | * @inode - pointer to host inode |
1299 | * @mapping - pointer to mapping | 1297 | * @mapping - pointer to mapping |
1300 | */ | 1298 | */ |
1301 | void nfs_revalidate_mapping(struct inode *inode, struct address_space *mapping) | 1299 | int nfs_revalidate_mapping(struct inode *inode, struct address_space *mapping) |
1302 | { | 1300 | { |
1303 | struct nfs_inode *nfsi = NFS_I(inode); | 1301 | struct nfs_inode *nfsi = NFS_I(inode); |
1302 | int ret = 0; | ||
1303 | |||
1304 | if (NFS_STALE(inode)) | ||
1305 | ret = -ESTALE; | ||
1306 | if ((nfsi->cache_validity & NFS_INO_REVAL_PAGECACHE) | ||
1307 | || nfs_attribute_timeout(inode)) | ||
1308 | ret = __nfs_revalidate_inode(NFS_SERVER(inode), inode); | ||
1304 | 1309 | ||
1305 | if (nfsi->cache_validity & NFS_INO_INVALID_DATA) { | 1310 | if (nfsi->cache_validity & NFS_INO_INVALID_DATA) { |
1306 | nfs_inc_stats(inode, NFSIOS_DATAINVALIDATE); | 1311 | nfs_inc_stats(inode, NFSIOS_DATAINVALIDATE); |
@@ -1321,6 +1326,7 @@ void nfs_revalidate_mapping(struct inode *inode, struct address_space *mapping) | |||
1321 | inode->i_sb->s_id, | 1326 | inode->i_sb->s_id, |
1322 | (long long)NFS_FILEID(inode)); | 1327 | (long long)NFS_FILEID(inode)); |
1323 | } | 1328 | } |
1329 | return ret; | ||
1324 | } | 1330 | } |
1325 | 1331 | ||
1326 | /** | 1332 | /** |