mirror of
https://github.com/fergalmoran/ladybird.git
synced 2025-12-27 03:37:53 +00:00
Ext2FS: Fix two bugs in block allocation:
1) Off-by-one in block allocation when block size != 1 KB Due to a quirk in the on-disk layout of ext2, file systems with a block size of 1 KB have block #1 as their first block, while all others start on block #0. 2) We had no fallback mechanism when the preferred group was full We now allocate blocks from the preferred block group as long as it's possible, and fall back to a simple scan through all groups when the preferred one is full.
This commit is contained in:
@@ -98,8 +98,10 @@ private:
|
||||
virtual RefPtr<Inode> create_directory(InodeIdentifier parentInode, const String& name, mode_t, int& error) override;
|
||||
virtual RefPtr<Inode> get_inode(InodeIdentifier) const override;
|
||||
|
||||
BlockIndex first_block_index() const;
|
||||
InodeIndex allocate_inode(GroupIndex preferred_group, off_t expected_size);
|
||||
Vector<BlockIndex> allocate_blocks(GroupIndex, int count);
|
||||
Vector<BlockIndex> allocate_blocks(GroupIndex preferred_group_index, int count);
|
||||
BlockIndex allocate_block(GroupIndex preferred_group_index);
|
||||
GroupIndex group_index_from_inode(InodeIndex) const;
|
||||
GroupIndex group_index_from_block_index(BlockIndex) const;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user