From 5dfab8dbb84669d6646959f683f7325a530fb393 Mon Sep 17 00:00:00 2001 From: Chris Lu Date: Sat, 29 Nov 2025 01:34:16 -0800 Subject: [PATCH] Refactor: use MaybeCache with count parameter instead of new MaybeCacheMany function --- weed/filer/reader_at.go | 2 +- weed/filer/reader_cache.go | 8 ++------ 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/weed/filer/reader_at.go b/weed/filer/reader_at.go index 82ece52db..93fa76a2e 100644 --- a/weed/filer/reader_at.go +++ b/weed/filer/reader_at.go @@ -258,7 +258,7 @@ func (c *ChunkReadAt) readChunkSliceAt(ctx context.Context, buffer []byte, chunk if nextChunkViews != nil && c.prefetchCount > 0 { // Prefetch multiple chunks ahead for better sequential read throughput // This keeps the network pipeline full with parallel chunk fetches - c.readerCache.MaybeCacheMany(nextChunkViews, c.prefetchCount) + c.readerCache.MaybeCache(nextChunkViews, c.prefetchCount) } } } diff --git a/weed/filer/reader_cache.go b/weed/filer/reader_cache.go index 86906d042..605be5e73 100644 --- a/weed/filer/reader_cache.go +++ b/weed/filer/reader_cache.go @@ -46,14 +46,10 @@ func NewReaderCache(limit int, chunkCache chunk_cache.ChunkCache, lookupFileIdFn } } -func (rc *ReaderCache) MaybeCache(chunkViews *Interval[*ChunkView]) { - rc.MaybeCacheMany(chunkViews, 1) -} - -// MaybeCacheMany prefetches up to 'count' chunks ahead in parallel. +// MaybeCache prefetches up to 'count' chunks ahead in parallel. // This improves read throughput for sequential reads by keeping the // network pipeline full with parallel chunk fetches. -func (rc *ReaderCache) MaybeCacheMany(chunkViews *Interval[*ChunkView], count int) { +func (rc *ReaderCache) MaybeCache(chunkViews *Interval[*ChunkView], count int) { if rc.lookupFileIdFn == nil { return }