]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Use page-rounded size for MemStore size rather than stored size.
authorDmitry Kurochkin <dmitry.kurochkin@measurement-factory.com>
Mon, 18 Apr 2011 15:01:04 +0000 (19:01 +0400)
committerDmitry Kurochkin <dmitry.kurochkin@measurement-factory.com>
Mon, 18 Apr 2011 15:01:04 +0000 (19:01 +0400)
Also rename MemStore::cur_size to MemStore::theCurrentSize to avoid confusion
with the KB-based SwapDir::cur_size.

src/MemStore.cc
src/MemStore.h

index c68e7caec584e627a9677175224d0d030a020939..e1491d68a1eed0338caf39d5650a75bee0efd23c 100644 (file)
@@ -29,7 +29,7 @@ MemStore::Init()
     delete map; // we just wanted to initialize shared memory segments
 }
 
-MemStore::MemStore(): map(NULL), cur_size(0)
+MemStore::MemStore(): map(NULL), theCurrentSize(0)
 {
 }
 
@@ -105,7 +105,7 @@ MemStore::maxSize() const
 uint64_t
 MemStore::currentSize() const
 {
-    return cur_size >> 10;
+    return theCurrentSize >> 10;
 }
 
 uint64_t
@@ -331,7 +331,7 @@ MemStore::copyToShm(StoreEntry &e, MemStoreMap::Extras &extras)
     debugs(20, 7, HERE << "mem-cached all " << eSize << " bytes of " << e <<
            " in " << page);
 
-    cur_size += eSize;
+    theCurrentSize += Ipc::Mem::PageSize();
     // remember storage location and size
     extras.page = page;
     extras.storedSize = copied;
@@ -342,7 +342,7 @@ void
 MemStore::cleanReadable(const sfileno fileno)
 {
     Ipc::Mem::PutPage(map->extras(fileno).page);
-    cur_size -= map->extras(fileno).storedSize;
+    theCurrentSize -= Ipc::Mem::PageSize();
 }
 
 /// calculates maximum number of entries we need to store and map
index ca5e60cea3691b07460e20a6cfe0741ee3513b8b..f95875a9df8b8aa723a0933e4e353e507072a5e8 100644 (file)
@@ -52,7 +52,7 @@ protected:
 
 private:
     MemStoreMap *map; ///< index of mem-cached entries
-    uint64_t cur_size; ///< currently used space in the storage area
+    uint64_t theCurrentSize; ///< currently used space in the storage area
 };
 
 // Why use Store as a base? MemStore and SwapDir are both "caches".