summaryrefslogtreecommitdiff
path: root/Kernel/FileSystem/Ext2FileSystem.h
diff options
context:
space:
mode:
authorAndreas Kling <awesomekling@gmail.com>2019-09-22 18:34:52 +0200
committerAndreas Kling <awesomekling@gmail.com>2019-09-22 18:37:17 +0200
commitbff59eff4bb519e958e6f5cf0c98a1cb2afbfc20 (patch)
tree66e0ee245b35cb2e2c4e130d39199c3481ccce71 /Kernel/FileSystem/Ext2FileSystem.h
parent9c549c178a35934425e4e46be353f6e5e4f60b4f (diff)
downloadserenity-bff59eff4bb519e958e6f5cf0c98a1cb2afbfc20.zip
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.
Diffstat (limited to 'Kernel/FileSystem/Ext2FileSystem.h')
-rw-r--r--Kernel/FileSystem/Ext2FileSystem.h4
1 files changed, 3 insertions, 1 deletions
diff --git a/Kernel/FileSystem/Ext2FileSystem.h b/Kernel/FileSystem/Ext2FileSystem.h
index 3cc7f19716..3c43f55680 100644
--- a/Kernel/FileSystem/Ext2FileSystem.h
+++ b/Kernel/FileSystem/Ext2FileSystem.h
@@ -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;