From: Dmitry Kurochkin Date: Mon, 18 Apr 2011 15:01:04 +0000 (+0400) Subject: Use page-rounded size for MemStore size rather than stored size. X-Git-Tag: take06~13 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=17cf0a47537718b45b4b0a576ff9956e57cbdaaa;p=thirdparty%2Fsquid.git Use page-rounded size for MemStore size rather than stored size. Also rename MemStore::cur_size to MemStore::theCurrentSize to avoid confusion with the KB-based SwapDir::cur_size. --- diff --git a/src/MemStore.cc b/src/MemStore.cc index c68e7caec5..e1491d68a1 100644 --- a/src/MemStore.cc +++ b/src/MemStore.cc @@ -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 diff --git a/src/MemStore.h b/src/MemStore.h index ca5e60cea3..f95875a9df 100644 --- a/src/MemStore.h +++ b/src/MemStore.h @@ -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".