mirror of
https://github.com/fergalmoran/ladybird.git
synced 2025-12-26 19:29:16 +00:00
Ext2FS: Rename allocate_inode() => find_a_free_inode()
Since this function doesn't actually mark the inode as allocated, let's tone down the name a little bit.
This commit is contained in:
@@ -1069,11 +1069,11 @@ Vector<Ext2FS::BlockIndex> Ext2FS::allocate_blocks(GroupIndex preferred_group_in
|
||||
return blocks;
|
||||
}
|
||||
|
||||
unsigned Ext2FS::allocate_inode(GroupIndex preferred_group, off_t expected_size)
|
||||
unsigned Ext2FS::find_a_free_inode(GroupIndex preferred_group, off_t expected_size)
|
||||
{
|
||||
LOCKER(m_lock);
|
||||
#ifdef EXT2_DEBUG
|
||||
dbgprintf("Ext2FS: allocate_inode(preferredGroup: %u, expected_size: %u)\n", preferred_group, expected_size);
|
||||
dbgprintf("Ext2FS: find_a_free_inode(preferred_group: %u, expected_size: %ld)\n", preferred_group, expected_size);
|
||||
#endif
|
||||
|
||||
unsigned needed_blocks = ceil_div(expected_size, block_size());
|
||||
@@ -1101,12 +1101,12 @@ unsigned Ext2FS::allocate_inode(GroupIndex preferred_group, off_t expected_size)
|
||||
}
|
||||
|
||||
if (!group_index) {
|
||||
kprintf("Ext2FS: allocate_inode: no suitable group found for new inode with %u blocks needed :(\n", needed_blocks);
|
||||
kprintf("Ext2FS: find_a_free_inode: no suitable group found for new inode with %u blocks needed :(\n", needed_blocks);
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifdef EXT2_DEBUG
|
||||
dbgprintf("Ext2FS: allocate_inode: found suitable group [%u] for new inode with %u blocks needed :^)\n", group_index, needed_blocks);
|
||||
dbgprintf("Ext2FS: find_a_free_inode: found suitable group [%u] for new inode with %u blocks needed :^)\n", group_index, needed_blocks);
|
||||
#endif
|
||||
|
||||
auto& bgd = group_descriptor(group_index);
|
||||
@@ -1135,9 +1135,6 @@ unsigned Ext2FS::allocate_inode(GroupIndex preferred_group, off_t expected_size)
|
||||
#endif
|
||||
|
||||
ASSERT(get_inode_allocation_state(inode) == false);
|
||||
|
||||
// FIXME: allocate blocks if needed!
|
||||
|
||||
return inode;
|
||||
}
|
||||
|
||||
@@ -1348,8 +1345,7 @@ RefPtr<Inode> Ext2FS::create_inode(InodeIdentifier parent_id, const String& name
|
||||
}
|
||||
|
||||
// NOTE: This doesn't commit the inode allocation just yet!
|
||||
// FIXME: Change the name of allocate_inode since it behaves differently than allocate_block
|
||||
auto inode_id = allocate_inode(0, size);
|
||||
auto inode_id = find_a_free_inode(0, size);
|
||||
if (!inode_id) {
|
||||
kprintf("Ext2FS: create_inode: allocate_inode failed\n");
|
||||
error = -ENOSPC;
|
||||
|
||||
@@ -103,7 +103,7 @@ private:
|
||||
virtual void flush_writes() override;
|
||||
|
||||
BlockIndex first_block_index() const;
|
||||
InodeIndex allocate_inode(GroupIndex preferred_group, off_t expected_size);
|
||||
InodeIndex find_a_free_inode(GroupIndex preferred_group, off_t expected_size);
|
||||
Vector<BlockIndex> allocate_blocks(GroupIndex preferred_group_index, int count);
|
||||
BlockIndex allocate_block(GroupIndex preferred_group_index);
|
||||
GroupIndex group_index_from_inode(InodeIndex) const;
|
||||
|
||||
Reference in New Issue
Block a user