Commit f648022f authored by Trond Myklebust's avatar Trond Myklebust

NFS: Convert readdir page cache to use a cookie based index

Instead of using a linear index to address the pages, use the cookie of
the first entry, since that is what we use to match the page anyway.

This allows us to avoid re-reading the entire cache on a seekdir() type
of operation. The latter is very common when re-exporting NFS, and is a
major performance drain.

The change does affect our duplicate cookie detection, since we can no
longer rely on the page index as a linear offset for detecting whether
we looped backwards. However since we no longer do a linear search
through all the pages on each call to nfs_readdir(), this is less of a
concern than it was previously.
The other downside is that invalidate_mapping_pages() no longer can use
the page index to avoid clearing pages that have been read. A subsequent
patch will restore the functionality this provides to the 'ls -l'
heuristic.
Signed-off-by: default avatarTrond Myklebust <trond.myklebust@hammerspace.com>
parent 9332cf14
...@@ -4,6 +4,10 @@ config NFS_FS ...@@ -4,6 +4,10 @@ config NFS_FS
depends on INET && FILE_LOCKING && MULTIUSER depends on INET && FILE_LOCKING && MULTIUSER
select LOCKD select LOCKD
select SUNRPC select SUNRPC
select CRYPTO
select CRYPTO_HASH
select XXHASH
select CRYPTO_XXHASH
select NFS_ACL_SUPPORT if NFS_V3_ACL select NFS_ACL_SUPPORT if NFS_V3_ACL
help help
Choose Y here if you want to access files residing on other Choose Y here if you want to access files residing on other
......
This diff is collapsed.
...@@ -106,11 +106,9 @@ struct nfs_open_dir_context { ...@@ -106,11 +106,9 @@ struct nfs_open_dir_context {
unsigned long attr_gencount; unsigned long attr_gencount;
__be32 verf[NFS_DIR_VERIFIER_SIZE]; __be32 verf[NFS_DIR_VERIFIER_SIZE];
__u64 dir_cookie; __u64 dir_cookie;
__u64 dup_cookie;
__u64 last_cookie; __u64 last_cookie;
pgoff_t page_index; pgoff_t page_index;
unsigned int dtsize; unsigned int dtsize;
signed char duped;
bool eof; bool eof;
struct rcu_head rcu_head; struct rcu_head rcu_head;
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment