summaryrefslogtreecommitdiff
path: root/fs
diff options
context:
space:
mode:
authorTrond Myklebust <Trond.Myklebust@netapp.com>2010-09-24 22:49:43 (GMT)
committerTrond Myklebust <Trond.Myklebust@netapp.com>2010-10-23 19:27:30 (GMT)
commitbaf57a09e9d87b14be5e2788828169394a2525ab (patch)
tree77b35fe3ef7868f3c642093a4a8c01ed6be584cd /fs
parentd1bacf9eb2fd0e7ef870acf84b9e3b157dcfa7dc (diff)
downloadlinux-baf57a09e9d87b14be5e2788828169394a2525ab.tar.xz
NFS: Optimise the readdir searches
If we're going through the loop in nfs_readdir() more than once, we usually do not want to restart searching from the beginning of the pages cache. We only want to do that if the previous search failed... Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs')
-rw-r--r--fs/nfs/dir.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/fs/nfs/dir.c b/fs/nfs/dir.c
index f772439..33b0ce7 100644
--- a/fs/nfs/dir.c
+++ b/fs/nfs/dir.c
@@ -491,10 +491,6 @@ static inline
int readdir_search_pagecache(nfs_readdir_descriptor_t *desc)
{
int res = -EAGAIN;
- desc->page_index = 0;
-
- if (*desc->dir_cookie == 0)
- desc->cache_entry_index = 0;
while (1) {
res = find_cache_page(desc);
@@ -589,6 +585,7 @@ int uncached_readdir(nfs_readdir_descriptor_t *desc, void *dirent,
goto out_release;
}
+ desc->page_index = 0;
desc->page = page;
status = nfs_do_filldir(desc, dirent, filldir);
@@ -653,6 +650,7 @@ static int nfs_readdir(struct file *filp, void *dirent, filldir_t filldir)
if (res == -ETOOSMALL && desc->plus) {
clear_bit(NFS_INO_ADVISE_RDPLUS, &NFS_I(inode)->flags);
nfs_zap_caches(inode);
+ desc->page_index = 0;
desc->plus = 0;
desc->eof = 0;
continue;