From 95a1860d653ad886d4f70d031f8af0c5bf5351d4 Mon Sep 17 00:00:00 2001 From: Chris Lu Date: Sun, 28 Jun 2020 10:25:54 -0700 Subject: [PATCH] remove empty calls for list cache --- weed/filesys/dir.go | 15 +-------------- weed/filesys/dir_rename.go | 2 -- weed/filesys/file.go | 6 ------ weed/filesys/wfs.go | 8 -------- weed/filesys/xattr.go | 4 ---- 5 files changed, 1 insertion(+), 34 deletions(-) diff --git a/weed/filesys/dir.go b/weed/filesys/dir.go index bb4500531..294650910 100644 --- a/weed/filesys/dir.go +++ b/weed/filesys/dir.go @@ -211,15 +211,13 @@ func (dir *Dir) Lookup(ctx context.Context, req *fuse.LookupRequest, resp *fuse. glog.V(4).Infof("dir Lookup %s: %s by %s", dir.FullPath(), req.Name, req.Header.String()) fullFilePath := util.NewFullPath(dir.FullPath(), req.Name) - entry := dir.wfs.cacheGet(fullFilePath) - dirPath := util.FullPath(dir.FullPath()) meta_cache.EnsureVisited(dir.wfs.metaCache, dir.wfs, util.FullPath(dirPath)) cachedEntry, cacheErr := dir.wfs.metaCache.FindEntry(context.Background(), fullFilePath) if cacheErr == filer_pb.ErrNotFound { return nil, fuse.ENOENT } - entry = cachedEntry.ToProtoEntry() + entry := cachedEntry.ToProtoEntry() if entry == nil { // glog.V(3).Infof("dir Lookup cache miss %s", fullFilePath) @@ -228,7 +226,6 @@ func (dir *Dir) Lookup(ctx context.Context, req *fuse.LookupRequest, resp *fuse. glog.V(1).Infof("dir GetEntry %s: %v", fullFilePath, err) return nil, fuse.ENOENT } - dir.wfs.cacheSet(fullFilePath, entry, 5*time.Minute) } else { glog.V(4).Infof("dir Lookup cache hit %s", fullFilePath) } @@ -260,7 +257,6 @@ func (dir *Dir) ReadDirAll(ctx context.Context) (ret []fuse.Dirent, err error) { glog.V(3).Infof("dir ReadDirAll %s", dir.FullPath()) - cacheTtl := 5 * time.Minute processEachEntryFn := func(entry *filer_pb.Entry, isLast bool) error { fullpath := util.NewFullPath(dir.FullPath(), entry.Name) inode := fullpath.AsInode() @@ -271,7 +267,6 @@ func (dir *Dir) ReadDirAll(ctx context.Context) (ret []fuse.Dirent, err error) { dirent := fuse.Dirent{Inode: inode, Name: entry.Name, Type: fuse.DT_File} ret = append(ret, dirent) } - dir.wfs.cacheSet(fullpath, entry, cacheTtl) return nil } @@ -311,7 +306,6 @@ func (dir *Dir) removeOneFile(req *fuse.RemoveRequest) error { dir.wfs.deleteFileChunks(entry.Chunks) - dir.wfs.cacheDelete(filePath) dir.wfs.fsNodeCache.DeleteFsNode(filePath) dir.wfs.metaCache.DeleteEntry(context.Background(), filePath) @@ -330,7 +324,6 @@ func (dir *Dir) removeOneFile(req *fuse.RemoveRequest) error { func (dir *Dir) removeFolder(req *fuse.RemoveRequest) error { t := util.NewFullPath(dir.FullPath(), req.Name) - dir.wfs.cacheDelete(t) dir.wfs.fsNodeCache.DeleteFsNode(t) dir.wfs.metaCache.DeleteEntry(context.Background(), t) @@ -370,8 +363,6 @@ func (dir *Dir) Setattr(ctx context.Context, req *fuse.SetattrRequest, resp *fus dir.entry.Attributes.Mtime = req.Mtime.Unix() } - dir.wfs.cacheDelete(util.FullPath(dir.FullPath())) - return dir.saveEntry() } @@ -388,8 +379,6 @@ func (dir *Dir) Setxattr(ctx context.Context, req *fuse.SetxattrRequest) error { return err } - dir.wfs.cacheDelete(util.FullPath(dir.FullPath())) - return dir.saveEntry() } @@ -406,8 +395,6 @@ func (dir *Dir) Removexattr(ctx context.Context, req *fuse.RemovexattrRequest) e return err } - dir.wfs.cacheDelete(util.FullPath(dir.FullPath())) - return dir.saveEntry() } diff --git a/weed/filesys/dir_rename.go b/weed/filesys/dir_rename.go index ea40f5c31..d618c28ea 100644 --- a/weed/filesys/dir_rename.go +++ b/weed/filesys/dir_rename.go @@ -39,8 +39,6 @@ func (dir *Dir) Rename(ctx context.Context, req *fuse.RenameRequest, newDirector }) if err == nil { - dir.wfs.cacheDelete(newPath) - dir.wfs.cacheDelete(oldPath) // fmt.Printf("rename path: %v => %v\n", oldPath, newPath) dir.wfs.fsNodeCache.Move(oldPath, newPath) diff --git a/weed/filesys/file.go b/weed/filesys/file.go index 31059112f..4a6bc9a8a 100644 --- a/weed/filesys/file.go +++ b/weed/filesys/file.go @@ -150,8 +150,6 @@ func (file *File) Setattr(ctx context.Context, req *fuse.SetattrRequest, resp *f return nil } - file.wfs.cacheDelete(file.fullpath()) - return file.saveEntry() } @@ -168,8 +166,6 @@ func (file *File) Setxattr(ctx context.Context, req *fuse.SetxattrRequest) error return err } - file.wfs.cacheDelete(file.fullpath()) - return file.saveEntry() } @@ -186,8 +182,6 @@ func (file *File) Removexattr(ctx context.Context, req *fuse.RemovexattrRequest) return err } - file.wfs.cacheDelete(file.fullpath()) - return file.saveEntry() } diff --git a/weed/filesys/wfs.go b/weed/filesys/wfs.go index 41e953af3..6b3ef8f3c 100644 --- a/weed/filesys/wfs.go +++ b/weed/filesys/wfs.go @@ -226,14 +226,6 @@ func (wfs *WFS) Statfs(ctx context.Context, req *fuse.StatfsRequest, resp *fuse. return nil } -func (wfs *WFS) cacheGet(path util.FullPath) *filer_pb.Entry { - return nil -} -func (wfs *WFS) cacheSet(path util.FullPath, entry *filer_pb.Entry, ttl time.Duration) { -} -func (wfs *WFS) cacheDelete(path util.FullPath) { -} - func (wfs *WFS) AdjustedUrl(hostAndPort string) string { if !wfs.option.OutsideContainerClusterMode { return hostAndPort diff --git a/weed/filesys/xattr.go b/weed/filesys/xattr.go index b6bce6978..091a70fa3 100644 --- a/weed/filesys/xattr.go +++ b/weed/filesys/xattr.go @@ -111,10 +111,6 @@ 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