SeaweedFS is a distributed storage system for object storage (S3), file systems, Iceberg table buckets, and Lance vector buckets, designed to handle billions of files with O(1) disk access and effortless horizontal scaling.
Go blob-storagecloud-drivedistributed-file-systemdistributed-storageerasure-codingfusehadoop-hdfshdfskuberneteslancelancedbobject-storageposixs3s3-storageseaweedfstiered-file-systemvector-search
Revert "Refactor for Sync method (#3426)"
chrislu93261f519999
diff --git a/weed/storage/backend/disk_file.go b/weed/storage/backend/disk_file.goindex 93a2f8cccb..0dd153d5d3 100644--- a/weed/storage/backend/disk_file.go+++ b/weed/storage/backend/disk_file.go@@ -1,11 +1,10 @@package backendimport (- "os"- "time"-"github.com/seaweedfs/seaweedfs/weed/glog". "github.com/seaweedfs/seaweedfs/weed/storage/types"+ "os"+ "time")var (@@ -80,3 +79,8 @@ func (df *DiskFile) GetStat() (datSize int64, modTime time.Time, err error) {func (df *DiskFile) Name() string {return df.fullFilePath}++func (df *DiskFile) Sync() error {+ return nil+ // return df.File.Sync()+}diff --git a/weed/storage/backend/disk_file_darwin.go b/weed/storage/backend/disk_file_darwin.godeleted file mode 100644index 76be810dbb..0000000000--- a/weed/storage/backend/disk_file_darwin.go+++ /dev/null@@ -1,43 +0,0 @@-//go:build darwin-// +build darwin--package backend--import (- "syscall"-- "golang.org/x/sys/unix"-)--const (- // Using default File.Sync function, same as fcntl(fd, F_FULLFSYNC)- DM_SYNC = 1-- // Using syscall.Fsync function, for MacOS this is not safe but is very fast.- DM_FSYNC = 2-- // Using fcntl with F_BARRIERFSYNC parameter, for more details please refer:- // https://developer.apple.com/documentation/xcode/reducing-disk-writes- DM_BFSYNC = 3-- F_BARRIERFSYNC = 85-)--var (- // By default using F_BARRIERFSYNC- DarwinSyncMode = DM_BFSYNC-)--func (df *DiskFile) Sync() error {- switch DarwinSyncMode {- case DM_SYNC:- return df.File.Sync()- case DM_BFSYNC:- fd := df.File.Fd()- _, err := unix.FcntlInt(fd, F_BARRIERFSYNC, 0)- return err- default:- fd := df.File.Fd()- return syscall.Fsync(int(fd))- }-}diff --git a/weed/storage/backend/disk_file_linux.go b/weed/storage/backend/disk_file_linux.godeleted file mode 100644index a38489dcf2..0000000000--- a/weed/storage/backend/disk_file_linux.go+++ /dev/null@@ -1,14 +0,0 @@-//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))-}diff --git a/weed/storage/backend/disk_file_others.go b/weed/storage/backend/disk_file_others.godeleted file mode 100644index 08d29d2175..0000000000--- a/weed/storage/backend/disk_file_others.go+++ /dev/null@@ -1,9 +0,0 @@-//go:build !linux && !darwin-// +build !linux,!darwin--package backend--// Using default sync operation-func (df *DiskFile) Sync() error {- return df.File.Sync()-}