Checkout
Ivan Zhakov
committed
on 03 Sep 15
Implement svn_io_file_rename2() with FLUSH_TO_DISK flag to require OS to
wait until rename operation is actually written to disk. Discussed … Show more
Implement svn_io_file_rename2() with FLUSH_TO_DISK flag to require OS to

wait until rename operation is actually written to disk. Discussed in thread

"svn commit: r1682265 - /subversion/trunk/subversion/libsvn_fs_fs/util.c" on

dev@s.a.o [1]

[1] http://svn.haxx.se/dev/archive-2015-05/0211.shtml

* subversion/include/svn_io.h

 (svn_io_file_rename2): New function declaration.

 (svn_io_file_rename): Deprecate.

* subversion/libsvn_subr/io.c

 (win32_file_rename): Use MOVEFILE_WRITE_THROUGH flag in call to

  MoveFileExW if FLUSH_TO_DISK is non-zero.

 (svn_io_file_rename2): Revv from svn_io_file_rename(). Add FLUSH_TO_DISK

  parameter and perform flush to disk operation depending on the platform:

  use MoveFileEx flag on Windows, fsync() target directory on POSIX and

  fsync() target file on all other platforms. This logic mostly copied

  from svn_fs_fs__move_into_place().

 (svn_io_copy_link, svn_io_copy_file, svn_io_write_atomic,

  svn_io_write_version_file): Use svn_io_rename2() with

  FLUSH_TO_DISK=FALSE instead of svn_io_rename().

* subversion/tests/libsvn_subr/io-test.c

 (test_file_rename2): Simple tests for svn_io_file_rename2().

 (test_funcs): Add test_file_rename2.

* subversion/libsvn_subr/deprecated.c

 (svn_io_file_rename): Call svn_io_file_rename2() with FLUSH_TO_DISK=FALSE.

* subversion/libsvn_client/copy.c

* subversion/libsvn_client/export.c

* subversion/libsvn_client/externals.c

* subversion/libsvn_fs_fs/fs_fs.c

* subversion/libsvn_fs_fs/lock.c

* subversion/libsvn_fs_fs/transaction.c

* subversion/libsvn_fs_fs/util.c

* subversion/libsvn_fs_x/lock.c

* subversion/libsvn_fs_x/transaction.c

* subversion/libsvn_fs_x/util.c

* subversion/libsvn_subr/config_auth.c

* subversion/libsvn_subr/stream.c

* subversion/libsvn_subr/subst.c

* subversion/libsvn_wc/copy.c

* subversion/libsvn_wc/node.c

* subversion/libsvn_wc/upgrade.c

* subversion/libsvn_wc/wc_db_pristine.c

* subversion/libsvn_wc/workqueue.c

 (*): Use svn_io_file_rename2() with FLUSH_TO_DISK=FALSE instead of

 svn_io_file_rename().

Show less