提交 f2c77f4e 编写于 作者: T Trond Myklebust

NFS: Optimise nfs_lookup_revalidate()

We don't need to call nfs_revalidate_inode() on the directory if we already
know that the verifiers don't match.
Signed-off-by: NTrond Myklebust <Trond.Myklebust@netapp.com>
上级 6d2b2966
...@@ -646,9 +646,14 @@ static int nfs_check_verifier(struct inode *dir, struct dentry *dentry) ...@@ -646,9 +646,14 @@ static int nfs_check_verifier(struct inode *dir, struct dentry *dentry)
{ {
if (IS_ROOT(dentry)) if (IS_ROOT(dentry))
return 1; return 1;
if (nfs_verify_change_attribute(dir, dentry->d_time)) if (!nfs_verify_change_attribute(dir, dentry->d_time))
return 1; return 0;
return 0; /* Revalidate nfsi->cache_change_attribute before we declare a match */
if (nfs_revalidate_inode(NFS_SERVER(dir), dir) < 0)
return 0;
if (!nfs_verify_change_attribute(dir, dentry->d_time))
return 0;
return 1;
} }
static inline void nfs_set_verifier(struct dentry * dentry, unsigned long verf) static inline void nfs_set_verifier(struct dentry * dentry, unsigned long verf)
...@@ -742,10 +747,6 @@ static int nfs_lookup_revalidate(struct dentry * dentry, struct nameidata *nd) ...@@ -742,10 +747,6 @@ static int nfs_lookup_revalidate(struct dentry * dentry, struct nameidata *nd)
nfs_inc_stats(dir, NFSIOS_DENTRYREVALIDATE); nfs_inc_stats(dir, NFSIOS_DENTRYREVALIDATE);
inode = dentry->d_inode; inode = dentry->d_inode;
/* Revalidate parent directory attribute cache */
if (nfs_revalidate_inode(NFS_SERVER(dir), dir) < 0)
goto out_zap_parent;
if (!inode) { if (!inode) {
if (nfs_neg_need_reval(dir, dentry, nd)) if (nfs_neg_need_reval(dir, dentry, nd))
goto out_bad; goto out_bad;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册