mirror of
https://github.com/isar/libmdbx.git
synced 2025-01-30 22:47:16 +08:00
mdbx: allow sync_file_range() to fail for Valgrind/QEMU cases.
Change-Id: I9aa77d1debfbd0cb18e940946533e4ed758d08e8
This commit is contained in:
parent
c01750be2e
commit
a7a8631bc3
18
src/core.c
18
src/core.c
@ -4950,14 +4950,24 @@ __cold static int mdbx_wipe_steady(MDBX_env *env, const txnid_t last_steady) {
|
|||||||
return err;
|
return err;
|
||||||
} else {
|
} else {
|
||||||
#if MDBX_USE_SYNCFILERANGE
|
#if MDBX_USE_SYNCFILERANGE
|
||||||
if (sync_file_range(env->me_lazy_fd, 0, pgno2bytes(env, NUM_METAS),
|
static bool syncfilerange_unavailable;
|
||||||
SYNC_FILE_RANGE_WRITE | SYNC_FILE_RANGE_WAIT_AFTER))
|
if (likely(!syncfilerange_unavailable)) {
|
||||||
|
if (likely(!sync_file_range(
|
||||||
|
env->me_lazy_fd, 0, pgno2bytes(env, NUM_METAS),
|
||||||
|
SYNC_FILE_RANGE_WRITE | SYNC_FILE_RANGE_WAIT_AFTER)))
|
||||||
|
goto done_filesync;
|
||||||
err = errno;
|
err = errno;
|
||||||
#else
|
if (ignore_enosys(err) != MDBX_RESULT_TRUE)
|
||||||
|
return err;
|
||||||
|
syncfilerange_unavailable = true;
|
||||||
|
}
|
||||||
|
#endif /* MDBX_USE_SYNCFILERANGE */
|
||||||
err = mdbx_fsync(env->me_lazy_fd, MDBX_SYNC_DATA);
|
err = mdbx_fsync(env->me_lazy_fd, MDBX_SYNC_DATA);
|
||||||
#endif
|
|
||||||
if (unlikely(err != MDBX_SUCCESS))
|
if (unlikely(err != MDBX_SUCCESS))
|
||||||
return err;
|
return err;
|
||||||
|
#if MDBX_USE_SYNCFILERANGE
|
||||||
|
done_filesync:
|
||||||
|
#endif /* MDBX_USE_SYNCFILERANGE */
|
||||||
mdbx_flush_incoherent_mmap(env->me_map, pgno2bytes(env, NUM_METAS),
|
mdbx_flush_incoherent_mmap(env->me_map, pgno2bytes(env, NUM_METAS),
|
||||||
env->me_os_psize);
|
env->me_os_psize);
|
||||||
}
|
}
|
||||||
|
@ -184,9 +184,9 @@
|
|||||||
|
|
||||||
/** Advanced: Using sync_file_range() syscall (autodetection by default). */
|
/** Advanced: Using sync_file_range() syscall (autodetection by default). */
|
||||||
#ifndef MDBX_USE_SYNCFILERANGE
|
#ifndef MDBX_USE_SYNCFILERANGE
|
||||||
#if (defined(__linux__) || defined(__gnu_linux__)) && \
|
#if ((defined(__linux__) || defined(__gnu_linux__)) && __GLIBC_PREREQ(2, 6) && \
|
||||||
(!defined(__ANDROID_API__) || __ANDROID_API__ >= 26) && \
|
defined(_GNU_SOURCE)) || \
|
||||||
defined(_GNU_SOURCE) && !defined(MDBX_SAFE4QEMU)
|
(defined(__ANDROID_API__) && __ANDROID_API__ >= 26)
|
||||||
#define MDBX_USE_SYNCFILERANGE 1
|
#define MDBX_USE_SYNCFILERANGE 1
|
||||||
#else
|
#else
|
||||||
#define MDBX_USE_SYNCFILERANGE 0
|
#define MDBX_USE_SYNCFILERANGE 0
|
||||||
|
Loading…
x
Reference in New Issue
Block a user