OSDN Git Service

NFS: Do uncached readdir when we're seeking a cookie in an empty page cache
authorTrond Myklebust <trond.myklebust@hammerspace.com>
Sat, 7 Nov 2020 01:47:05 +0000 (20:47 -0500)
committerTrond Myklebust <trond.myklebust@hammerspace.com>
Wed, 2 Dec 2020 19:05:52 +0000 (14:05 -0500)
commit794092c57f89c2c833da00f82f38a0afcb4033bc
treeb5f6e8a2b84eb4e959ad99d34265b4e98d11ac05
parent35df59d3ef693292840a61cdb04b39d8c9412f4e
NFS: Do uncached readdir when we're seeking a cookie in an empty page cache

If the directory is changing, causing the page cache to get invalidated
while we are listing the contents, then the NFS client is currently forced
to read in the entire directory contents from scratch, because it needs
to perform a linear search for the readdir cookie. While this is not
an issue for small directories, it does not scale to directories with
millions of entries.
In order to be able to deal with large directories that are changing,
add a heuristic to ensure that if the page cache is empty, and we are
searching for a cookie that is not the zero cookie, we just default to
performing uncached readdir.

Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
Reviewed-by: Benjamin Coddington <bcodding@redhat.com>
Tested-by: Benjamin Coddington <bcodding@redhat.com>
Tested-by: Dave Wysochanski <dwysocha@redhat.com>
fs/nfs/dir.c