diff --git a/VirtualFileSystem/DiskBackedFileSystem.cpp b/VirtualFileSystem/DiskBackedFileSystem.cpp index b0c9998e68..359a04f5e5 100644 --- a/VirtualFileSystem/DiskBackedFileSystem.cpp +++ b/VirtualFileSystem/DiskBackedFileSystem.cpp @@ -7,7 +7,6 @@ typedef int InterruptDisabler; #endif //#define DBFS_DEBUG -#define BLOCK_CACHE DiskBackedFS::DiskBackedFS(RetainPtr&& device) : m_device(move(device)) @@ -43,18 +42,6 @@ ByteBuffer DiskBackedFS::readBlock(unsigned index) const #ifdef DBFS_DEBUG kprintf("DiskBackedFileSystem::readBlock %u\n", index); #endif - -#ifdef BLOCK_CACHE - { - LOCKER(m_blockCacheLock); - InterruptDisabler disabler; - auto it = m_blockCache.find(index); - if (it != m_blockCache.end()) { - return (*it).value; - } - } -#endif - auto buffer = ByteBuffer::create_uninitialized(blockSize()); //kprintf("created block buffer with size %u\n", blockSize()); DiskOffset baseOffset = static_cast(index) * static_cast(blockSize()); @@ -62,16 +49,6 @@ ByteBuffer DiskBackedFS::readBlock(unsigned index) const bool success = device().read(baseOffset, blockSize(), bufferPointer); ASSERT(success); ASSERT(buffer.size() == blockSize()); - -#ifdef BLOCK_CACHE - { - LOCKER(m_blockCacheLock); - InterruptDisabler disabler; - if (m_blockCache.size() >= 32) - m_blockCache.removeOneRandomly(); - m_blockCache.set(index, buffer); - } -#endif return buffer; } @@ -100,12 +77,4 @@ void DiskBackedFS::setBlockSize(unsigned blockSize) if (blockSize == m_blockSize) return; m_blockSize = blockSize; - invalidateCaches(); -} - -void DiskBackedFS::invalidateCaches() -{ - LOCKER(m_blockCacheLock); - InterruptDisabler disabler; - m_blockCache.clear(); } diff --git a/VirtualFileSystem/DiskBackedFileSystem.h b/VirtualFileSystem/DiskBackedFileSystem.h index 51d3815b02..0a9f35f51f 100644 --- a/VirtualFileSystem/DiskBackedFileSystem.h +++ b/VirtualFileSystem/DiskBackedFileSystem.h @@ -2,8 +2,6 @@ #include "FileSystem.h" #include -#include -#include class DiskBackedFS : public FS { public: @@ -18,7 +16,6 @@ protected: explicit DiskBackedFS(RetainPtr&&); void setBlockSize(unsigned); - void invalidateCaches(); ByteBuffer readBlock(unsigned index) const; ByteBuffer readBlocks(unsigned index, unsigned count) const; @@ -29,7 +26,4 @@ protected: private: size_t m_blockSize { 0 }; RetainPtr m_device; - - mutable SpinLock m_blockCacheLock; - mutable HashMap m_blockCache; }; diff --git a/VirtualFileSystem/Ext2FileSystem.h b/VirtualFileSystem/Ext2FileSystem.h index c5a094e019..44aefba1ca 100644 --- a/VirtualFileSystem/Ext2FileSystem.h +++ b/VirtualFileSystem/Ext2FileSystem.h @@ -4,6 +4,7 @@ #include "UnixTypes.h" #include #include +#include #include "ext2_fs.h" struct ext2_group_desc;