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

Ext2FS: Fix various bugs in inode and block allocation.

I had the wrong idea about how group indices work, so using a larger fs
with more than one group caused all kinds of mess.
This commit is contained in:
Andreas Kling 2019-02-15 23:24:01 +01:00
parent cbfd416279
commit 749db8237c
2 changed files with 40 additions and 24 deletions

View file

@ -92,6 +92,7 @@ private:
unsigned allocate_inode(unsigned preferredGroup, unsigned expectedSize);
Vector<BlockIndex> allocate_blocks(unsigned group, unsigned count);
unsigned group_index_from_inode(unsigned) const;
GroupIndex group_index_from_block_index(BlockIndex) const;
Vector<unsigned> block_list_for_inode(const ext2_inode&, bool include_block_list_blocks = false) const;
bool write_block_list_for_inode(InodeIndex, ext2_inode&, const Vector<BlockIndex>&);
@ -106,7 +107,7 @@ private:
bool write_directory_inode(unsigned directoryInode, Vector<DirectoryEntry>&&);
bool get_inode_allocation_state(InodeIndex) const;
bool set_inode_allocation_state(unsigned inode, bool);
bool set_block_allocation_state(GroupIndex, BlockIndex, bool);
bool set_block_allocation_state(BlockIndex, bool);
void uncache_inode(InodeIndex);
void free_inode(Ext2FSInode&);