Browse Source

FUSE: implement dir fsync

fix https://github.com/chrislusf/seaweedfs/issues/1398
pull/1402/head
Chris Lu 4 years ago
parent
commit
df7eee523b
  1. 9
      weed/filesys/dir.go

9
weed/filesys/dir.go

@ -27,6 +27,7 @@ type Dir struct {
var _ = fs.Node(&Dir{}) var _ = fs.Node(&Dir{})
var _ = fs.NodeCreater(&Dir{}) var _ = fs.NodeCreater(&Dir{})
var _ = fs.NodeMkdirer(&Dir{}) var _ = fs.NodeMkdirer(&Dir{})
var _ = fs.NodeFsyncer(&Dir{})
var _ = fs.NodeRequestLookuper(&Dir{}) var _ = fs.NodeRequestLookuper(&Dir{})
var _ = fs.HandleReadDirAller(&Dir{}) var _ = fs.HandleReadDirAller(&Dir{})
var _ = fs.NodeRemover(&Dir{}) var _ = fs.NodeRemover(&Dir{})
@ -90,6 +91,14 @@ func (dir *Dir) setRootDirAttributes(attr *fuse.Attr) {
attr.BlockSize = 1024 * 1024 attr.BlockSize = 1024 * 1024
} }
func (dir *Dir) Fsync(ctx context.Context, req *fuse.FsyncRequest) error {
// fsync works at OS level
// write the file chunks to the filerGrpcAddress
glog.V(3).Infof("dir %s fsync %+v", dir.FullPath(), req)
return nil
}
func (dir *Dir) newFile(name string, entry *filer_pb.Entry) fs.Node { func (dir *Dir) newFile(name string, entry *filer_pb.Entry) fs.Node {
return dir.wfs.fsNodeCache.EnsureFsNode(util.NewFullPath(dir.FullPath(), name), func() fs.Node { return dir.wfs.fsNodeCache.EnsureFsNode(util.NewFullPath(dir.FullPath(), name), func() fs.Node {
return &File{ return &File{

Loading…
Cancel
Save