HomeFreeBSD

Optimize pathologic case of telldir() for Samba.

Description

Optimize pathologic case of telldir() for Samba.

When application reads large directory, calling telldir() for each entry,
like Samba does, it creates exponential performance drop as number of
entries reach tenths to hundreds of thousands. It is caused by full search
through the internal list, that never finds matches in that scenario, but
creates O(n^2) delays. This patch optimizes that search, limiting it to
entries of the same buffer, turning time closer to O(n) in case of linear
directory scan.

PR: 218622
Reviewed by: jhb, jilles
MFC after: 2 weeks
Sponsored by: iXsystems, Inc.
Differential Revision: https://reviews.freebsd.org/D10408

Details

Provenance
mavAuthored on
Reviewer
jhb
Differential Revision
D10408: Optimize pathologic case of telldir()
Parents
rS317063: Remove trailing whitespace from r317061
Branches
Unknown
Tags
Unknown