diff options
author | Scott Mayhew <smayhew@redhat.com> | 2013-07-05 17:49:31 -0400 |
---|---|---|
committer | Trond Myklebust <Trond.Myklebust@netapp.com> | 2013-07-09 17:17:07 -0400 |
commit | 07b5ce8ef2d87f1914054804720d6facbaa3f4ce (patch) | |
tree | 9f89c1704d7501d14a3ffd9451f8ee6d4054a3c2 /fs | |
parent | 43f291cd0754f8f10c2cd701e014936f708dab59 (diff) |
NFS: Make nfs_readdir revalidate less often
Make nfs_readdir revalidate only when we're at the beginning of the directory or
if the cached attributes have expired.
Signed-off-by: Scott Mayhew <smayhew@redhat.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/nfs/dir.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/fs/nfs/dir.c b/fs/nfs/dir.c index bd7e1cc53b90..e474ca2b2bfe 100644 --- a/fs/nfs/dir.c +++ b/fs/nfs/dir.c | |||
@@ -818,7 +818,7 @@ static int nfs_readdir(struct file *file, struct dir_context *ctx) | |||
818 | nfs_readdir_descriptor_t my_desc, | 818 | nfs_readdir_descriptor_t my_desc, |
819 | *desc = &my_desc; | 819 | *desc = &my_desc; |
820 | struct nfs_open_dir_context *dir_ctx = file->private_data; | 820 | struct nfs_open_dir_context *dir_ctx = file->private_data; |
821 | int res; | 821 | int res = 0; |
822 | 822 | ||
823 | dfprintk(FILE, "NFS: readdir(%s/%s) starting at cookie %llu\n", | 823 | dfprintk(FILE, "NFS: readdir(%s/%s) starting at cookie %llu\n", |
824 | dentry->d_parent->d_name.name, dentry->d_name.name, | 824 | dentry->d_parent->d_name.name, dentry->d_name.name, |
@@ -840,7 +840,8 @@ static int nfs_readdir(struct file *file, struct dir_context *ctx) | |||
840 | desc->plus = nfs_use_readdirplus(inode, ctx) ? 1 : 0; | 840 | desc->plus = nfs_use_readdirplus(inode, ctx) ? 1 : 0; |
841 | 841 | ||
842 | nfs_block_sillyrename(dentry); | 842 | nfs_block_sillyrename(dentry); |
843 | res = nfs_revalidate_mapping(inode, file->f_mapping); | 843 | if (ctx->pos == 0 || nfs_attribute_cache_expired(inode)) |
844 | res = nfs_revalidate_mapping(inode, file->f_mapping); | ||
844 | if (res < 0) | 845 | if (res < 0) |
845 | goto out; | 846 | goto out; |
846 | 847 | ||