mdbx: provide MDBX_USE_SYNCFILERANGE option.

Change-Id: Icf1f27d6203653b4e2f2180a59a65e958c4d5e2e
This commit is contained in:
Leonid Yuriev 2020-09-21 03:03:20 +03:00
parent 5c3655dff9
commit c01750be2e
2 changed files with 12 additions and 3 deletions

View File

@ -4949,9 +4949,7 @@ __cold static int mdbx_wipe_steady(MDBX_env *env, const txnid_t last_steady) {
if (unlikely(err != MDBX_SUCCESS))
return err;
} else {
#if (defined(__linux__) || defined(__gnu_linux__)) && \
(!defined(__ANDROID_API__) || __ANDROID_API__ >= 26) && \
defined(_GNU_SOURCE) && !defined(MDBX_SAFE4QEMU)
#if MDBX_USE_SYNCFILERANGE
if (sync_file_range(env->me_lazy_fd, 0, pgno2bytes(env, NUM_METAS),
SYNC_FILE_RANGE_WRITE | SYNC_FILE_RANGE_WAIT_AFTER))
err = errno;

View File

@ -182,6 +182,17 @@
#endif
#endif /* MDBX_USE_COPYFILERANGE */
/** Advanced: Using sync_file_range() syscall (autodetection by default). */
#ifndef MDBX_USE_SYNCFILERANGE
#if (defined(__linux__) || defined(__gnu_linux__)) && \
(!defined(__ANDROID_API__) || __ANDROID_API__ >= 26) && \
defined(_GNU_SOURCE) && !defined(MDBX_SAFE4QEMU)
#define MDBX_USE_SYNCFILERANGE 1
#else
#define MDBX_USE_SYNCFILERANGE 0
#endif
#endif /* MDBX_USE_SYNCFILERANGE */
//------------------------------------------------------------------------------
#ifndef MDBX_CPU_WRITEBACK_INCOHERENT