From 90acfd939405b8eefcc10f9c4043ea489eba207f Mon Sep 17 00:00:00 2001 From: chrislu Date: Tue, 5 Nov 2024 08:42:44 -0800 Subject: [PATCH] remove case when read request is out side of the file size --- weed/filer/reader_at.go | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/weed/filer/reader_at.go b/weed/filer/reader_at.go index 5c52c8a2f..b87fa0411 100644 --- a/weed/filer/reader_at.go +++ b/weed/filer/reader_at.go @@ -176,12 +176,11 @@ func (c *ChunkReadAt) doReadAt(p []byte, offset int64) (n int, ts int64, err err if c.fileSize >= startOffset { delta = min(remaining, c.fileSize-startOffset) startOffset -= offset - } else { - delta = remaining - startOffset = max(startOffset-offset, startOffset-remaining-offset) } - glog.V(4).Infof("zero2 [%d,%d) of file size %d bytes", startOffset, startOffset+delta, c.fileSize) - n += zero(p, startOffset, delta) + if delta > 0 { + glog.V(4).Infof("zero2 [%d,%d) of file size %d bytes", startOffset, startOffset+delta, c.fileSize) + n += zero(p, startOffset, delta) + } } if err == nil && offset+int64(len(p)) >= c.fileSize {