Kernel/SysFS: Remove unnecessary mutex lockers in SysFS metadata getters

SysFS inodes have immutable metadata once created.
This commit is contained in:
Andreas Kling 2021-08-28 23:59:29 +02:00
parent 8ebf08b6c8
commit 244ede561b
Notes: sideshowbarker 2024-07-18 05:06:57 +09:00

View File

@ -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;
@ -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;