Neil Bird <neil@jibbyjobby.co.uk>


Suggested
r1075950

r1075950 | stsp | 2011-03-01 18:00:41 +0000 (Tue, 01 Mar 2011)

On the 1.6.x-issue3719 branch, backport a few performance-related
changes in the way temporary files are created.

Related thread:
  Date: Thu, 03 Feb 2011 16:18:32 +0000
  From: Neil Bird
  To: dev@
  Subject: [PATCH] issue #3719 fix slow large checkouts on Windows
  Message-ID: <4D4AD558.3010705@jibbyjobby.co.uk>
  http://svn.haxx.se/dev/archive-2011-02/0066.shtml

This backport does not have any mergeinfo associated with it.
The changes were made on trunk in several revisions, so it was easier
to just copy the current trunk code over and tweak it into shape instead
of merging individual revisions. For this reason, I've written a new log
message that describes the change.

Suggested by: Neil Bird <neil@jibbyjobby.co.uk>
(who also provided an initial patch, and tested this patch)

* subversion/libsvn_subr/io.c
  (): Include svn_dirent_uri.h.
  (temp_file_create): New helper. Uses apr_file_mktemp() on non-Windows systems.
   On Windows systems, it uses a custom implementation that works much like
   svn_io_open_uniquely_named(), but with a pseudo-random value for numbers
   within the filename.
  (svn_io_open_unique_file3): Instead of calling svn_io_open_uniquely_named(),
   use temp_file_create().
  (file_perms_set2): New helper. On trunk, this function has a sibling called
   file_perms_set() which we don't need here.
  (get_default_file_perms): Create a temporary file inside the function
   instead of opening a file at a path provided by the caller.
   As a performance optimisation, cache the default file permissions in
   a static variable upon the first call. Subsequent calls will not go
   to disk but return the cached value.
  (merge_default_file_perms): New helper.
  (io_set_file_perms): Don't overwrite existing permission bits when making
   a file read-write.