mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2024-01-19 02:48:24 +00:00
mount: use direct_io to avoid OS page cache
fix https://github.com/chrislusf/seaweedfs/issues/1752
This commit is contained in:
parent
711c3f3939
commit
20ef3bb8d4
|
@ -91,6 +91,9 @@ func (file *File) Getxattr(ctx context.Context, req *fuse.GetxattrRequest, resp
|
|||
func (file *File) Open(ctx context.Context, req *fuse.OpenRequest, resp *fuse.OpenResponse) (fs.Handle, error) {
|
||||
|
||||
glog.V(4).Infof("file %v open %+v", file.fullpath(), req)
|
||||
if USE_DIRECT_IO {
|
||||
resp.Flags |= fuse.OpenDirectIO
|
||||
}
|
||||
|
||||
handle := file.wfs.AcquireHandle(file, req.Uid, req.Gid)
|
||||
|
||||
|
|
8
weed/filesys/file_darwin.go
Normal file
8
weed/filesys/file_darwin.go
Normal file
|
@ -0,0 +1,8 @@
|
|||
//+build darwin
|
||||
|
||||
package filesys
|
||||
|
||||
const (
|
||||
USE_DIRECT_IO = false
|
||||
)
|
||||
|
7
weed/filesys/file_other.go
Normal file
7
weed/filesys/file_other.go
Normal file
|
@ -0,0 +1,7 @@
|
|||
//+build !darwin
|
||||
|
||||
package filesys
|
||||
|
||||
const (
|
||||
USE_DIRECT_IO = true
|
||||
)
|
|
@ -90,8 +90,9 @@ func (fh *FileHandle) Read(ctx context.Context, req *fuse.ReadRequest, resp *fus
|
|||
glog.Warningf("%s FileHandle Read %d: [%d,%d) size %d totalRead %d", fh.f.fullpath(), fh.handle, req.Offset, req.Offset+int64(req.Size), req.Size, totalRead)
|
||||
totalRead = min(int64(len(buff)), totalRead)
|
||||
}
|
||||
// resp.Data = buff[:totalRead]
|
||||
resp.Data = buff
|
||||
if err == nil {
|
||||
resp.Data = buff[:totalRead]
|
||||
}
|
||||
|
||||
return err
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue