1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 07:58:11 +00:00

Kernel/Ext2FS: Cache the root inode in a member variable

We often get queried for the root inode, and it will always be cached
in memory anyway, so let's make Ext2FS::root_inode() fast by keeping
the root inode in a dedicated member variable.
This commit is contained in:
Andreas Kling 2021-07-18 01:29:54 +02:00
parent 9457d83986
commit 58c6d30f6a
4 changed files with 13 additions and 4 deletions

View file

@ -99,7 +99,7 @@ public:
virtual unsigned total_inode_count() const override;
virtual unsigned free_inode_count() const override;
virtual KResult prepare_to_unmount() const override;
virtual KResult prepare_to_unmount() override;
virtual bool supports_watchers() const override { return true; }
@ -183,6 +183,7 @@ private:
KResult update_bitmap_block(BlockIndex bitmap_block, size_t bit_index, bool new_state, u32& super_block_counter, u16& group_descriptor_counter);
Vector<OwnPtr<CachedBitmap>> m_cached_bitmaps;
RefPtr<Ext2FSInode> m_root_inode;
};
inline Ext2FS& Ext2FSInode::fs()