From 0cbc586aad13a3725f34765bd84a8785d7a7723b Mon Sep 17 00:00:00 2001 From: leonrayang Date: Wed, 3 Aug 2022 15:29:07 +0800 Subject: [PATCH] update: qos cache2 path effect means limit alreay happend and not calc again for read blobstore Signed-off-by: leonrayang --- sdk/data/blobstore/reader.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/sdk/data/blobstore/reader.go b/sdk/data/blobstore/reader.go index 0a9b3140c6..dc8f51bab2 100644 --- a/sdk/data/blobstore/reader.go +++ b/sdk/data/blobstore/reader.go @@ -310,13 +310,14 @@ func (reader *Reader) readSliceRange(ctx context.Context, rs *rwSlice) (err erro } } + readLimitOn := false //read cfs and cache to bcache if rs.extentKey != (proto.ExtentKey{}) { //check if dp is exist in preload sence if err = reader.ec.CheckDataPartitionExsit(rs.extentKey.PartitionId); err == nil { + readLimitOn = true readN, err = reader.ec.ReadExtent(reader.ino, &rs.extentKey, buf, int(rs.rOffset), int(rs.rSize)) if err == nil && readN == int(rs.rSize) { - // L2 cache hit. metric := exporter.NewTPCnt("L2CacheGetHit") stat.EndStat("CacheHit-L2", nil, bgTime, 1) @@ -333,8 +334,10 @@ func (reader *Reader) readSliceRange(ctx context.Context, rs *rwSlice) (err erro } log.LogDebugf("TRACE blobStore readSliceRange. cfs block miss.extentKey=%v,err=%v", rs.extentKey, err) } + if !readLimitOn { + reader.limitManager.ReadAlloc(ctx, int(rs.rSize)) + } - reader.limitManager.ReadAlloc(ctx, int(rs.rSize)) readN, err = reader.ebs.Read(ctx, reader.volName, buf, rs.rOffset, uint64(rs.rSize), rs.objExtentKey) if err != nil { reader.err <- err