aboutsummaryrefslogtreecommitdiff
path: root/weed/storage/backend/disk_file_linux.go
diff options
context:
space:
mode:
authorRain Li <blacktear23@gmail.com>2022-08-10 23:21:57 +0800
committerGitHub <noreply@github.com>2022-08-10 08:21:57 -0700
commit670cb759f82815461bc854569542582da51a6199 (patch)
tree39e3e2cdcbf92b9fcf957f5507c0f9544375e634 /weed/storage/backend/disk_file_linux.go
parent662ec97602443a702c13c34283e72ab239291048 (diff)
downloadseaweedfs-670cb759f82815461bc854569542582da51a6199.tar.xz
seaweedfs-670cb759f82815461bc854569542582da51a6199.zip
Refactor for Sync method (#3426)
Diffstat (limited to 'weed/storage/backend/disk_file_linux.go')
-rw-r--r--weed/storage/backend/disk_file_linux.go14
1 files changed, 14 insertions, 0 deletions
diff --git a/weed/storage/backend/disk_file_linux.go b/weed/storage/backend/disk_file_linux.go
new file mode 100644
index 000000000..a38489dcf
--- /dev/null
+++ b/weed/storage/backend/disk_file_linux.go
@@ -0,0 +1,14 @@
+//go:build linux
+// +build linux
+
+package backend
+
+import (
+ "syscall"
+)
+
+// Using Fdatasync to optimize file sync operation
+func (df *DiskFile) Sync() error {
+ fd := df.File.Fd()
+ return syscall.Fdatasync(int(fd))
+}