]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
nfscl: Use hash lists to improve expected search performance for opens
authorRick Macklem <rmacklem@FreeBSD.org>
Fri, 28 May 2021 02:08:36 +0000 (19:08 -0700)
committerRick Macklem <rmacklem@FreeBSD.org>
Fri, 28 May 2021 02:08:36 +0000 (19:08 -0700)
commit96b40b896772bbce5f93d62eaa640e1eb51b4a30
treebca0caded4761b6f182765b711926eccc77871ef
parentf81b451dcccd449388dd1b7901683d4cdd481a6e
nfscl: Use hash lists to improve expected search performance for opens

A problem was reported via email, where a large (130000+) accumulation
of NFSv4 opens on an NFSv4 mount caused significant lock contention
on the mutex used to protect the client mount's open/lock state.
Although the root cause for the accumulation of opens was not
resolved, it is obvious that the NFSv4 client is not designed to
handle 100000+ opens efficiently.  When searching for an open,
usually for a match by file handle, a linear search of all opens
is done.

Commit 3f7e14ad9345 added a hash table of lists hashed on file handle
for the opens.  This patch uses the hash lists for searching for
a matching open based of file handle instead of an exhaustive
linear search of all opens.
This change appears to be performance neutral for a small number
of opens, but should improve expected performance for a large
number of opens.

This commit should not affect the high level semantics of open
handling.

MFC after: 2 weeks
sys/fs/nfsclient/nfs_clstate.c