1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-16 19:35:08 +00:00

Ext2FS: Make Ext2FSInode::is_directory() fast

This patch overloads Inode::is_directory() with a faster version that
doesn't require instantiating the whole InodeMetadata.

If you have an Ext2FSInode&, calling is_directory() should be instant
since we can just look directly at the raw inode bits.
This commit is contained in:
Andreas Kling 2019-10-02 13:37:44 +02:00
parent d553bae749
commit 5ab044beae
2 changed files with 2 additions and 1 deletions

View file

@ -802,7 +802,7 @@ ssize_t Ext2FSInode::write_bytes(off_t offset, ssize_t count, const u8* data, Fi
bool Ext2FSInode::traverse_as_directory(Function<bool(const FS::DirectoryEntry&)> callback) const
{
LOCKER(m_lock);
ASSERT(metadata().is_directory());
ASSERT(is_directory());
#ifdef EXT2_DEBUG
kprintf("Ext2Inode::traverse_as_directory: inode=%u:\n", index());