Skip to content
  • Rick Macklem's avatar
    nfscl: Use hash lists to improve expected search performance for opens · 724072ab
    Rick Macklem authored
    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 3f7e14ad 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 patch also moves any found match to the front
    of the hash list, to try and maintain the hash lists in recently
    used ordering (least recently used at the end of the list).
    
    This commit should not affect the high level semantics of open
    handling.
    
    MFC after:	2 weeks
    724072ab