From: "Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com>
To: "Jose R. Santos" <jrs@us.ibm.com>
Cc: cmm@us.ibm.com, tytso@mit.edu, sandeen@redhat.com,
linux-ext4@vger.kernel.org
Subject: Re: [PATCH] ext4: Fix FLEX_BG and uninit group usage.
Date: Thu, 15 May 2008 09:36:58 +0530 [thread overview]
Message-ID: <20080515040658.GA15128@skywalker> (raw)
In-Reply-To: <20080514140802.5621167d@gara>
On Wed, May 14, 2008 at 02:08:02PM -0500, Jose R. Santos wrote:
> On Thu, 15 May 2008 00:17:12 +0530
> "Aneesh Kumar K.V" <aneesh.kumar@linux.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@linux.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;
> }
But with FLEX_BG won't we mark the group as initialized if we are
placing the bitmap or inode table in the group ?
-aneesh
next prev parent reply other threads:[~2008-05-15 4:07 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-05-14 18:47 [PATCH] ext4: printk stack trace on ext4_error, ext4_abort and ext4_warning Aneesh Kumar K.V
2008-05-14 18:47 ` [PATCH] ext4: Fix use of uninitialized data Aneesh Kumar K.V
2008-05-14 18:47 ` [PATCH] ext4: Fix FLEX_BG and uninit group usage Aneesh Kumar K.V
2008-05-14 19:08 ` Jose R. Santos
2008-05-15 4:06 ` Aneesh Kumar K.V [this message]
2008-05-15 16:32 ` Jose R. Santos
2008-06-02 0:08 ` [PATCH] ext4: Fix use of uninitialized data Theodore Tso
2008-06-02 8:59 ` Aneesh Kumar K.V
2008-06-02 10:02 ` Shen Feng
2008-06-02 10:32 ` Aneesh Kumar K.V
2008-06-03 0:57 ` Shen Feng
2008-06-03 20:02 ` Andreas Dilger
2008-06-02 13:42 ` Eric Sandeen
2008-06-02 14:17 ` Aneesh Kumar K.V
2008-06-02 14:23 ` Eric Sandeen
2008-05-14 19:07 ` [PATCH] ext4: printk stack trace on ext4_error, ext4_abort and ext4_warning Eric Sandeen
2008-05-14 19:44 ` Theodore Tso
2008-05-15 4:25 ` Aneesh Kumar K.V
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20080515040658.GA15128@skywalker \
--to=aneesh.kumar@linux.vnet.ibm.com \
--cc=cmm@us.ibm.com \
--cc=jrs@us.ibm.com \
--cc=linux-ext4@vger.kernel.org \
--cc=sandeen@redhat.com \
--cc=tytso@mit.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).