From: Avantika Mathur <mathur@linux.vnet.ibm.com>
To: Andreas Dilger <adilger@clusterfs.com>
Cc: Valerie Clement <valerie.clement@bull.net>,
linux-ext4@vger.kernel.org, cmm@us.ibm.com, kalpak@clusterfs.com,
girish@clusterfs.com
Subject: Re: [PATCH] Ext4: Uninitialized Block Groups
Date: Wed, 19 Sep 2007 12:19:22 -0700 [thread overview]
Message-ID: <46F1763A.1040807@linux.vnet.ibm.com> (raw)
In-Reply-To: <20070919164220.GJ32520@schatzie.adilger.int>
Andreas Dilger wrote:
> On Sep 19, 2007 14:06 +0200, Valerie Clement wrote:
>
>> I ran some tests with the uninit_groups feature enabled and got error messages
>> when running e2fsck on my ext4 partition. e2fsck complains of an "invalid
>> unused inodes count" in some group descriptors.
>> These errors occur when checking groups which have only one inode in use. The
>> "free inodes" count has been decremented by one in these groups but not the
>> "unused inodes" count.
>>
>> Index: linux-2.6.23-rc6/fs/ext4/ialloc.c
>> ===================================================================
>> --- linux-2.6.23-rc6.orig/fs/ext4/ialloc.c 2007-09-19 11:31:01.000000000 +0200
>> +++ linux-2.6.23-rc6/fs/ext4/ialloc.c 2007-09-19 11:31:41.000000000 +0200
>> @@ -633,13 +633,10 @@ got:
>> /* If we didn't allocate from within the initialized part of the inode
>> * table then we need to initialize up to this inode. */
>> if (EXT4_HAS_RO_COMPAT_FEATURE(sb, EXT4_FEATURE_RO_COMPAT_GDT_CSUM)) {
>> - if (gdp->bg_flags & cpu_to_le16(EXT4_BG_INODE_UNINIT)) {
>> + if (gdp->bg_flags & cpu_to_le16(EXT4_BG_INODE_UNINIT))
>> gdp->bg_flags &= cpu_to_le16(~EXT4_BG_INODE_UNINIT);
>> - free = EXT4_INODES_PER_GROUP(sb);
>> - } else {
>> - free = EXT4_INODES_PER_GROUP(sb) -
>> + free = EXT4_INODES_PER_GROUP(sb) -
>> le16_to_cpu(gdp->bg_itable_unused);
>> - }
>>
>
> Hmm, this is indeed incorrect, but I'm not sure solution is the right one.
> I guess in our testing we ran it for a long time and must have created
> more than a single inode per group...
>
> What about the following instead? I think the assumption in the original
> code is that "it's a new group, all the inodes are free", but that is not
> correct - we want to make NONE of the inodes free initially so that
> bt_itable_unused is recalculated below:
>
> if (gdp->bg_flags & cpu_to_le16(EXT4_BG_INODE_UNINIT)) {
> gdp->bg_flags &= cpu_to_le16(~EXT4_BG_INODE_UNINIT);
> - free = EXT4_INODES_PER_GROUP(sb);
> + free = 0;
> } else {
> free = EXT4_INODES_PER_GROUP(sb) -
> le16_to_cpu(gdp->bg_itable_unused);
> }
>
> if (ino > free)
> gdp->bg_itable_unused =
> cpu_to_le16(EXT3_INODES_PER_GROUP(sb) - ino);
>
> Still a bit uneasy about off-by-one errors here though. Is "ino" 0 or
> 1 for the first inode in the group. We might need to have a -1 in the
> bg_itable_unused calculation still.
>
ino is incremented right before this code, so the first inode in the
group is represented by 1, not 0. So this fix looks good.
Aneesh has incorporated this fix and also removed the local crc16 code,
I will be reposting his new patch to lkml.
thanks
Avantika
next prev parent reply other threads:[~2007-09-19 19:18 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-09-19 0:25 [PATCH] Ext4: Uninitialized Block Groups Avantika Mathur
2007-09-19 3:03 ` Andrew Morton
2007-09-19 6:30 ` Andreas Dilger
2007-09-19 22:54 ` Avantika Mathur
2007-09-19 3:05 ` Andrew Morton
2007-09-19 12:06 ` Valerie Clement
2007-09-19 11:34 ` Aneesh Kumar K.V
2007-09-19 12:01 ` Valerie Clement
2007-09-19 16:42 ` Andreas Dilger
2007-09-19 19:19 ` Avantika Mathur [this message]
2007-09-20 23:22 ` Andrew Morton
-- strict thread matches above, loose matches on Subject: below --
2007-10-04 5:50 [PATCH, RFC] Ext4 patches planned for submission upstream Theodore Ts'o
2007-10-04 5:50 ` [PATCH] jbd/jbd2: JBD memory allocation cleanups Theodore Ts'o
2007-10-04 5:50 ` [PATCH] jbd/jbd2: Journal initialization doesn't need __GFP_NOFAIL Theodore Ts'o
2007-10-04 5:50 ` [PATCH] JBD2/Ext4: Convert kmalloc to kzalloc in jbd2/ext4 Theodore Ts'o
[not found] ` <1191477059-5357-5-git-send-email-tytso@mit.edu>
2007-10-04 5:50 ` [PATCH] jbd2: fix commit code to properly abort journal Theodore Ts'o
2007-10-04 5:50 ` [PATCH] JBD2: debug code cleanup Theodore Ts'o
2007-10-04 5:50 ` [PATCH] Once ext4 will not implement fragment, it is believed it will never be Theodore Ts'o
2007-10-04 5:50 ` [PATCH] ext4: remove #ifdef CONFIG_EXT4_INDEX Theodore Ts'o
2007-10-04 5:50 ` [PATCH] Ext4: Uninitialized Block Groups Theodore Ts'o
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=46F1763A.1040807@linux.vnet.ibm.com \
--to=mathur@linux.vnet.ibm.com \
--cc=adilger@clusterfs.com \
--cc=cmm@us.ibm.com \
--cc=girish@clusterfs.com \
--cc=kalpak@clusterfs.com \
--cc=linux-ext4@vger.kernel.org \
--cc=valerie.clement@bull.net \
/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).