From 87071640a7101703895172fb23c06f9365f1c6e1 Mon Sep 17 00:00:00 2001
From: Aliaksandr Valialkin <valyala@victoriametrics.com>
Date: Mon, 7 Feb 2022 19:28:36 +0200
Subject: [PATCH] lib/blockcache: return proper number of entries from the
 cache

This has been broken in 0d7374ad2f68d22de96c1731d83db1343584cb52
---
 lib/blockcache/blockcache.go | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/lib/blockcache/blockcache.go b/lib/blockcache/blockcache.go
index 62920e50c5..0b2c5e7483 100644
--- a/lib/blockcache/blockcache.go
+++ b/lib/blockcache/blockcache.go
@@ -199,7 +199,10 @@ end:
 // Len returns the number of blocks in the cache c.
 func (c *Cache) Len() int {
 	c.mu.RLock()
-	n := len(c.m)
+	n := 0
+	for _, m := range c.m {
+		n += len(m)
+	}
 	c.mu.RUnlock()
 	return n
 }