[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: allocation



John Nelson wrote:
does ext3 allocate space for files anywhere on the disk where there is free space or does it try to keep them all in one area like how ntfs or fat do?

_______________________________________________
Ext3-users mailing list
Ext3-users redhat com
https://www.redhat.com/mailman/listinfo/ext3-users


In fs/ext3/ialloc.c:

/*
* There are two policies for allocating an inode.  If the new inode is
* a directory, then a forward search is made for a block group with both
* free space and a low directory-to-inode ratio; if that fails, then of
* the groups with above-average free space, that group with the fewest
* directories already is chosen.
*
* For other inodes, search forward from the parent directory\'s block
* group to find a free inode.
*/
static int find_group_dir(struct super_block *sb, struct inode *parent)
{
       int ngroups = EXT3_SB(sb)->s_groups_count;
       unsigned int freei, avefreei;
       struct ext3_group_desc *desc, *best_desc = NULL;
       int group, best_group = -1;

And this:

/*
* There are two policies for allocating an inode.  If the new inode is
* a directory, then a forward search is made for a block group with both
* free space and a low directory-to-inode ratio; if that fails, then of
* the groups with above-average free space, that group with the fewest
* directories already is chosen.
*
* For other inodes, search forward from the parent directory's block
* group to find a free inode.
*/
struct inode *ext3_new_inode(handle_t *handle, struct inode * dir, int mode)
{
       struct super_block *sb;
       struct buffer_head *bitmap_bh = NULL;
       struct buffer_head *bh2;
       int group;
       unsigned long ino = 0;


Possibly u can look further from here.   it is new to me too.


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]