1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-18 11:35:06 +00:00

Add CoreInode::reverse_lookup().

Getting the absolute path of an ext2fs inode now uses the lookup cache
which makes it a lot faster.
This commit is contained in:
Andreas Kling 2018-11-15 17:04:55 +01:00
parent 5f434bc00b
commit eced5f11e3
7 changed files with 61 additions and 74 deletions

View file

@ -26,6 +26,9 @@ private:
virtual void populate_metadata() const override;
virtual bool traverse_as_directory(Function<bool(const FileSystem::DirectoryEntry&)>) override;
virtual InodeIdentifier lookup(const String& name) override;
virtual String reverse_lookup(InodeIdentifier) override;
void populate_lookup_cache();
Ext2FileSystem& fs();
const Ext2FileSystem& fs() const;
@ -33,7 +36,7 @@ private:
SpinLock m_lock;
Vector<unsigned> m_block_list;
HashMap<String, unsigned> m_child_cache;
HashMap<String, unsigned> m_lookup_cache;
ext2_inode m_raw_inode;
};
@ -71,7 +74,6 @@ private:
virtual const char* class_name() const override;
virtual InodeIdentifier rootInode() const override;
virtual bool writeInode(InodeIdentifier, const ByteBuffer&) override;
virtual bool enumerateDirectoryInode(InodeIdentifier, Function<bool(const DirectoryEntry&)>) const override;
virtual InodeMetadata inodeMetadata(InodeIdentifier) const override;
virtual bool set_mtime(InodeIdentifier, dword timestamp) override;
virtual InodeIdentifier create_inode(InodeIdentifier parentInode, const String& name, Unix::mode_t, unsigned size) override;
@ -102,6 +104,8 @@ private:
unsigned m_blockGroupCount { 0 };
bool deprecated_enumerateDirectoryInode(InodeIdentifier, Function<bool(const DirectoryEntry&)>) const;
mutable ByteBuffer m_cachedSuperBlock;
mutable ByteBuffer m_cachedBlockGroupDescriptorTable;