[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20080514140802.5621167d@gara>
Date: Wed, 14 May 2008 14:08:02 -0500
From: "Jose R. Santos" <jrs@...ibm.com>
To: "Aneesh Kumar K.V" <aneesh.kumar@...ux.vnet.ibm.com>
Cc: cmm@...ibm.com, tytso@....edu, sandeen@...hat.com,
linux-ext4@...r.kernel.org,
"Aneesh Kumar K.V" <aneesh.kumar@...ux.vnet.ibm.com>
Subject: Re: [PATCH] ext4: Fix FLEX_BG and uninit group usage.
On Thu, 15 May 2008 00:17:12 +0530
"Aneesh Kumar K.V" <aneesh.kumar@...ux.vnet.ibm.com> wrote:
> With FLEX_BG we allocate block bitmap, inode bitmap, and
> inode table outside the group. So when initialzing the
> uninit block group we don't need to set bits corresponding
> to these meta-data in the bitmaps. Also return the right
> number of free blocks when counting the available free
> blocks in uninit group.
>
> Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@...ux.vnet.ibm.com>
> ---
> fs/ext4/balloc.c | 15 ++++++++++++++-
> 1 files changed, 14 insertions(+), 1 deletions(-)
>
> diff --git a/fs/ext4/balloc.c b/fs/ext4/balloc.c
> index 5c80eb5..fb63f01 100644
> --- a/fs/ext4/balloc.c
> +++ b/fs/ext4/balloc.c
> @@ -109,7 +109,14 @@ unsigned ext4_init_block_bitmap(struct super_block *sb, struct buffer_head *bh,
>
> for (bit = 0; bit < bit_max; bit++)
> ext4_set_bit(bit, bh->b_data);
> -
> + /*
> + * With FLEX_BG uninit group we have all the
> + * blocks available for use. So no need
> + * to set any bits in bitmap
> + */
> + if (EXT4_HAS_INCOMPAT_FEATURE(sb,
> + EXT4_FEATURE_INCOMPAT_FLEX_BG))
> + return free_blocks;
> start = ext4_group_first_block_no(sb, block_group);
>
> /* Set bits for block and inode bitmaps, and inode table */
> @@ -126,6 +133,12 @@ unsigned ext4_init_block_bitmap(struct super_block *sb, struct buffer_head *bh,
> */
> mark_bitmap_end(group_blocks, sb->s_blocksize * 8, bh->b_data);
> }
> + /*
> + * With FLEX_BG uninit group we have all the
> + * blocks available for use.
> + */
> + if (EXT4_HAS_INCOMPAT_FEATURE(sb, EXT4_FEATURE_INCOMPAT_FLEX_BG))
> + return free_blocks;
>
> return free_blocks - sbi->s_itb_per_group - 2;
> }
This assumes that if the FLEX_BG feature is enable that all block
groups have no bitmaps or inode tables (which is wrong).
Something like this (ignore the fact that doesnt handle hi bits) should be better.
used_blocks = sbi->s_itb_per_group + 2;
if (EXT4_HAS_INCOMPAT_FEATURE(sb, EXT4_FEATURE_INCOMPAT_FLEX_BG)) {
ext4_get_group_no_and_offset(sbi, bgd->bg_block_bitmap_lo, tmp, 0);
if (tmp != block_group)
used_blocks--;
ext4_get_group_no_and_offset(sbi, bgd->bg_inode_bitmap_lo, tmp, 0);
if (tmp != block_group)
used_blocks--;
ext4_get_group_no_and_offset(sbi, bgd->bg_inode_table_lo, tmp, 0);
if (tmp != block_group)
used_blocks -= sbi->s_itb_per_group;
}
return free_blocks - used_blocks;
}
-JRS
--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists