mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-27 23:09:08 +00:00
Kernel/Ext2FS: Surface Vector allocation failures in block allocation
This commit is contained in:
parent
1f18558ee2
commit
bd37840cf5
Notes:
sideshowbarker
2024-07-18 08:50:41 +09:00
Author: https://github.com/awesomekling
Commit: bd37840cf5
1 changed files with 3 additions and 4 deletions
|
@ -1294,15 +1294,15 @@ bool Ext2FS::write_ext2_inode(InodeIndex inode, const ext2_inode& e2inode)
|
|||
|
||||
auto Ext2FS::allocate_blocks(GroupIndex preferred_group_index, size_t count) -> KResultOr<Vector<BlockIndex>>
|
||||
{
|
||||
MutexLocker locker(m_lock);
|
||||
dbgln_if(EXT2_DEBUG, "Ext2FS: allocate_blocks(preferred group: {}, count {})", preferred_group_index, count);
|
||||
if (count == 0)
|
||||
return Vector<BlockIndex> {};
|
||||
|
||||
Vector<BlockIndex> blocks;
|
||||
dbgln_if(EXT2_DEBUG, "Ext2FS: allocate_blocks:");
|
||||
blocks.ensure_capacity(count);
|
||||
if (!blocks.try_ensure_capacity(count))
|
||||
return ENOMEM;
|
||||
|
||||
MutexLocker locker(m_lock);
|
||||
auto group_index = preferred_group_index;
|
||||
|
||||
if (!group_descriptor(preferred_group_index).bg_free_blocks_count) {
|
||||
|
@ -1310,7 +1310,6 @@ auto Ext2FS::allocate_blocks(GroupIndex preferred_group_index, size_t count) ->
|
|||
}
|
||||
|
||||
while (blocks.size() < count) {
|
||||
|
||||
bool found_a_group = false;
|
||||
if (group_descriptor(group_index).bg_free_blocks_count) {
|
||||
found_a_group = true;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue