Add an inode metadata cache to the ext2fs implementation.

This commit is contained in:
Andreas Kling 2018-10-29 23:45:34 +01:00
parent 4259ffb080
commit 8e640539ef
Notes: sideshowbarker 2024-07-19 18:36:42 +09:00
7 changed files with 57 additions and 5 deletions

View file

@ -46,6 +46,7 @@ ByteBuffer DiskBackedFileSystem::readBlock(unsigned index) const
#ifdef BLOCK_CACHE
{
LOCKER(m_blockCacheLock);
InterruptDisabler disabler;
auto it = m_blockCache.find(index);
if (it != m_blockCache.end()) {
@ -64,6 +65,7 @@ ByteBuffer DiskBackedFileSystem::readBlock(unsigned index) const
#ifdef BLOCK_CACHE
{
LOCKER(m_blockCacheLock);
InterruptDisabler disabler;
if (m_blockCache.size() >= 32)
m_blockCache.removeOneRandomly();
@ -103,6 +105,7 @@ void DiskBackedFileSystem::setBlockSize(unsigned blockSize)
void DiskBackedFileSystem::invalidateCaches()
{
LOCKER(m_blockCacheLock);
InterruptDisabler disabler;
m_blockCache.clear();
}