NFS: Simplify nfs_fhget()
If the inode is being initialised, there is no point in setting flags such as NFS_INO_INVALID_ACCESS, NFS_INO_INVALID_ACL or NFS_INO_INVALID_DATA since there are no cached access calls, acls or data caches to invalidate. Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
This commit is contained in:
parent
8d197a568f
commit
4124bbc521
1 changed files with 6 additions and 17 deletions
|
@ -285,9 +285,7 @@ nfs_fhget(struct super_block *sb, struct nfs_fh *fh, struct nfs_fattr *fattr)
|
||||||
inode->i_mode = fattr->mode;
|
inode->i_mode = fattr->mode;
|
||||||
if ((fattr->valid & NFS_ATTR_FATTR_MODE) == 0
|
if ((fattr->valid & NFS_ATTR_FATTR_MODE) == 0
|
||||||
&& nfs_server_capable(inode, NFS_CAP_MODE))
|
&& nfs_server_capable(inode, NFS_CAP_MODE))
|
||||||
nfsi->cache_validity |= NFS_INO_INVALID_ATTR
|
nfsi->cache_validity |= NFS_INO_INVALID_ATTR;
|
||||||
| NFS_INO_INVALID_ACCESS
|
|
||||||
| NFS_INO_INVALID_ACL;
|
|
||||||
/* Why so? Because we want revalidate for devices/FIFOs, and
|
/* Why so? Because we want revalidate for devices/FIFOs, and
|
||||||
* that's precisely what we have in nfs_file_inode_operations.
|
* that's precisely what we have in nfs_file_inode_operations.
|
||||||
*/
|
*/
|
||||||
|
@ -337,24 +335,19 @@ nfs_fhget(struct super_block *sb, struct nfs_fh *fh, struct nfs_fattr *fattr)
|
||||||
if (fattr->valid & NFS_ATTR_FATTR_MTIME)
|
if (fattr->valid & NFS_ATTR_FATTR_MTIME)
|
||||||
inode->i_mtime = fattr->mtime;
|
inode->i_mtime = fattr->mtime;
|
||||||
else if (nfs_server_capable(inode, NFS_CAP_MTIME))
|
else if (nfs_server_capable(inode, NFS_CAP_MTIME))
|
||||||
nfsi->cache_validity |= NFS_INO_INVALID_ATTR
|
nfsi->cache_validity |= NFS_INO_INVALID_ATTR;
|
||||||
| NFS_INO_INVALID_DATA;
|
|
||||||
if (fattr->valid & NFS_ATTR_FATTR_CTIME)
|
if (fattr->valid & NFS_ATTR_FATTR_CTIME)
|
||||||
inode->i_ctime = fattr->ctime;
|
inode->i_ctime = fattr->ctime;
|
||||||
else if (nfs_server_capable(inode, NFS_CAP_CTIME))
|
else if (nfs_server_capable(inode, NFS_CAP_CTIME))
|
||||||
nfsi->cache_validity |= NFS_INO_INVALID_ATTR
|
nfsi->cache_validity |= NFS_INO_INVALID_ATTR;
|
||||||
| NFS_INO_INVALID_ACCESS
|
|
||||||
| NFS_INO_INVALID_ACL;
|
|
||||||
if (fattr->valid & NFS_ATTR_FATTR_CHANGE)
|
if (fattr->valid & NFS_ATTR_FATTR_CHANGE)
|
||||||
inode->i_version = fattr->change_attr;
|
inode->i_version = fattr->change_attr;
|
||||||
else if (nfs_server_capable(inode, NFS_CAP_CHANGE_ATTR))
|
else if (nfs_server_capable(inode, NFS_CAP_CHANGE_ATTR))
|
||||||
nfsi->cache_validity |= NFS_INO_INVALID_ATTR
|
nfsi->cache_validity |= NFS_INO_INVALID_ATTR;
|
||||||
| NFS_INO_INVALID_DATA;
|
|
||||||
if (fattr->valid & NFS_ATTR_FATTR_SIZE)
|
if (fattr->valid & NFS_ATTR_FATTR_SIZE)
|
||||||
inode->i_size = nfs_size_to_loff_t(fattr->size);
|
inode->i_size = nfs_size_to_loff_t(fattr->size);
|
||||||
else
|
else
|
||||||
nfsi->cache_validity |= NFS_INO_INVALID_ATTR
|
nfsi->cache_validity |= NFS_INO_INVALID_ATTR
|
||||||
| NFS_INO_INVALID_DATA
|
|
||||||
| NFS_INO_REVAL_PAGECACHE;
|
| NFS_INO_REVAL_PAGECACHE;
|
||||||
if (fattr->valid & NFS_ATTR_FATTR_NLINK)
|
if (fattr->valid & NFS_ATTR_FATTR_NLINK)
|
||||||
set_nlink(inode, fattr->nlink);
|
set_nlink(inode, fattr->nlink);
|
||||||
|
@ -363,15 +356,11 @@ nfs_fhget(struct super_block *sb, struct nfs_fh *fh, struct nfs_fattr *fattr)
|
||||||
if (fattr->valid & NFS_ATTR_FATTR_OWNER)
|
if (fattr->valid & NFS_ATTR_FATTR_OWNER)
|
||||||
inode->i_uid = fattr->uid;
|
inode->i_uid = fattr->uid;
|
||||||
else if (nfs_server_capable(inode, NFS_CAP_OWNER))
|
else if (nfs_server_capable(inode, NFS_CAP_OWNER))
|
||||||
nfsi->cache_validity |= NFS_INO_INVALID_ATTR
|
nfsi->cache_validity |= NFS_INO_INVALID_ATTR;
|
||||||
| NFS_INO_INVALID_ACCESS
|
|
||||||
| NFS_INO_INVALID_ACL;
|
|
||||||
if (fattr->valid & NFS_ATTR_FATTR_GROUP)
|
if (fattr->valid & NFS_ATTR_FATTR_GROUP)
|
||||||
inode->i_gid = fattr->gid;
|
inode->i_gid = fattr->gid;
|
||||||
else if (nfs_server_capable(inode, NFS_CAP_OWNER_GROUP))
|
else if (nfs_server_capable(inode, NFS_CAP_OWNER_GROUP))
|
||||||
nfsi->cache_validity |= NFS_INO_INVALID_ATTR
|
nfsi->cache_validity |= NFS_INO_INVALID_ATTR;
|
||||||
| NFS_INO_INVALID_ACCESS
|
|
||||||
| NFS_INO_INVALID_ACL;
|
|
||||||
if (fattr->valid & NFS_ATTR_FATTR_BLOCKS_USED)
|
if (fattr->valid & NFS_ATTR_FATTR_BLOCKS_USED)
|
||||||
inode->i_blocks = fattr->du.nfs2.blocks;
|
inode->i_blocks = fattr->du.nfs2.blocks;
|
||||||
if (fattr->valid & NFS_ATTR_FATTR_SPACE_USED) {
|
if (fattr->valid & NFS_ATTR_FATTR_SPACE_USED) {
|
||||||
|
|
Loading…
Reference in a new issue