mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2025-08-01 17:18:31 +08:00
revert disabling FSync for non Mac (#3814)
This commit is contained in:
parent
3550692afc
commit
5b28c3f728
@ -4,6 +4,7 @@ import (
|
|||||||
"github.com/seaweedfs/seaweedfs/weed/glog"
|
"github.com/seaweedfs/seaweedfs/weed/glog"
|
||||||
. "github.com/seaweedfs/seaweedfs/weed/storage/types"
|
. "github.com/seaweedfs/seaweedfs/weed/storage/types"
|
||||||
"os"
|
"os"
|
||||||
|
"runtime"
|
||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -11,6 +12,8 @@ var (
|
|||||||
_ BackendStorageFile = &DiskFile{}
|
_ BackendStorageFile = &DiskFile{}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
const isMac = runtime.GOOS == "darwin"
|
||||||
|
|
||||||
type DiskFile struct {
|
type DiskFile struct {
|
||||||
File *os.File
|
File *os.File
|
||||||
fullFilePath string
|
fullFilePath string
|
||||||
@ -81,6 +84,11 @@ func (df *DiskFile) Name() string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (df *DiskFile) Sync() error {
|
func (df *DiskFile) Sync() error {
|
||||||
return nil
|
if df.File == nil {
|
||||||
// return df.File.Sync()
|
return os.ErrInvalid
|
||||||
|
}
|
||||||
|
if isMac {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
return df.File.Sync()
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user