]> 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)
commitbfb04c365314b6c188ab98f363442e5e8e157be1
tree45c9e48027420cf9be617e967b178b06a3d40160
parent646e955e81bd40ea8072b362eb070e35036c7b39
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