mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-01-04 23:57:25 +00:00
Make page_in_from_vnode 2x faster.
...by adding a new class called Ext2Inode that inherits CoreInode. The idea is that a vnode will wrap a CoreInode rather than InodeIdentifier. Each CoreInode subclass can keep whatever caches they like. Right now, Ext2Inode caches the list of block indices since it can be very expensive to retrieve.
This commit is contained in:
@@ -17,6 +17,31 @@
|
||||
static const dword mepoch = 476763780;
|
||||
|
||||
class FileDescriptor;
|
||||
class FileSystem;
|
||||
|
||||
class CoreInode : public Retainable<CoreInode> {
|
||||
public:
|
||||
virtual ~CoreInode();
|
||||
|
||||
FileSystem& fs() const { return m_fs; }
|
||||
unsigned fsid() const;
|
||||
unsigned index() const { return m_index; }
|
||||
|
||||
InodeIdentifier identifier() const { return { fsid(), index() }; }
|
||||
|
||||
virtual Unix::ssize_t read_bytes(Unix::off_t, Unix::size_t, byte* buffer, FileDescriptor*) = 0;
|
||||
|
||||
protected:
|
||||
CoreInode(FileSystem& fs, unsigned index)
|
||||
: m_fs(fs)
|
||||
, m_index(index)
|
||||
{
|
||||
}
|
||||
|
||||
private:
|
||||
FileSystem& m_fs;
|
||||
unsigned m_index { 0 };
|
||||
};
|
||||
|
||||
class FileSystem : public Retainable<FileSystem> {
|
||||
public:
|
||||
@@ -50,6 +75,8 @@ public:
|
||||
|
||||
virtual InodeIdentifier findParentOfInode(InodeIdentifier) const = 0;
|
||||
|
||||
virtual RetainPtr<CoreInode> get_inode(InodeIdentifier) = 0;
|
||||
|
||||
InodeIdentifier childOfDirectoryInodeWithName(InodeIdentifier, const String& name) const;
|
||||
ByteBuffer readEntireInode(InodeIdentifier, FileDescriptor* = nullptr) const;
|
||||
String nameOfChildInDirectory(InodeIdentifier parent, InodeIdentifier child) const;
|
||||
@@ -83,6 +110,11 @@ inline bool InodeIdentifier::isRootInode() const
|
||||
return (*this) == fileSystem()->rootInode();
|
||||
}
|
||||
|
||||
inline unsigned CoreInode::fsid() const
|
||||
{
|
||||
return m_fs.id();
|
||||
}
|
||||
|
||||
namespace AK {
|
||||
|
||||
template<>
|
||||
|
||||
Reference in New Issue
Block a user