Checkout
kotkov
committed
on 22 May
io: Implement the functions that check for node existence using the native
Win32 APIs on Windows:

svn_io_check_path()
svn_io_check_reso… Show more
io: Implement the functions that check for node existence using the native

Win32 APIs on Windows:

 svn_io_check_path()

 svn_io_check_resolved_path()

 svn_io_check_special_path()

This changeset aims for two distinct things:

1) First of all, starting from r1833621, these functions were patched to stop

  checking symlinks on Windows.  The root cause for this change has been an

  incorrect implementation of stat in APR that didn't properly distinguish

  between various types of reparse points, some of which are not symlinks.

  Providing the custom implementation allows us to remove the hack and

  properly handle such reparse points irrespectively of the APR version

  in use.

  Additional details on the core of the issue can be found here:

  - https://github.com/golang/go/issues/23684

  - https://github.com/dotnet/corefx/issues/24250

2) These APIs are used in various performance-critical code paths such as

  in the core part of `svn st`.

  On Win32 the necessary answers for these particular functions can be

  obtained with a single call to GetFileAttributes(), which is much faster

  than using the generic stat implementations from APR 1.6.x and 1.7.x

  (I believe that it would be even slower in the latter case).

  A couple of quick tests show about 20%-25% improvement in the speed of

  `svn st` for a large working copy.  The improvement may be more significant

  with indexers or virus scanners, as just asking for file attributes may

  completely avoid opening a file (by retrieving the result through the

  fast I/O QueryOpen).

* subversion/libsvn_subr/io.c

 (FILE_ATTRIBUTE_TAG_INFO, FileAttributeTagInfo): Add these definitions

  for old versions of Windows SDK.

 (typedef GetFileInformationByHandleEx_t,

  get_file_information_by_handle_ex_proc): New.

 (win_init_dynamic_imports): Import `GetFileInformationByHandleEx()`.

 (win32_get_file_information_by_handle): New helper function.

 (io_win_check_path): New helper with the Win32 implementation required

  for the "check path" functions.

 (svn_io_check_path,

  svn_io_check_resolved_path,

  svn_io_check_special_path): Invoke the new helper.

 (io_check_path): Undo the workaround from r1833621 that stopped passing

  APR_FINFO_LINK when performing a stat.

Show less