diff --git a/weed/mount/meta_cache/meta_cache_init.go b/weed/mount/meta_cache/meta_cache_init.go index 4ef1757d1..f360f1f2b 100644 --- a/weed/mount/meta_cache/meta_cache_init.go +++ b/weed/mount/meta_cache/meta_cache_init.go @@ -10,7 +10,7 @@ import ( "github.com/chrislusf/seaweedfs/weed/util" ) -func EnsureVisited(mc *MetaCache, client filer_pb.FilerClient, dirPath util.FullPath, entryChan chan *filer.Entry) error { +func EnsureVisited(mc *MetaCache, client filer_pb.FilerClient, dirPath util.FullPath) error { currentPath := dirPath @@ -22,14 +22,8 @@ func EnsureVisited(mc *MetaCache, client filer_pb.FilerClient, dirPath util.Full return nil } - if entryChan != nil && dirPath == currentPath { - if err := doEnsureVisited(mc, client, currentPath, entryChan); err != nil { - return err - } - } else { - if err := doEnsureVisited(mc, client, currentPath, nil); err != nil { - return err - } + if err := doEnsureVisited(mc, client, currentPath); err != nil { + return err } // continue to parent directory @@ -45,7 +39,7 @@ func EnsureVisited(mc *MetaCache, client filer_pb.FilerClient, dirPath util.Full } -func doEnsureVisited(mc *MetaCache, client filer_pb.FilerClient, path util.FullPath, entryChan chan *filer.Entry) error { +func doEnsureVisited(mc *MetaCache, client filer_pb.FilerClient, path util.FullPath) error { glog.V(4).Infof("ReadDirAllEntries %s ...", path) @@ -59,9 +53,6 @@ func doEnsureVisited(mc *MetaCache, client filer_pb.FilerClient, path util.FullP glog.V(0).Infof("read %s: %v", entry.FullPath, err) return err } - if entryChan != nil { - entryChan <- entry - } return nil }) }) diff --git a/weed/mount/weedfs.go b/weed/mount/weedfs.go index 2e22e3589..2ab82b3ed 100644 --- a/weed/mount/weedfs.go +++ b/weed/mount/weedfs.go @@ -161,7 +161,7 @@ func (wfs *WFS) maybeLoadEntry(fullpath util.FullPath) (*filer_pb.Entry, fuse.St } // read from async meta cache - meta_cache.EnsureVisited(wfs.metaCache, wfs, util.FullPath(dir), nil) + meta_cache.EnsureVisited(wfs.metaCache, wfs, util.FullPath(dir)) cachedEntry, cacheErr := wfs.metaCache.FindEntry(context.Background(), fullpath) if cacheErr == filer_pb.ErrNotFound { return nil, fuse.ENOENT diff --git a/weed/mount/weedfs_dir_lookup.go b/weed/mount/weedfs_dir_lookup.go index 381bbe223..fdc16aad5 100644 --- a/weed/mount/weedfs_dir_lookup.go +++ b/weed/mount/weedfs_dir_lookup.go @@ -27,7 +27,7 @@ func (wfs *WFS) Lookup(cancel <-chan struct{}, header *fuse.InHeader, name strin fullFilePath := dirPath.Child(name) - visitErr := meta_cache.EnsureVisited(wfs.metaCache, wfs, dirPath, nil) + visitErr := meta_cache.EnsureVisited(wfs.metaCache, wfs, dirPath) if visitErr != nil { glog.Errorf("dir Lookup %s: %v", dirPath, visitErr) return fuse.EIO diff --git a/weed/mount/weedfs_dir_read.go b/weed/mount/weedfs_dir_read.go index 1baa68fa2..dd34e1ab5 100644 --- a/weed/mount/weedfs_dir_read.go +++ b/weed/mount/weedfs_dir_read.go @@ -219,7 +219,7 @@ func (wfs *WFS) doReadDirectory(input *fuse.ReadIn, out *fuse.DirEntryList, isPl } var err error - if err = meta_cache.EnsureVisited(wfs.metaCache, wfs, dirPath, nil); err != nil { + if err = meta_cache.EnsureVisited(wfs.metaCache, wfs, dirPath); err != nil { glog.Errorf("dir ReadDirAll %s: %v", dirPath, err) return fuse.EIO }