aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--weed/command/mount.go2
-rw-r--r--weed/command/mount_std.go1
-rw-r--r--weed/filesys/dir.go8
-rw-r--r--weed/filesys/wfs.go1
-rw-r--r--weed/filesys/xattr.go4
5 files changed, 16 insertions, 0 deletions
diff --git a/weed/command/mount.go b/weed/command/mount.go
index efa4650ab..75ea485d3 100644
--- a/weed/command/mount.go
+++ b/weed/command/mount.go
@@ -20,6 +20,7 @@ type MountOptions struct {
umaskString *string
nonempty *bool
outsideContainerClusterMode *bool
+ asyncMetaDataCaching *bool
}
var (
@@ -47,6 +48,7 @@ func init() {
mountCpuProfile = cmdMount.Flag.String("cpuprofile", "", "cpu profile output file")
mountMemProfile = cmdMount.Flag.String("memprofile", "", "memory profile output file")
mountOptions.outsideContainerClusterMode = cmdMount.Flag.Bool("outsideContainerClusterMode", false, "allows other users to access the file system")
+ mountOptions.asyncMetaDataCaching = cmdMount.Flag.Bool("asyncMetaDataCaching", false, "<wip> async meta data caching")
}
var cmdMount = &Command{
diff --git a/weed/command/mount_std.go b/weed/command/mount_std.go
index 0f87d6aee..b1e47809c 100644
--- a/weed/command/mount_std.go
+++ b/weed/command/mount_std.go
@@ -175,6 +175,7 @@ func RunMount(option *MountOptions, umask os.FileMode) bool {
MountMtime: time.Now(),
Umask: umask,
OutsideContainerClusterMode: *mountOptions.outsideContainerClusterMode,
+ AsyncMetaDataCaching: *mountOptions.asyncMetaDataCaching,
Cipher: cipher,
}))
diff --git a/weed/filesys/dir.go b/weed/filesys/dir.go
index 46e8aebb4..ace958e82 100644
--- a/weed/filesys/dir.go
+++ b/weed/filesys/dir.go
@@ -205,6 +205,10 @@ func (dir *Dir) Lookup(ctx context.Context, req *fuse.LookupRequest, resp *fuse.
fullFilePath := util.NewFullPath(dir.FullPath(), req.Name)
entry := dir.wfs.cacheGet(fullFilePath)
+ if dir.wfs.option.AsyncMetaDataCaching {
+
+ }
+
if entry == nil {
// glog.V(3).Infof("dir Lookup cache miss %s", fullFilePath)
entry, err = filer_pb.GetEntry(dir.wfs, fullFilePath)
@@ -244,6 +248,10 @@ func (dir *Dir) ReadDirAll(ctx context.Context) (ret []fuse.Dirent, err error) {
glog.V(3).Infof("dir ReadDirAll %s", dir.FullPath())
+ if dir.wfs.option.AsyncMetaDataCaching {
+
+ }
+
cacheTtl := 5 * time.Minute
readErr := filer_pb.ReadDirAllEntries(dir.wfs, util.FullPath(dir.FullPath()), "", func(entry *filer_pb.Entry, isLast bool) {
diff --git a/weed/filesys/wfs.go b/weed/filesys/wfs.go
index b3772d683..2013f3c03 100644
--- a/weed/filesys/wfs.go
+++ b/weed/filesys/wfs.go
@@ -44,6 +44,7 @@ type Option struct {
OutsideContainerClusterMode bool // whether the mount runs outside SeaweedFS containers
Cipher bool // whether encrypt data on volume server
+ AsyncMetaDataCaching bool // whether asynchronously cache meta data
}
diff --git a/weed/filesys/xattr.go b/weed/filesys/xattr.go
index a9848fbe7..1768c1d6e 100644
--- a/weed/filesys/xattr.go
+++ b/weed/filesys/xattr.go
@@ -114,6 +114,10 @@ func (wfs *WFS) maybeLoadEntry(dir, name string) (entry *filer_pb.Entry, err err
}
// glog.V(3).Infof("read entry cache miss %s", fullpath)
+ if wfs.option.AsyncMetaDataCaching {
+
+ }
+
err = wfs.WithFilerClient(func(client filer_pb.SeaweedFilerClient) error {
request := &filer_pb.LookupDirectoryEntryRequest{