Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fscache: teach fscache to use NtQueryDirectoryFile #1937

Merged
merged 2 commits into from Nov 27, 2018
Merged

fscache: teach fscache to use NtQueryDirectoryFile #1937

merged 2 commits into from Nov 27, 2018

Commits on Nov 27, 2018

  1. fixup! mingw: Windows Docker volumes are *not* symbolic links

    The code in question is unclear, and not everbody has the time to dig up
    the commit message for the commit that added it, so let's play nice and
    add an explanation as a code comment.
    
    Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
    dscho committed Nov 27, 2018
    Copy the full SHA
    c545663 View commit details
    Browse the repository at this point in the history
  2. fscache: teach fscache to use NtQueryDirectoryFile

    Using FindFirstFileExW() requires the OS to allocate a 64K buffer for each
    directory and then free it when we call FindClose().  Update fscache to call
    the underlying kernel API NtQueryDirectoryFile so that we can do the buffer
    management ourselves.  That allows us to allocate a single buffer for the
    lifetime of the cache and reuse it for each directory.
    
    This change improves performance of 'git status' by 18% in a repo with ~200K
    files and 30k folders.
    
    Documentation for NtQueryDirectoryFile can be found at:
    
    https://docs.microsoft.com/en-us/windows-hardware/drivers/ddi/content/ntifs/nf-ntifs-ntquerydirectoryfile
    https://docs.microsoft.com/en-us/windows/desktop/FileIO/file-attribute-constants
    https://docs.microsoft.com/en-us/windows/desktop/fileio/reparse-point-tags
    
    To determine if the specified directory is a symbolic link, inspect the
    FileAttributes member to see if the FILE_ATTRIBUTE_REPARSE_POINT flag is
    set. If so, EaSize will contain the reparse tag (this is a so far
    undocumented feature, but confirmed by the NTFS developers). To
    determine if the reparse point is a symbolic link (and not some other
    form of reparse point), test whether the tag value equals the value
    IO_REPARSE_TAG_SYMLINK.
    
    Signed-off-by: Ben Peart <benpeart@microsoft.com>
    benpeart authored and dscho committed Nov 27, 2018
    Copy the full SHA
    23d89f8 View commit details
    Browse the repository at this point in the history