From: "Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com>
To: Valerie Clement <valerie.clement@bull.net>
Cc: Avantika Mathur <mathur@linux.vnet.ibm.com>,
linux-ext4@vger.kernel.org,
Andreas Dilger <adilger@clusterfs.com>,
cmm@us.ibm.com
Subject: Re: [PATCH] Ext4: Uninitialized Block Groups
Date: Wed, 19 Sep 2007 17:04:39 +0530 [thread overview]
Message-ID: <46F1094F.1080906@linux.vnet.ibm.com> (raw)
In-Reply-To: <1190203577.14472.25.camel@ext1.frec.bull.fr>
Valerie Clement wrote:
> Hi Avantika,
> 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.
>
> The following patch fixes the problem.
>
> Andreas, could you check if my patch is correct?
> Thanks a lot,
> Valérie
>
> 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);
> - }
>
>
the variable free is confusingly named here. It is not the free inode count.
rather it indicate the last used relative inode number in the group. How about
the below ?
-aneesh
diff --git a/fs/ext4/ialloc.c b/fs/ext4/ialloc.c
index 4250c02..cfe2e09 100644
--- a/fs/ext4/ialloc.c
+++ b/fs/ext4/ialloc.c
@@ -633,17 +633,21 @@ 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) -
- le16_to_cpu(gdp->bg_itable_unused);
- }
- if (ino > free)
+ /*
+ * Check the relative inode number against the last used
+ * relative inode number in this group. if it is greater
+ * we need to update the bg_itable_unused count
+ *
+ */
+ if (ino > (EXT4_INODES_PER_GROUP(sb) -
+ le16_to_cpu(gdp->bg_itable_unused))) {
+
gdp->bg_itable_unused =
cpu_to_le16(EXT4_INODES_PER_GROUP(sb) - ino);
+ }
}
gdp->bg_free_inodes_count =
next prev parent reply other threads:[~2007-09-19 11:35 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 [this message]
2007-09-19 12:01 ` Valerie Clement
2007-09-19 16:42 ` Andreas Dilger
2007-09-19 19:19 ` Avantika Mathur
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=46F1094F.1080906@linux.vnet.ibm.com \
--to=aneesh.kumar@linux.vnet.ibm.com \
--cc=adilger@clusterfs.com \
--cc=cmm@us.ibm.com \
--cc=linux-ext4@vger.kernel.org \
--cc=mathur@linux.vnet.ibm.com \
--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).