SeaweedFS is a distributed storage system for object storage (S3), file systems, Iceberg table buckets, and Lance vector buckets, designed to handle billions of files with O(1) disk access and effortless horizontal scaling.
Go blob-storagecloud-drivedistributed-file-systemdistributed-storageerasure-codingfusehadoop-hdfshdfskuberneteslancelancedbobject-storageposixs3s3-storageseaweedfstiered-file-systemvector-search
mount: add back support for filer.path
chrislufcf371444356
diff --git a/weed/mount/inode_to_path.go b/weed/mount/inode_to_path.goindex 1e2126b74c..cae0144bc9 100644--- a/weed/mount/inode_to_path.go+++ b/weed/mount/inode_to_path.go@@ -21,13 +21,13 @@ type InodeEntry struct {isChildrenCached bool}-func NewInodeToPath() *InodeToPath {+func NewInodeToPath(root util.FullPath) *InodeToPath {t := &InodeToPath{inode2path: make(map[uint64]*InodeEntry),path2inode: make(map[util.FullPath]uint64),}- t.inode2path[1] = &InodeEntry{"/", 1, true, false}- t.path2inode["/"] = 1+ t.inode2path[1] = &InodeEntry{root, 1, true, false}+ t.path2inode[root] = 1return t}diff --git a/weed/mount/meta_cache/meta_cache.go b/weed/mount/meta_cache/meta_cache.goindex 994f00463e..8c434787a8 100644--- a/weed/mount/meta_cache/meta_cache.go+++ b/weed/mount/meta_cache/meta_cache.go@@ -14,6 +14,7 @@ import (// e.g. fill fileId field for chunkstype MetaCache struct {+ root util.FullPathlocalStore filer.VirtualFilerStore// sync.RWMutexuidGidMapper *UidGidMapper@@ -22,8 +23,10 @@ type MetaCache struct {invalidateFunc func(fullpath util.FullPath, entry *filer_pb.Entry)}-func NewMetaCache(dbFolder string, uidGidMapper *UidGidMapper, markCachedFn func(path util.FullPath), isCachedFn func(path util.FullPath) bool, invalidateFunc func(util.FullPath, *filer_pb.Entry)) *MetaCache {+func NewMetaCache(dbFolder string, uidGidMapper *UidGidMapper, root util.FullPath,+ markCachedFn func(path util.FullPath), isCachedFn func(path util.FullPath) bool, invalidateFunc func(util.FullPath, *filer_pb.Entry)) *MetaCache {return &MetaCache{+ root: root,localStore: openMetaStore(dbFolder),markCachedFn: markCachedFn,isCachedFn: isCachedFn,diff --git a/weed/mount/meta_cache/meta_cache_init.go b/weed/mount/meta_cache/meta_cache_init.goindex ef14fbb3f7..679cb953d1 100644--- a/weed/mount/meta_cache/meta_cache_init.go+++ b/weed/mount/meta_cache/meta_cache_init.go@@ -33,7 +33,7 @@ func EnsureVisited(mc *MetaCache, client filer_pb.FilerClient, dirPath util.Full}// continue to parent directory- if currentPath != "/" {+ if currentPath != mc.root {parent, _ := currentPath.DirAndName()currentPath = util.FullPath(parent)} else {diff --git a/weed/mount/weedfs.go b/weed/mount/weedfs.goindex 157d385c78..0e54891985 100644--- a/weed/mount/weedfs.go+++ b/weed/mount/weedfs.go@@ -73,7 +73,7 @@ func NewSeaweedFileSystem(option *Option) *WFS {RawFileSystem: fuse.NewDefaultRawFileSystem(),option: option,signature: util.RandomInt32(),- inodeToPath: NewInodeToPath(),+ inodeToPath: NewInodeToPath(util.FullPath(option.FilerMountRootPath)),fhmap: NewFileHandleToInode(),dhmap: NewDirectoryHandleToInode(),}@@ -84,12 +84,14 @@ func NewSeaweedFileSystem(option *Option) *WFS {wfs.chunkCache = chunk_cache.NewTieredChunkCache(256, option.getUniqueCacheDir(), option.CacheSizeMB, 1024*1024)}- wfs.metaCache = meta_cache.NewMetaCache(path.Join(option.getUniqueCacheDir(), "meta"), option.UidGidMapper, func(path util.FullPath) {- wfs.inodeToPath.MarkChildrenCached(path)- }, func(path util.FullPath) bool {- return wfs.inodeToPath.IsChildrenCached(path)- }, func(filePath util.FullPath, entry *filer_pb.Entry) {- })+ wfs.metaCache = meta_cache.NewMetaCache(path.Join(option.getUniqueCacheDir(), "meta"), option.UidGidMapper,+ util.FullPath(option.FilerMountRootPath),+ func(path util.FullPath) {+ wfs.inodeToPath.MarkChildrenCached(path)+ }, func(path util.FullPath) bool {+ return wfs.inodeToPath.IsChildrenCached(path)+ }, func(filePath util.FullPath, entry *filer_pb.Entry) {+ })grace.OnInterrupt(func() {wfs.metaCache.Shutdown()os.RemoveAll(option.getUniqueCacheDir())