mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2024-01-19 02:48:24 +00:00
remove empty calls for list cache
This commit is contained in:
parent
6498d0c86b
commit
95a1860d65
|
@ -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())
|
glog.V(4).Infof("dir Lookup %s: %s by %s", dir.FullPath(), req.Name, req.Header.String())
|
||||||
|
|
||||||
fullFilePath := util.NewFullPath(dir.FullPath(), req.Name)
|
fullFilePath := util.NewFullPath(dir.FullPath(), req.Name)
|
||||||
entry := dir.wfs.cacheGet(fullFilePath)
|
|
||||||
|
|
||||||
dirPath := util.FullPath(dir.FullPath())
|
dirPath := util.FullPath(dir.FullPath())
|
||||||
meta_cache.EnsureVisited(dir.wfs.metaCache, dir.wfs, util.FullPath(dirPath))
|
meta_cache.EnsureVisited(dir.wfs.metaCache, dir.wfs, util.FullPath(dirPath))
|
||||||
cachedEntry, cacheErr := dir.wfs.metaCache.FindEntry(context.Background(), fullFilePath)
|
cachedEntry, cacheErr := dir.wfs.metaCache.FindEntry(context.Background(), fullFilePath)
|
||||||
if cacheErr == filer_pb.ErrNotFound {
|
if cacheErr == filer_pb.ErrNotFound {
|
||||||
return nil, fuse.ENOENT
|
return nil, fuse.ENOENT
|
||||||
}
|
}
|
||||||
entry = cachedEntry.ToProtoEntry()
|
entry := cachedEntry.ToProtoEntry()
|
||||||
|
|
||||||
if entry == nil {
|
if entry == nil {
|
||||||
// glog.V(3).Infof("dir Lookup cache miss %s", fullFilePath)
|
// 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)
|
glog.V(1).Infof("dir GetEntry %s: %v", fullFilePath, err)
|
||||||
return nil, fuse.ENOENT
|
return nil, fuse.ENOENT
|
||||||
}
|
}
|
||||||
dir.wfs.cacheSet(fullFilePath, entry, 5*time.Minute)
|
|
||||||
} else {
|
} else {
|
||||||
glog.V(4).Infof("dir Lookup cache hit %s", fullFilePath)
|
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())
|
glog.V(3).Infof("dir ReadDirAll %s", dir.FullPath())
|
||||||
|
|
||||||
cacheTtl := 5 * time.Minute
|
|
||||||
processEachEntryFn := func(entry *filer_pb.Entry, isLast bool) error {
|
processEachEntryFn := func(entry *filer_pb.Entry, isLast bool) error {
|
||||||
fullpath := util.NewFullPath(dir.FullPath(), entry.Name)
|
fullpath := util.NewFullPath(dir.FullPath(), entry.Name)
|
||||||
inode := fullpath.AsInode()
|
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}
|
dirent := fuse.Dirent{Inode: inode, Name: entry.Name, Type: fuse.DT_File}
|
||||||
ret = append(ret, dirent)
|
ret = append(ret, dirent)
|
||||||
}
|
}
|
||||||
dir.wfs.cacheSet(fullpath, entry, cacheTtl)
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -311,7 +306,6 @@ func (dir *Dir) removeOneFile(req *fuse.RemoveRequest) error {
|
||||||
|
|
||||||
dir.wfs.deleteFileChunks(entry.Chunks)
|
dir.wfs.deleteFileChunks(entry.Chunks)
|
||||||
|
|
||||||
dir.wfs.cacheDelete(filePath)
|
|
||||||
dir.wfs.fsNodeCache.DeleteFsNode(filePath)
|
dir.wfs.fsNodeCache.DeleteFsNode(filePath)
|
||||||
|
|
||||||
dir.wfs.metaCache.DeleteEntry(context.Background(), 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 {
|
func (dir *Dir) removeFolder(req *fuse.RemoveRequest) error {
|
||||||
|
|
||||||
t := util.NewFullPath(dir.FullPath(), req.Name)
|
t := util.NewFullPath(dir.FullPath(), req.Name)
|
||||||
dir.wfs.cacheDelete(t)
|
|
||||||
dir.wfs.fsNodeCache.DeleteFsNode(t)
|
dir.wfs.fsNodeCache.DeleteFsNode(t)
|
||||||
|
|
||||||
dir.wfs.metaCache.DeleteEntry(context.Background(), 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.entry.Attributes.Mtime = req.Mtime.Unix()
|
||||||
}
|
}
|
||||||
|
|
||||||
dir.wfs.cacheDelete(util.FullPath(dir.FullPath()))
|
|
||||||
|
|
||||||
return dir.saveEntry()
|
return dir.saveEntry()
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -388,8 +379,6 @@ func (dir *Dir) Setxattr(ctx context.Context, req *fuse.SetxattrRequest) error {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
dir.wfs.cacheDelete(util.FullPath(dir.FullPath()))
|
|
||||||
|
|
||||||
return dir.saveEntry()
|
return dir.saveEntry()
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -406,8 +395,6 @@ func (dir *Dir) Removexattr(ctx context.Context, req *fuse.RemovexattrRequest) e
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
dir.wfs.cacheDelete(util.FullPath(dir.FullPath()))
|
|
||||||
|
|
||||||
return dir.saveEntry()
|
return dir.saveEntry()
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,8 +39,6 @@ func (dir *Dir) Rename(ctx context.Context, req *fuse.RenameRequest, newDirector
|
||||||
})
|
})
|
||||||
|
|
||||||
if err == nil {
|
if err == nil {
|
||||||
dir.wfs.cacheDelete(newPath)
|
|
||||||
dir.wfs.cacheDelete(oldPath)
|
|
||||||
|
|
||||||
// fmt.Printf("rename path: %v => %v\n", oldPath, newPath)
|
// fmt.Printf("rename path: %v => %v\n", oldPath, newPath)
|
||||||
dir.wfs.fsNodeCache.Move(oldPath, newPath)
|
dir.wfs.fsNodeCache.Move(oldPath, newPath)
|
||||||
|
|
|
@ -150,8 +150,6 @@ func (file *File) Setattr(ctx context.Context, req *fuse.SetattrRequest, resp *f
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
file.wfs.cacheDelete(file.fullpath())
|
|
||||||
|
|
||||||
return file.saveEntry()
|
return file.saveEntry()
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -168,8 +166,6 @@ func (file *File) Setxattr(ctx context.Context, req *fuse.SetxattrRequest) error
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
file.wfs.cacheDelete(file.fullpath())
|
|
||||||
|
|
||||||
return file.saveEntry()
|
return file.saveEntry()
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -186,8 +182,6 @@ func (file *File) Removexattr(ctx context.Context, req *fuse.RemovexattrRequest)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
file.wfs.cacheDelete(file.fullpath())
|
|
||||||
|
|
||||||
return file.saveEntry()
|
return file.saveEntry()
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -226,14 +226,6 @@ func (wfs *WFS) Statfs(ctx context.Context, req *fuse.StatfsRequest, resp *fuse.
|
||||||
return nil
|
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 {
|
func (wfs *WFS) AdjustedUrl(hostAndPort string) string {
|
||||||
if !wfs.option.OutsideContainerClusterMode {
|
if !wfs.option.OutsideContainerClusterMode {
|
||||||
return hostAndPort
|
return hostAndPort
|
||||||
|
|
|
@ -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) {
|
func (wfs *WFS) maybeLoadEntry(dir, name string) (entry *filer_pb.Entry, err error) {
|
||||||
|
|
||||||
fullpath := util.NewFullPath(dir, name)
|
fullpath := util.NewFullPath(dir, name)
|
||||||
entry = wfs.cacheGet(fullpath)
|
|
||||||
if entry != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
// glog.V(3).Infof("read entry cache miss %s", fullpath)
|
// glog.V(3).Infof("read entry cache miss %s", fullpath)
|
||||||
|
|
||||||
// read from async meta cache
|
// read from async meta cache
|
||||||
|
|
Loading…
Reference in a new issue