mirror of
https://github.com/isar/libmdbx.git
synced 2025-04-25 06:12:25 +08:00
mdbx: provide MDBX_USE_SYNCFILERANGE option.
Change-Id: Icf1f27d6203653b4e2f2180a59a65e958c4d5e2e
This commit is contained in:
parent
5c3655dff9
commit
c01750be2e
@ -4949,9 +4949,7 @@ __cold static int mdbx_wipe_steady(MDBX_env *env, const txnid_t last_steady) {
|
|||||||
if (unlikely(err != MDBX_SUCCESS))
|
if (unlikely(err != MDBX_SUCCESS))
|
||||||
return err;
|
return err;
|
||||||
} else {
|
} else {
|
||||||
#if (defined(__linux__) || defined(__gnu_linux__)) && \
|
#if MDBX_USE_SYNCFILERANGE
|
||||||
(!defined(__ANDROID_API__) || __ANDROID_API__ >= 26) && \
|
|
||||||
defined(_GNU_SOURCE) && !defined(MDBX_SAFE4QEMU)
|
|
||||||
if (sync_file_range(env->me_lazy_fd, 0, pgno2bytes(env, NUM_METAS),
|
if (sync_file_range(env->me_lazy_fd, 0, pgno2bytes(env, NUM_METAS),
|
||||||
SYNC_FILE_RANGE_WRITE | SYNC_FILE_RANGE_WAIT_AFTER))
|
SYNC_FILE_RANGE_WRITE | SYNC_FILE_RANGE_WAIT_AFTER))
|
||||||
err = errno;
|
err = errno;
|
||||||
|
@ -182,6 +182,17 @@
|
|||||||
#endif
|
#endif
|
||||||
#endif /* MDBX_USE_COPYFILERANGE */
|
#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
|
#ifndef MDBX_CPU_WRITEBACK_INCOHERENT
|
||||||
|
Loading…
x
Reference in New Issue
Block a user