]> git.baikalelectronics.ru Git - kernel.git/commit
NFS: Convert readdir page cache to use a cookie based index
authorTrond Myklebust <trond.myklebust@hammerspace.com>
Wed, 23 Feb 2022 16:31:51 +0000 (11:31 -0500)
committerTrond Myklebust <trond.myklebust@hammerspace.com>
Wed, 2 Mar 2022 13:43:39 +0000 (08:43 -0500)
commit4a0086850c4fbe0afc6a41905f38eaf2e0bfb32d
tree45c9e48027420cf9be617e967b178b06a3d40160
parent4fc9b174e20a8071d64815d4e6576dfe153cc65c
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: Trond Myklebust <trond.myklebust@hammerspace.com>
fs/nfs/Kconfig
fs/nfs/dir.c
include/linux/nfs_fs.h