summaryrefslogtreecommitdiff
path: root/Kernel/FileSystem/Ext2FileSystem.cpp
diff options
context:
space:
mode:
authorLiav A <liavalb@gmail.com>2022-08-06 18:07:03 +0300
committerIdan Horowitz <idan.horowitz@gmail.com>2022-09-16 14:55:45 +0300
commit843bd43c5be5b5d1b8bff8aa2a81b99ed232bc57 (patch)
tree5d687afeccd422ca56877a450501571e5e455f2c /Kernel/FileSystem/Ext2FileSystem.cpp
parentb04de3090f25506c00a1f159dc5d9b211dc839fe (diff)
downloadserenity-843bd43c5be5b5d1b8bff8aa2a81b99ed232bc57.zip
Kernel/FileSystem: Mark ext2 inode lookup cache non-const
For the lookup cache, no method being declared const tried to modify it, so it was easy to drop the mutable declaration on the HashMap member.
Diffstat (limited to 'Kernel/FileSystem/Ext2FileSystem.cpp')
-rw-r--r--Kernel/FileSystem/Ext2FileSystem.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/Kernel/FileSystem/Ext2FileSystem.cpp b/Kernel/FileSystem/Ext2FileSystem.cpp
index b2f90f85ac..48aa3b4cdd 100644
--- a/Kernel/FileSystem/Ext2FileSystem.cpp
+++ b/Kernel/FileSystem/Ext2FileSystem.cpp
@@ -1499,9 +1499,9 @@ ErrorOr<NonnullLockRefPtr<Inode>> Ext2FS::create_inode(Ext2FSInode& parent_inode
return new_inode;
}
-ErrorOr<void> Ext2FSInode::populate_lookup_cache() const
+ErrorOr<void> Ext2FSInode::populate_lookup_cache()
{
- MutexLocker locker(m_inode_lock);
+ VERIFY(m_inode_lock.is_exclusively_locked_by_current_thread());
if (!m_lookup_cache.is_empty())
return {};
HashMap<NonnullOwnPtr<KString>, InodeIndex> children;
@@ -1521,11 +1521,11 @@ ErrorOr<NonnullLockRefPtr<Inode>> Ext2FSInode::lookup(StringView name)
{
VERIFY(is_directory());
dbgln_if(EXT2_DEBUG, "Ext2FSInode[{}]:lookup(): Looking up '{}'", identifier(), name);
- TRY(populate_lookup_cache());
InodeIndex inode_index;
{
MutexLocker locker(m_inode_lock);
+ TRY(populate_lookup_cache());
auto it = m_lookup_cache.find(name);
if (it == m_lookup_cache.end()) {
dbgln_if(EXT2_DEBUG, "Ext2FSInode[{}]:lookup(): '{}' not found", identifier(), name);