diff options
| author | Chris Lu <chris.lu@gmail.com> | 2019-12-13 10:05:43 -0800 |
|---|---|---|
| committer | Chris Lu <chris.lu@gmail.com> | 2019-12-13 10:05:43 -0800 |
| commit | 05c3b795dcc159f0e6397af972d93a497ac555ae (patch) | |
| tree | 849650a65ed8260d1fa933f9b54a783ebe768e8a /weed/filesys/file.go | |
| parent | 987108a2b16e61595d0c7768ca47937d0652d5c4 (diff) | |
| download | seaweedfs-05c3b795dcc159f0e6397af972d93a497ac555ae.tar.xz seaweedfs-05c3b795dcc159f0e6397af972d93a497ac555ae.zip | |
filer: configurable directory list cache size
Diffstat (limited to 'weed/filesys/file.go')
| -rw-r--r-- | weed/filesys/file.go | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/weed/filesys/file.go b/weed/filesys/file.go index 1b359ebbe..d78895615 100644 --- a/weed/filesys/file.go +++ b/weed/filesys/file.go @@ -36,6 +36,8 @@ func (file *File) fullpath() string { func (file *File) Attr(ctx context.Context, attr *fuse.Attr) error { + glog.V(4).Infof("file Attr %s", file.fullpath()) + if err := file.maybeLoadAttributes(ctx); err != nil { return err } @@ -54,7 +56,7 @@ func (file *File) Attr(ctx context.Context, attr *fuse.Attr) error { func (file *File) Open(ctx context.Context, req *fuse.OpenRequest, resp *fuse.OpenResponse) (fs.Handle, error) { - glog.V(3).Infof("%v file open %+v", file.fullpath(), req) + glog.V(4).Infof("file %v open %+v", file.fullpath(), req) file.isOpen = true @@ -140,10 +142,16 @@ func (file *File) maybeLoadAttributes(ctx context.Context) error { if file.entry == nil || !file.isOpen { item := file.wfs.listDirectoryEntriesCache.Get(file.fullpath()) if item != nil && !item.Expired() { + + glog.V(4).Infof("file read attr cache hit %s", file.fullpath()) + entry := item.Value().(*filer_pb.Entry) file.setEntry(entry) // glog.V(1).Infof("file attr read cached %v attributes", file.Name) } else { + + glog.V(3).Infof("file read attr cache miss %s", file.fullpath()) + err := file.wfs.WithFilerClient(ctx, func(client filer_pb.SeaweedFilerClient) error { request := &filer_pb.LookupDirectoryEntryRequest{ |
