From b7d22e8fbfcc21fed36ec61275499086f46e6a8c Mon Sep 17 00:00:00 2001 From: Nuno Cruces <ncruces@users.noreply.github.com> Date: Thu, 21 Mar 2024 15:04:59 +0000 Subject: [PATCH] Fdatasync. --- vfs/os_linux.go | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/vfs/os_linux.go b/vfs/os_linux.go index 8b89e88b..a0484eb6 100644 --- a/vfs/os_linux.go +++ b/vfs/os_linux.go @@ -8,15 +8,9 @@ import ( "golang.org/x/sys/unix" ) -func osSync(file *os.File, _ /*fullsync*/, dataonly bool) error { - if dataonly { - _, _, err := unix.Syscall(unix.SYS_FDATASYNC, file.Fd(), 0, 0) - if err != 0 { - return err - } - return nil - } - return file.Sync() +func osSync(file *os.File, _ /*fullsync*/, _ /*dataonly*/ bool) error { + // SQLite trusts Linux's fdatasync for all fsync's. + return unix.Fdatasync(int(file.Fd())) } func osAllocate(file *os.File, size int64) error {