mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2025-10-22 00:37:24 +08:00
avoid creating multiple reader
This commit is contained in:
@@ -23,7 +23,7 @@ type FileHandle struct {
|
|||||||
dirtyPages *ContinuousDirtyPages
|
dirtyPages *ContinuousDirtyPages
|
||||||
contentType string
|
contentType string
|
||||||
handle uint64
|
handle uint64
|
||||||
sync.RWMutex
|
sync.Mutex
|
||||||
|
|
||||||
f *File
|
f *File
|
||||||
RequestId fuse.RequestID // unique ID for request
|
RequestId 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 {
|
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))
|
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()
|
fh.Lock()
|
||||||
defer fh.RUnlock()
|
defer fh.Unlock()
|
||||||
|
|
||||||
if req.Size <= 0 {
|
if req.Size <= 0 {
|
||||||
return nil
|
return nil
|
||||||
|
Reference in New Issue
Block a user