questions on handling the size of the last block group

Eric Sandeen <[email protected]> Wed, 16 Aug 2006 16:03:36 -0500
Newsgroups gmane.comp.file-systems.ext2.devel
Message-ID <[email protected]>
 From my understanding, it's possible that the last block group can have 
fewer blocks than blocks_per_group, if

total blocks < groups * blocks_per_group

I found one or two places in e2fsprogs where this is explicitly handled, 
and in the patch series I just sent I put it in a few more places, but 
there are still some spots I wonder about, such as:

static int alloc_new_reservation(struct ext3_reserve_window_node *my_rsv,
                 ext3_grpblk_t grp_goal, struct super_block *sb,
                 unsigned int group, struct buffer_head *bitmap_bh)
{
         group_first_block = ext3_group_first_block_no(sb, group);
         group_end_block = group_first_block + 
(EXT3_BLOCKS_PER_GROUP(sb) - 1);

	<...>

         ret = find_next_reservable_window(search_head, my_rsv, sb,
                                                 start_block, 
group_end_block)

Here group_end_block may be off the end of the filesystem for the last 
group.

Is this safe for allocations in the last block group?  Could the 
allocator be looking for blocks past the end of the filesystem...? 
Surely not, I expect that more than one such filesystem has been filled 
to the last block, but I'm not sure where this gets caught... perhaps 
when searching the bitmaps?

Thanks,

-Eric

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642