mirror of
https://github.com/isar/libmdbx.git
synced 2025-01-02 01:14:13 +08:00
mdbx: skip msync(MS_ASYNC) on Linux > 2.6.19.
Change-Id: Ic1f631ef856a09cf62353c2b0092b0341ecf4fa2
This commit is contained in:
parent
dcd4574510
commit
261f697d8c
@ -784,6 +784,13 @@ int mdbx_msync(mdbx_mmap_t *map, size_t offset, size_t length, int async) {
|
||||
return MDBX_SUCCESS;
|
||||
return GetLastError();
|
||||
#else
|
||||
#ifdef __linux__
|
||||
if (async && linux_kernel_version > 0x02061300)
|
||||
/* Since Linux 2.6.19, MS_ASYNC is in fact a no-op,
|
||||
since the kernel properly tracks dirty pages and flushes them to storage
|
||||
as necessary. */
|
||||
return MDBX_SUCCESS;
|
||||
#endif /* Linux */
|
||||
const int mode = async ? MS_ASYNC : MS_SYNC;
|
||||
return (msync(ptr, length, mode) == 0) ? MDBX_SUCCESS : errno;
|
||||
#endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user