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

Ext2FS: Simplify inode creation by always starting empty

We had two ways of creating a new Ext2FS inode. Either they were empty,
or they started with some pre-allocated size.

In practice, the pre-sizing code path was only used for new directories
and it didn't actually improve anything as far as I can tell.

This patch simplifies inode creation by simply always allocating empty
inodes. Block allocation and block list generation now always happens
on the same code path.
This commit is contained in:
Andreas Kling 2021-02-02 16:24:26 +01:00
parent dbb668ddd3
commit 9e4dd834ab
2 changed files with 14 additions and 40 deletions

View file

@ -138,12 +138,12 @@ private:
virtual const char* class_name() const override;
virtual NonnullRefPtr<Inode> root_inode() const override;
RefPtr<Inode> get_inode(InodeIdentifier) const;
KResultOr<NonnullRefPtr<Inode>> create_inode(InodeIdentifier parent_id, const String& name, mode_t, off_t size, dev_t, uid_t, gid_t);
KResultOr<NonnullRefPtr<Inode>> create_inode(InodeIdentifier parent_id, const String& name, mode_t, dev_t, uid_t, gid_t);
KResult create_directory(InodeIdentifier parent_inode, const String& name, mode_t, uid_t, gid_t);
virtual void flush_writes() override;
BlockIndex first_block_index() const;
InodeIndex find_a_free_inode(GroupIndex preferred_group, off_t expected_size);
InodeIndex find_a_free_inode(GroupIndex preferred_group = 0);
Vector<BlockIndex> allocate_blocks(GroupIndex preferred_group_index, size_t count);
GroupIndex group_index_from_inode(InodeIndex) const;
GroupIndex group_index_from_block_index(BlockIndex) const;