diff options
| author | yourchanges <yourchanges@gmail.com> | 2020-07-17 19:49:16 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-07-17 19:49:16 +0800 |
| commit | 64df5207db14ccf7e7915561b5c9b8f3dab53c6e (patch) | |
| tree | df4a05999d67abb7c4765d39eddc01318521169b /weed/filesys/wfs.go | |
| parent | 8c318470dd95b3fc24d39dc3cf253cc17b03ab39 (diff) | |
| parent | f43146b237bc5bbfb7033f6e427b5299554c0824 (diff) | |
| download | seaweedfs-64df5207db14ccf7e7915561b5c9b8f3dab53c6e.tar.xz seaweedfs-64df5207db14ccf7e7915561b5c9b8f3dab53c6e.zip | |
Merge pull request #2 from chrislusf/master
merge
Diffstat (limited to 'weed/filesys/wfs.go')
| -rw-r--r-- | weed/filesys/wfs.go | 20 |
1 files changed, 8 insertions, 12 deletions
diff --git a/weed/filesys/wfs.go b/weed/filesys/wfs.go index 8dffa6555..1bd36167b 100644 --- a/weed/filesys/wfs.go +++ b/weed/filesys/wfs.go @@ -53,7 +53,7 @@ var _ = fs.FS(&WFS{}) var _ = fs.FSStatfser(&WFS{}) type WFS struct { - option *Option + option *Option // contains all open handles, protected by handlesLock handlesLock sync.Mutex @@ -76,15 +76,15 @@ type statsCache struct { func NewSeaweedFileSystem(option *Option) *WFS { wfs := &WFS{ - option: option, - handles: make(map[uint64]*FileHandle), + option: option, + handles: make(map[uint64]*FileHandle), bufPool: sync.Pool{ New: func() interface{} { return make([]byte, option.ChunkSizeLimit) }, }, } - cacheUniqueId := util.Md5([]byte(option.FilerGrpcAddress))[0:4] + cacheUniqueId := util.Md5([]byte(option.FilerGrpcAddress + option.FilerMountRootPath + util.Version()))[0:4] cacheDir := path.Join(option.CacheDir, cacheUniqueId) if option.CacheSizeMB > 0 { os.MkdirAll(cacheDir, 0755) @@ -96,14 +96,10 @@ func NewSeaweedFileSystem(option *Option) *WFS { wfs.metaCache = meta_cache.NewMetaCache(path.Join(cacheDir, "meta")) startTime := time.Now() - if err := meta_cache.InitMetaCache(wfs.metaCache, wfs, wfs.option.FilerMountRootPath); err != nil { - glog.V(0).Infof("failed to init meta cache: %v", err) - } else { - go meta_cache.SubscribeMetaEvents(wfs.metaCache, wfs, wfs.option.FilerMountRootPath, startTime.UnixNano()) - grace.OnInterrupt(func() { - wfs.metaCache.Shutdown() - }) - } + go meta_cache.SubscribeMetaEvents(wfs.metaCache, wfs, wfs.option.FilerMountRootPath, startTime.UnixNano()) + grace.OnInterrupt(func() { + wfs.metaCache.Shutdown() + }) wfs.root = &Dir{name: wfs.option.FilerMountRootPath, wfs: wfs} wfs.fsNodeCache = newFsCache(wfs.root) |
