mirror of
https://github.com/isar/libmdbx.git
synced 2025-11-09 08:11:28 +08:00
mdbx: add workaround for ext4 fast-commit bug.
This commit is contained in:
10
src/osal.c
10
src/osal.c
@@ -1648,6 +1648,16 @@ int osal_fsetsize(mdbx_filehandle_t fd, const uint64_t length) {
|
|||||||
return MDBX_SUCCESS;
|
return MDBX_SUCCESS;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(__linux__) || defined(__gnu_linux__)
|
||||||
|
if (globals.linux_kernel_version < 0x05110000 && globals.linux_kernel_version >= 0x050a0000) {
|
||||||
|
struct statfs statfs_info;
|
||||||
|
if (fstatfs(fd, &statfs_info))
|
||||||
|
return errno;
|
||||||
|
if (statfs_info.f_type == 0xEF53 /* EXT4_SUPER_MAGIC */ && unlikely(fdatasync(fd)))
|
||||||
|
return errno;
|
||||||
|
}
|
||||||
|
#endif /* Linux */
|
||||||
|
|
||||||
return unlikely(ftruncate(fd, length)) ? errno : MDBX_SUCCESS;
|
return unlikely(ftruncate(fd, length)) ? errno : MDBX_SUCCESS;
|
||||||
|
|
||||||
#endif /* !Windows */
|
#endif /* !Windows */
|
||||||
|
|||||||
Reference in New Issue
Block a user