mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-06-23 15:11:16 +00:00
[PATCH] NFS: Cleanup of caching code, and slight optimization of writes.
Unless we're doing O_APPEND writes, we really don't care about revalidating the file length. Just make sure that we catch any page cache invalidations. Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
This commit is contained in:
parent
951a143b3f
commit
7d52e86274
3 changed files with 39 additions and 18 deletions
|
@ -1062,21 +1062,7 @@ __nfs_revalidate_inode(struct nfs_server *server, struct inode *inode)
|
|||
if (verifier == nfsi->cache_change_attribute)
|
||||
nfsi->flags &= ~(NFS_INO_INVALID_ATTR|NFS_INO_INVALID_ATIME);
|
||||
/* Do the page cache invalidation */
|
||||
if (flags & NFS_INO_INVALID_DATA) {
|
||||
if (S_ISREG(inode->i_mode)) {
|
||||
if (filemap_fdatawrite(inode->i_mapping) == 0)
|
||||
filemap_fdatawait(inode->i_mapping);
|
||||
nfs_wb_all(inode);
|
||||
}
|
||||
nfsi->flags &= ~NFS_INO_INVALID_DATA;
|
||||
invalidate_inode_pages2(inode->i_mapping);
|
||||
memset(NFS_COOKIEVERF(inode), 0, sizeof(NFS_COOKIEVERF(inode)));
|
||||
dfprintk(PAGECACHE, "NFS: (%s/%Ld) data cache invalidated\n",
|
||||
inode->i_sb->s_id,
|
||||
(long long)NFS_FILEID(inode));
|
||||
/* This ensures we revalidate dentries */
|
||||
nfsi->cache_change_attribute++;
|
||||
}
|
||||
nfs_revalidate_mapping(inode, inode->i_mapping);
|
||||
if (flags & NFS_INO_INVALID_ACL)
|
||||
nfs_zap_acl_cache(inode);
|
||||
dfprintk(PAGECACHE, "NFS: (%s/%Ld) revalidation complete\n",
|
||||
|
@ -1115,6 +1101,34 @@ int nfs_revalidate_inode(struct nfs_server *server, struct inode *inode)
|
|||
return __nfs_revalidate_inode(server, inode);
|
||||
}
|
||||
|
||||
/**
|
||||
* nfs_revalidate_mapping - Revalidate the pagecache
|
||||
* @inode - pointer to host inode
|
||||
* @mapping - pointer to mapping
|
||||
*/
|
||||
void nfs_revalidate_mapping(struct inode *inode, struct address_space *mapping)
|
||||
{
|
||||
struct nfs_inode *nfsi = NFS_I(inode);
|
||||
|
||||
if (nfsi->flags & NFS_INO_INVALID_DATA) {
|
||||
if (S_ISREG(inode->i_mode)) {
|
||||
if (filemap_fdatawrite(mapping) == 0)
|
||||
filemap_fdatawait(mapping);
|
||||
nfs_wb_all(inode);
|
||||
}
|
||||
invalidate_inode_pages2(mapping);
|
||||
nfsi->flags &= ~NFS_INO_INVALID_DATA;
|
||||
if (S_ISDIR(inode->i_mode)) {
|
||||
memset(nfsi->cookieverf, 0, sizeof(nfsi->cookieverf));
|
||||
/* This ensures we revalidate child dentries */
|
||||
nfsi->cache_change_attribute++;
|
||||
}
|
||||
dfprintk(PAGECACHE, "NFS: (%s/%Ld) data cache invalidated\n",
|
||||
inode->i_sb->s_id,
|
||||
(long long)NFS_FILEID(inode));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* nfs_begin_data_update
|
||||
* @inode - pointer to inode
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue