Skip to content

Commit

Permalink
Kernel/SysFS: Remove unnecessary mutex lockers in SysFS metadata getters
Browse files Browse the repository at this point in the history
SysFS inodes have immutable metadata once created.
  • Loading branch information
awesomekling committed Aug 28, 2021
1 parent 8ebf08b commit 244ede5
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Kernel/FileSystem/SysFS.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ KResultOr<NonnullRefPtr<Inode>> SysFSInode::lookup(StringView)

InodeMetadata SysFSInode::metadata() const
{
MutexLocker locker(m_inode_lock);
// NOTE: No locking required as m_associated_component or its component index will never change during our lifetime.
InodeMetadata metadata;
metadata.inode = { fsid(), m_associated_component->component_index() };
metadata.mode = S_IFREG | S_IRUSR | S_IRGRP | S_IROTH;
Expand Down Expand Up @@ -179,7 +179,7 @@ SysFSDirectoryInode::~SysFSDirectoryInode()

InodeMetadata SysFSDirectoryInode::metadata() const
{
MutexLocker locker(m_inode_lock);
// NOTE: No locking required as m_associated_component or its component index will never change during our lifetime.
InodeMetadata metadata;
metadata.inode = { fsid(), m_associated_component->component_index() };
metadata.mode = S_IFDIR | S_IRUSR | S_IRGRP | S_IROTH | S_IXOTH;
Expand Down

0 comments on commit 244ede5

Please sign in to comment.