From: Benjamin Coddington <bcodding@redhat.com>
To: linux-nfs@vger.kernel.org
Cc: Trond Myklebust <trond.myklebust@primarydata.com>,
Anna Schumaker <anna.schumaker@netapp.com>,
Scott@redhat.com, "Mayhew <smayhew"@redhat.com
Subject: [PATCH v2] NFS: Don't invalidate directory mapping until attributes expire
Date: Fri, 26 Aug 2016 11:37:37 -0400 [thread overview]
Message-ID: <e0f959ab63372fef427e6d1cccf7e85d1f4b51c1.1472225243.git.bcodding@redhat.com> (raw)
In-Reply-To: <67cfa1f7f028229bfd4b1ac2619bc85b9e34ef7f.1472059583.git.bcodding@redhat.com>
This approach uses another bit in the inode flags.. if that's too expensive
for this ls -l optimization, I will look for another way.
Change from v1:
Doesn't completely break the commit 311324ad1713 functionality.
8<-----------------------------------------------------------------------------
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 | 3 ++-
include/linux/nfs_fs.h | 1 +
2 files changed, 3 insertions(+), 1 deletion(-)
diff --git a/fs/nfs/dir.c b/fs/nfs/dir.c
index 19d93d0cd400..88f5dd561025 100644
--- a/fs/nfs/dir.c
+++ b/fs/nfs/dir.c
@@ -477,6 +477,7 @@ void nfs_force_use_readdirplus(struct inode *dir)
{
if (!list_empty(&NFS_I(dir)->open_files)) {
nfs_advise_use_readdirplus(dir);
+ set_bit(NFS_INO_FORCE_RDPLUS, &NFS_I(dir)->flags);
nfs_zap_mapping(dir, dir->i_mapping);
}
}
@@ -878,7 +879,7 @@ static bool nfs_dir_mapping_need_revalidate(struct inode *dir)
if (nfs_attribute_cache_expired(dir))
return true;
- if (nfsi->cache_validity & NFS_INO_INVALID_DATA)
+ if (test_and_clear_bit(NFS_INO_FORCE_RDPLUS, &nfsi->flags))
return true;
return false;
}
diff --git a/include/linux/nfs_fs.h b/include/linux/nfs_fs.h
index d71278c3c5bd..729cddb7364f 100644
--- a/include/linux/nfs_fs.h
+++ b/include/linux/nfs_fs.h
@@ -211,6 +211,7 @@ struct nfs_inode {
#define NFS_INO_LAYOUTCOMMIT (9) /* layoutcommit required */
#define NFS_INO_LAYOUTCOMMITTING (10) /* layoutcommit inflight */
#define NFS_INO_LAYOUTSTATS (11) /* layoutstats inflight */
+#define NFS_INO_FORCE_RDPLUS (12) /* force readdirplus */
static inline struct nfs_inode *NFS_I(const struct inode *inode)
{
--
2.5.5
next prev parent reply other threads:[~2016-08-26 15:38 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
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 ` Benjamin Coddington [this message]
2016-11-18 13:28 ` [PATCH v2] " Benjamin Coddington
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=e0f959ab63372fef427e6d1cccf7e85d1f4b51c1.1472225243.git.bcodding@redhat.com \
--to=bcodding@redhat.com \
--cc="Mayhew <smayhew"@redhat.com \
--cc=Scott@redhat.com \
--cc=anna.schumaker@netapp.com \
--cc=linux-nfs@vger.kernel.org \
--cc=trond.myklebust@primarydata.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).