linux-nfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] NFS: Don't invalidate directory mapping until attributes expire
@ 2016-08-24 17:27 Benjamin Coddington
  2016-08-24 17:49 ` Trond Myklebust
  2016-08-26 15:37 ` [PATCH v2] NFS: " Benjamin Coddington
  0 siblings, 2 replies; 5+ messages in thread
From: Benjamin Coddington @ 2016-08-24 17:27 UTC (permalink / raw)
  To: linux-nfs; +Cc: Trond Myklebust, Anna Schumaker, Scott Mayhew

Commit 311324ad1713666a6e803aecf0d4e1a136a5b34a ("NFS: Be more aggressive
in using readdirplus for 'ls -l' situations") removed the optimization
added by commit 07b5ce8ef2d87f1914054804720d6facbaa3f4ce ("NFS: Make nfs_readdir
revalidate less often") to bypass the revalidation of the directory mapping
on subsequent calls into nfs_readdir().  Add that optimization back here.

A directory modified once every second and containing 40k entries takes my
system around 80 seconds to list.  With this patch, that time is reduced to
7 seconds.

Signed-off-by: Benjamin Coddington <bcodding@redhat.com>
---
 fs/nfs/dir.c | 13 +------------
 1 file changed, 1 insertion(+), 12 deletions(-)

diff --git a/fs/nfs/dir.c b/fs/nfs/dir.c
index 19d93d0cd400..9a036dc6caa3 100644
--- a/fs/nfs/dir.c
+++ b/fs/nfs/dir.c
@@ -872,17 +872,6 @@ int uncached_readdir(nfs_readdir_descriptor_t *desc)
 	goto out;
 }
 
-static bool nfs_dir_mapping_need_revalidate(struct inode *dir)
-{
-	struct nfs_inode *nfsi = NFS_I(dir);
-
-	if (nfs_attribute_cache_expired(dir))
-		return true;
-	if (nfsi->cache_validity & NFS_INO_INVALID_DATA)
-		return true;
-	return false;
-}
-
 /* The file offset position represents the dirent entry number.  A
    last cookie cache takes care of the common case of reading the
    whole directory.
@@ -914,7 +903,7 @@ static int nfs_readdir(struct file *file, struct dir_context *ctx)
 	desc->decode = NFS_PROTO(inode)->decode_dirent;
 	desc->plus = nfs_use_readdirplus(inode, ctx) ? 1 : 0;
 
-	if (ctx->pos == 0 || nfs_dir_mapping_need_revalidate(inode))
+	if (ctx->pos == 0 || nfs_attribute_cache_expired(inode))
 		res = nfs_revalidate_mapping(inode, file->f_mapping);
 	if (res < 0)
 		goto out;
-- 
2.5.5


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2016-11-18 13:28 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-08-24 17:27 [PATCH] NFS: Don't invalidate directory mapping until attributes expire Benjamin Coddington
2016-08-24 17:49 ` Trond Myklebust
2016-08-26 15:31   ` [PATCH] " Benjamin Coddington
2016-08-26 15:37 ` [PATCH v2] NFS: " Benjamin Coddington
2016-11-18 13:28   ` [PATCH v2] " Benjamin Coddington

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).