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
avoid creating multiple reader
Chris Lu3cbc40fa4868
diff --git a/weed/filesys/filehandle.go b/weed/filesys/filehandle.goindex 53c1c23d52..6d72e62ce9 100644--- a/weed/filesys/filehandle.go+++ b/weed/filesys/filehandle.go@@ -23,7 +23,7 @@ type FileHandle struct {dirtyPages *ContinuousDirtyPagescontentType stringhandle uint64- sync.RWMutex+ sync.Mutexf *FileRequestId fuse.RequestID // unique ID for request@@ -59,8 +59,8 @@ var _ = fs.HandleReleaser(&FileHandle{})func (fh *FileHandle) Read(ctx context.Context, req *fuse.ReadRequest, resp *fuse.ReadResponse) error {glog.V(4).Infof("%s read fh %d: [%d,%d) size %d resp.Data cap=%d", fh.f.fullpath(), fh.handle, req.Offset, req.Offset+int64(req.Size), req.Size, cap(resp.Data))- fh.RLock()- defer fh.RUnlock()+ fh.Lock()+ defer fh.Unlock()if req.Size <= 0 {return nil