Kernel: Remove unnecessary hash map lookups
This commit is contained in:
@@ -295,8 +295,9 @@ namespace Kernel
|
||||
TRY(sync_superblock());
|
||||
|
||||
// remove inode from cache
|
||||
if (m_inode_cache.contains(ino))
|
||||
m_inode_cache.remove(ino);
|
||||
auto it = m_inode_cache.find(ino);
|
||||
if (it != m_inode_cache.end())
|
||||
m_inode_cache.remove(it);
|
||||
|
||||
return {};
|
||||
}
|
||||
|
||||
@@ -24,8 +24,9 @@ namespace Kernel
|
||||
|
||||
BAN::ErrorOr<BAN::RefPtr<Ext2Inode>> Ext2Inode::create(Ext2FS& fs, uint32_t inode_ino)
|
||||
{
|
||||
if (fs.inode_cache().contains(inode_ino))
|
||||
return fs.inode_cache()[inode_ino];
|
||||
auto it = fs.inode_cache().find(inode_ino);
|
||||
if (it != fs.inode_cache().end())
|
||||
return it->value;
|
||||
|
||||
auto inode_location = TRY(fs.locate_inode(inode_ino));
|
||||
|
||||
|
||||
@@ -68,8 +68,9 @@ namespace Kernel
|
||||
{
|
||||
LockGuard _(m_mutex);
|
||||
|
||||
if (m_inode_cache.contains(ino))
|
||||
return m_inode_cache[ino];
|
||||
auto it = m_inode_cache.find(ino);
|
||||
if (it != m_inode_cache.end())
|
||||
return it->value;
|
||||
|
||||
TmpInodeInfo inode_info;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user