diff options
Diffstat (limited to 'weed/filesys/xattr.go')
| -rw-r--r-- | weed/filesys/xattr.go | 42 |
1 files changed, 6 insertions, 36 deletions
diff --git a/weed/filesys/xattr.go b/weed/filesys/xattr.go index 7e7b8c60b..940979457 100644 --- a/weed/filesys/xattr.go +++ b/weed/filesys/xattr.go @@ -3,10 +3,10 @@ package filesys import ( "context" - "github.com/chrislusf/seaweedfs/weed/glog" + "github.com/seaweedfs/fuse" + "github.com/chrislusf/seaweedfs/weed/pb/filer_pb" "github.com/chrislusf/seaweedfs/weed/util" - "github.com/seaweedfs/fuse" ) func getxattr(entry *filer_pb.Entry, req *fuse.GetxattrRequest, resp *fuse.GetxattrResponse) error { @@ -110,43 +110,13 @@ func listxattr(entry *filer_pb.Entry, req *fuse.ListxattrRequest, resp *fuse.Lis func (wfs *WFS) maybeLoadEntry(dir, name string) (entry *filer_pb.Entry, err error) { fullpath := util.NewFullPath(dir, name) - entry = wfs.cacheGet(fullpath) - if entry != nil { - return - } // glog.V(3).Infof("read entry cache miss %s", fullpath) // read from async meta cache - if wfs.option.AsyncMetaDataCaching { - cachedEntry, cacheErr := wfs.metaCache.FindEntry(context.Background(), fullpath) - if cacheErr == filer_pb.ErrNotFound { - return nil, fuse.ENOENT - } - return cachedEntry.ToProtoEntry(), nil + cachedEntry, cacheErr := wfs.metaCache.FindEntry(context.Background(), fullpath) + if cacheErr == filer_pb.ErrNotFound { + return nil, fuse.ENOENT } + return cachedEntry.ToProtoEntry(), nil - err = wfs.WithFilerClient(func(client filer_pb.SeaweedFilerClient) error { - - request := &filer_pb.LookupDirectoryEntryRequest{ - Name: name, - Directory: dir, - } - - resp, err := filer_pb.LookupEntry(client, request) - if err != nil { - if err == filer_pb.ErrNotFound { - glog.V(3).Infof("file attr read not found file %v: %v", request, err) - return fuse.ENOENT - } - glog.V(3).Infof("attr read %v: %v", request, err) - return fuse.EIO - } - - entry = resp.Entry - wfs.cacheSet(fullpath, entry, wfs.option.EntryCacheTtl) - - return nil - }) - - return } |
