NFS: Don't re-read the entire page cache to find the next cookie
authorTrond Myklebust <trond.myklebust@hammerspace.com>
Tue, 22 Feb 2022 13:59:33 +0000 (08:59 -0500)
committerTrond Myklebust <trond.myklebust@hammerspace.com>
Wed, 2 Mar 2022 13:43:38 +0000 (08:43 -0500)
commit728dd0ab37421396927749fc8cec9c2009c526c8
treeed2e2eb88ffafa5d64fad9be45a14c2a5a15f5de
parentd09e673f497164442ad7976a870d7cc857783fd4
NFS: Don't re-read the entire page cache to find the next cookie

If the page cache entry that was last read gets invalidated for some
reason, then make sure we can re-create it on the next call to readdir.
This, combined with the cache page validation, allows us to reuse the
cached value of page-index on successive calls to nfs_readdir.

Credit is due to Benjamin Coddington for showing that the concept works,
and that it allows for improved cache sharing between processes even in
the case where pages are lost due to LRU or active invalidation.

Suggested-by: Benjamin Coddington <bcodding@redhat.com>
Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
fs/nfs/dir.c
include/linux/nfs_fs.h