lkml.org 
[lkml]   [2001]   [Nov]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [Ext2-devel] ext2/ialloc.c cleanup
On Nov 06, 2001  18:17 -0500, Alexander Viro wrote:
> Folks, promised cleanup of ialloc.c is on
> ftp.math.psu.edu:pub/viro/ialloc.c,v
>
> And yes, it's in RCS. The thing is split into _really_ small
> steps (commented in the log). Each is a trivial transformation
> and it should be very easy to verify correctness of any of
> them.
>
> Please, review. IMO it's cut fine enough to make the gradual merge
> possible for 2.4 - look and you'll see.

Minor nits, from my changes to this same function:
1) please replace use of "i" for best block group in find_cg_*, to
something better like "group", just for clarity.
2) in find_cg_*, when you fail the quadratic search, the linear search
should skip groups that were previously checked in the quadratic search,
with slight changes to both loops:

start = dir->u.ext2_i.i_block_group;

/* Use quadratic hash to find group with a free inode */
for (j = 1; j < count; j <<= 1) {
group = start + j;
if (group >= count)
group -= count;
cg = ext2_get_group_desc(sb, group, &bh);
if (cg && le16_to_cpu(cg->bg_free_inodes_count))
goto found;
}

/* That failed: try linear search for a free inode
* skipping groups we checked in the previous loop.
*/
for (j = 3; j < count; j++) {
if ((j & (j - 1)) == 0)
continue;
group = start + j;
if (group > count)
group -= count;
cg = ext2_get_group_desc(sb, group, &bh);
if (cg && le16_to_cpu(cg->bg_free_inodes_count))
goto found;
}
3) I know that "cylinder groups" were used in old FFS/whatever implementation,
but all of the ext2 code/documentation refers to these as block groups.
Can you stick with that for ext2 (e.g. gdp, not cg; bg_foo, not cg_foo)?
4) sbi can be gotten by "EXT2_SB(sb)".

Cheers, Andreas
--
Andreas Dilger
http://sourceforge.net/projects/ext2resize/
http://www-mddsp.enel.ucalgary.ca/People/adilger/

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 13:12    [W:1.648 / U:0.000 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site