1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 14:28:12 +00:00

Ext2FS: Inode allocation improvements

This patch combines inode the scan for an available inode with the
updating of the bit in the inode bitmap into a single operation.

We also exit the scan immediately when we find an inode, instead of
continuing until we've scanned all the eligible groups(!)

Finally, we stop holding the filesystem lock throughout the entire
operation, and instead only take it while actually necessary
(during inode allocation, flush, and inode cache update.)
This commit is contained in:
Andreas Kling 2021-02-26 12:03:14 +01:00
parent 1318b9391d
commit 1f9409a658
2 changed files with 40 additions and 55 deletions

View file

@ -140,7 +140,7 @@ private:
virtual void flush_writes() override;
BlockIndex first_block_index() const;
KResultOr<InodeIndex> find_a_free_inode(GroupIndex preferred_group = 0);
KResultOr<InodeIndex> allocate_inode(GroupIndex preferred_group = 0);
KResultOr<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;