]> git.ipfire.org Git - thirdparty/linux.git/commit
9p: Cache negative dentries for lookup performance
authorRemi Pommarel <repk@triplefau.lt>
Thu, 21 May 2026 09:40:29 +0000 (11:40 +0200)
committerDominique Martinet <asmadeus@codewreck.org>
Sun, 21 Jun 2026 05:22:56 +0000 (05:22 +0000)
commitf00e6c1d282578b077b87b88f42e701bc40f2fff
treebfb721455665c346bfdcf19cc918f485cad6a5ab
parent314b58c01a9047567fd19446ca5fd46c473b89ff
9p: Cache negative dentries for lookup performance

Not caching negative dentries can result in poor performance for
workloads that repeatedly look up non-existent paths. Each such
lookup triggers a full 9P transaction with the server, adding
unnecessary overhead.

A typical example is source compilation, where multiple cc1 processes
are spawned and repeatedly search for the same missing header files
over and over again.

This change enables caching of negative dentries, so that lookups for
known non-existent paths do not require a full 9P transaction. The
cached negative dentries are retained for a configurable duration
(expressed in milliseconds), as specified by the ndentry_timeout
field in struct v9fs_session_info. If set to -1, negative dentries
are cached indefinitely.

This optimization reduces lookup overhead and improves performance for
workloads involving frequent access to non-existent paths.

Signed-off-by: Remi Pommarel <repk@triplefau.lt>
Message-ID: <e542317dd03bbadb5249abd3ea6aecfdca692c19.1779355927.git.repk@triplefau.lt>
Signed-off-by: Dominique Martinet <asmadeus@codewreck.org>
fs/9p/fid.c
fs/9p/v9fs.c
fs/9p/v9fs.h
fs/9p/v9fs_vfs.h
fs/9p/vfs_dentry.c
fs/9p/vfs_inode.c
fs/9p/vfs_super.c
include/net/9p/client.h