aboutsummaryrefslogtreecommitdiff
path: root/weed/filesys/filehandle.go
diff options
context:
space:
mode:
authorChris Lu <chris.lu@gmail.com>2020-03-28 13:43:31 -0700
committerChris Lu <chris.lu@gmail.com>2020-03-28 13:43:31 -0700
commit826bc0b7e3b5eb0717c179987a32e3290e773527 (patch)
tree299a1b1d2333dd61127581863b96956fce7b4634 /weed/filesys/filehandle.go
parent4aa82c95e6130b3eaa785f079a97552f354cefc4 (diff)
downloadseaweedfs-826bc0b7e3b5eb0717c179987a32e3290e773527.tar.xz
seaweedfs-826bc0b7e3b5eb0717c179987a32e3290e773527.zip
FUSE: add chunk cache for recently accessed file chunks
Diffstat (limited to 'weed/filesys/filehandle.go')
-rw-r--r--weed/filesys/filehandle.go4
1 files changed, 3 insertions, 1 deletions
diff --git a/weed/filesys/filehandle.go b/weed/filesys/filehandle.go
index 9c3eb4202..4897d3a08 100644
--- a/weed/filesys/filehandle.go
+++ b/weed/filesys/filehandle.go
@@ -92,7 +92,7 @@ func (fh *FileHandle) readFromChunks(buff []byte, offset int64) (int64, error) {
if fh.f.reader == nil {
chunkViews := filer2.ViewFromVisibleIntervals(fh.f.entryViewCache, 0, math.MaxInt32)
- fh.f.reader = filer2.NewChunkReaderAtFromClient(fh.f.wfs, chunkViews)
+ fh.f.reader = NewChunkReaderAtFromClient(fh.f.wfs, chunkViews, fh.f.wfs.chunkCache)
}
totalRead, err := fh.f.reader.ReadAt(buff, offset)
@@ -153,6 +153,8 @@ func (fh *FileHandle) Release(ctx context.Context, req *fuse.ReleaseRequest) err
fh.dirtyPages.releaseResource()
fh.f.wfs.ReleaseHandle(fh.f.fullpath(), fuse.HandleID(fh.handle))
}
+ fh.f.entryViewCache = nil
+ fh.f.reader = nil
return nil
}