use existing attributes instead of fetching from filer

This commit is contained in:
Chris Lu 2018-05-25 01:22:31 -07:00
parent 0a223838bd
commit 6d1bcd4b8c

View file

@ -28,6 +28,8 @@ type File struct {
func (file *File) Attr(context context.Context, attr *fuse.Attr) error {
fullPath := filepath.Join(file.dir.Path, file.Name)
if file.attributes == nil {
item := file.wfs.listDirectoryEntriesCache.Get(fullPath)
if item != nil {
entry := item.Value().(*filer_pb.Entry)
@ -60,6 +62,7 @@ func (file *File) Attr(context context.Context, attr *fuse.Attr) error {
return err
}
}
}
attr.Mode = os.FileMode(file.attributes.FileMode)
attr.Size = filer2.TotalSize(file.Chunks)